diff --git a/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelMatch.java b/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelMatch.java index f0b3a26118d..b5f40072bc8 100644 --- a/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelMatch.java +++ b/Mage.Server.Plugins/Mage.Game.CommanderDuel/src/mage/game/CommanderDuelMatch.java @@ -53,6 +53,7 @@ public class CommanderDuelMatch extends MatchImpl { CommanderDuel game = new CommanderDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setStartMessage(this.createGameStartMessage()); game.setAlsoHand(alsoHand); + game.setAlsoLibrary(true); initGame(game); games.add(game); } diff --git a/Mage.Server.Plugins/Mage.Game.CommanderFreeForAll/src/mage/game/CommanderFreeForAllMatch.java b/Mage.Server.Plugins/Mage.Game.CommanderFreeForAll/src/mage/game/CommanderFreeForAllMatch.java index e8eb1bd46d8..1b23d078d99 100644 --- a/Mage.Server.Plugins/Mage.Game.CommanderFreeForAll/src/mage/game/CommanderFreeForAllMatch.java +++ b/Mage.Server.Plugins/Mage.Game.CommanderFreeForAll/src/mage/game/CommanderFreeForAllMatch.java @@ -52,6 +52,7 @@ public class CommanderFreeForAllMatch extends MatchImpl { CommanderFreeForAll game = new CommanderFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife); game.setStartMessage(this.createGameStartMessage()); game.setAlsoHand(alsoHand); + game.setAlsoLibrary(true); initGame(game); games.add(game); } diff --git a/Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/src/mage/game/TinyLeadersDuelMatch.java b/Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/src/mage/game/TinyLeadersDuelMatch.java index 6ec787ca9d2..05fce9272c2 100644 --- a/Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/src/mage/game/TinyLeadersDuelMatch.java +++ b/Mage.Server.Plugins/Mage.Game.TinyLeadersDuel/src/mage/game/TinyLeadersDuelMatch.java @@ -50,7 +50,8 @@ public class TinyLeadersDuelMatch extends MatchImpl { game.setStartMessage(this.createGameStartMessage()); //Tucking a Tiny Leader is legal - game.setAlsoHand(true); + game.setAlsoHand(false); + game.setAlsoLibrary(false); this.initGame(game); games.add(game); } diff --git a/Mage/src/mage/abilities/effects/common/continuous/CommanderReplacementEffect.java b/Mage/src/mage/abilities/effects/common/continuous/CommanderReplacementEffect.java index 842ed2554af..c1c8270aece 100644 --- a/Mage/src/mage/abilities/effects/common/continuous/CommanderReplacementEffect.java +++ b/Mage/src/mage/abilities/effects/common/continuous/CommanderReplacementEffect.java @@ -55,19 +55,22 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl { private final UUID commanderId; private final boolean alsoHand; + private final boolean alsoLibrary; - public CommanderReplacementEffect(UUID commanderId, boolean alsoHand) { + public CommanderReplacementEffect(UUID commanderId, boolean alsoHand, boolean alsoLibrary) { super(Duration.WhileOnBattlefield, Outcome.Benefit); staticText = "If a commander would be put into its owner’s graveyard from anywhere, that player may put it into the command zone instead. If a commander would be put into the exile zone from anywhere, its owner may put it into the command zone instead."; this.commanderId = commanderId; this.duration = Duration.EndOfGame; this.alsoHand = alsoHand; + this.alsoLibrary = alsoLibrary; } public CommanderReplacementEffect(final CommanderReplacementEffect effect) { super(effect); this.commanderId = effect.commanderId; this.alsoHand = effect.alsoHand; + this.alsoLibrary = effect.alsoLibrary; } @Override @@ -97,12 +100,15 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl { public boolean applies(GameEvent event, Ability source, Game game) { switch(((ZoneChangeEvent)event).getToZone()) { case HAND: - if (!alsoHand) { + if (!alsoHand && ((ZoneChangeEvent)event).getToZone() == Zone.HAND) { + return false; + } + case LIBRARY: + if (!alsoLibrary && ((ZoneChangeEvent)event).getToZone() == Zone.LIBRARY) { return false; } case GRAVEYARD: - case EXILED: - case LIBRARY: + case EXILED: if(commanderId.equals(event.getTargetId())){ return true; } diff --git a/Mage/src/mage/game/GameCommanderImpl.java b/Mage/src/mage/game/GameCommanderImpl.java index 980dcc22ee5..f11afffb705 100644 --- a/Mage/src/mage/game/GameCommanderImpl.java +++ b/Mage/src/mage/game/GameCommanderImpl.java @@ -59,7 +59,8 @@ public abstract class GameCommanderImpl extends GameImpl { private final Map mulliganedCards = new HashMap<>(); private final Set commanderCombatWatcher = new HashSet<>(); - protected boolean alsoHand; // replace also commander going to hand + protected boolean alsoHand; // replace commander going to hand + protected boolean alsoLibrary; // replace commander going to library protected boolean startingPlayerSkipsDraw = true; public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { @@ -69,6 +70,7 @@ public abstract class GameCommanderImpl extends GameImpl { public GameCommanderImpl(final GameCommanderImpl game) { super(game); this.alsoHand = game.alsoHand; + this.alsoLibrary = game.alsoLibrary; this.startingPlayerSkipsDraw = game.startingPlayerSkipsDraw; } @@ -84,7 +86,7 @@ public abstract class GameCommanderImpl extends GameImpl { if (commander != null) { player.setCommanderId(commander.getId()); commander.moveToZone(Zone.COMMAND, null, this, true); - ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand)); + ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary)); ability.addEffect(new CommanderCostModification(commander.getId())); ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander))); getState().setValue(commander.getId() + "_castCount", 0); @@ -215,4 +217,7 @@ public abstract class GameCommanderImpl extends GameImpl { this.alsoHand = alsoHand; } + public void setAlsoLibrary(boolean alsoLibrary) { + this.alsoLibrary = alsoLibrary; + } } diff --git a/Mage/src/mage/game/GameTinyLeadersImpl.java b/Mage/src/mage/game/GameTinyLeadersImpl.java index 06d1a7a2172..11c285982a2 100644 --- a/Mage/src/mage/game/GameTinyLeadersImpl.java +++ b/Mage/src/mage/game/GameTinyLeadersImpl.java @@ -60,6 +60,7 @@ import mage.watchers.common.CommanderInfoWatcher; public abstract class GameTinyLeadersImpl extends GameImpl{ protected boolean alsoHand; // replace also commander going to library + protected boolean alsoLibrary; // replace also commander going to library protected boolean startingPlayerSkipsDraw = true; public GameTinyLeadersImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) { @@ -86,7 +87,7 @@ public abstract class GameTinyLeadersImpl extends GameImpl{ this.loadCards(cards, playerId); player.setCommanderId(commander.getId()); commander.moveToZone(Zone.COMMAND, null, this, true); - ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand)); + ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary)); ability.addEffect(new CommanderCostModification(commander.getId())); ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander))); getState().setValue(commander.getId() + "_castCount", 0); @@ -155,7 +156,10 @@ public abstract class GameTinyLeadersImpl extends GameImpl{ public void setAlsoHand(boolean alsoHand) { this.alsoHand = alsoHand; } - + + public void setAlsoLibrary(boolean alsoLibrary) { + this.alsoLibrary = alsoLibrary; + } } class DefaultCommander extends CardImpl {