From abd0568eeab2bc0588370a4203dd4021eada46ce Mon Sep 17 00:00:00 2001 From: Sloth Date: Wed, 16 Nov 2011 21:34:37 +0000 Subject: [PATCH] - Added the following properties to hasProperty: attackedThisTurn, attackedLastTurn, blockedThisTurn, notAttackedThisTurn, notAttackedLastTurn and notBlockedThisTurn. - Added Lurker. --- .gitattributes | 1 + res/cardsfolder/l/lurker.txt | 11 +++++ res/cardsfolder/m/mercy_killing.txt | 2 + src/main/java/forge/Card.java | 75 +++++++++++++++++++++++++++++ src/main/java/forge/EndOfTurn.java | 6 +-- 5 files changed, 92 insertions(+), 3 deletions(-) create mode 100644 res/cardsfolder/l/lurker.txt diff --git a/.gitattributes b/.gitattributes index 64644b18526..90b6866bda7 100644 --- a/.gitattributes +++ b/.gitattributes @@ -4861,6 +4861,7 @@ res/cardsfolder/l/lunk_errant.txt svneol=native#text/plain res/cardsfolder/l/lure.txt svneol=native#text/plain res/cardsfolder/l/lure_of_prey.txt -text res/cardsfolder/l/lurebound_scarecrow.txt -text svneol=unset#text/plain +res/cardsfolder/l/lurker.txt -text res/cardsfolder/l/lurking_crocodile.txt svneol=native#text/plain res/cardsfolder/l/lurking_informant.txt svneol=native#text/plain res/cardsfolder/l/lurking_nightstalker.txt svneol=native#text/plain diff --git a/res/cardsfolder/l/lurker.txt b/res/cardsfolder/l/lurker.txt new file mode 100644 index 00000000000..baf3df484aa --- /dev/null +++ b/res/cardsfolder/l/lurker.txt @@ -0,0 +1,11 @@ +Name:Lurker +ManaCost:2 G +Types:Creature Beast +Text: +PT:2/3 +S:Mode$ CantTarget | ValidCard$ Card.Self+notAttackedThisTurn+notBlockedThisTurn | Spell$ True | Description$ CARDNAME can't be the target of spells unless it attacked or blocked this turn. +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/lurker.jpg +SetInfo:DRK|Rare|http://magiccards.info/scans/en/dk/43.jpg +Oracle:Lurker can't be the target of spells unless it attacked or blocked this turn. +End \ No newline at end of file diff --git a/res/cardsfolder/m/mercy_killing.txt b/res/cardsfolder/m/mercy_killing.txt index 76cd9d9055d..307a1534636 100644 --- a/res/cardsfolder/m/mercy_killing.txt +++ b/res/cardsfolder/m/mercy_killing.txt @@ -7,4 +7,6 @@ SVar:DBToken:DB$ Token | TokenAmount$ X | TokenPower$ 1 | TokenToughness$ 1 | To SVar:X:Targeted$CardPower SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/mercy_killing.jpg +SetInfo:SHM|Uncommon|http://magiccards.info/scans/en/shm/231.jpg +Oracle:Target creature's controller sacrifices it, then puts X 1/1 green and white Elf Warrior creature tokens onto the battlefield, where X is that creature's power. End \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 87f3d3d0114..09a9f3637a2 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -320,8 +320,10 @@ public class Card extends GameEntity implements Comparable { private boolean spellWithChoices = false; private boolean spellCopyingCard = false; private boolean creatureAttackedThisTurn = false; + private boolean creatureAttackedLastTurn = false; private boolean creatureAttackedThisCombat = false; private boolean creatureBlockedThisCombat = false; + private boolean creatureBlockedThisTurn = false; private boolean creatureGotBlockedThisCombat = false; private boolean dealtDmgToHumanThisTurn = false; private boolean dealtDmgToComputerThisTurn = false; @@ -866,6 +868,29 @@ public class Card extends GameEntity implements Comparable { public final boolean getCreatureAttackedThisTurn() { return this.creatureAttackedThisTurn; } + + /** + *

+ * Setter for the field creatureAttackedLastTurn. + *

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

+ * Getter for the field creatureAttackedLastTurn. + *

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

@@ -877,6 +902,9 @@ public class Card extends GameEntity implements Comparable { */ public final void setCreatureBlockedThisCombat(final boolean b) { this.creatureBlockedThisCombat = b; + if(b) { + setCreatureBlockedThisTurn(true); + } } /** @@ -889,6 +917,29 @@ public class Card extends GameEntity implements Comparable { 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; + } /** *

@@ -6634,6 +6685,30 @@ public class Card extends GameEntity implements Comparable { if ((this.getReceivedDamageFromThisTurn().keySet()).isEmpty()) { return false; } + } else if (property.startsWith("attackedThisTurn")) { + if (!getCreatureAttackedThisTurn()) { + return false; + } + } else if (property.startsWith("attackedLastTurn")) { + if (!getCreatureAttackedLastTurn()) { + return false; + } + } else if (property.startsWith("blockedThisTurn")) { + if (!getCreatureBlockedThisTurn()) { + return false; + } + } else if (property.startsWith("notAttackedThisTurn")) { + if (getCreatureAttackedThisTurn()) { + return false; + } + } else if (property.startsWith("notAttackedLastTurn")) { + if (getCreatureAttackedLastTurn()) { + return false; + } + } else if (property.startsWith("notBlockedThisTurn")) { + if (getCreatureBlockedThisTurn()) { + return false; + } } else if (property.startsWith("greatestPower")) { final CardList list = AllZoneUtil.getCreaturesInPlay(); for (final Card crd : list) { diff --git a/src/main/java/forge/EndOfTurn.java b/src/main/java/forge/EndOfTurn.java index 965f58ed8e5..f2be566f17c 100644 --- a/src/main/java/forge/EndOfTurn.java +++ b/src/main/java/forge/EndOfTurn.java @@ -257,9 +257,9 @@ public class EndOfTurn implements java.io.Serializable { CardList all2 = AllZoneUtil.getCardsIn(Zone.Battlefield); for (Card c : all2) { c.clearMustBlockCards(); - if (c.getCreatureAttackedThisTurn()) { - c.setCreatureAttackedThisTurn(false); - } + c.setCreatureAttackedLastTurn(c.getCreatureAttackedThisTurn()); + c.setCreatureAttackedThisTurn(false); + c.setCreatureBlockedThisTurn(false); } } // executeAt()