mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
fixed tournament not starting error
This commit is contained in:
parent
c4a3a496aa
commit
952b46bc1f
7 changed files with 22 additions and 8 deletions
|
@ -45,7 +45,7 @@ import mage.Constants.MultiplayerAttackOption;
|
|||
import mage.Constants.RangeOfInfluence;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.client.MageFrame;
|
||||
import mage.client.remote.Session;
|
||||
import mage.remote.Session;
|
||||
import mage.client.table.TournamentPlayerPanel;
|
||||
import mage.game.draft.DraftOptions;
|
||||
import mage.game.draft.DraftOptions.TimingOption;
|
||||
|
@ -299,7 +299,7 @@ public class NewTournamentDialog extends MageDialog {
|
|||
if (tOptions.getLimitedOptions() == null)
|
||||
tOptions.setLimitedOptions(new LimitedOptions());
|
||||
for (JComboBox pack: packs) {
|
||||
tOptions.getLimitedOptions().getSets().add((ExpansionSet) pack.getSelectedItem());
|
||||
tOptions.getLimitedOptions().getSetCodes().add(((ExpansionSet) pack.getSelectedItem()).getCode());
|
||||
}
|
||||
}
|
||||
tOptions.getMatchOptions().setDeckType("Limited");
|
||||
|
|
|
@ -36,6 +36,7 @@ import java.util.Map;
|
|||
import mage.game.tournament.Tournament;
|
||||
import mage.game.tournament.TournamentOptions;
|
||||
import mage.game.tournament.TournamentType;
|
||||
import mage.sets.Sets;
|
||||
import mage.view.TournamentTypeView;
|
||||
import org.apache.log4j.Logger;
|
||||
|
||||
|
@ -64,6 +65,9 @@ public class TournamentFactory {
|
|||
try {
|
||||
con = tournaments.get(tournamentType).getConstructor(new Class[]{TournamentOptions.class});
|
||||
tournament = con.newInstance(new Object[] {options});
|
||||
for (String setCode: options.getLimitedOptions().getSetCodes()) {
|
||||
tournament.getSets().add(Sets.findSet(setCode));
|
||||
}
|
||||
} catch (Exception ex) {
|
||||
logger.fatal("TournamentFactory error ", ex);
|
||||
return null;
|
||||
|
|
|
@ -55,6 +55,7 @@ public abstract class DraftImpl<T extends DraftImpl<T>> implements Draft {
|
|||
protected Map<UUID, DraftPlayer> players = new HashMap<UUID, DraftPlayer>();
|
||||
protected PlayerList table = new PlayerList();
|
||||
protected List<ExpansionSet> sets;
|
||||
protected List<String> setCodes;
|
||||
protected int boosterNum = 0;
|
||||
protected int cardNum = 0;
|
||||
protected TimingOption timing;
|
||||
|
@ -65,7 +66,7 @@ public abstract class DraftImpl<T extends DraftImpl<T>> implements Draft {
|
|||
|
||||
public DraftImpl(DraftOptions options) {
|
||||
id = UUID.randomUUID();
|
||||
this.sets = options.getSets();
|
||||
this.setCodes = options.getSetCodes();
|
||||
this.timing = options.getTiming();
|
||||
}
|
||||
|
||||
|
|
|
@ -31,7 +31,6 @@ package mage.game.tournament;
|
|||
import java.io.Serializable;
|
||||
import java.util.ArrayList;
|
||||
import java.util.List;
|
||||
import mage.cards.ExpansionSet;
|
||||
|
||||
/**
|
||||
*
|
||||
|
@ -39,9 +38,9 @@ import mage.cards.ExpansionSet;
|
|||
*/
|
||||
public class LimitedOptions implements Serializable {
|
||||
|
||||
protected List<ExpansionSet> sets = new ArrayList<ExpansionSet>();
|
||||
protected List<String> sets = new ArrayList<String>();
|
||||
|
||||
public List<ExpansionSet> getSets() {
|
||||
public List<String> getSetCodes() {
|
||||
return sets;
|
||||
}
|
||||
|
||||
|
|
|
@ -29,7 +29,9 @@
|
|||
package mage.game.tournament;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
import mage.cards.ExpansionSet;
|
||||
import mage.cards.decks.Deck;
|
||||
import mage.game.events.Listener;
|
||||
import mage.game.events.PlayerQueryEvent;
|
||||
|
@ -47,6 +49,7 @@ public interface Tournament {
|
|||
public TournamentPlayer getPlayer(UUID playerId);
|
||||
public Collection<TournamentPlayer> getPlayers();
|
||||
public Collection<Round> getRounds();
|
||||
public List<ExpansionSet> getSets();
|
||||
public void submitDeck(UUID playerId, Deck deck);
|
||||
public void autoSubmit(UUID playerId, Deck deck);
|
||||
public boolean allJoined();
|
||||
|
|
|
@ -61,6 +61,7 @@ public abstract class TournamentImpl implements Tournament {
|
|||
protected static Random rnd = new Random();
|
||||
protected String matchName;
|
||||
protected TournamentOptions options;
|
||||
protected List<ExpansionSet> sets = new ArrayList<ExpansionSet>();
|
||||
|
||||
protected TableEventSource tableEventSource = new TableEventSource();
|
||||
protected PlayerQueryEventSource playerQueryEventSource = new PlayerQueryEventSource();
|
||||
|
@ -103,6 +104,11 @@ public abstract class TournamentImpl implements Tournament {
|
|||
return rounds;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ExpansionSet> getSets() {
|
||||
return sets;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void leave(UUID playerId) {
|
||||
//TODO: implement this
|
||||
|
@ -249,7 +255,7 @@ public abstract class TournamentImpl implements Tournament {
|
|||
protected void openBoosters() {
|
||||
for (TournamentPlayer player: this.players.values()) {
|
||||
player.setDeck(new Deck());
|
||||
for (ExpansionSet set: options.limitedOptions.getSets()) {
|
||||
for (ExpansionSet set: sets) {
|
||||
List<Card> booster = set.createBooster();
|
||||
for (Card card: booster) {
|
||||
player.getDeck().getSideboard().add(card);
|
||||
|
|
|
@ -1,11 +1,12 @@
|
|||
package mage.target.targetpointer;
|
||||
|
||||
import java.io.Serializable;
|
||||
import mage.abilities.Ability;
|
||||
|
||||
import java.util.List;
|
||||
import java.util.UUID;
|
||||
|
||||
public interface TargetPointer {
|
||||
public interface TargetPointer extends Serializable {
|
||||
List<UUID> getTargets(Ability source);
|
||||
UUID getFirst(Ability source);
|
||||
TargetPointer copy();
|
||||
|
|
Loading…
Reference in a new issue