From 98aefb5a6b4d93cb244ef8a7cee37b930de993f0 Mon Sep 17 00:00:00 2001 From: Hellfish Date: Wed, 21 Sep 2011 14:19:09 +0000 Subject: [PATCH] *Added initial Radiance parameter to AF_DealDamage. *Converted Wojek Embermage to script. *Converted Cleansing Beam to Radiance parameter. *Fixed one of the Haunt triggers, previously it would bug the AIs ETB trigger evaluation. *Added Count$DamageDoneThisTurn *Added Brightflame --- .gitattributes | 1 + res/cardsfolder/b/brightflame.txt | 9 +++ res/cardsfolder/c/cleansing_beam.txt | 4 +- res/cardsfolder/w/wojek_embermage.txt | 1 + src/main/java/forge/Card.java | 9 +++ .../AbilityFactory_DealDamage.java | 19 ++++++- .../card/cardFactory/CardFactoryUtil.java | 8 ++- .../cardFactory/CardFactory_Creatures.java | 57 ------------------- 8 files changed, 45 insertions(+), 63 deletions(-) create mode 100644 res/cardsfolder/b/brightflame.txt diff --git a/.gitattributes b/.gitattributes index 6785b1fe206..6944e7c2259 100644 --- a/.gitattributes +++ b/.gitattributes @@ -964,6 +964,7 @@ res/cardsfolder/b/briarhorn.txt svneol=native#text/plain res/cardsfolder/b/briarknit_kami.txt svneol=native#text/plain res/cardsfolder/b/bribery.txt svneol=native#text/plain res/cardsfolder/b/bridge_from_below.txt svneol=native#text/plain +res/cardsfolder/b/brightflame.txt -text res/cardsfolder/b/brighthearth_banneret.txt svneol=native#text/plain res/cardsfolder/b/brightstone_ritual.txt svneol=native#text/plain res/cardsfolder/b/brilliant_halo.txt svneol=native#text/plain diff --git a/res/cardsfolder/b/brightflame.txt b/res/cardsfolder/b/brightflame.txt new file mode 100644 index 00000000000..37bccd98e33 --- /dev/null +++ b/res/cardsfolder/b/brightflame.txt @@ -0,0 +1,9 @@ +Name:Brightflame +ManaCost:X R R W W +Types:Sorcery +Text:no text +A:SP$DealDamage | Cost$ X R R W W | ValidTgts$ Creature | Radiance$ True | NumDmg$ X | SubAbility$ DBGainLife | SpellDescription$ Radiance - Brightflame deals X damage to target creature and each other creature that shares a color with it. You gain life equal to the damage dealt this way. +SVar:DBGainLife:DB$GainLife | Defined$ You | LifeAmount$ Y +SVar:X:Count$xPaid +SVar:Y:Count$DamageDoneThisTurn +End \ No newline at end of file diff --git a/res/cardsfolder/c/cleansing_beam.txt b/res/cardsfolder/c/cleansing_beam.txt index b8408ee2ed4..17c4deb3812 100644 --- a/res/cardsfolder/c/cleansing_beam.txt +++ b/res/cardsfolder/c/cleansing_beam.txt @@ -2,9 +2,7 @@ Name:Cleansing Beam ManaCost:4 R Types:Instant Text:no text -A:SP$ DealDamage | Cost$ 4 R | ValidTgts$ Creature | TgtPrompt$ Select target creature | NumDmg$ 2 | SubAbility$ SVar=DBDamageAll | RememberTargets$ True | ForgetOtherTargets$ True | SpellDescription$ Radiance - CARDNAME deals 2 damage to target creature and each other creature that shares a color with it. -SVar:DBDamageAll:DB$DamageAll | NumDmg$ 2 | ValidCards$ Remembered.Creature+Other+SharesColorWith | SubAbility$ DBCleanup -SVar:DBCleanup:DB$Cleanup | ClearRemembered$ True +A:SP$ DealDamage | Cost$ 4 R | ValidTgts$ Creature | Radiance$ True | TgtPrompt$ Select target creature | NumDmg$ 2 | SpellDescription$ Radiance - CARDNAME deals 2 damage to target creature and each other creature that shares a color with it. SVar:RemAIDeck:True SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/cleansing_beam.jpg diff --git a/res/cardsfolder/w/wojek_embermage.txt b/res/cardsfolder/w/wojek_embermage.txt index b581625cde6..74ff9583abf 100644 --- a/res/cardsfolder/w/wojek_embermage.txt +++ b/res/cardsfolder/w/wojek_embermage.txt @@ -3,6 +3,7 @@ ManaCost:3 R Types:Creature Human Wizard Text:no text PT:1/2 +A:AB$DealDamage | Cost$ T | ValidTgts$ Creature | Radiance$ True | PreCostDesc$ Radiance - | NumDmg$ 1 | SpellDescription$ CARDNAME deals 1 damage to target creature and each other creature that shares a color with it. SVar:Rarity:Uncommon SVar:Picture:http://www.wizards.com/global/images/magic/general/wojek_embermage.jpg SetInfo:RAV|Uncommon|http://magiccards.info/scans/en/rav/152.jpg diff --git a/src/main/java/forge/Card.java b/src/main/java/forge/Card.java index 1b5db4b068e..8550a763d62 100644 --- a/src/main/java/forge/Card.java +++ b/src/main/java/forge/Card.java @@ -6201,6 +6201,15 @@ public class Card extends GameEntity implements Comparable { public final void setHaunting(final Card c) { haunting = c; + } + + public final int getDamageDoneThisTurn() { + int sum = 0; + for(Card c : dealtDamageToThisTurn.keySet()) { + sum += dealtDamageToThisTurn.get(c); + } + + return sum; } } //end Card class diff --git a/src/main/java/forge/card/abilityFactory/AbilityFactory_DealDamage.java b/src/main/java/forge/card/abilityFactory/AbilityFactory_DealDamage.java index 067c4f1c967..90d304d2c05 100644 --- a/src/main/java/forge/card/abilityFactory/AbilityFactory_DealDamage.java +++ b/src/main/java/forge/card/abilityFactory/AbilityFactory_DealDamage.java @@ -603,8 +603,25 @@ public class AbilityFactory_DealDamage { tgts = AbilityFactory.getDefinedObjects(saMe.getSourceCard(), params.get("Defined"), saMe); else tgts = saMe.getTarget().getTargets(); - + boolean targeted = (AF.getAbTgt() != null); + + if(params.containsKey("Radiance") && targeted) { + Card origin = null; + for(int i = 0; i< tgts.size();i++) + { + if(tgts.get(i) instanceof Card) { + origin = (Card)tgts.get(i); + break; + } + } + if(origin != null) //Can't radiate from a player + { + for(Card c : CardUtil.getRadiance(AF.getHostCard(), origin, params.get("ValidTgts").split(","))) { + tgts.add(c); + } + } + } ArrayList definedSources = AbilityFactory.getDefinedCards(saMe.getSourceCard(), params.get("DamageSource"), saMe); Card source = definedSources.get(0); diff --git a/src/main/java/forge/card/cardFactory/CardFactoryUtil.java b/src/main/java/forge/card/cardFactory/CardFactoryUtil.java index a46ae7b5e42..80a27bfddc6 100644 --- a/src/main/java/forge/card/cardFactory/CardFactoryUtil.java +++ b/src/main/java/forge/card/cardFactory/CardFactoryUtil.java @@ -2930,6 +2930,10 @@ public class CardFactoryUtil { if (sq[0].equals("StormCount")) { return doXMath(Phase.getStormCount() - 1, m, c); } + + if(sq[0].equals("DamageDoneThisTurn")) { + return doXMath(c.getDamageDoneThisTurn(), m, c); + } CardList someCards = new CardList(); @@ -4791,7 +4795,7 @@ public class CardFactoryUtil { card.getKeyword().remove(hauntPos); - //First, create trigger that runs when the haunter dies (if it's a creature) + //First, create trigger that runs when the haunter goes to the graveyard Trigger haunterDies = forge.card.trigger.TriggerHandler.parseTrigger("Mode$ ChangesZone | Origin$ Battlefield | Destination$ Graveyard | ValidCard$ Card.Self | Static$ True | Secondary$ True | TriggerDescription$ Blank", card, true); final Ability haunterDies_Work = new Ability(card,"0") { @@ -4871,7 +4875,7 @@ public class CardFactoryUtil { Trigger haunterETB = forge.card.trigger.TriggerHandler.parseTrigger("Mode$ ChangesZone | Destination$ Battlefield | ValidCard$ Card.Self | Execute$ " + hauntSVarName + " | Secondary$ True | TriggerDescription$ " + hauntDescription, card, true); //Fourth, create a trigger that removes the haunting status if the haunter leaves the exile - Trigger haunterUnExiled = forge.card.trigger.TriggerHandler.parseTrigger("Mode$ ChangesZone | Origin$ Exile | ValidCard$ Card.Self | Static$ True | Secondary$ True | TriggerDescription$ Blank", card, true); + Trigger haunterUnExiled = forge.card.trigger.TriggerHandler.parseTrigger("Mode$ ChangesZone | Origin$ Exile | Destination$ Any | ValidCard$ Card.Self | Static$ True | Secondary$ True | TriggerDescription$ Blank", card, true); Ability haunterUnExiled_Work = new Ability(card,"0") { @Override diff --git a/src/main/java/forge/card/cardFactory/CardFactory_Creatures.java b/src/main/java/forge/card/cardFactory/CardFactory_Creatures.java index eebc7c1172a..8c448e3499a 100644 --- a/src/main/java/forge/card/cardFactory/CardFactory_Creatures.java +++ b/src/main/java/forge/card/cardFactory/CardFactory_Creatures.java @@ -686,63 +686,6 @@ public class CardFactory_Creatures { card.addComesIntoPlayCommand(comesIntoPlay); }//*************** END ************ END ************************** - - //*************** START *********** START ************************** - else if (cardName.equals("Wojek Embermage")) { - Cost abCost = new Cost("T", cardName, true); - Target tgt = new Target(card, "TgtC"); - final Ability_Activated ability = new Ability_Activated(card, abCost, tgt) { - private static final long serialVersionUID = -1208482961653326721L; - - @Override - public boolean canPlayAI() { - return (CardFactoryUtil.AI_getHumanCreature(1, card, true).size() != 0) - && (AllZone.getPhase().getPhase().equals(Constant.Phase.Main2)); - } - - @Override - public void chooseTargetAI() { - CardList list = CardFactoryUtil.AI_getHumanCreature(1, card, true); - list.shuffle(); - setTargetCard(list.get(0)); - } - - @Override - public void resolve() { - if (AllZoneUtil.isCardInPlay(getTargetCard()) - && CardFactoryUtil.canTarget(card, getTargetCard())) { - CardList list = getRadiance(getTargetCard()); - for (int i = 0; i < list.size(); i++) { - list.get(i).addDamage(1, card); - } - } - }//resolve() - - //parameter Card c, is included in CardList - //no multi-colored cards - CardList getRadiance(Card c) { - if (CardUtil.getColors(c).contains(Constant.Color.Colorless)) { - CardList list = new CardList(); - list.add(c); - return list; - } - - CardList sameColor = new CardList(); - CardList list = AllZoneUtil.getCreaturesInPlay(); - - for (int i = 0; i < list.size(); i++) - if (list.get(i).sharesColorWith(c)) sameColor.add(list.get(i)); - - return sameColor; - } - - };//SpellAbility - card.addSpellAbility(ability); - ability.setDescription("Radiance - " + abCost + cardName + " deals 1 damage to target creature and each other creature that shares a color with it."); - - }//*************** END ************ END ************************** - - //*************** START *********** START ************************** else if (cardName.equals("Adarkar Valkyrie")) { //tap ability - no cost - target creature - EOT