From 805e6a718c750ff14a77e4184aa8ba64cbbba62c Mon Sep 17 00:00:00 2001 From: Hanmac Date: Wed, 20 Jul 2016 14:37:31 +0000 Subject: [PATCH] CardFactoryUtil: add Scavenge as Keyword --- .../src/main/java/forge/game/card/Card.java | 2 +- .../java/forge/game/card/CardFactoryUtil.java | 33 +++++++++++++++++-- .../main/java/forge/game/keyword/Keyword.java | 1 + .../res/cardsfolder/d/deadbridge_goliath.txt | 3 +- forge-gui/res/cardsfolder/d/dreg_mangler.txt | 3 +- forge-gui/res/cardsfolder/d/drudge_beetle.txt | 3 +- forge-gui/res/cardsfolder/g/golgari_decoy.txt | 3 +- .../res/cardsfolder/k/korozda_monitor.txt | 3 +- .../res/cardsfolder/s/sewer_shambler.txt | 3 +- forge-gui/res/cardsfolder/s/slitherhead.txt | 3 +- .../res/cardsfolder/s/sluiceway_scorpion.txt | 3 +- forge-gui/res/cardsfolder/t/terrus_wurm.txt | 3 +- .../res/cardsfolder/t/thrashing_mossdog.txt | 3 +- .../cardsfolder/v/varolz_the_scar_striped.txt | 4 +-- .../res/cardsfolder/z/zanikev_locust.txt | 3 +- 15 files changed, 45 insertions(+), 28 deletions(-) diff --git a/forge-game/src/main/java/forge/game/card/Card.java b/forge-game/src/main/java/forge/game/card/Card.java index d46fe2e331a..41f674b4ca1 100644 --- a/forge-game/src/main/java/forge/game/card/Card.java +++ b/forge-game/src/main/java/forge/game/card/Card.java @@ -1419,7 +1419,7 @@ public class Card extends GameEntity implements Comparable { } else if (keyword.startsWith("Soulbond")) { sbLong.append(keyword + " (" + Keyword.getInstance(keyword).getReminderText() + ")"); } else if (keyword.startsWith("Equip") || keyword.startsWith("Fortify") || keyword.startsWith("Outlast") - || keyword.startsWith("Unearth")) { + || keyword.startsWith("Unearth") || keyword.startsWith("Scavenge")) { // keyword parsing takes care of adding a proper description } else if (keyword.startsWith("CantBeBlockedBy")) { sbLong.append(getName()).append(" can't be blocked "); diff --git a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java index c989e7f50f8..da7d02c22a0 100644 --- a/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java +++ b/forge-game/src/main/java/forge/game/card/CardFactoryUtil.java @@ -2220,6 +2220,9 @@ public class CardFactoryUtil { // add ability to instrinic strings so copies/clones create the ability also card.getCurrentState().addUnparsedAbility(effect); } + else if (keyword.startsWith("Scavenge")) { + addSpellAbility(keyword, card, null); + } else if (keyword.startsWith("Unearth")) { addSpellAbility(keyword, card, null); } @@ -2667,7 +2670,7 @@ public class CardFactoryUtil { abilityStr.append("- "); } abilityStr.append("| CostDesc$ " + cost.toSimpleString() + " "); - abilityStr.append("| SpellDescription$ (" + cost.toSimpleString() + ", {T}: Put a +1/+1 counter on this creature. Outlast only as a sorcery.)"); + abilityStr.append("| SpellDescription$ (" + Keyword.getInstance(keyword).getReminderText() + ")"); final SpellAbility sa = AbilityFactory.getAbility(abilityStr.toString(), card); card.addSpellAbility(sa); // add ability to instrinic strings so copies/clones create the ability also @@ -3018,7 +3021,30 @@ public class CardFactoryUtil { public static void addSpellAbility(final String keyword, final Card card, final KeywordsChange kws) { final boolean intrinsic = kws == null; - if (keyword.startsWith("Unearth")) { + if (keyword.startsWith("Scavenge")) { + final String[] k = keyword.split(":"); + final String manacost = k[1]; + + String effect = "AB$ PutCounter | Cost$ " + manacost + " ExileFromGrave<1/CARDNAME> " + + "| ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 " + + "| CounterNum$ ScavengeX | SorcerySpeed$ True | References$ ScavengeX " + + "| PrecostDesc$ Scavenge | | CostDesc$ " + ManaCostParser.parse(manacost) + + "| SpellDescription$ (" + Keyword.getInstance("Scavenge:" + manacost).getReminderText() + ")"; + + card.setSVar("ScavengeX", "Count$CardPower"); + + final SpellAbility sa = AbilityFactory.getAbility(effect, card); + if (!intrinsic) { + sa.setTemporary(true); + sa.setIntrinsic(false); + //sa.setOriginalHost(hostCard); + kws.addSpellAbility(sa); + } else { + // add ability to instrinic strings so copies/clones create the ability also + card.getCurrentState().addUnparsedAbility(effect); + } + card.addSpellAbility(sa); + } else if (keyword.startsWith("Unearth")) { final String[] k = keyword.split(":"); final String manacost = k[1]; @@ -3046,6 +3072,9 @@ public class CardFactoryUtil { sa.setIntrinsic(false); //sa.setOriginalHost(hostCard); kws.addSpellAbility(sa); + } else { + // add ability to instrinic strings so copies/clones create the ability also + card.getCurrentState().addUnparsedAbility(effect); } card.addSpellAbility(sa); } diff --git a/forge-game/src/main/java/forge/game/keyword/Keyword.java b/forge-game/src/main/java/forge/game/keyword/Keyword.java index 9a8407b43f0..3870ec8ff1f 100644 --- a/forge-game/src/main/java/forge/game/keyword/Keyword.java +++ b/forge-game/src/main/java/forge/game/keyword/Keyword.java @@ -99,6 +99,7 @@ public enum Keyword { SHADOW(SimpleKeyword.class, true, "This creature can block or be blocked by only creatures with shadow."), SHROUD(SimpleKeyword.class, true, "This can't be the target of spells or abilities."), SKULK(SimpleKeyword.class, true, "This creature can't be blocked by creatures with greater power."), + SCAVENGE(KeywordWithCost.class, false, "%s, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery."), SOULBOND(SimpleKeyword.class, true, "You may pair this creature with another unpaired creature when either enters the battlefield. They remain paired for as long as you control both of them"), SOULSHIFT(KeywordWithAmount.class, false, "When this creature dies, you may return target Spirit card with converted mana cost %d or less from your graveyard to your hand."), SPLICE(KeywordWithCostAndType.class, false, "You may reveal this card from your hand as you cast a %s spell. If you do, copy this card's text box onto that spell and pay %s as an additional cost to cast that spell."), diff --git a/forge-gui/res/cardsfolder/d/deadbridge_goliath.txt b/forge-gui/res/cardsfolder/d/deadbridge_goliath.txt index d006a0a6a8d..d068d08fcd3 100644 --- a/forge-gui/res/cardsfolder/d/deadbridge_goliath.txt +++ b/forge-gui/res/cardsfolder/d/deadbridge_goliath.txt @@ -2,7 +2,6 @@ Name:Deadbridge Goliath ManaCost:2 G G Types:Creature Insect PT:5/5 -A:AB$ PutCounter | Cost$ 4 G G ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:4 G G SVar:Picture:http://www.wizards.com/global/images/magic/general/deadbridge_goliath.jpg Oracle:Scavenge {4}{G}{G} ({4}{G}{G}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/d/dreg_mangler.txt b/forge-gui/res/cardsfolder/d/dreg_mangler.txt index 12d62f1a069..aa2e64a2352 100644 --- a/forge-gui/res/cardsfolder/d/dreg_mangler.txt +++ b/forge-gui/res/cardsfolder/d/dreg_mangler.txt @@ -3,7 +3,6 @@ ManaCost:1 B G Types:Creature Plant Zombie PT:3/3 K:Haste -A:AB$ PutCounter | Cost$ 3 B G ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:3 B G SVar:Picture:http://www.wizards.com/global/images/magic/general/dreg_mangler.jpg Oracle:Haste\nScavenge {3}{B}{G} ({3}{B}{G}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/d/drudge_beetle.txt b/forge-gui/res/cardsfolder/d/drudge_beetle.txt index fe87f25affa..2c59df97f01 100644 --- a/forge-gui/res/cardsfolder/d/drudge_beetle.txt +++ b/forge-gui/res/cardsfolder/d/drudge_beetle.txt @@ -2,7 +2,6 @@ Name:Drudge Beetle ManaCost:1 G Types:Creature Insect PT:2/2 -A:AB$ PutCounter | Cost$ 5 G ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:5 G SVar:Picture:http://www.wizards.com/global/images/magic/general/drudge_beetle.jpg Oracle:Scavenge {5}{G} ({5}{G}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/g/golgari_decoy.txt b/forge-gui/res/cardsfolder/g/golgari_decoy.txt index a1ac147e6e5..a23f2071f79 100644 --- a/forge-gui/res/cardsfolder/g/golgari_decoy.txt +++ b/forge-gui/res/cardsfolder/g/golgari_decoy.txt @@ -3,7 +3,6 @@ ManaCost:3 G Types:Creature Elf Rogue PT:2/2 K:All creatures able to block CARDNAME do so. -A:AB$ PutCounter | Cost$ 3 G G ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:3 G G SVar:Picture:http://www.wizards.com/global/images/magic/general/golgari_decoy.jpg Oracle:All creatures able to block Golgari Decoy do so.\nScavenge {3}{G}{G} ({3}{G}{G}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/k/korozda_monitor.txt b/forge-gui/res/cardsfolder/k/korozda_monitor.txt index 254aba94013..1b2f8e8a651 100644 --- a/forge-gui/res/cardsfolder/k/korozda_monitor.txt +++ b/forge-gui/res/cardsfolder/k/korozda_monitor.txt @@ -3,7 +3,6 @@ ManaCost:2 G G Types:Creature Lizard PT:3/3 K:Trample -A:AB$ PutCounter | Cost$ 5 G G ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:5 G G SVar:Picture:http://www.wizards.com/global/images/magic/general/korozda_monitor.jpg Oracle:Trample\nScavenge {5}{G}{G} ({5}{G}{G}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/s/sewer_shambler.txt b/forge-gui/res/cardsfolder/s/sewer_shambler.txt index b88bf1f008a..dcb170b3e0b 100644 --- a/forge-gui/res/cardsfolder/s/sewer_shambler.txt +++ b/forge-gui/res/cardsfolder/s/sewer_shambler.txt @@ -3,7 +3,6 @@ ManaCost:2 B Types:Creature Zombie PT:2/1 K:Swampwalk -A:AB$ PutCounter | Cost$ 2 B ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:2 B SVar:Picture:http://www.wizards.com/global/images/magic/general/sewer_shambler.jpg Oracle:Swampwalk (This creature can't be blocked as long as defending player controls a Swamp.)\nScavenge {2}{B} ({2}{B}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/s/slitherhead.txt b/forge-gui/res/cardsfolder/s/slitherhead.txt index 0d335815ae4..6a3d04e7b1a 100644 --- a/forge-gui/res/cardsfolder/s/slitherhead.txt +++ b/forge-gui/res/cardsfolder/s/slitherhead.txt @@ -2,8 +2,7 @@ Name:Slitherhead ManaCost:BG Types:Creature Plant Zombie PT:1/1 -A:AB$ PutCounter | Cost$ 0 ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:0 SVar:SacMe:1 SVar:DiscardMe:1 SVar:Picture:http://www.wizards.com/global/images/magic/general/slitherhead.jpg diff --git a/forge-gui/res/cardsfolder/s/sluiceway_scorpion.txt b/forge-gui/res/cardsfolder/s/sluiceway_scorpion.txt index 35381cf7a0a..af2d5c57ce6 100644 --- a/forge-gui/res/cardsfolder/s/sluiceway_scorpion.txt +++ b/forge-gui/res/cardsfolder/s/sluiceway_scorpion.txt @@ -3,7 +3,6 @@ ManaCost:2 B G Types:Creature Scorpion PT:2/2 K:Deathtouch -A:AB$ PutCounter | Cost$ 1 B G ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:1 B G SVar:Picture:http://www.wizards.com/global/images/magic/general/sluiceway_scorpion.jpg Oracle:Deathtouch (Any amount of damage this deals to a creature is enough to destroy it.)\nScavenge {1}{B}{G} ({1}{B}{G}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/t/terrus_wurm.txt b/forge-gui/res/cardsfolder/t/terrus_wurm.txt index 62e52a52384..1b495d62687 100644 --- a/forge-gui/res/cardsfolder/t/terrus_wurm.txt +++ b/forge-gui/res/cardsfolder/t/terrus_wurm.txt @@ -2,7 +2,6 @@ Name:Terrus Wurm ManaCost:6 B Types:Creature Zombie Wurm PT:5/5 -A:AB$ PutCounter | Cost$ 6 B ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:6 B SVar:Picture:http://www.wizards.com/global/images/magic/general/terrus_wurm.jpg Oracle:Scavenge {6}{B} ({6}{B}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/t/thrashing_mossdog.txt b/forge-gui/res/cardsfolder/t/thrashing_mossdog.txt index 1fce8713d16..67a31588082 100644 --- a/forge-gui/res/cardsfolder/t/thrashing_mossdog.txt +++ b/forge-gui/res/cardsfolder/t/thrashing_mossdog.txt @@ -3,7 +3,6 @@ ManaCost:3 G Types:Creature Plant Hound PT:3/3 K:Reach -A:AB$ PutCounter | Cost$ 4 G G ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:4 G G SVar:Picture:http://www.wizards.com/global/images/magic/general/thrashing_mossdog.jpg Oracle:Reach (This creature can block creatures with flying.)\nScavenge {4}{G}{G} ({4}{G}{G}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.) diff --git a/forge-gui/res/cardsfolder/v/varolz_the_scar_striped.txt b/forge-gui/res/cardsfolder/v/varolz_the_scar_striped.txt index e101ec7c8a6..4cd79b4e79c 100644 --- a/forge-gui/res/cardsfolder/v/varolz_the_scar_striped.txt +++ b/forge-gui/res/cardsfolder/v/varolz_the_scar_striped.txt @@ -2,9 +2,7 @@ Name:Varolz, the Scar-Striped ManaCost:1 B G Types:Legendary Creature Troll Warrior PT:2/2 -S:Mode$ Continuous | Affected$ Creature.YouOwn | AffectedZone$ Graveyard | AddAbility$ VarolzScavenge | AddSVar$ VarolzX | Description$ Each creature card in your graveyard has scavenge. The scavenge cost is equal to its mana cost. -SVar:VarolzScavenge:AB$ PutCounter | Cost$ CardManaCost ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ VarolzX | SorcerySpeed$ True | References$ VarolzX | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:VarolzX:Count$CardPower +S:Mode$ Continuous | Affected$ Creature.YouOwn | AffectedZone$ Graveyard | AddKeyword$ Scavenge:CardManaCost | Description$ Each creature card in your graveyard has scavenge. The scavenge cost is equal to its mana cost. A:AB$ Regenerate | Cost$ Sac<1/Creature.Other/another creature> | SpellDescription$ Regenerate CARDNAME. SVar:Picture:http://www.wizards.com/global/images/magic/general/varolz_the_scar_striped.jpg Oracle:Each creature card in your graveyard has scavenge. The scavenge cost is equal to its mana cost. (Exile a creature card from your graveyard and pay its mana cost: Put a number of +1/+1 counters equal to that card's power on target creature. Scavenge only as a sorcery.)\nSacrifice another creature: Regenerate Varolz, the Scar-Striped. diff --git a/forge-gui/res/cardsfolder/z/zanikev_locust.txt b/forge-gui/res/cardsfolder/z/zanikev_locust.txt index 663672c8416..43cdcf0173d 100644 --- a/forge-gui/res/cardsfolder/z/zanikev_locust.txt +++ b/forge-gui/res/cardsfolder/z/zanikev_locust.txt @@ -3,7 +3,6 @@ ManaCost:5 B Types:Creature Insect PT:3/3 K:Flying -A:AB$ PutCounter | Cost$ 2 B B ExileFromGrave<1/CARDNAME> | ActivationZone$ Graveyard | ValidTgts$ Creature | CounterType$ P1P1 | CounterNum$ X | SorcerySpeed$ True | References$ X | PrecostDesc$ Scavenge | SpellDescription$ Put a number of +1/+1 counter's equal to this card's power on target creature. Scavenge only as a sorcery. -SVar:X:Count$CardPower +K:Scavenge:2 B B SVar:Picture:http://www.wizards.com/global/images/magic/general/zanikev_locust.jpg Oracle:Flying\nScavenge {2}{B}{B} ({2}{B}{B}, Exile this card from your graveyard: Put a number of +1/+1 counters equal to this card's power on target creature. Scavenge only as a sorcery.)