From b40302a3aa5c8011fadac46b64d963c3783c68db Mon Sep 17 00:00:00 2001 From: swordshine Date: Sat, 14 Sep 2013 04:17:27 +0000 Subject: [PATCH] - Added Personal Incarnation --- .gitattributes | 1 + res/cardsfolder/p/personal_incarnation.txt | 22 +++++++++++++++++++ .../spellability/SpellAbilityRestriction.java | 9 ++++++++ .../spellability/SpellAbilityVariables.java | 21 ++++++++++++++++-- 4 files changed, 51 insertions(+), 2 deletions(-) create mode 100644 res/cardsfolder/p/personal_incarnation.txt diff --git a/.gitattributes b/.gitattributes index b1c525155ab..5f5ed909fdd 100644 --- a/.gitattributes +++ b/.gitattributes @@ -8097,6 +8097,7 @@ res/cardsfolder/p/permafrost_trap.txt svneol=native#text/plain res/cardsfolder/p/pernicious_deed.txt svneol=native#text/plain res/cardsfolder/p/perplex.txt -text res/cardsfolder/p/persecute.txt -text +res/cardsfolder/p/personal_incarnation.txt -text res/cardsfolder/p/personal_sanctuary.txt -text res/cardsfolder/p/personal_tutor.txt svneol=native#text/plain res/cardsfolder/p/persuasion.txt svneol=native#text/plain diff --git a/res/cardsfolder/p/personal_incarnation.txt b/res/cardsfolder/p/personal_incarnation.txt new file mode 100644 index 00000000000..edb9bb0b16d --- /dev/null +++ b/res/cardsfolder/p/personal_incarnation.txt @@ -0,0 +1,22 @@ +Name:Personal Incarnation +ManaCost:3 W W W +Types:Creature Avatar Incarnation +PT:6/6 +A:AB$ Effect | Cost$ 0 | Name$ Personal Incarnation Redirection | ReplacementEffects$ PersonalCombat,PersonalNonCombat | OwnerOnly$ True | SVars$ CombatDmg,NonCombatDmg,ExileEffect,RestDmgCombat,RestDmg,X,Y | References$ PersonalCombat,PersonalNonCombat,CombatDmg,NonCombatDmg,ExileEffect,RestDmgCombat,RestDmg,X,Y | Duration$ HostLeavesOrEOT | RememberObjects$ Self | EffectOwner$ CardOwner | SpellDescription$ The next 1 damage that would be dealt to CARDNAME this turn is dealt to its owner instead. Any player may activate this ability, but only if he or she owns CARDNAME. +SVar:PersonalCombat:Event$ DamageDone | ValidTarget$ Card.IsRemembered | IsCombat$ True | ReplaceWith$ CombatDmg | Description$ The next 1 damage that would be dealt to Personal Incarnation this turn is dealt to its owner instead. +SVar:PersonalNonCombat:Event$ DamageDone | ValidTarget$ Card.IsRemembered | IsCombat$ False | ReplaceWith$ NonCombatDmg | Secondary$ True | Description$ The next 1 damage that would be dealt to Personal Incarnation this turn is dealt to its owner instead. +SVar:CombatDmg:AB$ DealDamage | Cost$ 0 | Defined$ You | DamageSource$ ReplacedSource | CombatDamage$ True | NumDmg$ 1 | SubAbility$ RestDmgCombat | ConditionCheckSVar$ Y | ConditionSVarCompare$ GE1 | References$ Y +SVar:NonCombatDmg:AB$ DealDamage | Cost$ 0 | Defined$ You | DamageSource$ ReplacedSource | NumDmg$ 1 | SubAbility$ RestDmg | ConditionCheckSVar$ Y | ConditionSVarCompare$ GE1 | References$ Y +SVar:RestDmgCombat:DB$ DealDamage | Defined$ Remembered | DamageSource$ ReplacedSource | CombatDamage$ True | NumDmg$ X | SubAbility$ ExileEffect | References$ X +SVar:RestDmg:DB$ DealDamage | Defined$ Remembered | DamageSource$ ReplacedSource | NumDmg$ X | SubAbility$ ExileEffect | References$ X +SVar:ExileEffect:DB$ ChangeZone | Defined$ Self | Origin$ Command | Destination$ Exile | Static$ True +SVar:X:ReplaceCount$DamageAmount/Minus.1 +SVar:Y:ReplaceCount$DamageAmount +T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Execute$ TrigLoseLife | TriggerController$ TriggeredCardController | TriggerDescription$ When CARDNAME dies, its owner loses half his or her life, rounded up. +SVar:TrigLoseLife:AB$ Pump | Cost$ 0 | RememberObjects$ TriggeredCardOwner | SubAbility$ DBLoseLife +SVar:DBLoseLife:DB$ LoseLife | Defined$ Remembered | LifeAmount$ HavocX | References$ HavocX | SubAbility$ DBCleanup +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:HavocX:PlayerCountRemembered$LifeTotal/HalfUp +SVar:RemAIDeck:True +SVar:Picture:http://www.wizards.com/global/images/magic/general/personal_incarnation.jpg +Oracle:{0}: The next 1 damage that would be dealt to Personal Incarnation this turn is dealt to its owner instead. Any player may activate this ability, but only if he or she owns Personal Incarnation.\nWhen Personal Incarnation dies, its owner loses half his or her life, rounded up. diff --git a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java index ed43bb3dd49..ea14e35d0f1 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityRestriction.java +++ b/src/main/java/forge/card/spellability/SpellAbilityRestriction.java @@ -121,6 +121,10 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { this.setOpponentOnly(true); } + if (params.containsKey("OwnerOnly")) { + this.setOwnerOnly(true); + } + if (params.containsKey("ActivationLimit")) { this.setLimitToCheck(params.get("ActivationLimit")); } @@ -274,9 +278,14 @@ public class SpellAbilityRestriction extends SpellAbilityVariables { return true; } + if (this.isOwnerOnly()) { + return activator.equals(c.getOwner()); + } + if (activator.equals(c.getController()) && !this.isOpponentOnly()) { return true; } + if (!activator.equals(c.getController()) && (this.isOpponentOnly() || c.hasKeyword("May be played by your opponent"))) { return true; diff --git a/src/main/java/forge/card/spellability/SpellAbilityVariables.java b/src/main/java/forge/card/spellability/SpellAbilityVariables.java index 186bf341422..6c573cc813b 100644 --- a/src/main/java/forge/card/spellability/SpellAbilityVariables.java +++ b/src/main/java/forge/card/spellability/SpellAbilityVariables.java @@ -58,7 +58,8 @@ public class SpellAbilityVariables { this.sorcerySpeed = sav.isSorcerySpeed(); this.instantSpeed = sav.isInstantSpeed(); this.anyPlayer = sav.isAnyPlayer(); - this.setOpponentOnly(sav.isAnyPlayer()); + this.opponentOnly = sav.isOpponentOnly(); + this.ownerOnly = sav.isOwnerOnly(); this.opponentTurn = sav.isOpponentTurn(); this.playerTurn = sav.isPlayerTurn(); this.activationLimit = sav.getActivationLimit(); @@ -104,9 +105,12 @@ public class SpellAbilityVariables { /** The b any player. */ private boolean anyPlayer = false; - /** The b any player. */ + /** The b opponent only. */ private boolean opponentOnly = false; + /** The b owner only. */ + private boolean ownerOnly = false; + /** The b opponent turn. */ private boolean opponentTurn = false; @@ -992,6 +996,19 @@ public class SpellAbilityVariables { this.opponentOnly = opponentOnly; } + /** + * @return the ownerOnly + */ + public boolean isOwnerOnly() { + return ownerOnly; + } + + /** + * @param ownerOnly the ownerOnly to set + */ + public void setOwnerOnly(boolean ownerOnly) { + this.ownerOnly = ownerOnly; + } /** *

* Setter for the field ColorToCheck.