From 4371e32e67c54a2d1051c12a3d37ac6a6d267257 Mon Sep 17 00:00:00 2001 From: moomarc Date: Fri, 25 May 2012 16:35:00 +0000 Subject: [PATCH] Added Archangel of Strife - Added to AbilityFactoryEffect: EffectOwner, Duration$UntilHostLeavesPlay, and RememberEffect. - Added exception to Card.java so that Effect cards can be counted when remembered --- .gitattributes | 1 + res/cardsfolder/a/archangel_of_strife.txt | 29 +++++++++++++++++++ src/main/java/forge/Card.java | 3 +- .../abilityfactory/AbilityFactoryEffect.java | 19 +++++++++++- 4 files changed, 50 insertions(+), 2 deletions(-) create mode 100644 res/cardsfolder/a/archangel_of_strife.txt diff --git a/.gitattributes b/.gitattributes index 67a4d989196..3d7a949cd6c 100644 --- a/.gitattributes +++ b/.gitattributes @@ -397,6 +397,7 @@ res/cardsfolder/a/arcbound_wanderer.txt svneol=native#text/plain res/cardsfolder/a/arcbound_worker.txt svneol=native#text/plain res/cardsfolder/a/archaeological_dig.txt svneol=native#text/plain res/cardsfolder/a/archangel.txt svneol=native#text/plain +res/cardsfolder/a/archangel_of_strife.txt -text res/cardsfolder/a/archangels_light.txt -text res/cardsfolder/a/archdemon_of_unx.txt svneol=native#text/plain res/cardsfolder/a/architects_of_will.txt svneol=native#text/plain diff --git a/res/cardsfolder/a/archangel_of_strife.txt b/res/cardsfolder/a/archangel_of_strife.txt new file mode 100644 index 00000000000..68f780de689 --- /dev/null +++ b/res/cardsfolder/a/archangel_of_strife.txt @@ -0,0 +1,29 @@ +Name:Archangel of Strife +ManaCost:5 W W +Types:Creature Angel +Text:no text +PT:6/6 +K:Flying +T:Mode$ ChangesZone | Origin$ Any | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ Tolstoy | Static$ True | TriggerDescription$ As CARDNAME enters the battlefield, each player chooses war or peace. Creatures controlled by players who chose war get +3/+0. Creatures controlled by players who chose peace get +0/+3. +SVar:Tolstoy:AB$ GenericChoice | Cost$ 0 | Defined$ You | Choices$ WarChoice,PeaceChoice | SubAbility$ OppChoice +SVar:OppChoice:DB$ GenericChoice | Cost$ 0 | Defined$ Opponent | Choices$ Attacking,Defensive +SVar:WarChoice:DB$ Effect | Name$ Archangel War Effect | ChoiceDescription$ War | Duration$ UntilHostLeavesPlay | RememberEffect$ True +SVar:PeaceChoice:DB$ Effect | Name$ Archangel Peace Effect | ChoiceDescription$ Peace | Duration$ UntilHostLeavesPlay | RememberEffect$ True +SVar:Attacking:DB$ Effect | Name$ Archangel War Effect | ChoiceDescription$ War | EffectOwner$ Opponent | Duration$ UntilHostLeavesPlay | RememberEffect$ True +SVar:Defensive:DB$ Effect | Name$ Archangel Peace Effect | ChoiceDescription$ Peace | EffectOwner$ Opponent | Duration$ UntilHostLeavesPlay | RememberEffect$ True +S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddPower$ 3 | CheckSVar$ WarYou | SVarCompare$ GE1 +S:Mode$ Continuous | Affected$ Creature.YouCtrl | AddToughness$ 3 | CheckSVar$ PeaceYou | SVarCompare$ GE1 +S:Mode$ Continuous | Affected$ Creature.YouDontCtrl | AddPower$ 3 | CheckSVar$ WarOpp | SVarCompare$ GE1 +S:Mode$ Continuous | Affected$ Creature.YouDontCtrl | AddToughness$ 3 | CheckSVar$ PeaceOpp | SVarCompare$ GE1 +T:Mode$ ChangesZone | Origin$ Battlefield | Destination$ Any | Defined$ Self | Execute$ DBCleanup | Static$ True +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:WarYou:Remembered$Valid Card.namedArchangel War Effect+YouCtrl +SVar:PeaceYou:Remembered$Valid Card.namedArchangel Peace Effect+YouCtrl +SVar:WarOpp:Remembered$Valid Card.namedArchangel War Effect+YouDontCtrl +SVar:PeaceOpp:Remembered$Valid Card.namedArchangel Peace Effect+YouDontCtrl +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/archangel_of_strife.jpg +SetInfo:COM|Rare|http://magiccards.info/scans/en/cmd/7.jpg +Oracle:Flying\nAs Archangel of Strife enters the battlefield, each player chooses war or peace.\nCreatures controlled by players who chose war get +3/+0.\nCreatures controlled by players who chose peace get +0/+3. +End \ No newline at end of file diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 076ef085319..91d2f04301f 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -6321,7 +6321,8 @@ public class Card extends GameEntity implements Comparable { @Override public final boolean isValid(final String restriction, final Player sourceController, final Card source) { - if (this.isImmutable()) { + if (this.isImmutable() + && !source.getRemembered().contains(this)) { // special case exclusion return false; } diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryEffect.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryEffect.java index 365ad0221ad..24531e30a63 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryEffect.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryEffect.java @@ -17,6 +17,7 @@ */ package forge.card.abilityfactory; +import java.util.ArrayList; import java.util.HashMap; import java.util.Random; @@ -376,6 +377,7 @@ public class AbilityFactoryEffect { String[] effectReplacementEffects = null; String effectRemembered = null; String effectImprinted = null; + Player ownerEff = null; if (params.containsKey("Abilities")) { effectAbilities = params.get("Abilities").split(","); @@ -420,7 +422,13 @@ public class AbilityFactoryEffect { return; } - final Player controller = sa.getActivatingPlayer(); + if (params.containsKey("EffectOwner")) { + ArrayList effectOwner; + effectOwner = AbilityFactory.getDefinedPlayers(sa.getSourceCard(), params.get("EffectOwner"), sa); + ownerEff = effectOwner.get(0); + } + + final Player controller = params.containsKey("EffectOwner") ? ownerEff : sa.getActivatingPlayer(); final Card eff = new Card(); eff.setName(name); eff.addType("Effect"); // Or Emblem @@ -513,6 +521,11 @@ public class AbilityFactoryEffect { eff.setChosenColor(card.getChosenColor()); } + // Remember created effect + if (params.containsKey("RememberEffect")) { + AllZoneUtil.getCardState(card).addRemembered(eff); + } + // Duration final String duration = params.get("Duration"); if ((duration == null) || !duration.equals("Permanent")) { @@ -528,6 +541,10 @@ public class AbilityFactoryEffect { if ((duration == null) || duration.equals("EndOfTurn")) { AllZone.getEndOfTurn().addUntil(endEffect); } + + if (duration.equals("UntilHostLeavesPlay")) { + card.addLeavesPlayCommand(endEffect); + } } // TODO: Add targeting to the effect so it knows who it's dealing with