mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
Merge branch 'fixNPE' into 'master'
Rework ceaseToExist See merge request core-developers/forge!4559
This commit is contained in:
@@ -789,6 +789,7 @@ public class Game {
|
|||||||
cc.removeImprintedCard(c);
|
cc.removeImprintedCard(c);
|
||||||
cc.removeEncodedCard(c);
|
cc.removeEncodedCard(c);
|
||||||
cc.removeRemembered(c);
|
cc.removeRemembered(c);
|
||||||
|
cc.removeAttachedTo(c);
|
||||||
}
|
}
|
||||||
getAction().ceaseToExist(c, false);
|
getAction().ceaseToExist(c, false);
|
||||||
// CR 603.2f owner of trigger source lost game
|
// CR 603.2f owner of trigger source lost game
|
||||||
|
|||||||
@@ -920,17 +920,14 @@ public class GameAction {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public void ceaseToExist(Card c, boolean skipTrig) {
|
public void ceaseToExist(Card c, boolean skipTrig) {
|
||||||
final String origin = c.getZone().getZoneType().name();
|
|
||||||
|
|
||||||
c.getZone().remove(c);
|
c.getZone().remove(c);
|
||||||
c.setZone(null);
|
|
||||||
|
|
||||||
// CR 603.6c other players LTB triggers should work
|
// CR 603.6c other players LTB triggers should work
|
||||||
if (!skipTrig) {
|
if (!skipTrig) {
|
||||||
game.addChangeZoneLKIInfo(c);
|
game.addChangeZoneLKIInfo(c);
|
||||||
Card lki = null;
|
|
||||||
CardCollectionView lastBattlefield = game.getLastStateBattlefield();
|
CardCollectionView lastBattlefield = game.getLastStateBattlefield();
|
||||||
int idx = lastBattlefield.indexOf(c);
|
int idx = lastBattlefield.indexOf(c);
|
||||||
|
Card lki = null;
|
||||||
if (idx != -1) {
|
if (idx != -1) {
|
||||||
lki = lastBattlefield.get(idx);
|
lki = lastBattlefield.get(idx);
|
||||||
}
|
}
|
||||||
@@ -942,12 +939,10 @@ public class GameAction {
|
|||||||
game.getCombat().saveLKI(lki);
|
game.getCombat().saveLKI(lki);
|
||||||
}
|
}
|
||||||
game.getTriggerHandler().registerActiveLTBTrigger(lki);
|
game.getTriggerHandler().registerActiveLTBTrigger(lki);
|
||||||
|
|
||||||
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
|
final Map<AbilityKey, Object> runParams = AbilityKey.mapFromCard(c);
|
||||||
runParams.put(AbilityKey.CardLKI, lki);
|
runParams.put(AbilityKey.CardLKI, lki);
|
||||||
runParams.put(AbilityKey.Origin, origin);
|
runParams.put(AbilityKey.Origin, c.getZone().getZoneType().name());
|
||||||
game.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams, false);
|
game.getTriggerHandler().runTrigger(TriggerType.ChangesZone, runParams, false);
|
||||||
game.getTriggerHandler().runWaitingTriggers();
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -640,5 +640,7 @@ public class TriggerHandler {
|
|||||||
delayedTriggers.remove(t);
|
delayedTriggers.remove(t);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
// run all ChangesZone
|
||||||
|
runWaitingTriggers();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user