mirror of
https://github.com/correl/mage.git
synced 2024-12-26 11:09:27 +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;
|
package mage.game;
|
||||||
|
|
||||||
import java.util.Map;
|
import java.util.Map;
|
||||||
|
@ -44,18 +43,20 @@ public abstract class GameCommanderImpl extends GameImpl {
|
||||||
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
for (UUID playerId : state.getPlayerList(startingPlayerId)) {
|
||||||
Player player = getPlayer(playerId);
|
Player player = getPlayer(playerId);
|
||||||
if (player != null) {
|
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()) {
|
while (!player.getSideboard().isEmpty()) {
|
||||||
Card commander = this.getCard(player.getSideboard().iterator().next());
|
Card commander = this.getCard(player.getSideboard().iterator().next());
|
||||||
if (commander != null) {
|
if (commander != null) {
|
||||||
player.addCommanderId(commander.getId());
|
player.addCommanderId(commander.getId());
|
||||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
initCommander(commander, ability, player);
|
||||||
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);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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
|
//20130711
|
||||||
/*903.8. The Commander variant uses an alternate mulligan rule.
|
/*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.
|
* 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