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,10 +192,14 @@ public class ReplacementHandler {
|
|||||||
} while(tailend != null);
|
} while(tailend != null);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (effectSA != null && replacementEffect.isIntrinsic()) {
|
if (effectSA != null) {
|
||||||
effectSA.setIntrinsic(true);
|
effectSA.setLastStateBattlefield(game.getLastStateBattlefield());
|
||||||
effectSA.changeText();
|
effectSA.setLastStateGraveyard(game.getLastStateGraveyard());
|
||||||
effectSA.setReplacementAbility(true);
|
if (replacementEffect.isIntrinsic()) {
|
||||||
|
effectSA.setIntrinsic(true);
|
||||||
|
effectSA.changeText();
|
||||||
|
effectSA.setReplacementAbility(true);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Decider gets to choose whether or not to apply the replacement.
|
// Decider gets to choose whether or not to apply the replacement.
|
||||||
|
|||||||
@@ -146,6 +146,7 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
|||||||
private StaticAbility mayPlay = null;
|
private StaticAbility mayPlay = null;
|
||||||
|
|
||||||
private CardCollection lastStateBattlefield = null;
|
private CardCollection lastStateBattlefield = null;
|
||||||
|
private CardCollection lastStateGraveyard = null;
|
||||||
|
|
||||||
public CardCollection getLastStateBattlefield() {
|
public CardCollection getLastStateBattlefield() {
|
||||||
return lastStateBattlefield;
|
return lastStateBattlefield;
|
||||||
@@ -154,6 +155,13 @@ public abstract class SpellAbility extends CardTraitBase implements ISpellAbilit
|
|||||||
public void setLastStateBattlefield(final CardCollectionView lastStateBattlefield) {
|
public void setLastStateBattlefield(final CardCollectionView lastStateBattlefield) {
|
||||||
this.lastStateBattlefield = new CardCollection(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) {
|
protected SpellAbility(final Card iSourceCard, final Cost toPay) {
|
||||||
this(iSourceCard, toPay, null);
|
this(iSourceCard, toPay, null);
|
||||||
|
|||||||
@@ -517,6 +517,7 @@ public class TriggerHandler {
|
|||||||
|
|
||||||
sa.setHostCard(host);
|
sa.setHostCard(host);
|
||||||
sa.setLastStateBattlefield(game.getLastStateBattlefield());
|
sa.setLastStateBattlefield(game.getLastStateBattlefield());
|
||||||
|
sa.setLastStateGraveyard(game.getLastStateGraveyard());
|
||||||
|
|
||||||
sa.setTrigger(true);
|
sa.setTrigger(true);
|
||||||
sa.setSourceTrigger(regtrig.getId());
|
sa.setSourceTrigger(regtrig.getId());
|
||||||
|
|||||||
@@ -501,7 +501,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
boolean thisHasFizzled = hasFizzled(sa, source, null);
|
boolean thisHasFizzled = hasFizzled(sa, source, null);
|
||||||
|
|
||||||
if (!thisHasFizzled) {
|
if (!thisHasFizzled) {
|
||||||
game.copyLastStateBattlefield();
|
game.copyLastState();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (thisHasFizzled) { // Fizzle
|
if (thisHasFizzled) { // Fizzle
|
||||||
@@ -532,7 +532,7 @@ public class MagicStack /* extends MyObservable */ implements Iterable<SpellAbil
|
|||||||
}
|
}
|
||||||
|
|
||||||
if (isEmpty()) {
|
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?
|
// 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();
|
game.clearChangeZoneLKIInfo();
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user