* Karn Liberated - Fixed that a with Karn's ability exiled commander was not put to battlefield after game restart.

This commit is contained in:
LevelX2 2020-01-19 16:48:58 +01:00
parent 217517feee
commit d87a4e4c9b
5 changed files with 122 additions and 65 deletions

View file

@ -1,5 +1,7 @@
package mage.game;
import java.util.Map;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.InfoEffect;
@ -16,9 +18,6 @@ import mage.players.Player;
import mage.watchers.common.CommanderInfoWatcher;
import mage.watchers.common.CommanderPlaysCountWatcher;
import java.util.Map;
import java.util.UUID;
public abstract class GameCommanderImpl extends GameImpl {
// private final Map<UUID, Cards> mulliganedCards = new HashMap<>();
@ -78,7 +77,9 @@ public abstract class GameCommanderImpl extends GameImpl {
}
public void initCommander(Card commander, Player player) {
commander.moveToZone(Zone.COMMAND, null, this, true);
if (!Zone.EXILED.equals(getState().getZone(commander.getId()))) { // Exile check needed for Karn Liberated restart
commander.moveToZone(Zone.COMMAND, null, this, true);
}
commander.getAbilities().setControllerId(player.getId());
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Commander effects"));

View file

@ -1,5 +1,8 @@
package mage.watchers.common;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
import mage.MageObject;
import mage.cards.Card;
import mage.constants.WatcherScope;
@ -11,10 +14,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.watchers.Watcher;
import java.util.HashMap;
import java.util.Map;
import java.util.UUID;
/* 20130711
*903.14a A player that's been dealt 21 or more combat damage by the same commander
* over the course of the game loses the game. (This is a state-based action. See rule 704.)
@ -69,7 +68,7 @@ public class CommanderInfoWatcher extends Watcher {
}
if (object != null) {
StringBuilder sb = new StringBuilder();
sb.append("<b>" + commanderTypeName + "</b>");
sb.append("<b>").append(commanderTypeName).append("</b>");
CommanderPlaysCountWatcher watcher = game.getState().getWatcher(CommanderPlaysCountWatcher.class);
int playsCount = watcher.getPlaysCount(sourceId);
if (playsCount > 0) {
@ -80,7 +79,7 @@ public class CommanderInfoWatcher extends Watcher {
if (checkCommanderDamage) {
for (Map.Entry<UUID, Integer> entry : damageToPlayer.entrySet()) {
Player damagedPlayer = game.getPlayer(entry.getKey());
sb.append("<b>" + commanderTypeName + "</b> did ").append(entry.getValue()).append(" combat damage to player ").append(damagedPlayer.getLogName()).append('.');
sb.append("<b>").append(commanderTypeName).append("</b> did ").append(entry.getValue()).append(" combat damage to player ").append(damagedPlayer.getLogName()).append('.');
this.addInfo(object, "Commander" + entry.getKey(),
"<b>" + commanderTypeName + "</b> did " + entry.getValue() + " combat damage to player " + damagedPlayer.getLogName() + '.', game);
}