From 880bfb1728932c87d37bf8305d2e88ae073e2e3f Mon Sep 17 00:00:00 2001 From: moomarc Date: Wed, 4 Apr 2012 08:38:51 +0000 Subject: [PATCH] Added Alpha Brawl. - DamageAll can now set the damage source with DamageSource param - EachDamage now handles Remembered defined cards - DamageAll and EachDamage support StackDescription param now --- .gitattributes | 1 + res/cardsfolder/a/alpha_brawl.txt | 17 +++++ .../AbilityFactoryDealDamage.java | 68 +++++++++++++++---- 3 files changed, 72 insertions(+), 14 deletions(-) create mode 100644 res/cardsfolder/a/alpha_brawl.txt diff --git a/.gitattributes b/.gitattributes index 400d0067f33..f2b5601a4c1 100644 --- a/.gitattributes +++ b/.gitattributes @@ -200,6 +200,7 @@ res/cardsfolder/a/alloy_myr.txt svneol=native#text/plain res/cardsfolder/a/alluring_scent.txt svneol=native#text/plain res/cardsfolder/a/alluring_siren.txt svneol=native#text/plain res/cardsfolder/a/alms.txt -text +res/cardsfolder/a/alpha_brawl.txt -text res/cardsfolder/a/alpha_kavu.txt svneol=native#text/plain res/cardsfolder/a/alpha_myr.txt svneol=native#text/plain res/cardsfolder/a/alpha_status.txt -text diff --git a/res/cardsfolder/a/alpha_brawl.txt b/res/cardsfolder/a/alpha_brawl.txt new file mode 100644 index 00000000000..3ce5548d392 --- /dev/null +++ b/res/cardsfolder/a/alpha_brawl.txt @@ -0,0 +1,17 @@ +Name:Alpha Brawl +ManaCost:6 R R +Types:Sorcery +Text:no text +A:SP$ Pump | Cost$ 6 R R | ValidTgts$ Creature.YouDontCtrl | TgtPrompt$ Select target creature an opponent controls | RememberTargets$ True | StackDescription$ None | SubAbility$ AlphaAttack | SpellDescription$ Target creature an opponent controls deals damage equal to its power to each other creature that player controls, then each of those creatures deals damage equal to its power to that creature. +SVar:AlphaAttack:DB$DamageAll | ValidCards$ Creature.YouDontCtrl+IsNotRemembered | DamageSource$ Targeted | NumDmg$ Y | SubAbility$ SucksToBeAlpha | StackDescription$ Targeted creature deals damage equal to its power to each other creature that player controls, +SVar:SucksToBeAlpha:DB$ EachDamage | ValidCards$ Creature.YouDontCtrl+IsNotRemembered | ValidDescription$ of those creatures | NumDmg$ X | DamageDesc$ damage equal to its power | DefinedCards$ Remembered | SubAbility$ DBCleanup | StackDescription$ then each of those creatures deals damage equal to its power to that creature +#NumDmg isn't really used here. It is left for clarity. The AF pulls Damage straight from "X" hardcoded. +SVar:DBCleanup:DB$ Cleanup | ClearRemembered$ True +SVar:X:Count$CardPower +SVar:Y:Remembered$CardPower +SVar:RemAIDeck:True +SVar:Rarity:Rare +SVar:Picture:http://www.wizards.com/global/images/magic/general/alpha_brawl.jpg +SetInfo:DKA|Rare|http://magiccards.info/scans/en/dka/82.jpg +Oracle:Target creature an opponent controls deals damage equal to its power to each other creature that player controls, then each of those creatures deals damage equal to its power to that creature. +End \ No newline at end of file diff --git a/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java b/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java index 2596f284425..af82d8fd301 100644 --- a/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java +++ b/src/main/java/forge/card/abilityfactory/AbilityFactoryDealDamage.java @@ -996,7 +996,26 @@ public class AbilityFactoryDealDamage { } final int dmg = this.getNumDamage(sa); - sb.append(name).append(" - Deals " + dmg + " damage to " + desc); + if (!(sa instanceof AbilitySub)) { + sb.append(name).append(" -"); + } + sb.append(" "); + + if (params.containsKey("StackDescription")) { + sb.append(params.get("StackDescription")); + } else { + final ArrayList definedSources = AbilityFactory.getDefinedCards(sa.getSourceCard(), af.getMapParams() + .get("DamageSource"), sa); + final Card source = definedSources.get(0); + + if (source != sa.getSourceCard()) { + sb.append(source.toString()).append(" deals"); + } else { + sb.append("Deals"); + } + + sb.append(" ").append(dmg).append(" damage to ").append(desc); + } final AbilitySub abSub = sa.getSubAbility(); if (abSub != null) { @@ -1226,7 +1245,9 @@ public class AbilityFactoryDealDamage { */ private void damageAllResolve(final AbilityFactory af, final SpellAbility sa) { final HashMap params = af.getMapParams(); - final Card card = sa.getSourceCard(); + final ArrayList definedSources = AbilityFactory.getDefinedCards(sa.getSourceCard(), + params.get("DamageSource"), sa); + final Card card = definedSources.get(0); final int dmg = this.getNumDamage(sa); @@ -1426,13 +1447,17 @@ public class AbilityFactoryDealDamage { dmg += this.getNumDamage(sa) + " damage"; } - sb.append("Each ").append(desc).append(" deals ").append(dmg).append(" to "); - for (final Player p : tgtPlayers) { - sb.append(p); - } - if (params.containsKey("DefinedCards")) { - if (params.get("DefinedCards").equals("Self")) { - sb.append(" itself"); + if (params.containsKey("StackDescription")) { + sb.append(params.get("StackDescription")); + } else { + sb.append("Each ").append(desc).append(" deals ").append(dmg).append(" to "); + for (final Player p : tgtPlayers) { + sb.append(p); + } + if (params.containsKey("DefinedCards")) { + if (params.get("DefinedCards").equals("Self")) { + sb.append(" itself"); + } } } sb.append("."); @@ -1506,11 +1531,26 @@ public class AbilityFactoryDealDamage { } } - if (params.containsKey("DefinedCards") && params.get("DefinedCards").equals("Self")) { - for (final Card source : sources) { - final int dmg = CardFactoryUtil.xCount(source, card.getSVar("X")); - // System.out.println(source+" deals "+dmg+" damage to "+source); - source.addDamage(dmg, source); + if (params.containsKey("DefinedCards")) { + if (params.get("DefinedCards").equals("Self")) { + for (final Card source : sources) { + final int dmg = CardFactoryUtil.xCount(source, card.getSVar("X")); + // System.out.println(source+" deals "+dmg+" damage to "+source); + source.addDamage(dmg, source); + } + } + if (params.get("DefinedCards").equals("Remembered")) { + for (final Card source : sources) { + final int dmg = CardFactoryUtil.xCount(source, card.getSVar("X")); + Card rememberedcard; + for (final Object o : sa.getSourceCard().getRemembered()) { + if (o instanceof Card) { + rememberedcard = (Card) o; + // System.out.println(source + " deals " + dmg + " damage to " + rememberedcard); + rememberedcard.addDamage(dmg, source); + } + } + } } } }