mirror of
https://github.com/correl/mage.git
synced 2025-04-10 17:00:08 -09:00
* Chnaged Tiny Leaders handling of commander zone change replacement.
This commit is contained in:
parent
07fdd00fd1
commit
23f35e8ad1
6 changed files with 27 additions and 9 deletions
Mage.Server.Plugins
Mage.Game.CommanderDuel/src/mage/game
Mage.Game.CommanderFreeForAll/src/mage/game
Mage.Game.TinyLeadersDuel/src/mage/game
Mage/src/mage
abilities/effects/common/continuous
game
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
|
|
|
@ -59,7 +59,8 @@ public abstract class GameCommanderImpl extends GameImpl {
|
|||
private final Map<UUID, Cards> mulliganedCards = new HashMap<>();
|
||||
private final Set<CommanderInfoWatcher> 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;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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 {
|
||||
|
|
Loading…
Add table
Reference in a new issue