mirror of
https://github.com/correl/mage.git
synced 2024-11-14 19:19:32 +00:00
* Oathbreaker: fixed that signature spell can moves to graveyard instead forced move to command zone (#5819);
This commit is contained in:
parent
03f99016d3
commit
1d7cac3059
4 changed files with 41 additions and 20 deletions
|
@ -5,6 +5,8 @@ import mage.abilities.common.SignatureSpellCastOnlyWithOathbreakerEffect;
|
|||
import mage.abilities.common.SimpleStaticAbility;
|
||||
import mage.abilities.condition.common.OathbreakerOnBattlefieldCondition;
|
||||
import mage.abilities.effects.common.InfoEffect;
|
||||
import mage.abilities.effects.common.continuous.CommanderReplacementEffect;
|
||||
import mage.abilities.effects.common.cost.CommanderCostModification;
|
||||
import mage.abilities.hint.ConditionHint;
|
||||
import mage.cards.Card;
|
||||
import mage.constants.CommanderCardType;
|
||||
|
@ -26,6 +28,9 @@ public class OathbreakerFreeForAll extends GameCommanderImpl {
|
|||
private Map<UUID, Set<UUID>> playerSignatureSpells = new HashMap<>();
|
||||
private Map<UUID, Set<UUID>> playerOathbreakers = new HashMap<>();
|
||||
|
||||
private static final String COMMANDER_NAME_OATHBREAKER = "Oathbreaker";
|
||||
private static final String COMMANDER_NAME_SIGNATURE_SPELL = "Signature Spell";
|
||||
|
||||
public OathbreakerFreeForAll(MultiplayerAttackOption attackOption, RangeOfInfluence range, Mulligan mulligan, int startLife) {
|
||||
super(attackOption, range, mulligan, startLife);
|
||||
}
|
||||
|
@ -44,24 +49,27 @@ public class OathbreakerFreeForAll extends GameCommanderImpl {
|
|||
super.init(choosingPlayerId);
|
||||
}
|
||||
|
||||
private String getCommanderTypeName(Card commander) {
|
||||
return commander.isInstantOrSorcery() ? COMMANDER_NAME_SIGNATURE_SPELL : COMMANDER_NAME_OATHBREAKER;
|
||||
}
|
||||
|
||||
@Override
|
||||
public CommanderInfoWatcher initCommanderWatcher(Card commander, boolean checkCommanderDamage) {
|
||||
String commanderType;
|
||||
if (commander.isInstantOrSorcery()) {
|
||||
commanderType = "Signature Spell";
|
||||
} else {
|
||||
commanderType = "Oathbreaker";
|
||||
}
|
||||
return new CommanderInfoWatcher(commanderType, commander.getId(), checkCommanderDamage);
|
||||
return new CommanderInfoWatcher(getCommanderTypeName(commander), commander.getId(), checkCommanderDamage);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void initCommanderEffects(Card commander, Player player, Ability commanderAbility) {
|
||||
// all commander effects must be independent from sourceId or controllerId (it's limitation of current commander effects)
|
||||
super.initCommanderEffects(commander, player, commanderAbility);
|
||||
|
||||
boolean isSignatureSpell = this.playerSignatureSpells.getOrDefault(player.getId(), new HashSet<>()).contains(commander.getId());
|
||||
|
||||
// basic commmander restrict (oathbreaker may ask to move, signature force to move)
|
||||
commanderAbility.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary, isSignatureSpell, getCommanderTypeName(commander)));
|
||||
commanderAbility.addEffect(new CommanderCostModification(commander.getId()));
|
||||
|
||||
// signature spell restrict (spell can be casted on player's commander on battlefield)
|
||||
if (this.playerSignatureSpells.getOrDefault(player.getId(), new HashSet<>()).contains(commander.getId())) {
|
||||
if (isSignatureSpell) {
|
||||
OathbreakerOnBattlefieldCondition condition = new OathbreakerOnBattlefieldCondition(this, player.getId(), commander.getId(),
|
||||
this.playerOathbreakers.getOrDefault(player.getId(), new HashSet<>()));
|
||||
commanderAbility.addEffect(new SignatureSpellCastOnlyWithOathbreakerEffect(condition, commander.getId()));
|
||||
|
|
|
@ -1,7 +1,5 @@
|
|||
|
||||
package mage.abilities.effects.common.continuous;
|
||||
|
||||
import java.util.UUID;
|
||||
import mage.abilities.Ability;
|
||||
import mage.abilities.effects.ReplacementEffectImpl;
|
||||
import mage.cards.Card;
|
||||
|
@ -15,8 +13,9 @@ import mage.game.permanent.Permanent;
|
|||
import mage.game.stack.Spell;
|
||||
import mage.players.Player;
|
||||
|
||||
import java.util.UUID;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author Plopman
|
||||
*/
|
||||
//20130711
|
||||
|
@ -27,19 +26,31 @@ import mage.players.Player;
|
|||
library from anywhere, its owner may put it into the command zone instead. This replacement effect
|
||||
may apply more than once to the same event. This is an exception to rule 614.5.
|
||||
*/
|
||||
|
||||
// Oathbreaker mode: If your Oathbreaker changes zones, you may return it to the Command Zone. The Signature Spell must return to the Command Zone.
|
||||
|
||||
public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
||||
|
||||
private final UUID commanderId;
|
||||
private final boolean alsoHand;
|
||||
private final boolean alsoLibrary;
|
||||
private final boolean forceToMove;
|
||||
private final String commanderTypeName;
|
||||
|
||||
public CommanderReplacementEffect(UUID commanderId, boolean alsoHand, boolean alsoLibrary) {
|
||||
public CommanderReplacementEffect(UUID commanderId, boolean alsoHand, boolean alsoLibrary, boolean forceToMove, String commanderTypeName) {
|
||||
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.";
|
||||
String mayStr = forceToMove ? " " : " may ";
|
||||
|
||||
staticText = "If a " + commanderTypeName + " would be put into its owner's graveyard from anywhere, "
|
||||
+ "that player" + mayStr + "put it into the command zone instead. "
|
||||
+ "If a " + commanderTypeName + " would be put into the exile zone from anywhere, "
|
||||
+ "its owner" + mayStr + "put it into the command zone instead.";
|
||||
this.commanderId = commanderId;
|
||||
this.duration = Duration.EndOfGame;
|
||||
this.alsoHand = alsoHand;
|
||||
this.alsoLibrary = alsoLibrary;
|
||||
this.forceToMove = forceToMove;
|
||||
this.commanderTypeName = commanderTypeName;
|
||||
}
|
||||
|
||||
public CommanderReplacementEffect(final CommanderReplacementEffect effect) {
|
||||
|
@ -47,6 +58,8 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
|||
this.commanderId = effect.commanderId;
|
||||
this.alsoHand = effect.alsoHand;
|
||||
this.alsoLibrary = effect.alsoLibrary;
|
||||
this.forceToMove = effect.forceToMove;
|
||||
this.commanderTypeName = effect.commanderTypeName;
|
||||
}
|
||||
|
||||
@Override
|
||||
|
@ -114,10 +127,10 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
|||
Permanent permanent = ((ZoneChangeEvent) event).getTarget();
|
||||
if (permanent != null) {
|
||||
Player player = game.getPlayer(permanent.getOwnerId());
|
||||
if (player != null && player.chooseUse(Outcome.Benefit, "Move commander to command zone?", source, game)) {
|
||||
if (player != null && (forceToMove || player.chooseUse(Outcome.Benefit, "Move " + commanderTypeName + " to command zone?", source, game))) {
|
||||
((ZoneChangeEvent) event).setToZone(Zone.COMMAND);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(player.getLogName() + " has moved their commander to the command zone");
|
||||
game.informPlayers(player.getLogName() + " has moved their " + commanderTypeName + " to the command zone");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -134,10 +147,10 @@ public class CommanderReplacementEffect extends ReplacementEffectImpl {
|
|||
}
|
||||
if (card != null) {
|
||||
Player player = game.getPlayer(card.getOwnerId());
|
||||
if (player != null && player.chooseUse(Outcome.Benefit, "Move commander to command zone?", source, game)) {
|
||||
if (player != null && (forceToMove || player.chooseUse(Outcome.Benefit, "Move " + commanderTypeName + " to command zone?", source, game))) {
|
||||
((ZoneChangeEvent) event).setToZone(Zone.COMMAND);
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(player.getLogName() + " has moved their commander to the command zone");
|
||||
game.informPlayers(player.getLogName() + " has moved their " + commanderTypeName + " to the command zone");
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -92,7 +92,7 @@ public abstract class GameCommanderImpl extends GameImpl {
|
|||
|
||||
public void initCommanderEffects(Card commander, Player player, Ability commanderAbility) {
|
||||
// all commander effects must be independent from sourceId or controllerId
|
||||
commanderAbility.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary));
|
||||
commanderAbility.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary, false, "Commander"));
|
||||
commanderAbility.addEffect(new CommanderCostModification(commander.getId()));
|
||||
}
|
||||
|
||||
|
|
|
@ -58,7 +58,7 @@ public abstract class GameTinyLeadersImpl extends GameImpl {
|
|||
player.addCommanderId(commander.getId());
|
||||
commander.moveToZone(Zone.COMMAND, null, this, true);
|
||||
Ability ability = new SimpleStaticAbility(Zone.COMMAND, new InfoEffect("Commander effects"));
|
||||
ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary));
|
||||
ability.addEffect(new CommanderReplacementEffect(commander.getId(), alsoHand, alsoLibrary, false, "Commander"));
|
||||
ability.addEffect(new CommanderCostModification(commander.getId()));
|
||||
// Commander rule #4 was removed Jan. 18, 2016
|
||||
// ability.addEffect(new CommanderManaReplacementEffect(player.getId(), CardUtil.getColorIdentity(commander)));
|
||||
|
|
Loading…
Reference in a new issue