Fix a Card property and remove some unused card-related code.

This commit is contained in:
elcnesh
2014-07-30 06:49:44 +00:00
parent 600ea97726
commit ceb3de4bca
2 changed files with 15 additions and 5 deletions

View File

@@ -6418,7 +6418,7 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
} else if (property.startsWith("dealtDamageToOppThisTurn")) {
if (!this.getDamageHistory().getThisTurnDamaged().contains(sourceController.getOpponent())) {
if (!this.hasDealtDamageToOpponentThisTurn()) {
return false;
}
} else if (property.startsWith("controllerWasDealtCombatDamageByThisTurn")) {
@@ -7291,6 +7291,19 @@ public class Card extends GameEntity implements Comparable<Card> {
this.dealtDamageToPlayerThisTurn.clear();
}
/**
* @return {@code true} if and only if this dealt damage to an opponent this
* turn.
*/
public final boolean hasDealtDamageToOpponentThisTurn() {
for (final Player p : this.getDamageHistory().getThisTurnDamaged()) {
if (this.getController().isOpponentOf(p)) {
return true;
}
}
return false;
}
// this is the minimal damage a trampling creature has to assign to a blocker
/**
* <p>

View File

@@ -994,7 +994,6 @@ public class CardFactoryUtil {
if (sq[0].equals("YouDrewThisTurn")) return doXMath(c.getController().getNumDrawnThisTurn(), m, c);
if (sq[0].equals("OppDrewThisTurn")) return doXMath(c.getController().getOpponent().getNumDrawnThisTurn(), m, c);
if (sq[0].equals("FirstSpellTotalManaSpent")) return doXMath(c.getFirstSpellAbility().getTotalManaSpent(), m, c);
if (sq[0].equals("StormCount")) return doXMath(game.getStack().getCardsCastThisTurn().size() - 1, m, c);
@@ -1006,8 +1005,6 @@ public class CardFactoryUtil {
if (sq[0].startsWith("Triggered")) return doXMath(xCount((Card) c.getTriggeringObject("Card"), sq[0].substring(9)), m, c);
if (sq[0].contains("YourStartingLife")) return doXMath(cc.getStartingLife(), m, c);
//if (sq[0].contains("OppStartingLife")) return doXMath(oppController.getStartingLife(), m, c); // found no cards using it
if (sq[0].contains("YourLifeTotal")) return doXMath(cc.getLife(), m, c);
if (sq[0].contains("OppGreatestLifeTotal")) return doXMath(cc.getOpponentsGreatestLifeTotal(), m, c);