mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 12:48:00 +00:00
GameAction: add params hash for changeZone game actions
add old functions as overload MagicStack: add Fizzle and StackInfomation to the params when Card is removed from stack
This commit is contained in:
@@ -79,6 +79,10 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer position, SpellAbility cause) {
|
public Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer position, SpellAbility cause) {
|
||||||
|
return changeZone(zoneFrom, zoneTo, c, position, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public Card changeZone(final Zone zoneFrom, Zone zoneTo, final Card c, Integer position, SpellAbility cause, Map<String, Object> params) {
|
||||||
if (c.isCopiedSpell() || (c.isImmutable() && zoneTo.is(ZoneType.Exile))) {
|
if (c.isCopiedSpell() || (c.isImmutable() && zoneTo.is(ZoneType.Exile))) {
|
||||||
// Remove Effect from command immediately, this is essential when some replacement
|
// Remove Effect from command immediately, this is essential when some replacement
|
||||||
// effects happen during the resolving of a spellability ("the next time ..." effect)
|
// effects happen during the resolving of a spellability ("the next time ..." effect)
|
||||||
@@ -288,6 +292,8 @@ public class GameAction {
|
|||||||
repParams.put("Origin", zoneFrom != null ? zoneFrom.getZoneType() : null);
|
repParams.put("Origin", zoneFrom != null ? zoneFrom.getZoneType() : null);
|
||||||
repParams.put("Destination", zoneTo.getZoneType());
|
repParams.put("Destination", zoneTo.getZoneType());
|
||||||
|
|
||||||
|
repParams.putAll(params);
|
||||||
|
|
||||||
ReplacementResult repres = game.getReplacementHandler().run(repParams);
|
ReplacementResult repres = game.getReplacementHandler().run(repParams);
|
||||||
if (repres != ReplacementResult.NotReplaced) {
|
if (repres != ReplacementResult.NotReplaced) {
|
||||||
if (zoneChangedEarly) {
|
if (zoneChangedEarly) {
|
||||||
@@ -301,7 +307,7 @@ public class GameAction {
|
|||||||
|
|
||||||
if (game.getStack().isResolving(c) && !zoneTo.is(ZoneType.Graveyard) && repres == ReplacementResult.Prevented) {
|
if (game.getStack().isResolving(c) && !zoneTo.is(ZoneType.Graveyard) && repres == ReplacementResult.Prevented) {
|
||||||
copied.getOwner().removeInboundToken(copied);
|
copied.getOwner().removeInboundToken(copied);
|
||||||
return moveToGraveyard(c, cause);
|
return moveToGraveyard(c, cause, params);
|
||||||
}
|
}
|
||||||
copied.getOwner().removeInboundToken(copied);
|
copied.getOwner().removeInboundToken(copied);
|
||||||
return c;
|
return c;
|
||||||
@@ -385,11 +391,13 @@ public class GameAction {
|
|||||||
runParams.put("Destination", zoneTo.getZoneType().name());
|
runParams.put("Destination", zoneTo.getZoneType().name());
|
||||||
runParams.put("SpellAbilityStackInstance", game.stack.peek());
|
runParams.put("SpellAbilityStackInstance", game.stack.peek());
|
||||||
runParams.put("IndividualCostPaymentInstance", game.costPaymentStack.peek());
|
runParams.put("IndividualCostPaymentInstance", game.costPaymentStack.peek());
|
||||||
|
runParams.putAll(params);
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams, true);
|
game.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams, true);
|
||||||
if (zoneFrom != null && zoneFrom.is(ZoneType.Battlefield)) {
|
if (zoneFrom != null && zoneFrom.is(ZoneType.Battlefield)) {
|
||||||
final Map<String, Object> runParams2 = Maps.newHashMap();
|
final Map<String, Object> runParams2 = Maps.newHashMap();
|
||||||
runParams2.put("Card", lastKnownInfo);
|
runParams2.put("Card", lastKnownInfo);
|
||||||
runParams2.put("OriginalController", zoneFrom.getPlayer());
|
runParams2.put("OriginalController", zoneFrom.getPlayer());
|
||||||
|
runParams2.putAll(params);
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.ChangesController, runParams2, false);
|
game.getTriggerHandler().runTrigger(TriggerType.ChangesController, runParams2, false);
|
||||||
}
|
}
|
||||||
// AllZone.getStack().chooseOrderOfSimultaneousStackEntryAll();
|
// AllZone.getStack().chooseOrderOfSimultaneousStackEntryAll();
|
||||||
@@ -444,7 +452,7 @@ public class GameAction {
|
|||||||
// Ask controller if it wants to be on top or bottom of other meld.
|
// Ask controller if it wants to be on top or bottom of other meld.
|
||||||
unmeldPosition++;
|
unmeldPosition++;
|
||||||
}
|
}
|
||||||
changeZone(null, zoneTo, unmeld, position, cause);
|
changeZone(null, zoneTo, unmeld, position, cause, params);
|
||||||
}
|
}
|
||||||
// Reveal if face-down
|
// Reveal if face-down
|
||||||
if (c.isFaceDown()) {
|
if (c.isFaceDown()) {
|
||||||
@@ -527,12 +535,20 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveTo(final Zone zoneTo, Card c, SpellAbility cause) {
|
public final Card moveTo(final Zone zoneTo, Card c, SpellAbility cause) {
|
||||||
|
return moveTo(zoneTo, c, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveTo(final Zone zoneTo, Card c, SpellAbility cause, Map<String, Object> params) {
|
||||||
// FThreads.assertExecutedByEdt(false); // This code must never be executed from EDT,
|
// FThreads.assertExecutedByEdt(false); // This code must never be executed from EDT,
|
||||||
// use FThreads.invokeInNewThread to run code in a pooled thread
|
// use FThreads.invokeInNewThread to run code in a pooled thread
|
||||||
return moveTo(zoneTo, c, null, cause);
|
return moveTo(zoneTo, c, null, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveTo(final Zone zoneTo, Card c, Integer position, SpellAbility cause) {
|
public final Card moveTo(final Zone zoneTo, Card c, Integer position, SpellAbility cause) {
|
||||||
|
return moveTo(zoneTo, c, position, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveTo(final Zone zoneTo, Card c, Integer position, SpellAbility cause, Map<String, Object> params) {
|
||||||
// Ideally move to should never be called without a prevZone
|
// Ideally move to should never be called without a prevZone
|
||||||
// Remove card from Current Zone, if it has one
|
// Remove card from Current Zone, if it has one
|
||||||
final Zone zoneFrom = game.getZoneOf(c);
|
final Zone zoneFrom = game.getZoneOf(c);
|
||||||
@@ -540,7 +556,7 @@ public class GameAction {
|
|||||||
|
|
||||||
// Card lastKnownInfo = c;
|
// Card lastKnownInfo = c;
|
||||||
|
|
||||||
c = changeZone(zoneFrom, zoneTo, c, position, cause);
|
c = changeZone(zoneFrom, zoneTo, c, position, cause, params);
|
||||||
|
|
||||||
if (zoneFrom == null) {
|
if (zoneFrom == null) {
|
||||||
c.setCastFrom(null);
|
c.setCastFrom(null);
|
||||||
@@ -605,81 +621,126 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToStack(final Card c, SpellAbility cause) {
|
public final Card moveToStack(final Card c, SpellAbility cause) {
|
||||||
|
return moveToStack(c, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
public final Card moveToStack(final Card c, SpellAbility cause, Map<String, Object> params) {
|
||||||
final Zone stack = game.getStackZone();
|
final Zone stack = game.getStackZone();
|
||||||
return moveTo(stack, c, cause);
|
return moveTo(stack, c, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToGraveyard(final Card c, SpellAbility cause) {
|
public final Card moveToGraveyard(final Card c, SpellAbility cause) {
|
||||||
|
return moveToGraveyard(c, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
public final Card moveToGraveyard(final Card c, SpellAbility cause, Map<String, Object> params) {
|
||||||
final PlayerZone grave = c.getOwner().getZone(ZoneType.Graveyard);
|
final PlayerZone grave = c.getOwner().getZone(ZoneType.Graveyard);
|
||||||
// must put card in OWNER's graveyard not controller's
|
// must put card in OWNER's graveyard not controller's
|
||||||
return moveTo(grave, c, cause);
|
return moveTo(grave, c, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToHand(final Card c, SpellAbility cause) {
|
public final Card moveToHand(final Card c, SpellAbility cause) {
|
||||||
|
return moveToHand(c, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveToHand(final Card c, SpellAbility cause, Map<String, Object> params) {
|
||||||
final PlayerZone hand = c.getOwner().getZone(ZoneType.Hand);
|
final PlayerZone hand = c.getOwner().getZone(ZoneType.Hand);
|
||||||
return moveTo(hand, c, cause);
|
return moveTo(hand, c, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToPlay(final Card c, SpellAbility cause) {
|
public final Card moveToPlay(final Card c, SpellAbility cause) {
|
||||||
|
return moveToPlay(c, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveToPlay(final Card c, SpellAbility cause, Map<String, Object> params) {
|
||||||
final PlayerZone play = c.getController().getZone(ZoneType.Battlefield);
|
final PlayerZone play = c.getController().getZone(ZoneType.Battlefield);
|
||||||
return moveTo(play, c, cause);
|
return moveTo(play, c, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToPlay(final Card c, final Player p, SpellAbility cause) {
|
public final Card moveToPlay(final Card c, final Player p, SpellAbility cause) {
|
||||||
|
return moveToPlay(c, p, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveToPlay(final Card c, final Player p, SpellAbility cause, Map<String, Object> params) {
|
||||||
// move to a specific player's Battlefield
|
// move to a specific player's Battlefield
|
||||||
final PlayerZone play = p.getZone(ZoneType.Battlefield);
|
final PlayerZone play = p.getZone(ZoneType.Battlefield);
|
||||||
return moveTo(play, c, cause);
|
return moveTo(play, c, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToBottomOfLibrary(final Card c, SpellAbility cause) {
|
public final Card moveToBottomOfLibrary(final Card c, SpellAbility cause) {
|
||||||
return moveToLibrary(c, -1, cause);
|
return moveToBottomOfLibrary(c, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveToBottomOfLibrary(final Card c, SpellAbility cause, Map<String, Object> params) {
|
||||||
|
return moveToLibrary(c, -1, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToLibrary(final Card c, SpellAbility cause) {
|
public final Card moveToLibrary(final Card c, SpellAbility cause) {
|
||||||
return moveToLibrary(c, 0, cause);
|
return moveToLibrary(c, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveToLibrary(final Card c, SpellAbility cause, Map<String, Object> params) {
|
||||||
|
return moveToLibrary(c, 0, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToLibrary(Card c, int libPosition, SpellAbility cause) {
|
public final Card moveToLibrary(Card c, int libPosition, SpellAbility cause) {
|
||||||
|
return moveToLibrary(c, libPosition, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveToLibrary(Card c, int libPosition, SpellAbility cause, Map<String, Object> params) {
|
||||||
final PlayerZone library = c.getOwner().getZone(ZoneType.Library);
|
final PlayerZone library = c.getOwner().getZone(ZoneType.Library);
|
||||||
if (libPosition == -1 || libPosition > library.size()) {
|
if (libPosition == -1 || libPosition > library.size()) {
|
||||||
libPosition = library.size();
|
libPosition = library.size();
|
||||||
}
|
}
|
||||||
return changeZone(game.getZoneOf(c), library, c, libPosition, cause);
|
return changeZone(game.getZoneOf(c), library, c, libPosition, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveToVariantDeck(Card c, ZoneType zone, int deckPosition, SpellAbility cause) {
|
public final Card moveToVariantDeck(Card c, ZoneType zone, int deckPosition, SpellAbility cause) {
|
||||||
|
return moveToVariantDeck(c, zone, deckPosition, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveToVariantDeck(Card c, ZoneType zone, int deckPosition, SpellAbility cause, Map<String, Object> params) {
|
||||||
final PlayerZone deck = c.getOwner().getZone(zone);
|
final PlayerZone deck = c.getOwner().getZone(zone);
|
||||||
if (deckPosition == -1 || deckPosition > deck.size()) {
|
if (deckPosition == -1 || deckPosition > deck.size()) {
|
||||||
deckPosition = deck.size();
|
deckPosition = deck.size();
|
||||||
}
|
}
|
||||||
return changeZone(game.getZoneOf(c), deck, c, deckPosition, cause);
|
return changeZone(game.getZoneOf(c), deck, c, deckPosition, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card exile(final Card c, SpellAbility cause) {
|
public final Card exile(final Card c, SpellAbility cause) {
|
||||||
|
return exile(c, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
public final Card exile(final Card c, SpellAbility cause, Map<String, Object> params) {
|
||||||
if (game.isCardExiled(c)) {
|
if (game.isCardExiled(c)) {
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
final PlayerZone removed = c.getOwner().getZone(ZoneType.Exile);
|
final PlayerZone removed = c.getOwner().getZone(ZoneType.Exile);
|
||||||
return moveTo(removed, c, cause);
|
return moveTo(removed, c, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveTo(final ZoneType name, final Card c, SpellAbility cause) {
|
public final Card moveTo(final ZoneType name, final Card c, SpellAbility cause) {
|
||||||
return moveTo(name, c, 0, cause);
|
return moveTo(name, c, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveTo(final ZoneType name, final Card c, SpellAbility cause, Map<String, Object> params) {
|
||||||
|
return moveTo(name, c, 0, cause, params);
|
||||||
}
|
}
|
||||||
|
|
||||||
public final Card moveTo(final ZoneType name, final Card c, final int libPosition, SpellAbility cause) {
|
public final Card moveTo(final ZoneType name, final Card c, final int libPosition, SpellAbility cause) {
|
||||||
|
return moveTo(name, c, libPosition, cause, Maps.newHashMap());
|
||||||
|
}
|
||||||
|
|
||||||
|
public final Card moveTo(final ZoneType name, final Card c, final int libPosition, SpellAbility cause, Map<String, Object> params) {
|
||||||
// Call specific functions to set PlayerZone, then move onto moveTo
|
// Call specific functions to set PlayerZone, then move onto moveTo
|
||||||
switch(name) {
|
switch(name) {
|
||||||
case Hand: return moveToHand(c, cause);
|
case Hand: return moveToHand(c, cause, params);
|
||||||
case Library: return moveToLibrary(c, libPosition, cause);
|
case Library: return moveToLibrary(c, libPosition, cause, params);
|
||||||
case Battlefield: return moveToPlay(c, cause);
|
case Battlefield: return moveToPlay(c, cause, params);
|
||||||
case Graveyard: return moveToGraveyard(c, cause);
|
case Graveyard: return moveToGraveyard(c, cause, params);
|
||||||
case Exile: return exile(c, cause);
|
case Exile: return exile(c, cause, params);
|
||||||
case Stack: return moveToStack(c, cause);
|
case Stack: return moveToStack(c, cause, params);
|
||||||
case PlanarDeck: return moveToVariantDeck(c, ZoneType.PlanarDeck, libPosition, cause);
|
case PlanarDeck: return moveToVariantDeck(c, ZoneType.PlanarDeck, libPosition, cause, params);
|
||||||
case SchemeDeck: return moveToVariantDeck(c, ZoneType.SchemeDeck, libPosition, cause);
|
case SchemeDeck: return moveToVariantDeck(c, ZoneType.SchemeDeck, libPosition, cause, params);
|
||||||
default: // sideboard will also get there
|
default: // sideboard will also get there
|
||||||
return moveTo(c.getOwner().getZone(name), c, cause);
|
return moveTo(c.getOwner().getZone(name), c, cause, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -1034,7 +1095,7 @@ public class GameAction {
|
|||||||
|
|
||||||
if (!perm.isInZone(tgtZone) || !perm.canBeEnchantedBy(c, true) || (perm.isPhasedOut() && !c.isPhasedOut())) {
|
if (!perm.isInZone(tgtZone) || !perm.canBeEnchantedBy(c, true) || (perm.isPhasedOut() && !c.isPhasedOut())) {
|
||||||
c.unEnchantEntity(perm);
|
c.unEnchantEntity(perm);
|
||||||
moveToGraveyard(c, null);
|
moveToGraveyard(c, null, Maps.newHashMap());
|
||||||
checkAgain = true;
|
checkAgain = true;
|
||||||
}
|
}
|
||||||
} else if (entity instanceof Player) {
|
} else if (entity instanceof Player) {
|
||||||
@@ -1052,13 +1113,13 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
if (invalid) {
|
if (invalid) {
|
||||||
c.unEnchantEntity(pl);
|
c.unEnchantEntity(pl);
|
||||||
moveToGraveyard(c, null);
|
moveToGraveyard(c, null, Maps.newHashMap());
|
||||||
checkAgain = true;
|
checkAgain = true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (c.isInPlay() && !c.isEnchanting()) {
|
if (c.isInPlay() && !c.isEnchanting()) {
|
||||||
moveToGraveyard(c, null);
|
moveToGraveyard(c, null, Maps.newHashMap());
|
||||||
checkAgain = true;
|
checkAgain = true;
|
||||||
}
|
}
|
||||||
return checkAgain;
|
return checkAgain;
|
||||||
@@ -1231,7 +1292,7 @@ public class GameAction {
|
|||||||
|
|
||||||
for (Card c : list) {
|
for (Card c : list) {
|
||||||
if (c.getCounters(CounterType.LOYALTY) <= 0) {
|
if (c.getCounters(CounterType.LOYALTY) <= 0) {
|
||||||
moveToGraveyard(c, null);
|
moveToGraveyard(c, null, Maps.newHashMap());
|
||||||
// Play the Destroy sound
|
// Play the Destroy sound
|
||||||
game.fireEvent(new GameEventCardDestroyed());
|
game.fireEvent(new GameEventCardDestroyed());
|
||||||
recheck = true;
|
recheck = true;
|
||||||
@@ -1456,7 +1517,7 @@ public class GameAction {
|
|||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
final Card newCard = moveToGraveyard(c, cause);
|
final Card newCard = moveToGraveyard(c, cause, Maps.newHashMap());
|
||||||
|
|
||||||
return newCard;
|
return newCard;
|
||||||
}
|
}
|
||||||
@@ -1678,7 +1739,7 @@ public class GameAction {
|
|||||||
if (!isCommander) {
|
if (!isCommander) {
|
||||||
toMulligan = new CardCollection(p.getCardsIn(ZoneType.Hand));
|
toMulligan = new CardCollection(p.getCardsIn(ZoneType.Hand));
|
||||||
for (final Card c : toMulligan) {
|
for (final Card c : toMulligan) {
|
||||||
moveToLibrary(c, null);
|
moveToLibrary(c, null, Maps.newHashMap());
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
Thread.sleep(100); //delay for a tiny bit to give UI a chance catch up
|
Thread.sleep(100); //delay for a tiny bit to give UI a chance catch up
|
||||||
@@ -1690,7 +1751,7 @@ public class GameAction {
|
|||||||
} else {
|
} else {
|
||||||
List<Card> toExile = Lists.newArrayList(toMulligan);
|
List<Card> toExile = Lists.newArrayList(toMulligan);
|
||||||
for (Card c : toExile) {
|
for (Card c : toExile) {
|
||||||
exile(c, null);
|
exile(c, null, Maps.newHashMap());
|
||||||
}
|
}
|
||||||
exiledDuringMulligans.addAll(p, toExile);
|
exiledDuringMulligans.addAll(p, toExile);
|
||||||
try {
|
try {
|
||||||
@@ -1716,7 +1777,7 @@ public class GameAction {
|
|||||||
Player p = kv.getKey();
|
Player p = kv.getKey();
|
||||||
Collection<Card> cc = kv.getValue();
|
Collection<Card> cc = kv.getValue();
|
||||||
for (Card c : cc) {
|
for (Card c : cc) {
|
||||||
moveToLibrary(c, null);
|
moveToLibrary(c, null, Maps.newHashMap());
|
||||||
}
|
}
|
||||||
p.shuffle(null);
|
p.shuffle(null);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -142,7 +142,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
if (ability.isSpell()) {
|
if (ability.isSpell()) {
|
||||||
final Card source = ability.getHostCard();
|
final Card source = ability.getHostCard();
|
||||||
if (!source.isCopiedSpell() && !source.isInZone(ZoneType.Stack)) {
|
if (!source.isCopiedSpell() && !source.isInZone(ZoneType.Stack)) {
|
||||||
ability.setHostCard(game.getAction().moveToStack(source, ability));
|
ability.setHostCard(game.getAction().moveToStack(source, ability, Maps.newHashMap()));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -535,12 +535,14 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
}
|
}
|
||||||
|
|
||||||
private final void finishResolving(final SpellAbility sa, final boolean fizzle) {
|
private final void finishResolving(final SpellAbility sa, final boolean fizzle) {
|
||||||
// remove SA and card from the stack
|
|
||||||
removeCardFromStack(sa, fizzle);
|
|
||||||
// SpellAbility is removed from the stack here
|
// SpellAbility is removed from the stack here
|
||||||
// temporarily removed removing SA after resolution
|
// temporarily removed removing SA after resolution
|
||||||
final SpellAbilityStackInstance si = getInstanceFromSpellAbility(sa);
|
final SpellAbilityStackInstance si = getInstanceFromSpellAbility(sa);
|
||||||
|
|
||||||
|
// remove SA and card from the stack
|
||||||
|
removeCardFromStack(sa, si, fizzle);
|
||||||
|
|
||||||
if (si != null) {
|
if (si != null) {
|
||||||
remove(si);
|
remove(si);
|
||||||
}
|
}
|
||||||
@@ -571,7 +573,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
// sa.getHostCard().setXManaCostPaid(0);
|
// sa.getHostCard().setXManaCostPaid(0);
|
||||||
}
|
}
|
||||||
|
|
||||||
private final void removeCardFromStack(final SpellAbility sa, final boolean fizzle) {
|
private final void removeCardFromStack(final SpellAbility sa, final SpellAbilityStackInstance si, final boolean fizzle) {
|
||||||
Card source = sa.getHostCard();
|
Card source = sa.getHostCard();
|
||||||
|
|
||||||
// need to update active trigger
|
// need to update active trigger
|
||||||
@@ -584,14 +586,14 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
// Handle cards that need to be moved differently
|
// Handle cards that need to be moved differently
|
||||||
// TODO: replacement effects: Rebound, Buyback and Soulfire Grand Master
|
// TODO: replacement effects: Rebound, Buyback and Soulfire Grand Master
|
||||||
source.removeAllExtrinsicKeyword("Move CARDNAME to your hand as it resolves");
|
source.removeAllExtrinsicKeyword("Move CARDNAME to your hand as it resolves");
|
||||||
game.getAction().moveToHand(source, sa);
|
game.getAction().moveToHand(source, sa, Maps.newHashMap());
|
||||||
}
|
}
|
||||||
else if (sa.isFlashBackAbility()) {
|
else if (sa.isFlashBackAbility()) {
|
||||||
game.getAction().exile(source, sa);
|
game.getAction().exile(source, sa, Maps.newHashMap());
|
||||||
sa.setFlashBackAbility(false);
|
sa.setFlashBackAbility(false);
|
||||||
}
|
}
|
||||||
else if (sa.isAftermath()) {
|
else if (sa.isAftermath()) {
|
||||||
game.getAction().exile(source, sa);
|
game.getAction().exile(source, sa, Maps.newHashMap());
|
||||||
}
|
}
|
||||||
else if (source.hasKeyword("Rebound")
|
else if (source.hasKeyword("Rebound")
|
||||||
&& !fizzle
|
&& !fizzle
|
||||||
@@ -600,7 +602,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
&& source.getOwner().equals(source.getController())) //"If you cast this spell from your hand"
|
&& source.getOwner().equals(source.getController())) //"If you cast this spell from your hand"
|
||||||
{
|
{
|
||||||
//Move rebounding card to exile
|
//Move rebounding card to exile
|
||||||
source = game.getAction().exile(source, null);
|
source = game.getAction().exile(source, null, Maps.newHashMap());
|
||||||
|
|
||||||
source.setSVar("ReboundAbilityTrigger", "DB$ Play | Defined$ Self "
|
source.setSVar("ReboundAbilityTrigger", "DB$ Play | Defined$ Self "
|
||||||
+ "| WithoutManaCost$ True | Optional$ True");
|
+ "| WithoutManaCost$ True | Optional$ True");
|
||||||
@@ -617,7 +619,11 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
(source.isInstant() || source.isSorcery() || fizzle) &&
|
(source.isInstant() || source.isSorcery() || fizzle) &&
|
||||||
source.isInZone(ZoneType.Stack)) {
|
source.isInZone(ZoneType.Stack)) {
|
||||||
// If Spell and still on the Stack then let it goto the graveyard or replace its own movement
|
// If Spell and still on the Stack then let it goto the graveyard or replace its own movement
|
||||||
game.getAction().moveToGraveyard(source, null);
|
Map<String, Object> params = Maps.newHashMap();
|
||||||
|
params.put("StackSa", sa);
|
||||||
|
params.put("StackSi", si);
|
||||||
|
params.put("Fizzle", fizzle);
|
||||||
|
game.getAction().moveToGraveyard(source, null, params);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user