mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 18:58:00 +00:00
TriggerChangesZone: Trigger on leaving the battlefield look back in time using LKI
This commit is contained in:
@@ -390,7 +390,8 @@ public class GameAction {
|
|||||||
// play the change zone sound
|
// play the change zone sound
|
||||||
game.fireEvent(new GameEventCardChangeZone(c, zoneFrom, zoneTo));
|
game.fireEvent(new GameEventCardChangeZone(c, zoneFrom, zoneTo));
|
||||||
|
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(lastKnownInfo);
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(copied);
|
||||||
|
runParams.put(AbilityKey.CardLKI, lastKnownInfo);
|
||||||
runParams.put(AbilityKey.Cause, cause);
|
runParams.put(AbilityKey.Cause, cause);
|
||||||
runParams.put(AbilityKey.Origin, zoneFrom != null ? zoneFrom.getZoneType().name() : null);
|
runParams.put(AbilityKey.Origin, zoneFrom != null ? zoneFrom.getZoneType().name() : null);
|
||||||
runParams.put(AbilityKey.Destination, zoneTo.getZoneType().name());
|
runParams.put(AbilityKey.Destination, zoneTo.getZoneType().name());
|
||||||
|
|||||||
@@ -17,7 +17,6 @@
|
|||||||
*/
|
*/
|
||||||
package forge.game.trigger;
|
package forge.game.trigger;
|
||||||
|
|
||||||
import forge.game.Game;
|
|
||||||
import forge.game.ability.AbilityKey;
|
import forge.game.ability.AbilityKey;
|
||||||
import forge.game.ability.AbilityUtils;
|
import forge.game.ability.AbilityUtils;
|
||||||
import forge.game.card.Card;
|
import forge.game.card.Card;
|
||||||
@@ -102,16 +101,13 @@ public class TriggerChangesZone extends Trigger {
|
|||||||
|
|
||||||
if (hasParam("ValidCard")) {
|
if (hasParam("ValidCard")) {
|
||||||
Card moved = (Card) runParams.get(AbilityKey.Card);
|
Card moved = (Card) runParams.get(AbilityKey.Card);
|
||||||
final Game game = getHostCard().getGame();
|
|
||||||
boolean leavesBattlefield = "Battlefield".equals(getParam("Origin"));
|
boolean leavesBattlefield = "Battlefield".equals(getParam("Origin"));
|
||||||
boolean isDiesTrig = leavesBattlefield && "Graveyard".equals(getParam("Destination"));
|
|
||||||
|
|
||||||
if (isDiesTrig) {
|
if (leavesBattlefield) {
|
||||||
moved = game.getChangeZoneLKIInfo(moved);
|
moved = (Card) runParams.get(AbilityKey.CardLKI);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!moved.isValid(getParam("ValidCard").split(","), getHostCard().getController(),
|
if (!matchesValid(moved, getParam("ValidCard").split(","), getHostCard())) {
|
||||||
getHostCard(), null)) {
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -124,9 +120,10 @@ public class TriggerChangesZone extends Trigger {
|
|||||||
if (cause == null) {
|
if (cause == null) {
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
if (!cause.getHostCard().isValid(getParam("ValidCause").split(","), getHostCard().getController(),
|
if (!matchesValid(cause, getParam("ValidCause").split(","), getHostCard())) {
|
||||||
getHostCard(), null)) {
|
if (!matchesValid(cause.getHostCard(), getParam("ValidCause").split(","), getHostCard())) {
|
||||||
return false;
|
return false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -214,7 +211,11 @@ public class TriggerChangesZone extends Trigger {
|
|||||||
/** {@inheritDoc} */
|
/** {@inheritDoc} */
|
||||||
@Override
|
@Override
|
||||||
public final void setTriggeringObjects(final SpellAbility sa, Map<AbilityKey, Object> runParams) {
|
public final void setTriggeringObjects(final SpellAbility sa, Map<AbilityKey, Object> runParams) {
|
||||||
sa.setTriggeringObjectsFrom(runParams, AbilityKey.Card);
|
if ("Battlefield".equals(getParam("Origin"))) {
|
||||||
|
sa.setTriggeringObject(AbilityKey.Card, runParams.get(AbilityKey.CardLKI));
|
||||||
|
} else {
|
||||||
|
sa.setTriggeringObjectsFrom(runParams, AbilityKey.Card);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
|
|||||||
Reference in New Issue
Block a user