diff --git a/.gitattributes b/.gitattributes index a33a27133ee..34e5d76f385 100644 --- a/.gitattributes +++ b/.gitattributes @@ -11294,6 +11294,7 @@ src/main/java/forge/ButtonUtil.java svneol=native#text/plain src/main/java/forge/Card.java svneol=native#text/plain src/main/java/forge/CardColor.java svneol=native#text/plain src/main/java/forge/CardContainer.java svneol=native#text/plain +src/main/java/forge/CardDamageHistory.java -text src/main/java/forge/CardFilter.java svneol=native#text/plain src/main/java/forge/CardKeywords.java -text svneol=native#text/plain src/main/java/forge/CardList.java svneol=native#text/plain diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 4a0c0d076b7..a8fe57407e4 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -77,6 +77,7 @@ public class Card extends GameEntity implements Comparable { private Zone castFrom = null; + private final CardDamageHistory damageHistory = new CardDamageHistory(); /** * Instantiates a new card. */ @@ -376,20 +377,7 @@ public class Card extends GameEntity implements Comparable { private boolean copiedSpell = false; private boolean spellWithChoices = false; private boolean spellCopyingCard = false; - private boolean creatureAttackedThisTurn = false; - private boolean creatureAttackedLastHumanTurn = false; - private boolean creatureAttackedLastComputerTurn = false; - private boolean creatureAttackedThisCombat = false; - private boolean creatureBlockedThisCombat = false; - private boolean creatureBlockedThisTurn = false; - private boolean creatureGotBlockedThisCombat = false; - private boolean creatureGotBlockedThisTurn = false; - private boolean dealtDmgToHumanThisTurn = false; - private boolean dealtDmgToComputerThisTurn = false; - private boolean dealtDmgToHumanThisGame = false; - private boolean dealtDmgToComputerThisGame = false; - private boolean dealtCombatDmgToHumanThisTurn = false; - private boolean dealtCombatDmgToComputerThisTurn = false; + private boolean sirenAttackOrDestroy = false; private final ArrayList mustBlockCards = new ArrayList(); @@ -881,202 +869,6 @@ public class Card extends GameEntity implements Comparable { return this.xLifePaid; } - // used to see if an attacking creature with a triggering attack ability - // triggered this phase: - /** - *

- * Setter for the field creatureAttackedThisCombat. - *

