mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 11:18:01 +00:00
Merge pull request #2315 from tool4ever/checkselflki
Better fix for CheckSelfLKIZone
This commit is contained in:
@@ -173,21 +173,22 @@ public class ReplacementHandler {
|
||||
game.forEachCardInGame(new Visitor<Card>() {
|
||||
@Override
|
||||
public boolean visit(Card crd) {
|
||||
final Card c = preList.get(crd);
|
||||
Card c = preList.get(crd);
|
||||
Zone cardZone = game.getChangeZoneLKIInfo(c).getLastKnownZone();
|
||||
|
||||
// only when not prelist
|
||||
if (c == crd && cardZone.is(ZoneType.Battlefield) && event == ReplacementType.Moved &&
|
||||
runParams.containsKey(AbilityKey.LastStateBattlefield) && runParams.get(AbilityKey.LastStateBattlefield) != null) {
|
||||
Card lastState = ((CardCollectionView) runParams.get(AbilityKey.LastStateBattlefield)).get(crd);
|
||||
// no LKI found for this card so it shouldn't apply, this can happen during simultaneous zone changes
|
||||
if (lastState == crd) {
|
||||
return true;
|
||||
}
|
||||
// use the LKI because it has the right RE from the state before the effect started
|
||||
c = lastState;
|
||||
}
|
||||
|
||||
for (final ReplacementEffect replacementEffect : c.getReplacementEffects()) {
|
||||
Zone cardZone;
|
||||
// Use "CheckLKIZone" parameter to test for effects that care about where the card was last (e.g. Kalitas, Traitor of Ghet
|
||||
// getting hit by mass removal should still produce tokens).
|
||||
if ("True".equals(replacementEffect.getParam("CheckSelfLKIZone"))) {
|
||||
cardZone = game.getChangeZoneLKIInfo(c).getLastKnownZone();
|
||||
if (cardZone.is(ZoneType.Battlefield) && runParams.containsKey(AbilityKey.LastStateBattlefield) && runParams.get(AbilityKey.LastStateBattlefield) != null && !((CardCollectionView) runParams.get(AbilityKey.LastStateBattlefield)).contains(crd)) {
|
||||
continue;
|
||||
}
|
||||
} else {
|
||||
cardZone = game.getZoneOf(c);
|
||||
}
|
||||
|
||||
// Replacement effects that are tied to keywords (e.g. damage prevention effects - if the keyword is removed, the replacement
|
||||
// effect should be inactive)
|
||||
if (replacementEffect.hasParam("TiedToKeyword")) {
|
||||
|
||||
Reference in New Issue
Block a user