SpellAbility: add LastStateGraveyard

updated TriggerHandler and MagicStack
add it to ReplacementHandler too
This commit is contained in:
Hanmac
2016-08-14 08:59:17 +00:00
parent 444b01ce8f
commit db520bd7eb
4 changed files with 19 additions and 6 deletions

View File

@@ -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")) {

View File

@@ -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);

View File

@@ -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());

View File

@@ -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();
}