- * - * @param b - * a boolean. - */ - public final void setCreatureAttackedThisCombat(final boolean b) { - this.creatureAttackedThisCombat = b; - if (b) { - this.setCreatureAttackedThisTurn(true); - this.getController().setAttackedWithCreatureThisTurn(true); - } - } - - /** - *

- * Getter for the field creatureAttackedThisCombat. - *

- * - * @return a boolean. - */ - public final boolean getCreatureAttackedThisCombat() { - return this.creatureAttackedThisCombat; - } - - /** - *

- * Setter for the field creatureAttackedThisTurn. - *

- * - * @param b - * a boolean. - */ - public final void setCreatureAttackedThisTurn(final boolean b) { - this.creatureAttackedThisTurn = b; - } - - /** - *

- * Getter for the field creatureAttackedThisTurn. - *

- * - * @return a boolean. - */ - public final boolean getCreatureAttackedThisTurn() { - return this.creatureAttackedThisTurn; - } - - /** - *

- * Setter for the field creatureAttackedLastTurn. - *

- * - * @param b - * a boolean. - */ - public final void setCreatureAttackedLastHumanTurn(final boolean b) { - this.creatureAttackedLastHumanTurn = b; - } - - /** - *

- * Getter for the field creatureAttackedLastTurn. - *

- * - * @return a boolean. - */ - public final boolean getCreatureAttackedLastHumanTurn() { - return this.creatureAttackedLastHumanTurn; - } - - /** - *

- * Setter for the field creatureAttackedLastTurn. - *

- * - * @param b - * a boolean. - */ - public final void setCreatureAttackedLastComputerTurn(final boolean b) { - this.creatureAttackedLastComputerTurn = b; - } - - /** - *

- * Getter for the field creatureAttackedLastTurn. - *

- * - * @return a boolean. - */ - public final boolean getCreatureAttackedLastComputerTurn() { - return this.creatureAttackedLastComputerTurn; - } - - /** - *

- * Setter for the field creatureBlockedThisCombat. - *

- * - * @param b - * a boolean. - */ - public final void setCreatureBlockedThisCombat(final boolean b) { - this.creatureBlockedThisCombat = b; - if (b) { - this.setCreatureBlockedThisTurn(true); - } - } - - /** - *

- * Getter for the field creatureBlockedThisCombat. - *

- * - * @return a boolean. - */ - public final boolean getCreatureBlockedThisCombat() { - return this.creatureBlockedThisCombat; - } - - /** - *

- * Setter for the field creatureBlockedThisTurn. - *

- * - * @param b - * a boolean. - */ - public final void setCreatureBlockedThisTurn(final boolean b) { - this.creatureBlockedThisTurn = b; - } - - /** - *

- * Getter for the field creatureBlockedThisTurn. - *

- * - * @return a boolean. - */ - public final boolean getCreatureBlockedThisTurn() { - return this.creatureBlockedThisTurn; - } - - /** - *

- * Setter for the field creatureGotBlockedThisCombat. - *

- * - * @param b - * a boolean. - */ - public final void setCreatureGotBlockedThisCombat(final boolean b) { - this.creatureGotBlockedThisCombat = b; - if (b) { - this.setCreatureGotBlockedThisTurn(true); - } - } - - /** - *

- * Getter for the field creatureGotBlockedThisCombat. - *

- * - * @return a boolean. - */ - public final boolean getCreatureGotBlockedThisCombat() { - return this.creatureGotBlockedThisCombat; - } - - /** - *

- * Setter for the field creatureGotBlockedThisTurn. - *

- * - * @param b - * a boolean. - */ - public final void setCreatureGotBlockedThisTurn(final boolean b) { - this.creatureGotBlockedThisTurn = b; - } - - /** - *

- * Getter for the field creatureGotBlockedThisTurn. - *

- * - * @return a boolean. - */ - public final boolean getCreatureGotBlockedThisTurn() { - return this.creatureGotBlockedThisTurn; - } - /** * @return the blockedThisTurn */ @@ -1139,150 +931,6 @@ public class Card extends GameEntity implements Comparable { return false; } - /** - *

- * Setter for the field dealtDmgToHumanThisTurn. - *

- * - * @param b - * a boolean. - */ - public final void setDealtDmgToHumanThisTurn(final boolean b) { - this.dealtDmgToHumanThisTurn = b; - if (b) { - this.setDealtDmgToHumanThisGame(true); - } - } - - /** - *

- * Getter for the field dealtDmgToHumanThisTurn. - *

- * - * @return a boolean. - */ - public final boolean getDealtDmgToHumanThisTurn() { - return this.dealtDmgToHumanThisTurn; - } - - /** - *

- * Setter for the field dealtDmgToComputerThisTurn. - *

- * - * @param b - * a boolean. - */ - public final void setDealtDmgToComputerThisTurn(final boolean b) { - this.dealtDmgToComputerThisTurn = b; - if (b) { - this.setDealtDmgToComputerThisGame(true); - } - } - - /** - *

- * Getter for the field dealtCombatDmgToComputerThisGame. - *

- * - * @return a boolean. - */ - public final boolean getDealtDmgToComputerThisTurn() { - return this.dealtDmgToComputerThisTurn; - } - - /** - *

- * Setter for the field dealtDmgToHumanThisGame. - *

- * - * @param b - * a boolean. - */ - public final void setDealtDmgToHumanThisGame(final boolean b) { - this.dealtDmgToHumanThisGame = b; - } - - /** - *

- * Getter for the field dealtDmgToHumanThisGame. - *

- * - * @return a boolean. - */ - public final boolean getDealtDmgToHumanThisGame() { - return this.dealtDmgToHumanThisGame; - } - - /** - *

- * Setter for the field dealtDmgToComputerThisGame. - *

- * - * @param b - * a boolean. - */ - public final void setDealtDmgToComputerThisGame(final boolean b) { - this.dealtDmgToComputerThisGame = b; - } - - /** - *

- * Getter for the field dealtCombatDmgToComputerThisGame. - *

- * - * @return a boolean. - */ - public final boolean getDealtDmgToComputerThisGame() { - return this.dealtDmgToComputerThisGame; - } - - /** - *

- * Setter for the field dealtCombatDmgToHumanThisTurn. - *

- * - * @param b - * a boolean. - */ - public final void setDealtCombatDmgToHumanThisTurn(final boolean b) { - this.dealtCombatDmgToHumanThisTurn = b; - } - - /** - *

- * Getter for the field dealtDmgToHumanThisTurn. - *

- * - * @return a boolean. - */ - public final boolean getDealtCombatDmgToHumanThisTurn() { - return this.dealtCombatDmgToHumanThisTurn; - } - - /** - *

- * Setter for the field dealtCombatDmgToComputerThisTurn. - *

- * - * @param b - * a boolean. - */ - public final void setDealtCombatDmgToComputerThisTurn(final boolean b) { - this.dealtCombatDmgToComputerThisTurn = b; - } - - /** - *

- * Getter for the field dealtDmgToComputerThisTurn. - *

- * - * @return a boolean. - */ - public final boolean getDealtCombatDmgToComputerThisTurn() { - return this.dealtCombatDmgToComputerThisTurn; - } - /** *

* Setter for the field sirenAttackOrDestroy. @@ -7088,19 +6736,19 @@ public class Card extends GameEntity implements Comparable { return false; } } else if (property.startsWith("dealtDamageToYouThisTurn")) { - if (!(this.dealtDmgToHumanThisTurn && sourceController.isHuman()) - && !(this.dealtDmgToComputerThisTurn && sourceController.isComputer())) { + if (!(this.getDamageHistory().getDealtDmgToHumanThisTurn() && sourceController.isHuman()) + && !(this.getDamageHistory().getDealtDmgToComputerThisTurn() && sourceController.isComputer())) { return false; } } else if (property.startsWith("controllerWasDealtCombatDamageByThisTurn")) { - if (!(source.dealtCombatDmgToHumanThisTurn && this.getController().isPlayer(AllZone.getHumanPlayer())) - && !(source.dealtCombatDmgToComputerThisTurn && this.getController().isPlayer( + if (!(source.getDamageHistory().getDealtCombatDmgToHumanThisTurn() && this.getController().isPlayer(AllZone.getHumanPlayer())) + && !(source.getDamageHistory().getDealtCombatDmgToComputerThisTurn() && this.getController().isPlayer( AllZone.getComputerPlayer()))) { return false; } } else if (property.startsWith("controllerWasDealtDamageByThisTurn")) { - if (!(source.dealtDmgToHumanThisTurn && this.getController().isPlayer(AllZone.getHumanPlayer())) - && !(source.dealtDmgToComputerThisTurn && this.getController() + if (!(source.getDamageHistory().getDealtDmgToHumanThisTurn() && this.getController().isPlayer(AllZone.getHumanPlayer())) + && !(source.getDamageHistory().getDealtDmgToComputerThisTurn() && this.getController() .isPlayer(AllZone.getComputerPlayer()))) { return false; } @@ -7118,37 +6766,37 @@ public class Card extends GameEntity implements Comparable { return false; } } else if (property.startsWith("attackedThisTurn")) { - if (!this.getCreatureAttackedThisTurn()) { + if (!this.getDamageHistory().getCreatureAttackedThisTurn()) { return false; } } else if (property.startsWith("attackedLastTurn")) { - if (this.getController().isComputer() && !this.getCreatureAttackedLastComputerTurn()) { + if (this.getController().isComputer() && !this.getDamageHistory().getCreatureAttackedLastComputerTurn()) { return false; } - if (this.getController().isHuman() && !this.getCreatureAttackedLastHumanTurn()) { + if (this.getController().isHuman() && !this.getDamageHistory().getCreatureAttackedLastHumanTurn()) { return false; } } else if (property.startsWith("blockedThisTurn")) { - if (!this.getCreatureBlockedThisTurn()) { + if (!this.getDamageHistory().getCreatureBlockedThisTurn()) { return false; } } else if (property.startsWith("gotBlockedThisTurn")) { - if (!this.getCreatureGotBlockedThisTurn()) { + if (!this.getDamageHistory().getCreatureGotBlockedThisTurn()) { return false; } } else if (property.startsWith("notAttackedThisTurn")) { - if (this.getCreatureAttackedThisTurn()) { + if (this.getDamageHistory().getCreatureAttackedThisTurn()) { return false; } } else if (property.startsWith("notAttackedLastTurn")) { - if (this.getController().isComputer() && this.getCreatureAttackedLastComputerTurn()) { + if (this.getController().isComputer() && this.getDamageHistory().getCreatureAttackedLastComputerTurn()) { return false; } - if (this.getController().isHuman() && this.getCreatureAttackedLastHumanTurn()) { + if (this.getController().isHuman() && this.getDamageHistory().getCreatureAttackedLastHumanTurn()) { return false; } } else if (property.startsWith("notBlockedThisTurn")) { - if (this.getCreatureBlockedThisTurn()) { + if (this.getDamageHistory().getCreatureBlockedThisTurn()) { return false; } } else if (property.startsWith("greatestPower")) { @@ -9044,4 +8692,8 @@ public class Card extends GameEntity implements Comparable { this.castFrom = castFrom0; } + public CardDamageHistory getDamageHistory() { + return damageHistory; + } + } // end Card class diff --git a/src/main/java/forge/CardDamageHistory.java b/src/main/java/forge/CardDamageHistory.java new file mode 100644 index 00000000000..60da9ac7cda --- /dev/null +++ b/src/main/java/forge/CardDamageHistory.java @@ -0,0 +1,336 @@ +package forge; + +/** + * TODO: Write javadoc for this type. + * + */ +public class CardDamageHistory { + + private boolean creatureAttackedThisTurn = false; + private boolean creatureAttackedLastHumanTurn = false; + private boolean creatureAttackedLastComputerTurn = false; + private boolean creatureAttackedThisCombat = false; + private boolean creatureBlockedThisCombat = false; + private boolean creatureBlockedThisTurn = false; + private boolean creatureGotBlockedThisCombat = false; + private boolean creatureGotBlockedThisTurn = false; + private boolean dealtDmgToHumanThisTurn = false; + private boolean dealtDmgToComputerThisTurn = false; + private boolean dealtDmgToHumanThisGame = false; + private boolean dealtDmgToComputerThisGame = false; + private boolean dealtCombatDmgToHumanThisTurn = false; + private boolean dealtCombatDmgToComputerThisTurn = false; + // used to see if an attacking creature with a triggering attack ability + // triggered this phase: + /** + *

+ * Setter for the field creatureAttackedThisCombat. + *

+ * + * @param hasAttacked + * a boolean. + */ + public final void setCreatureAttackedThisCombat(final boolean hasAttacked, final Player controller) { + this.creatureAttackedThisCombat = hasAttacked; + if (hasAttacked) { + this.setCreatureAttackedThisTurn(true); + controller.setAttackedWithCreatureThisTurn(true); + } + } + /** + *

+ * Getter for the field creatureAttackedThisCombat. + *

+ * + * @return a boolean. + */ + public final boolean getCreatureAttackedThisCombat() { + return this.creatureAttackedThisCombat; + } + /** + *

+ * Setter for the field creatureAttackedThisTurn. + *

+ * + * @param b + * a boolean. + */ + public final void setCreatureAttackedThisTurn(final boolean b) { + this.creatureAttackedThisTurn = b; + } + /** + *

+ * Getter for the field creatureAttackedThisTurn. + *

+ * + * @return a boolean. + */ + public final boolean getCreatureAttackedThisTurn() { + return this.creatureAttackedThisTurn; + } + /** + *

+ * Setter for the field creatureAttackedLastTurn. + *

+ * + * @param b + * a boolean. + */ + public final void setCreatureAttackedLastHumanTurn(final boolean b) { + this.creatureAttackedLastHumanTurn = b; + } + /** + *

+ * Getter for the field creatureAttackedLastTurn. + *

+ * + * @return a boolean. + */ + public final boolean getCreatureAttackedLastHumanTurn() { + return this.creatureAttackedLastHumanTurn; + } + /** + *

+ * Setter for the field creatureAttackedLastTurn. + *

+ * + * @param b + * a boolean. + */ + public final void setCreatureAttackedLastComputerTurn(final boolean b) { + this.creatureAttackedLastComputerTurn = b; + } + /** + *

+ * Getter for the field creatureAttackedLastTurn. + *

+ * + * @return a boolean. + */ + public final boolean getCreatureAttackedLastComputerTurn() { + return this.creatureAttackedLastComputerTurn; + } + /** + *

+ * Setter for the field creatureBlockedThisCombat. + *

+ * + * @param b + * a boolean. + */ + public final void setCreatureBlockedThisCombat(final boolean b) { + this.creatureBlockedThisCombat = b; + if (b) { + this.setCreatureBlockedThisTurn(true); + } + } + /** + *

+ * Getter for the field creatureBlockedThisCombat. + *

+ * + * @return a boolean. + */ + public final boolean getCreatureBlockedThisCombat() { + return this.creatureBlockedThisCombat; + } + /** + *

+ * Setter for the field creatureBlockedThisTurn. + *

+ * + * @param b + * a boolean. + */ + public final void setCreatureBlockedThisTurn(final boolean b) { + this.creatureBlockedThisTurn = b; + } + /** + *

+ * Getter for the field creatureBlockedThisTurn. + *

+ * + * @return a boolean. + */ + public final boolean getCreatureBlockedThisTurn() { + return this.creatureBlockedThisTurn; + } + /** + *

+ * Setter for the field creatureGotBlockedThisCombat. + *

+ * + * @param b + * a boolean. + */ + public final void setCreatureGotBlockedThisCombat(final boolean b) { + this.creatureGotBlockedThisCombat = b; + if (b) { + this.setCreatureGotBlockedThisTurn(true); + } + } + /** + *

+ * Getter for the field creatureGotBlockedThisCombat. + *

+ * + * @return a boolean. + */ + public final boolean getCreatureGotBlockedThisCombat() { + return this.creatureGotBlockedThisCombat; + } + /** + *

+ * Setter for the field creatureGotBlockedThisTurn. + *

+ * + * @param b + * a boolean. + */ + public final void setCreatureGotBlockedThisTurn(final boolean b) { + this.creatureGotBlockedThisTurn = b; + } + /** + *

+ * Getter for the field creatureGotBlockedThisTurn. + *

+ * + * @return a boolean. + */ + public final boolean getCreatureGotBlockedThisTurn() { + return this.creatureGotBlockedThisTurn; + } + /** + *

+ * Setter for the field dealtDmgToHumanThisTurn. + *

+ * + * @param b + * a boolean. + */ + public final void setDealtDmgToHumanThisTurn(final boolean b) { + this.dealtDmgToHumanThisTurn = b; + if (b) { + this.setDealtDmgToHumanThisGame(true); + } + } + /** + *

+ * Getter for the field dealtDmgToHumanThisTurn. + *

+ * + * @return a boolean. + */ + public final boolean getDealtDmgToHumanThisTurn() { + return this.dealtDmgToHumanThisTurn; + } + /** + *

+ * Setter for the field dealtDmgToComputerThisTurn. + *

+ * + * @param b + * a boolean. + */ + public final void setDealtDmgToComputerThisTurn(final boolean b) { + this.dealtDmgToComputerThisTurn = b; + if (b) { + this.setDealtDmgToComputerThisGame(true); + } + } + /** + *

+ * Getter for the field dealtCombatDmgToComputerThisGame. + *

+ * + * @return a boolean. + */ + public final boolean getDealtDmgToComputerThisTurn() { + return this.dealtDmgToComputerThisTurn; + } + /** + *

+ * Setter for the field dealtDmgToHumanThisGame. + *

+ * + * @param b + * a boolean. + */ + public final void setDealtDmgToHumanThisGame(final boolean b) { + this.dealtDmgToHumanThisGame = b; + } + /** + *

+ * Getter for the field dealtDmgToHumanThisGame. + *

+ * + * @return a boolean. + */ + public final boolean getDealtDmgToHumanThisGame() { + return this.dealtDmgToHumanThisGame; + } + /** + *

+ * Setter for the field dealtDmgToComputerThisGame. + *

+ * + * @param b + * a boolean. + */ + public final void setDealtDmgToComputerThisGame(final boolean b) { + this.dealtDmgToComputerThisGame = b; + } + /** + *

+ * Getter for the field dealtCombatDmgToComputerThisGame. + *

+ * + * @return a boolean. + */ + public final boolean getDealtDmgToComputerThisGame() { + return this.dealtDmgToComputerThisGame; + } + /** + *

+ * Setter for the field dealtCombatDmgToHumanThisTurn. + *

+ * + * @param b + * a boolean. + */ + public final void setDealtCombatDmgToHumanThisTurn(final boolean b) { + this.dealtCombatDmgToHumanThisTurn = b; + } + /** + *

+ * Getter for the field dealtDmgToHumanThisTurn. + *

+ * + * @return a boolean. + */ + public final boolean getDealtCombatDmgToHumanThisTurn() { + return this.dealtCombatDmgToHumanThisTurn; + } + /** + *

+ * Setter for the field dealtCombatDmgToComputerThisTurn. + *

+ * + * @param b + * a boolean. + */ + public final void setDealtCombatDmgToComputerThisTurn(final boolean b) { + this.dealtCombatDmgToComputerThisTurn = b; + } + /** + *

+ * Getter for the field dealtDmgToComputerThisTurn. + *

+ * + * @return a boolean. + */ + public final boolean getDealtCombatDmgToComputerThisTurn() { + return this.dealtCombatDmgToComputerThisTurn; + } + +} diff --git a/src/main/java/forge/CardUtil.java b/src/main/java/forge/CardUtil.java index c64df94d348..f4b6e8019de 100644 --- a/src/main/java/forge/CardUtil.java +++ b/src/main/java/forge/CardUtil.java @@ -931,7 +931,7 @@ public final class CardUtil { res.setChangedCardTypes(c.getChangedCardTypes()); res.setNewPT(new ArrayList(c.getNewPT())); res.setReceivedDamageFromThisTurn(c.getReceivedDamageFromThisTurn()); - res.setCreatureGotBlockedThisTurn(c.getCreatureGotBlockedThisTurn()); + res.getDamageHistory().setCreatureGotBlockedThisTurn(c.getDamageHistory().getCreatureGotBlockedThisTurn()); res.setEnchanting(c.getEnchanting()); res.setHaunting(c.getHaunting()); for (final Card haunter : c.getHauntedBy()) { diff --git a/src/main/java/forge/CombatUtil.java b/src/main/java/forge/CombatUtil.java index b98d00b718c..e4c4ff34fb7 100644 --- a/src/main/java/forge/CombatUtil.java +++ b/src/main/java/forge/CombatUtil.java @@ -2591,7 +2591,7 @@ public class CombatUtil { AllZone.getTriggerHandler().runTrigger("Attacks", runParams); // Annihilator: - if (!c.getCreatureAttackedThisCombat()) { + if (!c.getDamageHistory().getCreatureAttackedThisCombat()) { final ArrayList kws = c.getKeyword(); final Pattern p = Pattern.compile("Annihilator [0-9]+"); Matcher m; @@ -2652,7 +2652,7 @@ public class CombatUtil { if (list.size() == 0) { c.addExtrinsicKeyword("This card doesn't untap during your next untap step."); } - } else if (c.getName().equals("Witch-Maw Nephilim") && !c.getCreatureAttackedThisCombat() + } else if (c.getName().equals("Witch-Maw Nephilim") && !c.getDamageHistory().getCreatureAttackedThisCombat() && (c.getNetAttack() >= 10)) { final Card charger = c; final Ability ability2 = new Ability(c, "0") { @@ -2686,7 +2686,7 @@ public class CombatUtil { } // Witch-Maw Nephilim - else if (c.getName().equals("Sapling of Colfenor") && !c.getCreatureAttackedThisCombat()) { + else if (c.getName().equals("Sapling of Colfenor") && !c.getDamageHistory().getCreatureAttackedThisCombat()) { final Player player = c.getController(); final PlayerZone lib = player.getZone(Constant.Zone.Library); @@ -2705,7 +2705,7 @@ public class CombatUtil { } } // Sapling of Colfenor - c.setCreatureAttackedThisCombat(true); + c.getDamageHistory().setCreatureAttackedThisCombat(true, c.getController()); } // checkDeclareAttackers /** @@ -2734,13 +2734,13 @@ public class CombatUtil { */ public static void checkDeclareBlockers(final CardList cl) { for (final Card c : cl) { - if (!c.getCreatureBlockedThisCombat()) { + if (!c.getDamageHistory().getCreatureBlockedThisCombat()) { for (final Ability ab : CardFactoryUtil.getBushidoEffects(c)) { AllZone.getStack().add(ab); } } - c.setCreatureBlockedThisCombat(true); + c.getDamageHistory().setCreatureBlockedThisCombat(true); } // for } // checkDeclareBlockers @@ -2764,7 +2764,7 @@ public class CombatUtil { runParams.put("Blocker", b); AllZone.getTriggerHandler().runTrigger("Blocks", runParams); - if (!a.getCreatureGotBlockedThisCombat()) { + if (!a.getDamageHistory().getCreatureGotBlockedThisCombat()) { final int blockers = AllZone.getCombat().getBlockers(a).size(); runParams.put("NumBlockers", blockers); AllZone.getTriggerHandler().runTrigger("AttackerBlocked", runParams); @@ -2842,7 +2842,7 @@ public class CombatUtil { } // flanking - a.setCreatureGotBlockedThisCombat(true); + a.getDamageHistory().setCreatureGotBlockedThisCombat(true); b.addBlockedThisTurn(a); a.addBlockedByThisTurn(b); } diff --git a/src/main/java/forge/EndOfTurn.java b/src/main/java/forge/EndOfTurn.java index 4ea4fe7ab72..ce31dbb107d 100644 --- a/src/main/java/forge/EndOfTurn.java +++ b/src/main/java/forge/EndOfTurn.java @@ -111,7 +111,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable { } // Berserk is using this, so don't check isFaceDown() if (c.hasKeyword("At the beginning of the next end step, destroy CARDNAME if it attacked this turn.")) { - if (c.getCreatureAttackedThisTurn()) { + if (c.getDamageHistory().getCreatureAttackedThisTurn()) { final Card card = c; final SpellAbility sac = new Ability(card, "0") { @Override @@ -155,7 +155,7 @@ public class EndOfTurn extends Phase implements java.io.Serializable { AllZone.getStack().addSimultaneousStackEntry(change); } - if (c.getName().equals("Erg Raiders") && !c.getCreatureAttackedThisTurn() && !c.hasSickness() + if (c.getName().equals("Erg Raiders") && !c.getDamageHistory().getCreatureAttackedThisTurn() && !c.hasSickness() && Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(c.getController())) { final Card raider = c; final SpellAbility change = new Ability(raider, "0") { @@ -279,9 +279,9 @@ public class EndOfTurn extends Phase implements java.io.Serializable { for (int i = 0; i < list.size(); i++) { final Card c = list.get(i); - c.setCreatureAttackedThisCombat(false); - c.setCreatureBlockedThisCombat(false); - c.setCreatureGotBlockedThisCombat(false); + c.getDamageHistory().setCreatureAttackedThisCombat(false, null); + c.getDamageHistory().setCreatureBlockedThisCombat(false); + c.getDamageHistory().setCreatureGotBlockedThisCombat(false); } } diff --git a/src/main/java/forge/GameActionUtil.java b/src/main/java/forge/GameActionUtil.java index e6081f78574..3cdb8207cac 100644 --- a/src/main/java/forge/GameActionUtil.java +++ b/src/main/java/forge/GameActionUtil.java @@ -755,10 +755,10 @@ public final class GameActionUtil { } if (player.isPlayer(AllZone.getHumanPlayer())) { - c.setDealtDmgToHumanThisTurn(true); + c.getDamageHistory().setDealtDmgToHumanThisTurn(true); } if (player.isPlayer(AllZone.getComputerPlayer())) { - c.setDealtDmgToComputerThisTurn(true); + c.getDamageHistory().setDealtDmgToComputerThisTurn(true); } } @@ -855,10 +855,10 @@ public final class GameActionUtil { } if (player.isPlayer(AllZone.getHumanPlayer())) { - c.setDealtCombatDmgToHumanThisTurn(true); + c.getDamageHistory().setDealtCombatDmgToHumanThisTurn(true); } if (player.isPlayer(AllZone.getComputerPlayer())) { - c.setDealtCombatDmgToComputerThisTurn(true); + c.getDamageHistory().setDealtCombatDmgToComputerThisTurn(true); } } // executeCombatDamageToPlayerEffects diff --git a/src/main/java/forge/PhaseHandler.java b/src/main/java/forge/PhaseHandler.java index 693d2ae7e26..069e27b7a0a 100644 --- a/src/main/java/forge/PhaseHandler.java +++ b/src/main/java/forge/PhaseHandler.java @@ -430,21 +430,21 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable { c.resetPreventNextDamage(); c.resetReceivedDamageFromThisTurn(); c.resetDealtDamageToThisTurn(); - c.setDealtDmgToHumanThisTurn(false); - c.setDealtDmgToComputerThisTurn(false); - c.setDealtCombatDmgToHumanThisTurn(false); - c.setDealtCombatDmgToComputerThisTurn(false); + c.getDamageHistory().setDealtDmgToHumanThisTurn(false); + c.getDamageHistory().setDealtDmgToComputerThisTurn(false); + c.getDamageHistory().setDealtCombatDmgToHumanThisTurn(false); + c.getDamageHistory().setDealtCombatDmgToComputerThisTurn(false); c.setRegeneratedThisTurn(0); c.clearMustBlockCards(); if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(AllZone.getComputerPlayer())) { - c.setCreatureAttackedLastComputerTurn(c.getCreatureAttackedThisTurn()); + c.getDamageHistory().setCreatureAttackedLastComputerTurn(c.getDamageHistory().getCreatureAttackedThisTurn()); } if (Singletons.getModel().getGameState().getPhaseHandler().isPlayerTurn(AllZone.getHumanPlayer())) { - c.setCreatureAttackedLastHumanTurn(c.getCreatureAttackedThisTurn()); + c.getDamageHistory().setCreatureAttackedLastHumanTurn(c.getDamageHistory().getCreatureAttackedThisTurn()); } - c.setCreatureAttackedThisTurn(false); - c.setCreatureBlockedThisTurn(false); - c.setCreatureGotBlockedThisTurn(false); + c.getDamageHistory().setCreatureAttackedThisTurn(false); + c.getDamageHistory().setCreatureBlockedThisTurn(false); + c.getDamageHistory().setCreatureGotBlockedThisTurn(false); c.clearBlockedByThisTurn(); c.clearBlockedThisTurn(); } @@ -838,15 +838,15 @@ public class PhaseHandler extends MyObservable implements java.io.Serializable { for (int i = 0; i < list.size(); i++) { final Card c = list.get(i); - if (c.getCreatureAttackedThisCombat()) { - c.setCreatureAttackedThisCombat(false); + if (c.getDamageHistory().getCreatureAttackedThisCombat()) { + c.getDamageHistory().setCreatureAttackedThisCombat(false, null); } - if (c.getCreatureBlockedThisCombat()) { - c.setCreatureBlockedThisCombat(false); + if (c.getDamageHistory().getCreatureBlockedThisCombat()) { + c.getDamageHistory().setCreatureBlockedThisCombat(false); } - if (c.getCreatureGotBlockedThisCombat()) { - c.setCreatureGotBlockedThisCombat(false); + if (c.getDamageHistory().getCreatureGotBlockedThisCombat()) { + c.getDamageHistory().setCreatureGotBlockedThisCombat(false); } } } diff --git a/src/main/java/forge/PhaseUtil.java b/src/main/java/forge/PhaseUtil.java index 7faafa570b7..4d215e1a450 100644 --- a/src/main/java/forge/PhaseUtil.java +++ b/src/main/java/forge/PhaseUtil.java @@ -331,7 +331,7 @@ public class PhaseUtil { list = list.filter(new CardListFilter() { @Override public boolean addCard(final Card c) { - return !c.getCreatureBlockedThisCombat(); + return !c.getDamageHistory().getCreatureBlockedThisCombat(); } }); diff --git a/src/main/java/forge/Player.java b/src/main/java/forge/Player.java index 436b5ed6dba..50c19fb7455 100644 --- a/src/main/java/forge/Player.java +++ b/src/main/java/forge/Player.java @@ -2428,10 +2428,10 @@ public abstract class Player extends GameEntity { return false; } } else if (property.equals("wasDealtDamageBySourceThisGame")) { - if (this.isHuman() && !source.getDealtDmgToHumanThisGame()) { + if (this.isHuman() && !source.getDamageHistory().getDealtDmgToHumanThisGame()) { return false; } - if (this.isComputer() && !source.getDealtDmgToComputerThisGame()) { + if (this.isComputer() && !source.getDamageHistory().getDealtDmgToComputerThisGame()) { return false; } } else if (property.startsWith("wasDealtDamageThisTurn")) { diff --git a/src/main/java/forge/card/cardfactory/CardFactoryInstants.java b/src/main/java/forge/card/cardfactory/CardFactoryInstants.java index 17905406b0d..7d54b0daea9 100644 --- a/src/main/java/forge/card/cardfactory/CardFactoryInstants.java +++ b/src/main/java/forge/card/cardfactory/CardFactoryInstants.java @@ -494,7 +494,7 @@ public class CardFactoryInstants { // +" flag: "+creature.getSirenAttackOrDestroy()); // System.out.println("Siren's Call - EOT - "+creature.getName() // +" attacked?: "+creature.getCreatureAttackedThisCombat()); - if (creature.getSirenAttackOrDestroy() && !creature.getCreatureAttackedThisTurn()) { + if (creature.getSirenAttackOrDestroy() && !creature.getDamageHistory().getCreatureAttackedThisTurn()) { if (AllZoneUtil.isCardInPlay(creature)) { // System.out.println("Siren's Call - destroying "+creature.getName()); // this should probably go on the stack