- Cleanup of Card class.

This commit is contained in:
Sloth
2013-06-19 12:34:05 +00:00
parent 9525581631
commit 85c1fc457c
3 changed files with 6 additions and 63 deletions

View File

@@ -492,14 +492,6 @@ public class Card extends GameEntity implements Comparable<Card> {
return Card.storableSVars; return Card.storableSVars;
} }
// hacky code below, used to limit the number of times an ability
// can be used per turn like Vampire Bats
// should be put in SpellAbility, but it is put here for convenience
// this is make public just to make things easy
// this code presumes that each card only has one ability that can be
// used a limited number of times per turn
// CardFactory.SSP_canPlay(Card) uses these variables
/** /**
* *
* Resets the unique number for this Card to 1. * Resets the unique number for this Card to 1.
@@ -951,22 +943,6 @@ public class Card extends GameEntity implements Comparable<Card> {
this.blockedByThisTurn = null; this.blockedByThisTurn = null;
} }
/**
* <p>
* canAnyPlayerActivate.
* </p>
*
* @return a boolean.
*/
public final boolean canAnyPlayerActivate() {
for (final SpellAbility s : this.getCharacteristics().getSpellAbility()) {
if (s.getRestrictions().isAnyPlayer()) {
return true;
}
}
return false;
}
/** /**
* a Card that this Card must block if able in an upcoming combat. This is * a Card that this Card must block if able in an upcoming combat. This is
* cleared at the end of each turn. * cleared at the end of each turn.
@@ -1071,17 +1047,6 @@ public class Card extends GameEntity implements Comparable<Card> {
this.cloneOrigin = name; this.cloneOrigin = name;
} }
/**
* <p>
* Getter for the field <code>sacrificeAtEOT</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getSacrificeAtEOT() {
return this.hasKeyword("At the beginning of the end step, sacrifice CARDNAME.");
}
/** /**
* <p> * <p>
* hasFirstStrike. * hasFirstStrike.
@@ -1286,9 +1251,6 @@ public class Card extends GameEntity implements Comparable<Card> {
return !this.counters.isEmpty(); return !this.counters.isEmpty();
} }
// get all counters from a card
/** /**
* <p> * <p>
* Setter for the field <code>counters</code>. * Setter for the field <code>counters</code>.
@@ -1302,7 +1264,6 @@ public class Card extends GameEntity implements Comparable<Card> {
this.counters = allCounters; this.counters = allCounters;
} }
// get all counters from a card
/** /**
* <p> * <p>
* clearCounters. * clearCounters.
@@ -4723,7 +4684,6 @@ public class Card extends GameEntity implements Comparable<Card> {
public final void setUniqueNumber(final int n) { public final void setUniqueNumber(final int n) {
//System.out.println("Card _ " + n); //System.out.println("Card _ " + n);
this.uniqueNumber = n; this.uniqueNumber = n;
//this.updateObservers();
} }
/** /**
@@ -6168,13 +6128,13 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} else if (property.equals("wasDealtDamageByEquipeeThisTurn")) { } else if (property.equals("wasDealtDamageByEquipeeThisTurn")) {
Card equipee = source.getEquippingCard(); Card equipee = source.getEquippingCard();
if (this.getReceivedDamageFromThisTurn().keySet().isEmpty() if (equipee == null || this.getReceivedDamageFromThisTurn().keySet().isEmpty()
|| !this.getReceivedDamageFromThisTurn().keySet().contains(equipee)) { || !this.getReceivedDamageFromThisTurn().keySet().contains(equipee)) {
return false; return false;
} }
} else if (property.equals("wasDealtDamageByEnchantedThisTurn")) { } else if (property.equals("wasDealtDamageByEnchantedThisTurn")) {
Card enchanted = source.getEnchantingCard(); Card enchanted = source.getEnchantingCard();
if (this.getReceivedDamageFromThisTurn().keySet().isEmpty() if (enchanted == null || this.getReceivedDamageFromThisTurn().keySet().isEmpty()
|| !this.getReceivedDamageFromThisTurn().keySet().contains(enchanted)) { || !this.getReceivedDamageFromThisTurn().keySet().contains(enchanted)) {
return false; return false;
} }
@@ -7025,8 +6985,7 @@ public class Card extends GameEntity implements Comparable<Card> {
this.dealtDamageToPlayerThisTurn.clear(); this.dealtDamageToPlayerThisTurn.clear();
} }
// this is the minimal damage a trampling creature has to assign to a // this is the minimal damage a trampling creature has to assign to a blocker
// blocker
/** /**
* <p> * <p>
* getLethalDamage. * getLethalDamage.
@@ -7086,17 +7045,6 @@ public class Card extends GameEntity implements Comparable<Card> {
} else { } else {
this.assignedDamageMap.put(sourceCard, this.assignedDamageMap.get(sourceCard) + assignedDamage); this.assignedDamageMap.put(sourceCard, this.assignedDamageMap.get(sourceCard) + assignedDamage);
} }
Log.debug("***");
/*
* if(sourceCards.size() > 1)
* System.out.println("(MULTIPLE blockers):");
* System.out.println("Assigned " + damage + " damage to " + card); for
* (int i=0;i<sourceCards.size();i++){
* System.out.println(sourceCards.get(i).getName() +
* " assigned damage to " + card.getName()); }
* System.out.println("***");
*/
} }
/** /**
@@ -7166,7 +7114,7 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} }
// This should be also usable by the AI to forecast an effect (so it must not change the game state) // This is used by the AI to forecast an effect (so it must not change the game state)
/** /**
* <p> * <p>
* staticDamagePrevention. * staticDamagePrevention.
@@ -7392,7 +7340,7 @@ public class Card extends GameEntity implements Comparable<Card> {
return restDamage; return restDamage;
} }
// This should be also usable by the AI to forecast an effect (so it must not change the game state) // This is used by the AI to forecast an effect (so it must not change the game state)
/** /**
* <p> * <p>
* staticReplaceDamage. * staticReplaceDamage.
@@ -7585,9 +7533,6 @@ public class Card extends GameEntity implements Comparable<Card> {
} }
} }
boolean wither = (getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.alwaysWither) boolean wither = (getGame().getStaticEffects().getGlobalRuleChange(GlobalRuleChange.alwaysWither)
|| source.hasKeyword("Wither") || source.hasKeyword("Infect")); || source.hasKeyword("Wither") || source.hasKeyword("Infect"));

View File

@@ -1,6 +1,5 @@
package forge.card.ability.effects; package forge.card.ability.effects;
import java.util.ArrayList;
import java.util.List; import java.util.List;
import forge.Card; import forge.Card;

View File

@@ -522,8 +522,7 @@ public class AiAttackController {
break; break;
} }
} }
if (mustAttack || attacker.getSacrificeAtEOT() if (mustAttack || attacker.getController().getMustAttackEntity() != null
|| attacker.getController().getMustAttackEntity() != null
|| attacker.getSVar("MustAttack").equals("True")) { || attacker.getSVar("MustAttack").equals("True")) {
combat.addAttacker(attacker, defender); combat.addAttacker(attacker, defender);
attackersLeft.remove(attacker); attackersLeft.remove(attacker);