mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-20 04:38:00 +00:00
- Attempt at reducing code when cards get created/change zone (should be watched).
- Removed a lot of suppressions of TriggerType.Transformed by adding a new setState function that does not run triggers at all.
This commit is contained in:
@@ -254,6 +254,31 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
this.characteristicsMap.put(CardCharactersticName.FaceDown, CardUtil.getFaceDownCharacteristic());
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the state.
|
||||
*
|
||||
* @param state
|
||||
* the state
|
||||
* @return true, if successful
|
||||
*/
|
||||
public boolean changeToState(final CardCharactersticName state) {
|
||||
|
||||
CardCharactersticName cur = this.curCharacteristics;
|
||||
|
||||
if (!setState(state)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if ((cur == CardCharactersticName.Original && state == CardCharactersticName.Transformed)
|
||||
|| (cur == CardCharactersticName.Transformed && state == CardCharactersticName.Original)) {
|
||||
HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Transformer", this);
|
||||
AllZone.getTriggerHandler().runTrigger(TriggerType.Transformed, runParams);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
* Sets the state.
|
||||
*
|
||||
@@ -275,17 +300,8 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
return false;
|
||||
}
|
||||
|
||||
CardCharactersticName cur = this.curCharacteristics;
|
||||
|
||||
this.curCharacteristics = state;
|
||||
|
||||
if ((cur == CardCharactersticName.Original && state == CardCharactersticName.Transformed)
|
||||
|| (cur == CardCharactersticName.Transformed && state == CardCharactersticName.Original)) {
|
||||
HashMap<String, Object> runParams = new HashMap<String, Object>();
|
||||
runParams.put("Transformer", this);
|
||||
AllZone.getTriggerHandler().runTrigger(TriggerType.Transformed, runParams);
|
||||
}
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -339,7 +355,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
public boolean turnFaceDown() {
|
||||
if (!this.isDoubleFaced) {
|
||||
this.preTFDCharacteristic = this.curCharacteristics;
|
||||
return this.setState(CardCharactersticName.FaceDown);
|
||||
return this.changeToState(CardCharactersticName.FaceDown);
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -352,7 +368,7 @@ public class Card extends GameEntity implements Comparable<Card> {
|
||||
*/
|
||||
public boolean turnFaceUp() {
|
||||
if (this.curCharacteristics == CardCharactersticName.FaceDown) {
|
||||
return this.setState(this.preTFDCharacteristic);
|
||||
return this.changeToState(this.preTFDCharacteristic);
|
||||
}
|
||||
|
||||
return false;
|
||||
|
||||
@@ -392,6 +392,11 @@ public class CardReader implements Runnable {
|
||||
|
||||
for (String line : lines) {
|
||||
line = line.trim();
|
||||
if (ignoreTheRest) {
|
||||
continue;
|
||||
} // have to deplete the iterator
|
||||
// otherwise the underlying class would close its stream on finalize
|
||||
// only
|
||||
|
||||
if ("End".equals(line)) {
|
||||
// have to deplete the iterator
|
||||
@@ -399,11 +404,6 @@ public class CardReader implements Runnable {
|
||||
continue;
|
||||
// otherwise the underlying class would close its stream on finalize only
|
||||
}
|
||||
if (ignoreTheRest) {
|
||||
continue;
|
||||
} // have to deplete the iterator
|
||||
// otherwise the underlying class would close its stream on finalize
|
||||
// only
|
||||
|
||||
if (line.isEmpty() || (line.charAt(0) == '#')) {
|
||||
continue;
|
||||
@@ -413,7 +413,7 @@ public class CardReader implements Runnable {
|
||||
rulesReader.parseLine(line);
|
||||
}
|
||||
|
||||
if (line.startsWith("Name:")) {
|
||||
if (line.startsWith("Name")) {
|
||||
final String value = line.substring(5);
|
||||
// System.out.println(s);
|
||||
if ((mapToFill != null) && mapToFill.containsKey(value)) {
|
||||
@@ -421,23 +421,23 @@ public class CardReader implements Runnable {
|
||||
} else {
|
||||
card.setName(value);
|
||||
}
|
||||
} else if (line.startsWith("ManaCost:")) {
|
||||
} else if (line.startsWith("ManaCost")) {
|
||||
final String value = line.substring(9);
|
||||
// System.out.println(s);
|
||||
if (!"no cost".equals(value)) {
|
||||
card.setManaCost(new CardManaCost(new ManaCostParser(value)));
|
||||
}
|
||||
} else if (line.startsWith("Types:")) {
|
||||
CardReader.addTypes(card, line.substring("Types:".length()));
|
||||
} else if (line.startsWith("Text:")) {
|
||||
String value = line.substring("Text:".length());
|
||||
} else if (line.startsWith("Types")) {
|
||||
CardReader.addTypes(card, line.substring(6));
|
||||
} else if (line.startsWith("Text")) {
|
||||
String value = line.substring(5);
|
||||
// if (!t.equals("no text"));
|
||||
if ("no text".equals(value)) {
|
||||
value = "";
|
||||
}
|
||||
card.setText(value);
|
||||
} else if (line.startsWith("PT:")) {
|
||||
final String value = line.substring("PT:".length());
|
||||
} else if (line.startsWith("PT")) {
|
||||
final String value = line.substring(3);
|
||||
final String[] powTough = value.split("/");
|
||||
int att;
|
||||
if (powTough[0].contains("*")) {
|
||||
@@ -457,14 +457,14 @@ public class CardReader implements Runnable {
|
||||
card.setBaseDefenseString(powTough[1]);
|
||||
card.setBaseAttack(att);
|
||||
card.setBaseDefense(def);
|
||||
} else if (line.startsWith("Loyalty:")) {
|
||||
} else if (line.startsWith("Loyalty")) {
|
||||
final String[] splitStr = line.split(":");
|
||||
final int loyal = Integer.parseInt(splitStr[1]);
|
||||
card.setBaseLoyalty(loyal);
|
||||
} else if (line.startsWith("K:")) {
|
||||
final String value = line.substring(2);
|
||||
card.addIntrinsicKeyword(value);
|
||||
} else if (line.startsWith("SVar:")) {
|
||||
} else if (line.startsWith("SVar")) {
|
||||
final String[] value = line.split(":", 3);
|
||||
card.setSVar(value[1], value[2]);
|
||||
} else if (line.startsWith("A:")) {
|
||||
@@ -475,8 +475,8 @@ public class CardReader implements Runnable {
|
||||
card.addStaticAbilityString(line.substring(2));
|
||||
} else if (line.startsWith("R:")) {
|
||||
card.addReplacementEffect(ReplacementHandler.parseReplacement(line.substring(2), card));
|
||||
} else if (line.startsWith("SetInfo:")) {
|
||||
final String value = line.substring("SetInfo:".length());
|
||||
} else if (line.startsWith("SetInfo")) {
|
||||
final String value = line.substring(8);
|
||||
card.addSet(new EditionInfo(value));
|
||||
// 8/18/11 11:08 PM
|
||||
} else if (line.equals("ALTERNATE")) {
|
||||
@@ -489,8 +489,8 @@ public class CardReader implements Runnable {
|
||||
mode = card.isTransformable();
|
||||
}
|
||||
card.addAlternateState(mode);
|
||||
card.setState(mode);
|
||||
} else if (line.startsWith("AlternateMode:")) {
|
||||
card.changeToState(mode);
|
||||
} else if (line.startsWith("AlternateMode")) {
|
||||
//System.out.println(card.getName());
|
||||
final CardCharactersticName value = CardCharactersticName.smartValueOf(line.substring("AlternateMode:".length()));
|
||||
if (value == CardCharactersticName.Flipped) {
|
||||
@@ -500,8 +500,8 @@ public class CardReader implements Runnable {
|
||||
} else {
|
||||
card.setTransformable(value);
|
||||
}
|
||||
} else if (line.startsWith("Colors:")) {
|
||||
final String value = line.substring("Colors:".length());
|
||||
} else if (line.startsWith("Colors")) {
|
||||
final String value = line.substring(7);
|
||||
final ArrayList<CardColor> newCols = new ArrayList<CardColor>();
|
||||
final CardColor newCol = new CardColor(card);
|
||||
for (final String col : value.split(",")) {
|
||||
|
||||
@@ -33,11 +33,9 @@ import org.apache.commons.lang3.StringUtils;
|
||||
import forge.card.CardCharacteristics;
|
||||
import forge.card.CardManaCost;
|
||||
import forge.card.EditionInfo;
|
||||
import forge.card.cardfactory.CardFactoryUtil;
|
||||
import forge.card.mana.ManaCost;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.spellability.SpellAbilityList;
|
||||
import forge.card.trigger.TriggerType;
|
||||
import forge.control.input.InputPayManaCostUtil;
|
||||
import forge.game.zone.DefaultPlayerZone;
|
||||
import forge.game.zone.ZoneType;
|
||||
@@ -912,14 +910,12 @@ public final class CardUtil {
|
||||
return c;
|
||||
}
|
||||
final CardCharactersticName state = c.getCurState();
|
||||
AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
|
||||
if (c.isInAlternateState()) {
|
||||
c.setState(CardCharactersticName.Original);
|
||||
}
|
||||
final Card res = AllZone.getCardFactory().copyCard(c);
|
||||
c.setState(state);
|
||||
res.setState(state);
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
|
||||
res.setControllerObjects(c.getControllerObjects());
|
||||
res.addTempAttackBoost(c.getTempAttackBoost());
|
||||
res.addSemiPermanentAttackBoost(c.getSemiPermanentAttackBoost());
|
||||
@@ -964,10 +960,11 @@ public final class CardUtil {
|
||||
newCopy.setDoubleFaced(in.isDoubleFaced());
|
||||
|
||||
// Copy all states
|
||||
AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
|
||||
// Commented out by Sloth 2012/07/25
|
||||
/*AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
|
||||
for (final CardCharactersticName state : in.getStates()) {
|
||||
newCopy.addAlternateState(state);
|
||||
newCopy.setState(state);
|
||||
newCopy.changeToState(state);
|
||||
CardFactoryUtil.copyState(in, state, newCopy);
|
||||
//Copies of full abilities not need in LKI copy
|
||||
/*
|
||||
@@ -993,13 +990,13 @@ public final class CardUtil {
|
||||
newCopy.addSpellAbility(newSA);
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
for (int i = 0; i < newCopy.getStaticAbilityStrings().size(); i++) {
|
||||
newCopy.addStaticAbility(newCopy.getStaticAbilityStrings().get(i));
|
||||
}
|
||||
}
|
||||
newCopy.setState(in.getCurState());
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
|
||||
newCopy.changeToState(in.getCurState());
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);*/
|
||||
|
||||
// I'm not sure if we really should be copying enchant/equip stuff over.
|
||||
|
||||
|
||||
@@ -140,16 +140,13 @@ public class GameAction {
|
||||
Card copied = null;
|
||||
Card lastKnownInfo = null;
|
||||
|
||||
// Don't copy Tokens, Cards staying in same zone, or cards entering
|
||||
// Battlefield
|
||||
if (c.isToken() || suppress || zoneTo.is(ZoneType.Battlefield) || zoneTo.is(ZoneType.Stack)
|
||||
|| (zoneFrom.is(ZoneType.Stack) && zoneTo.is(ZoneType.Battlefield))) {
|
||||
// Don't copy Tokens, copy only cards leaving the battlefield
|
||||
if (c.isToken() || suppress || zoneTo.is(ZoneType.Battlefield) || !zoneFrom.is(ZoneType.Battlefield)) {
|
||||
lastKnownInfo = c;
|
||||
copied = c;
|
||||
} else {
|
||||
lastKnownInfo = CardUtil.getLKICopy(c);
|
||||
|
||||
AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
|
||||
if (c.isCloned()) {
|
||||
c.switchStates(CardCharactersticName.Cloner, CardCharactersticName.Original);
|
||||
c.setState(CardCharactersticName.Original);
|
||||
@@ -162,20 +159,18 @@ public class GameAction {
|
||||
if (zoneFrom.is(ZoneType.Battlefield)) {
|
||||
c.setFlipStaus(false);
|
||||
}
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
|
||||
copied = AllZone.getCardFactory().copyCard(c);
|
||||
copied.setUnearthed(c.isUnearthed());
|
||||
copied.setTapped(false);
|
||||
for (final Trigger trigger : c.getTriggers()) {
|
||||
trigger.setHostCard(copied);
|
||||
}
|
||||
}
|
||||
|
||||
if (c.wasSuspendCast()) {
|
||||
copied = GameAction.addSuspendTriggers(c);
|
||||
}
|
||||
|
||||
for (final Trigger trigger : c.getTriggers()) {
|
||||
trigger.setHostCard(copied);
|
||||
}
|
||||
|
||||
if (suppress) {
|
||||
AllZone.getTriggerHandler().suppressMode(TriggerType.ChangesZone);
|
||||
}
|
||||
@@ -224,17 +219,14 @@ public class GameAction {
|
||||
// remove all counters from the card if destination is not the
|
||||
// battlefield
|
||||
// UNLESS we're dealing with Skullbriar, the Walking Grave
|
||||
if (!zoneTo.is(ZoneType.Battlefield)) {
|
||||
if (zoneFrom.is(ZoneType.Battlefield)) {
|
||||
copied.setSuspendCast(false);
|
||||
// remove all counters from the card if destination is not the battlefield
|
||||
// UNLESS we're dealing with Skullbriar, the Walking Grave
|
||||
if (!(c.getName().equals("Skullbriar, the Walking Grave") && !zoneTo.is(ZoneType.Hand) && !zoneTo
|
||||
.is(ZoneType.Library))) {
|
||||
if (zoneTo.is(ZoneType.Hand) || zoneTo.is(ZoneType.Library) || !c.getName().equals("Skullbriar, the Walking Grave")) {
|
||||
copied.clearCounters();
|
||||
}
|
||||
AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
|
||||
copied.setState(CardCharactersticName.Original);
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
|
||||
// Soulbond unpairing
|
||||
if (c.isPaired()) {
|
||||
c.getPairedWith().setPairedWith(null);
|
||||
@@ -276,15 +268,15 @@ public class GameAction {
|
||||
if (copied.isEnchanting()) {
|
||||
copied.unEnchantEntity(copied.getEnchanting());
|
||||
}
|
||||
}
|
||||
|
||||
copied.setTimestamp(AllZone.getNextTimestamp());
|
||||
for (String s : copied.getKeyword()) {
|
||||
if (s.startsWith("May be played") || s.startsWith("You may look at this card.")
|
||||
|| s.startsWith("May be played by your opponent")
|
||||
|| s.startsWith("Your opponent may look at this card.")) {
|
||||
copied.removeAllExtrinsicKeyword(s);
|
||||
copied.removeHiddenExtrinsicKeyword(s);
|
||||
} else if (zoneTo.is(ZoneType.Battlefield)) {
|
||||
copied.setTimestamp(AllZone.getNextTimestamp());
|
||||
for (String s : copied.getKeyword()) {
|
||||
if (s.startsWith("May be played") || s.startsWith("You may look at this card.")
|
||||
|| s.startsWith("May be played by your opponent")
|
||||
|| s.startsWith("Your opponent may look at this card.")) {
|
||||
copied.removeAllExtrinsicKeyword(s);
|
||||
copied.removeHiddenExtrinsicKeyword(s);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -639,9 +631,7 @@ public class GameAction {
|
||||
}
|
||||
|
||||
if (c.isInAlternateState()) {
|
||||
AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
|
||||
c.setState(CardCharactersticName.Original);
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
|
||||
}
|
||||
|
||||
if ((libPosition == -1) || (libPosition > library.size())) {
|
||||
|
||||
@@ -477,20 +477,20 @@ public final class AbilityFactoryClone {
|
||||
if (!copyingSelf) {
|
||||
if (tgtCard.isCloned()) { // cloning again
|
||||
tgtCard.switchStates(CardCharactersticName.Cloner, CardCharactersticName.Original);
|
||||
tgtCard.setState(CardCharactersticName.Original);
|
||||
tgtCard.changeToState(CardCharactersticName.Original);
|
||||
tgtCard.clearStates(CardCharactersticName.Cloner);
|
||||
}
|
||||
// add "Cloner" state to clone
|
||||
tgtCard.addAlternateState(CardCharactersticName.Cloner);
|
||||
tgtCard.switchStates(CardCharactersticName.Original, CardCharactersticName.Cloner);
|
||||
tgtCard.setState(CardCharactersticName.Original);
|
||||
tgtCard.changeToState(CardCharactersticName.Original);
|
||||
}
|
||||
else {
|
||||
//copy Original state to Cloned
|
||||
tgtCard.addAlternateState(CardCharactersticName.Cloned);
|
||||
tgtCard.switchStates(CardCharactersticName.Original, CardCharactersticName.Cloned);
|
||||
if (tgtCard.isFlipCard()) {
|
||||
tgtCard.setState(CardCharactersticName.Original);
|
||||
tgtCard.changeToState(CardCharactersticName.Original);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -521,7 +521,7 @@ public final class AbilityFactoryClone {
|
||||
if (cardToCopy.isFlipCard()) {
|
||||
if (!copyingSelf) {
|
||||
tgtCard.addAlternateState(CardCharactersticName.Flipped);
|
||||
tgtCard.setState(CardCharactersticName.Flipped);
|
||||
tgtCard.changeToState(CardCharactersticName.Flipped);
|
||||
}
|
||||
CardFactoryUtil.copyState(cardToCopy, CardCharactersticName.Flipped, tgtCard);
|
||||
addExtraCharacteristics(tgtCard, params, origSVars);
|
||||
@@ -537,7 +537,7 @@ public final class AbilityFactoryClone {
|
||||
tgtCard.setImageFilename(imageFileName);
|
||||
|
||||
if (!tgtCard.isFlipped()) {
|
||||
tgtCard.setState(CardCharactersticName.Original);
|
||||
tgtCard.changeToState(CardCharactersticName.Original);
|
||||
}
|
||||
} else {
|
||||
tgtCard.setFlipCard(false);
|
||||
|
||||
@@ -397,7 +397,7 @@ public final class AbilityFactoryCopy {
|
||||
if (c.isInAlternateState()) {
|
||||
stateName = c.getCurState();
|
||||
wasInAlt = true;
|
||||
c.setState(CardCharactersticName.Original);
|
||||
c.changeToState(CardCharactersticName.Original);
|
||||
}
|
||||
|
||||
// start copied Kiki code
|
||||
@@ -445,22 +445,22 @@ public final class AbilityFactoryCopy {
|
||||
|
||||
if (c.isDoubleFaced()) { // Cloned DFC's can't transform
|
||||
if (wasInAlt) {
|
||||
copy.setState(CardCharactersticName.Transformed);
|
||||
copy.changeToState(CardCharactersticName.Transformed);
|
||||
}
|
||||
}
|
||||
if (c.isFlipCard()) { // Cloned Flips CAN flip.
|
||||
copy.setState(CardCharactersticName.Original);
|
||||
c.setState(CardCharactersticName.Original);
|
||||
copy.changeToState(CardCharactersticName.Original);
|
||||
c.changeToState(CardCharactersticName.Original);
|
||||
copy.setImageFilename(c.getImageFilename());
|
||||
if (!c.isInAlternateState()) {
|
||||
copy.setState(CardCharactersticName.Flipped);
|
||||
copy.changeToState(CardCharactersticName.Flipped);
|
||||
}
|
||||
|
||||
c.setState(CardCharactersticName.Flipped);
|
||||
c.changeToState(CardCharactersticName.Flipped);
|
||||
}
|
||||
|
||||
if (c.isFaceDown()) {
|
||||
c.setState(CardCharactersticName.FaceDown);
|
||||
c.changeToState(CardCharactersticName.FaceDown);
|
||||
}
|
||||
copy = Singletons.getModel().getGameAction().moveToPlay(copy);
|
||||
|
||||
@@ -470,7 +470,7 @@ public final class AbilityFactoryCopy {
|
||||
}
|
||||
|
||||
if (wasInAlt) {
|
||||
c.setState(stateName);
|
||||
c.changeToState(stateName);
|
||||
}
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
|
||||
|
||||
|
||||
@@ -269,13 +269,13 @@ public class AbilityFactorySetState {
|
||||
}
|
||||
if (tgt.isDoubleFaced()) {
|
||||
if (tgt.getCurState() == CardCharactersticName.Original) {
|
||||
if (tgt.setState(CardCharactersticName.Transformed)) {
|
||||
if (tgt.changeToState(CardCharactersticName.Transformed)) {
|
||||
if (remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
} else if (tgt.getCurState() == CardCharactersticName.Transformed) {
|
||||
if (tgt.setState(CardCharactersticName.Original)) {
|
||||
if (tgt.changeToState(CardCharactersticName.Original)) {
|
||||
if (remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
@@ -286,7 +286,7 @@ public class AbilityFactorySetState {
|
||||
} else if (mode.equals("Flip")) {
|
||||
if (tgt.isFlipCard()) {
|
||||
if (tgt.getCurState() == CardCharactersticName.Original) {
|
||||
if (tgt.setState(CardCharactersticName.Flipped)) {
|
||||
if (tgt.changeToState(CardCharactersticName.Flipped)) {
|
||||
abilityFactory.getHostCard().setFlipStaus(true);
|
||||
if (remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
@@ -294,7 +294,7 @@ public class AbilityFactorySetState {
|
||||
}
|
||||
|
||||
} else if (tgt.getCurState() == CardCharactersticName.Flipped) {
|
||||
if (tgt.setState(CardCharactersticName.Original)) {
|
||||
if (tgt.changeToState(CardCharactersticName.Original)) {
|
||||
abilityFactory.getHostCard().setFlipStaus(false);
|
||||
if (remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
@@ -314,7 +314,7 @@ public class AbilityFactorySetState {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
tgt.setState(CardCharactersticName.smartValueOf(abilityFactory.getMapParams().get("NewState")));
|
||||
tgt.changeToState(CardCharactersticName.smartValueOf(abilityFactory.getMapParams().get("NewState")));
|
||||
}
|
||||
|
||||
}
|
||||
@@ -491,14 +491,14 @@ public class AbilityFactorySetState {
|
||||
}
|
||||
if (list.get(i).isDoubleFaced()) {
|
||||
if (list.get(i).getCurState() == CardCharactersticName.Original) {
|
||||
if (list.get(i).setState(CardCharactersticName.Transformed) && remChanged) {
|
||||
if (list.get(i).changeToState(CardCharactersticName.Transformed) && remChanged) {
|
||||
if (remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(list.get(i));
|
||||
}
|
||||
|
||||
}
|
||||
} else if (list.get(i).getCurState() == CardCharactersticName.Transformed) {
|
||||
if (list.get(i).setState(CardCharactersticName.Original)) {
|
||||
if (list.get(i).changeToState(CardCharactersticName.Original)) {
|
||||
if (remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(list.get(i));
|
||||
}
|
||||
@@ -509,14 +509,14 @@ public class AbilityFactorySetState {
|
||||
} else if (mode.equals("Flip")) {
|
||||
if (list.get(i).isFlipCard()) {
|
||||
if (list.get(i).getCurState() == CardCharactersticName.Original) {
|
||||
if (list.get(i).setState(CardCharactersticName.Flipped)) {
|
||||
if (list.get(i).changeToState(CardCharactersticName.Flipped)) {
|
||||
list.get(i).setFlipStaus(true);
|
||||
if (remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
}
|
||||
}
|
||||
} else if (list.get(i).getCurState() == CardCharactersticName.Flipped) {
|
||||
if (list.get(i).setState(CardCharactersticName.Original)) {
|
||||
if (list.get(i).changeToState(CardCharactersticName.Original)) {
|
||||
list.get(i).setFlipStaus(false);
|
||||
if (remChanged) {
|
||||
abilityFactory.getHostCard().addRemembered(tgt);
|
||||
@@ -536,7 +536,7 @@ public class AbilityFactorySetState {
|
||||
}
|
||||
}
|
||||
} else {
|
||||
list.get(i).setState(CardCharactersticName.smartValueOf(abilityFactory.getMapParams().get("NewState")));
|
||||
list.get(i).changeToState(CardCharactersticName.smartValueOf(abilityFactory.getMapParams().get("NewState")));
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -35,7 +35,6 @@ import forge.Singletons;
|
||||
import forge.card.spellability.SpellAbility;
|
||||
import forge.card.spellability.SpellPermanent;
|
||||
import forge.card.spellability.Target;
|
||||
import forge.card.trigger.TriggerType;
|
||||
import forge.game.player.ComputerUtil;
|
||||
import forge.game.player.Player;
|
||||
import forge.properties.ForgeProps;
|
||||
@@ -153,7 +152,6 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
@Override
|
||||
public final Card copyCard(final Card in) {
|
||||
final CardCharactersticName curState = in.getCurState();
|
||||
AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
|
||||
if (in.isInAlternateState()) {
|
||||
in.setState(CardCharactersticName.Original);
|
||||
}
|
||||
@@ -174,7 +172,6 @@ public abstract class AbstractCardFactory implements CardFactoryInterface {
|
||||
in.setState(curState);
|
||||
out.setState(curState);
|
||||
}
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
|
||||
|
||||
// I'm not sure if we really should be copying enchant/equip stuff over.
|
||||
out.setEquipping(in.getEquipping());
|
||||
|
||||
@@ -3914,7 +3914,6 @@ public class CardFactoryUtil {
|
||||
c.setDoubleFaced(sim.isDoubleFaced());
|
||||
c.setCurSetCode(sim.getCurSetCode());
|
||||
|
||||
AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
|
||||
final CardCharactersticName origState = sim.getCurState();
|
||||
for (final CardCharactersticName state : sim.getStates()) {
|
||||
c.addAlternateState(state);
|
||||
@@ -3926,7 +3925,6 @@ public class CardFactoryUtil {
|
||||
sim.setState(origState);
|
||||
c.setState(origState);
|
||||
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
|
||||
return c;
|
||||
} // copyStats()
|
||||
|
||||
|
||||
@@ -16,7 +16,6 @@ import forge.CardUtil;
|
||||
import forge.Constant;
|
||||
import forge.GameAction;
|
||||
import forge.Singletons;
|
||||
import forge.card.trigger.TriggerType;
|
||||
import forge.control.FControl;
|
||||
import forge.control.input.InputMulligan;
|
||||
import forge.deck.Deck;
|
||||
@@ -128,7 +127,6 @@ public class GameNew {
|
||||
final ArrayList<String> hAnteRemoved = new ArrayList<String>();
|
||||
final ArrayList<String> cAnteRemoved = new ArrayList<String>();
|
||||
|
||||
AllZone.getTriggerHandler().suppressMode(TriggerType.Transformed);
|
||||
for (final Entry<CardPrinted, Integer> stackOfCards : humanDeck.getMain()) {
|
||||
final CardPrinted cardPrinted = stackOfCards.getKey();
|
||||
for (int i = 0; i < stackOfCards.getValue(); i++) {
|
||||
@@ -141,8 +139,8 @@ public class GameNew {
|
||||
card.setFoil(iFoil);
|
||||
}
|
||||
|
||||
if (card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")
|
||||
&& !Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
|
||||
if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)
|
||||
&& card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")) {
|
||||
hAnteRemoved.add(card.getName());
|
||||
} else {
|
||||
AllZone.getHumanPlayer().getZone(ZoneType.Library).add(card);
|
||||
@@ -167,8 +165,8 @@ public class GameNew {
|
||||
card.setFoil(iFoil);
|
||||
}
|
||||
|
||||
if (card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")
|
||||
&& !Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)) {
|
||||
if (!Singletons.getModel().getPreferences().getPrefBoolean(FPref.UI_ANTE)
|
||||
&& card.hasKeyword("Remove CARDNAME from your deck before playing if you're not playing for ante.")) {
|
||||
cAnteRemoved.add(card.getName());
|
||||
} else {
|
||||
AllZone.getComputerPlayer().getZone(ZoneType.Library).add(card);
|
||||
@@ -182,7 +180,7 @@ public class GameNew {
|
||||
|
||||
}
|
||||
}
|
||||
AllZone.getTriggerHandler().clearSuppression(TriggerType.Transformed);
|
||||
|
||||
if (rAICards.size() > 0) {
|
||||
final StringBuilder sb = new StringBuilder(
|
||||
"AI deck contains the following cards that it can't play or may be buggy:\n");
|
||||
|
||||
Reference in New Issue
Block a user