mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-17 19:28:01 +00:00
SpellAbility: add LastStateGraveyard
updated TriggerHandler and MagicStack add it to ReplacementHandler too
This commit is contained in:
@@ -192,11 +192,15 @@ public class ReplacementHandler {
|
||||
} while(tailend != null);
|
||||
}
|
||||
|
||||
if (effectSA != null && replacementEffect.isIntrinsic()) {
|
||||
if (effectSA != null) {
|
||||
effectSA.setLastStateBattlefield(game.getLastStateBattlefield());
|
||||
effectSA.setLastStateGraveyard(game.getLastStateGraveyard());
|
||||
if (replacementEffect.isIntrinsic()) {
|
||||
effectSA.setIntrinsic(true);
|
||||
effectSA.changeText();
|
||||
effectSA.setReplacementAbility(true);
|
||||
}
|
||||
}
|
||||
|
||||
// Decider gets to choose whether or not to apply the replacement.
|
||||
if (replacementEffect.getMapParams().containsKey("Optional")) {
|
||||
|
||||
@@ -146,6 +146,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
private StaticAbility mayPlay = null;
|
||||
|
||||
private CardCollection lastStateBattlefield = null;
|
||||
private CardCollection lastStateGraveyard = null;
|
||||
|
||||
public CardCollection getLastStateBattlefield() {
|
||||
return lastStateBattlefield;
|
||||
@@ -154,6 +155,13 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
||||
public void setLastStateBattlefield(final CardCollectionView lastStateBattlefield) {
|
||||
this.lastStateBattlefield = new CardCollection(lastStateBattlefield);
|
||||
}
|
||||
public CardCollection getLastStateGraveyard() {
|
||||
return lastStateGraveyard;
|
||||
}
|
||||
|
||||
public void setLastStateGraveyard(final CardCollectionView lastStateGraveyard) {
|
||||
this.lastStateGraveyard = new CardCollection(lastStateGraveyard);
|
||||
}
|
||||
|
||||
protected SpellAbility(final Card iSourceCard, final Cost toPay) {
|
||||
this(iSourceCard, toPay, null);
|
||||
|
||||
@@ -517,6 +517,7 @@ public class TriggerHandler {
|
||||
|
||||
sa.setHostCard(host);
|
||||
sa.setLastStateBattlefield(game.getLastStateBattlefield());
|
||||
sa.setLastStateGraveyard(game.getLastStateGraveyard());
|
||||
|
||||
sa.setTrigger(true);
|
||||
sa.setSourceTrigger(regtrig.getId());
|
||||
|
||||
@@ -501,7 +501,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
boolean thisHasFizzled = hasFizzled(sa, source, null);
|
||||
|
||||
if (!thisHasFizzled) {
|
||||
game.copyLastStateBattlefield();
|
||||
game.copyLastState();
|
||||
}
|
||||
|
||||
if (thisHasFizzled) { // Fizzle
|
||||
@@ -532,7 +532,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
||||
}
|
||||
|
||||
if (isEmpty()) {
|
||||
game.copyLastStateBattlefield();
|
||||
game.copyLastState();
|
||||
// FIXME: assuming that if the stack is empty, no reason to hold on to old LKI data (everything is a new object). Is this correct?
|
||||
game.clearChangeZoneLKIInfo();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user