mirror of
https://github.com/correl/mage.git
synced 2024-12-26 03:00:11 +00:00
* Fixed a problem with commander game resatrt from Karn Liberated.
This commit is contained in:
parent
fa859a6bfd
commit
678118c79d
1 changed files with 25 additions and 13 deletions
|
@ -1,4 +1,3 @@
|
|||
|
||||
package mage.game;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -44,18 +43,20 @@ public abstract class GameCommanderImpl extends GameImpl {
|
|||
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
||||
Player player = getPlayer(playerId);
|
||||
if (player != null) {
|
||||
if (player.getSideboard().isEmpty()) { // needed for restart game of e.g. Karn Liberated
|
||||
for (UUID commanderId : player.getCommandersIds()) {
|
||||
Card commander = this.getCard(commanderId);
|
||||
if (commander != null) {
|
||||
initCommander(commander, ability, player);
|
||||
}
|
||||
}
|
||||
} else {
|
||||
while (!player.getSideboard().isEmpty()) {
|
||||
Card commander = this.getCard(player.getSideboard().iterator().next());
|
||||
if (commander != null) {
|
||||
player.addCommanderId(commander.getId());
|
||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
||||
commander.getAbilities().setControllerId(player.getId());
|
||||
ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary));
|
||||
ability.addEffect(new CommanderCostModification(commander.getId()));
|
||||
getState().setValue(commander.getId() + "_castCount", 0);
|
||||
CommanderInfoWatcher watcher = new CommanderInfoWatcher(commander.getId(), checkCommanderDamage);
|
||||
getState().addWatcher(watcher);
|
||||
watcher.addCardInfoToCommander(this);
|
||||
initCommander(commander, ability, player);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -67,6 +68,17 @@ public abstract class GameCommanderImpl extends GameImpl {
|
|||
}
|
||||
}
|
||||
|
||||
private void initCommander(Card commander, Ability ability, Player player) {
|
||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
||||
commander.getAbilities().setControllerId(player.getId());
|
||||
ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary));
|
||||
ability.addEffect(new CommanderCostModification(commander.getId()));
|
||||
getState().setValue(commander.getId() + "_castCount", 0);
|
||||
CommanderInfoWatcher watcher = new CommanderInfoWatcher(commander.getId(), checkCommanderDamage);
|
||||
getState().addWatcher(watcher);
|
||||
watcher.addCardInfoToCommander(this);
|
||||
}
|
||||
|
||||
//20130711
|
||||
/*903.8. The Commander variant uses an alternate mulligan rule.
|
||||
* Each time a player takes a mulligan, rather than shuffling their entire hand of cards into their library, that player exiles any number of cards from their hand face down.
|
||||
|
|
Loading…
Reference in a new issue