forked from External/mage
This reverts commit 82708e4273.
Some of these (AI related result in bloated memory usage, needs more investigation).
This commit is contained in:
parent
2f3831599d
commit
015cdf3136
79 changed files with 597 additions and 811 deletions
|
|
@ -39,7 +39,6 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
|
|||
public GameTinyLeadersImpl(final GameTinyLeadersImpl game) {
|
||||
super(game);
|
||||
this.alsoHand = game.alsoHand;
|
||||
this.alsoLibrary = game.alsoLibrary;
|
||||
this.startingPlayerSkipsDraw = game.startingPlayerSkipsDraw;
|
||||
}
|
||||
|
||||
|
|
@ -51,37 +50,35 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
|
|||
// move tiny leader to command zone
|
||||
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
||||
Player player = getPlayer(playerId);
|
||||
if (player == null) {
|
||||
continue;
|
||||
}
|
||||
|
||||
String commanderName = player.getMatchPlayer().getDeck().getName();
|
||||
Card commander = findCommander(this, player, commanderName);
|
||||
if (commander != null) {
|
||||
// already exists - just move to zone (example: game restart by Karn Liberated)
|
||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
||||
} else {
|
||||
// create new commander
|
||||
commander = getCommanderCard(commanderName, player.getId());
|
||||
if (player != null) {
|
||||
String commanderName = player.getMatchPlayer().getDeck().getName();
|
||||
Card commander = findCommander(this, player, commanderName);
|
||||
if (commander != null) {
|
||||
Set<Card> cards = new HashSet<>();
|
||||
cards.add(commander);
|
||||
this.loadCards(cards, playerId);
|
||||
player.addCommanderId(commander.getId());
|
||||
// already exists - just move to zone (example: game restart by Karn Liberated)
|
||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
||||
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Commander effects"));
|
||||
ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary, false, "Commander"));
|
||||
ability.addEffect(new CommanderCostModification(commander));
|
||||
// Commander rule #4 was removed Jan. 18, 2016
|
||||
// ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
|
||||
CommanderInfoWatcher watcher = new CommanderInfoWatcher("Commander", commander.getId(), false);
|
||||
getState().addWatcher(watcher);
|
||||
watcher.addCardInfoToCommander(this);
|
||||
this.getState().addAbility(ability, null);
|
||||
} else {
|
||||
// GameWorker.call processing errors and write it in magediag.log by defalt
|
||||
// Test use case: create tiny game with random generated deck - game freezes with empty battlefield
|
||||
throw new IllegalStateException("Commander card could not be created. Name: [" + player.getMatchPlayer().getDeck().getName() + ']');
|
||||
// create new commander
|
||||
commander = getCommanderCard(commanderName, player.getId());
|
||||
if (commander != null) {
|
||||
Set<Card> cards = new HashSet<>();
|
||||
cards.add(commander);
|
||||
this.loadCards(cards, playerId);
|
||||
player.addCommanderId(commander.getId());
|
||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
||||
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Commander effects"));
|
||||
ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary, false, "Commander"));
|
||||
ability.addEffect(new CommanderCostModification(commander));
|
||||
// Commander rule #4 was removed Jan. 18, 2016
|
||||
// ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
|
||||
CommanderInfoWatcher watcher = new CommanderInfoWatcher("Commander", commander.getId(), false);
|
||||
getState().addWatcher(watcher);
|
||||
watcher.addCardInfoToCommander(this);
|
||||
this.getState().addAbility(ability, null);
|
||||
} else {
|
||||
// GameWorker.call processing errors and write it in magediag.log by defalt
|
||||
// Test use case: create tiny game with random generated deck - game freezes with empty battlefield
|
||||
throw new IllegalStateException("Commander card could not be created. Name: [" + player.getMatchPlayer().getDeck().getName() + ']');
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue