- Fixed double faced cards changing zones getting transformed before triggers are called (fixed Loyal Cathar).

This commit is contained in:
Sloth
2012-02-07 17:33:34 +00:00
parent 3ce3687317
commit 0a442886ae
4 changed files with 21 additions and 18 deletions

View File

@@ -912,16 +912,19 @@ public final class CardUtil {
* *
* @param c * @param c
* a Card. * a Card.
* @param state
* a String object
* @return a copy of C with LastKnownInfo stuff retained. * @return a copy of C with LastKnownInfo stuff retained.
*/ */
public static Card getLKICopy(final Card c, final String state) { public static Card getLKICopy(final Card c) {
if (c.isToken()) { if (c.isToken()) {
return c; return c;
} }
final Card res = AllZone.getCardFactory().copyCard(c); final String state = c.getCurState();
AllZone.getTriggerHandler().suppressMode("Transformed"); AllZone.getTriggerHandler().suppressMode("Transformed");
if (c.isInAlternateState()) {
c.setState("Original");
}
final Card res = AllZone.getCardFactory().copyCard(c);
c.setState(state);
res.setState(state); res.setState(state);
AllZone.getTriggerHandler().clearSuppression("Transformed"); AllZone.getTriggerHandler().clearSuppression("Transformed");
res.setControllerObjects(c.getControllerObjects()); res.setControllerObjects(c.getControllerObjects());

View File

@@ -149,18 +149,14 @@ public class GameAction {
lastKnownInfo = c; lastKnownInfo = c;
copied = c; copied = c;
} else { } else {
final String state = c.getCurState();
AllZone.getTriggerHandler().suppressMode("Transformed"); AllZone.getTriggerHandler().suppressMode("Transformed");
if (c.isInAlternateState()) {
c.setState("Original");
}
if (c.isCloned()) { if (c.isCloned()) {
c.switchStates("Cloner", "Original"); c.switchStates("Cloner", "Original");
c.setState("Original"); c.setState("Original");
} }
AllZone.getTriggerHandler().clearSuppression("Transformed"); AllZone.getTriggerHandler().clearSuppression("Transformed");
lastKnownInfo = CardUtil.getLKICopy(c, state); lastKnownInfo = CardUtil.getLKICopy(c);
copied = AllZone.getCardFactory().copyCard(c); copied = AllZone.getCardFactory().copyCard(c);
copied.setUnearthed(c.isUnearthed()); copied.setUnearthed(c.isUnearthed());
@@ -218,11 +214,13 @@ public class GameAction {
// remove all counters from the card if destination is not the // remove all counters from the card if destination is not the
// battlefield // battlefield
// UNLESS we're dealing with Skullbriar, the Walking Grave // UNLESS we're dealing with Skullbriar, the Walking Grave
if (!zone.is(Constant.Zone.Battlefield) if (!zone.is(Constant.Zone.Battlefield)) {
&& !(c.getName().equals("Skullbriar, the Walking Grave") && !zone.is(Constant.Zone.Hand) && !zone if (!(c.getName().equals("Skullbriar, the Walking Grave") && !zone.is(Constant.Zone.Hand) && !zone
.is(Constant.Zone.Library))) { .is(Constant.Zone.Library))) {
copied.clearCounters(); copied.clearCounters();
} }
copied.setState("Original");
}
copied.setTimestamp(AllZone.getNextTimestamp()); copied.setTimestamp(AllZone.getNextTimestamp());
for (String s : copied.getKeyword()) { for (String s : copied.getKeyword()) {

View File

@@ -181,14 +181,17 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
*/ */
@Override @Override
public final Card copyCard(final Card in) { public final Card copyCard(final Card in) {
final String curState = in.getCurState();
AllZone.getTriggerHandler().suppressMode("Transformed");
if (in.isInAlternateState()) {
in.setState("Original");
}
final Card out = this.getCard(in.getName(), in.getOwner()); final Card out = this.getCard(in.getName(), in.getOwner());
out.setUniqueNumber(in.getUniqueNumber()); out.setUniqueNumber(in.getUniqueNumber());
out.setCurSetCode(in.getCurSetCode()); out.setCurSetCode(in.getCurSetCode());
CardFactoryUtil.copyCharacteristics(in, out); CardFactoryUtil.copyCharacteristics(in, out);
if (in.hasAlternateState()) { if (in.hasAlternateState()) {
AllZone.getTriggerHandler().suppressMode("Transformed");
final String curState = in.getCurState();
for (final String state : in.getStates()) { for (final String state : in.getStates()) {
in.setState(state); in.setState(state);
out.setState(state); out.setState(state);
@@ -196,9 +199,8 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
} }
in.setState(curState); in.setState(curState);
out.setState(curState); out.setState(curState);
AllZone.getTriggerHandler().clearSuppression("Transformed");
} }
AllZone.getTriggerHandler().clearSuppression("Transformed");
// I'm not sure if we really should be copying enchant/equip stuff over. // I'm not sure if we really should be copying enchant/equip stuff over.
out.setEquipping(in.getEquipping()); out.setEquipping(in.getEquipping());

View File

@@ -79,7 +79,7 @@ public abstract class CostPartWithList extends CostPart {
*/ */
public final void addListToHash(final SpellAbility sa, final String hash) { public final void addListToHash(final SpellAbility sa, final String hash) {
for (final Card card : this.getList()) { for (final Card card : this.getList()) {
Card copy = CardUtil.getLKICopy(card, card.getCurState()); Card copy = CardUtil.getLKICopy(card);
sa.addCostToHashList(copy, hash); sa.addCostToHashList(copy, hash);
} }
} }