moved fields related to combat in current and last turn from Card to a dedicated class

This commit is contained in:
Maxmtg
2012-03-26 03:11:27 +00:00
parent 73dff66169
commit 367070e170
11 changed files with 395 additions and 406 deletions

1
.gitattributes vendored
View File

@@ -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

View File

@@ -77,6 +77,7 @@ public class Card extends GameEntity implements Comparable<Card> {
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<Card> {
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<Card> mustBlockCards = new ArrayList<Card>();
@@ -881,202 +869,6 @@ public class Card extends GameEntity implements Comparable<Card> {
return this.xLifePaid;
}
// used to see if an attacking creature with a triggering attack ability
// triggered this phase:
/**
* <p>
* Setter for the field <code>creatureAttackedThisCombat</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureAttackedThisCombat(final boolean b) {
this.creatureAttackedThisCombat = b;
if (b) {
this.setCreatureAttackedThisTurn(true);
this.getController().setAttackedWithCreatureThisTurn(true);
}
}
/**
* <p>
* Getter for the field <code>creatureAttackedThisCombat</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureAttackedThisCombat() {
return this.creatureAttackedThisCombat;
}
/**
* <p>
* Setter for the field <code>creatureAttackedThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureAttackedThisTurn(final boolean b) {
this.creatureAttackedThisTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureAttackedThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureAttackedThisTurn() {
return this.creatureAttackedThisTurn;
}
/**
* <p>
* Setter for the field <code>creatureAttackedLastTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureAttackedLastHumanTurn(final boolean b) {
this.creatureAttackedLastHumanTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureAttackedLastTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureAttackedLastHumanTurn() {
return this.creatureAttackedLastHumanTurn;
}
/**
* <p>
* Setter for the field <code>creatureAttackedLastTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureAttackedLastComputerTurn(final boolean b) {
this.creatureAttackedLastComputerTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureAttackedLastTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureAttackedLastComputerTurn() {
return this.creatureAttackedLastComputerTurn;
}
/**
* <p>
* Setter for the field <code>creatureBlockedThisCombat</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureBlockedThisCombat(final boolean b) {
this.creatureBlockedThisCombat = b;
if (b) {
this.setCreatureBlockedThisTurn(true);
}
}
/**
* <p>
* Getter for the field <code>creatureBlockedThisCombat</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureBlockedThisCombat() {
return this.creatureBlockedThisCombat;
}
/**
* <p>
* Setter for the field <code>creatureBlockedThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureBlockedThisTurn(final boolean b) {
this.creatureBlockedThisTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureBlockedThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureBlockedThisTurn() {
return this.creatureBlockedThisTurn;
}
/**
* <p>
* Setter for the field <code>creatureGotBlockedThisCombat</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureGotBlockedThisCombat(final boolean b) {
this.creatureGotBlockedThisCombat = b;
if (b) {
this.setCreatureGotBlockedThisTurn(true);
}
}
/**
* <p>
* Getter for the field <code>creatureGotBlockedThisCombat</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureGotBlockedThisCombat() {
return this.creatureGotBlockedThisCombat;
}
/**
* <p>
* Setter for the field <code>creatureGotBlockedThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureGotBlockedThisTurn(final boolean b) {
this.creatureGotBlockedThisTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureGotBlockedThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureGotBlockedThisTurn() {
return this.creatureGotBlockedThisTurn;
}
/**
* @return the blockedThisTurn
*/
@@ -1139,150 +931,6 @@ public class Card extends GameEntity implements Comparable<Card> {
return false;
}
/**
* <p>
* Setter for the field <code>dealtDmgToHumanThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtDmgToHumanThisTurn(final boolean b) {
this.dealtDmgToHumanThisTurn = b;
if (b) {
this.setDealtDmgToHumanThisGame(true);
}
}
/**
* <p>
* Getter for the field <code>dealtDmgToHumanThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtDmgToHumanThisTurn() {
return this.dealtDmgToHumanThisTurn;
}
/**
* <p>
* Setter for the field <code>dealtDmgToComputerThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtDmgToComputerThisTurn(final boolean b) {
this.dealtDmgToComputerThisTurn = b;
if (b) {
this.setDealtDmgToComputerThisGame(true);
}
}
/**
* <p>
* Getter for the field <code>dealtCombatDmgToComputerThisGame</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtDmgToComputerThisTurn() {
return this.dealtDmgToComputerThisTurn;
}
/**
* <p>
* Setter for the field <code>dealtDmgToHumanThisGame</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtDmgToHumanThisGame(final boolean b) {
this.dealtDmgToHumanThisGame = b;
}
/**
* <p>
* Getter for the field <code>dealtDmgToHumanThisGame</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtDmgToHumanThisGame() {
return this.dealtDmgToHumanThisGame;
}
/**
* <p>
* Setter for the field <code>dealtDmgToComputerThisGame</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtDmgToComputerThisGame(final boolean b) {
this.dealtDmgToComputerThisGame = b;
}
/**
* <p>
* Getter for the field <code>dealtCombatDmgToComputerThisGame</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtDmgToComputerThisGame() {
return this.dealtDmgToComputerThisGame;
}
/**
* <p>
* Setter for the field <code>dealtCombatDmgToHumanThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtCombatDmgToHumanThisTurn(final boolean b) {
this.dealtCombatDmgToHumanThisTurn = b;
}
/**
* <p>
* Getter for the field <code>dealtDmgToHumanThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtCombatDmgToHumanThisTurn() {
return this.dealtCombatDmgToHumanThisTurn;
}
/**
* <p>
* Setter for the field <code>dealtCombatDmgToComputerThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtCombatDmgToComputerThisTurn(final boolean b) {
this.dealtCombatDmgToComputerThisTurn = b;
}
/**
* <p>
* Getter for the field <code>dealtDmgToComputerThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtCombatDmgToComputerThisTurn() {
return this.dealtCombatDmgToComputerThisTurn;
}
/**
* <p>
* Setter for the field <code>sirenAttackOrDestroy</code>.
@@ -7088,19 +6736,19 @@ public class Card extends GameEntity implements Comparable<Card> {
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<Card> {
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<Card> {
this.castFrom = castFrom0;
}
public CardDamageHistory getDamageHistory() {
return damageHistory;
}
} // end Card class

View File

@@ -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:
/**
* <p>
* Setter for the field <code>creatureAttackedThisCombat</code>.
* </p>
*
* @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);
}
}
/**
* <p>
* Getter for the field <code>creatureAttackedThisCombat</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureAttackedThisCombat() {
return this.creatureAttackedThisCombat;
}
/**
* <p>
* Setter for the field <code>creatureAttackedThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureAttackedThisTurn(final boolean b) {
this.creatureAttackedThisTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureAttackedThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureAttackedThisTurn() {
return this.creatureAttackedThisTurn;
}
/**
* <p>
* Setter for the field <code>creatureAttackedLastTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureAttackedLastHumanTurn(final boolean b) {
this.creatureAttackedLastHumanTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureAttackedLastTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureAttackedLastHumanTurn() {
return this.creatureAttackedLastHumanTurn;
}
/**
* <p>
* Setter for the field <code>creatureAttackedLastTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureAttackedLastComputerTurn(final boolean b) {
this.creatureAttackedLastComputerTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureAttackedLastTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureAttackedLastComputerTurn() {
return this.creatureAttackedLastComputerTurn;
}
/**
* <p>
* Setter for the field <code>creatureBlockedThisCombat</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureBlockedThisCombat(final boolean b) {
this.creatureBlockedThisCombat = b;
if (b) {
this.setCreatureBlockedThisTurn(true);
}
}
/**
* <p>
* Getter for the field <code>creatureBlockedThisCombat</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureBlockedThisCombat() {
return this.creatureBlockedThisCombat;
}
/**
* <p>
* Setter for the field <code>creatureBlockedThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureBlockedThisTurn(final boolean b) {
this.creatureBlockedThisTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureBlockedThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureBlockedThisTurn() {
return this.creatureBlockedThisTurn;
}
/**
* <p>
* Setter for the field <code>creatureGotBlockedThisCombat</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureGotBlockedThisCombat(final boolean b) {
this.creatureGotBlockedThisCombat = b;
if (b) {
this.setCreatureGotBlockedThisTurn(true);
}
}
/**
* <p>
* Getter for the field <code>creatureGotBlockedThisCombat</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureGotBlockedThisCombat() {
return this.creatureGotBlockedThisCombat;
}
/**
* <p>
* Setter for the field <code>creatureGotBlockedThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setCreatureGotBlockedThisTurn(final boolean b) {
this.creatureGotBlockedThisTurn = b;
}
/**
* <p>
* Getter for the field <code>creatureGotBlockedThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getCreatureGotBlockedThisTurn() {
return this.creatureGotBlockedThisTurn;
}
/**
* <p>
* Setter for the field <code>dealtDmgToHumanThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtDmgToHumanThisTurn(final boolean b) {
this.dealtDmgToHumanThisTurn = b;
if (b) {
this.setDealtDmgToHumanThisGame(true);
}
}
/**
* <p>
* Getter for the field <code>dealtDmgToHumanThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtDmgToHumanThisTurn() {
return this.dealtDmgToHumanThisTurn;
}
/**
* <p>
* Setter for the field <code>dealtDmgToComputerThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtDmgToComputerThisTurn(final boolean b) {
this.dealtDmgToComputerThisTurn = b;
if (b) {
this.setDealtDmgToComputerThisGame(true);
}
}
/**
* <p>
* Getter for the field <code>dealtCombatDmgToComputerThisGame</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtDmgToComputerThisTurn() {
return this.dealtDmgToComputerThisTurn;
}
/**
* <p>
* Setter for the field <code>dealtDmgToHumanThisGame</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtDmgToHumanThisGame(final boolean b) {
this.dealtDmgToHumanThisGame = b;
}
/**
* <p>
* Getter for the field <code>dealtDmgToHumanThisGame</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtDmgToHumanThisGame() {
return this.dealtDmgToHumanThisGame;
}
/**
* <p>
* Setter for the field <code>dealtDmgToComputerThisGame</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtDmgToComputerThisGame(final boolean b) {
this.dealtDmgToComputerThisGame = b;
}
/**
* <p>
* Getter for the field <code>dealtCombatDmgToComputerThisGame</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtDmgToComputerThisGame() {
return this.dealtDmgToComputerThisGame;
}
/**
* <p>
* Setter for the field <code>dealtCombatDmgToHumanThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtCombatDmgToHumanThisTurn(final boolean b) {
this.dealtCombatDmgToHumanThisTurn = b;
}
/**
* <p>
* Getter for the field <code>dealtDmgToHumanThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtCombatDmgToHumanThisTurn() {
return this.dealtCombatDmgToHumanThisTurn;
}
/**
* <p>
* Setter for the field <code>dealtCombatDmgToComputerThisTurn</code>.
* </p>
*
* @param b
* a boolean.
*/
public final void setDealtCombatDmgToComputerThisTurn(final boolean b) {
this.dealtCombatDmgToComputerThisTurn = b;
}
/**
* <p>
* Getter for the field <code>dealtDmgToComputerThisTurn</code>.
* </p>
*
* @return a boolean.
*/
public final boolean getDealtCombatDmgToComputerThisTurn() {
return this.dealtCombatDmgToComputerThisTurn;
}
}

View File

@@ -931,7 +931,7 @@ public final class CardUtil {
res.setChangedCardTypes(c.getChangedCardTypes());
res.setNewPT(new ArrayList<CardPowerToughness>(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()) {

View File

@@ -2591,7 +2591,7 @@ public class CombatUtil {
AllZone.getTriggerHandler().runTrigger("Attacks", runParams);
// Annihilator:
if (!c.getCreatureAttackedThisCombat()) {
if (!c.getDamageHistory().getCreatureAttackedThisCombat()) {
final ArrayList<String> 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);
}

View File

@@ -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);
}
}

View File

@@ -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

View File

@@ -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);
}
}
}

View File

@@ -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();
}
});

View File

@@ -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")) {

View File

@@ -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