mirror of
https://github.com/magefree/mage.git
synced 2025-12-20 18:50:06 -08: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
|
|
@ -53,6 +53,7 @@ public class CommanderDuelMatch extends MatchImpl {
|
||||||
CommanderDuel game = new CommanderDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife);
|
CommanderDuel game = new CommanderDuel(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife);
|
||||||
game.setStartMessage(this.createGameStartMessage());
|
game.setStartMessage(this.createGameStartMessage());
|
||||||
game.setAlsoHand(alsoHand);
|
game.setAlsoHand(alsoHand);
|
||||||
|
game.setAlsoLibrary(true);
|
||||||
initGame(game);
|
initGame(game);
|
||||||
games.add(game);
|
games.add(game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -52,6 +52,7 @@ public class CommanderFreeForAllMatch extends MatchImpl {
|
||||||
CommanderFreeForAll game = new CommanderFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife);
|
CommanderFreeForAll game = new CommanderFreeForAll(options.getAttackOption(), options.getRange(), options.getFreeMulligans(), startLife);
|
||||||
game.setStartMessage(this.createGameStartMessage());
|
game.setStartMessage(this.createGameStartMessage());
|
||||||
game.setAlsoHand(alsoHand);
|
game.setAlsoHand(alsoHand);
|
||||||
|
game.setAlsoLibrary(true);
|
||||||
initGame(game);
|
initGame(game);
|
||||||
games.add(game);
|
games.add(game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -50,7 +50,8 @@ public class TinyLeadersDuelMatch extends MatchImpl {
|
||||||
game.setStartMessage(this.createGameStartMessage());
|
game.setStartMessage(this.createGameStartMessage());
|
||||||
|
|
||||||
//Tucking a Tiny Leader is legal
|
//Tucking a Tiny Leader is legal
|
||||||
game.setAlsoHand(true);
|
game.setAlsoHand(false);
|
||||||
|
game.setAlsoLibrary(false);
|
||||||
this.initGame(game);
|
this.initGame(game);
|
||||||
games.add(game);
|
games.add(game);
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -55,19 +55,22 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
||||||
|
|
||||||
private final UUID commanderId;
|
private final UUID commanderId;
|
||||||
private final boolean alsoHand;
|
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);
|
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.";
|
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.commanderId = commanderId;
|
||||||
this.duration = Duration.EndOfGame;
|
this.duration = Duration.EndOfGame;
|
||||||
this.alsoHand = alsoHand;
|
this.alsoHand = alsoHand;
|
||||||
|
this.alsoLibrary = alsoLibrary;
|
||||||
}
|
}
|
||||||
|
|
||||||
public CommanderReplacementEffect(final CommanderReplacementEffect effect) {
|
public CommanderReplacementEffect(final CommanderReplacementEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
this.commanderId = effect.commanderId;
|
this.commanderId = effect.commanderId;
|
||||||
this.alsoHand = effect.alsoHand;
|
this.alsoHand = effect.alsoHand;
|
||||||
|
this.alsoLibrary = effect.alsoLibrary;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|
@ -97,12 +100,15 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
||||||
public boolean applies(GameEvent event, Ability source, Game game) {
|
public boolean applies(GameEvent event, Ability source, Game game) {
|
||||||
switch(((ZoneChangeEvent)event).getToZone()) {
|
switch(((ZoneChangeEvent)event).getToZone()) {
|
||||||
case HAND:
|
case HAND:
|
||||||
if (!alsoHand) {
|
if (!alsoHand && ((ZoneChangeEvent)event).getToZone() == Zone.HAND) {
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
case LIBRARY:
|
||||||
|
if (!alsoLibrary && ((ZoneChangeEvent)event).getToZone() == Zone.LIBRARY) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
case GRAVEYARD:
|
case GRAVEYARD:
|
||||||
case EXILED:
|
case EXILED:
|
||||||
case LIBRARY:
|
|
||||||
if(commanderId.equals(event.getTargetId())){
|
if(commanderId.equals(event.getTargetId())){
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
||||||
|
|
@ -59,7 +59,8 @@ public abstract class GameCommanderImpl extends GameImpl {
|
||||||
private final Map<UUID, Cards> mulliganedCards = new HashMap<>();
|
private final Map<UUID, Cards> mulliganedCards = new HashMap<>();
|
||||||
private final Set<CommanderInfoWatcher> commanderCombatWatcher = new HashSet<>();
|
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;
|
protected boolean startingPlayerSkipsDraw = true;
|
||||||
|
|
||||||
public GameCommanderImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) {
|
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) {
|
public GameCommanderImpl(final GameCommanderImpl game) {
|
||||||
super(game);
|
super(game);
|
||||||
this.alsoHand = game.alsoHand;
|
this.alsoHand = game.alsoHand;
|
||||||
|
this.alsoLibrary = game.alsoLibrary;
|
||||||
this.startingPlayerSkipsDraw = game.startingPlayerSkipsDraw;
|
this.startingPlayerSkipsDraw = game.startingPlayerSkipsDraw;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -84,7 +86,7 @@ public abstract class GameCommanderImpl extends GameImpl {
|
||||||
if (commander != null) {
|
if (commander != null) {
|
||||||
player.setCommanderId(commander.getId());
|
player.setCommanderId(commander.getId());
|
||||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
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 CommanderCostModification(commander.getId()));
|
||||||
ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
|
ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
|
||||||
getState().setValue(commander.getId() + "_castCount", 0);
|
getState().setValue(commander.getId() + "_castCount", 0);
|
||||||
|
|
@ -215,4 +217,7 @@ public abstract class GameCommanderImpl extends GameImpl {
|
||||||
this.alsoHand = alsoHand;
|
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{
|
public abstract class GameTinyLeadersImpl extends GameImpl{
|
||||||
|
|
||||||
protected boolean alsoHand; // replace also commander going to library
|
protected boolean alsoHand; // replace also commander going to library
|
||||||
|
protected boolean alsoLibrary; // replace also commander going to library
|
||||||
protected boolean startingPlayerSkipsDraw = true;
|
protected boolean startingPlayerSkipsDraw = true;
|
||||||
|
|
||||||
public GameTinyLeadersImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) {
|
public GameTinyLeadersImpl(MultiplayerAttackOption attackOption, RangeOfInfluence range, int freeMulligans, int startLife) {
|
||||||
|
|
@ -86,7 +87,7 @@ public abstract class GameTinyLeadersImpl extends GameImpl{
|
||||||
this.loadCards(cards, playerId);
|
this.loadCards(cards, playerId);
|
||||||
player.setCommanderId(commander.getId());
|
player.setCommanderId(commander.getId());
|
||||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
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 CommanderCostModification(commander.getId()));
|
||||||
ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
|
ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
|
||||||
getState().setValue(commander.getId() + "_castCount", 0);
|
getState().setValue(commander.getId() + "_castCount", 0);
|
||||||
|
|
@ -155,7 +156,10 @@ public abstract class GameTinyLeadersImpl extends GameImpl{
|
||||||
public void setAlsoHand(boolean alsoHand) {
|
public void setAlsoHand(boolean alsoHand) {
|
||||||
this.alsoHand = alsoHand;
|
this.alsoHand = alsoHand;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public void setAlsoLibrary(boolean alsoLibrary) {
|
||||||
|
this.alsoLibrary = alsoLibrary;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class DefaultCommander extends CardImpl {
|
class DefaultCommander extends CardImpl {
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue