From e27d302e9ddaba0ece757888a6317e4c09931d8a Mon Sep 17 00:00:00 2001 From: Evan Kranzler Date: Thu, 7 Sep 2017 15:58:55 -0400 Subject: [PATCH] updated card generation template for subtype enum --- Mage.Sets/src/mage/cards/h/HuatlisSnubhorn.java | 5 +++-- Mage.Sets/src/mage/cards/t/TempleOfAclazotz.java | 12 ++++++------ Utils/cardClass.tmpl | 3 +++ Utils/gen-card.pl | 5 ++++- 4 files changed, 16 insertions(+), 9 deletions(-) diff --git a/Mage.Sets/src/mage/cards/h/HuatlisSnubhorn.java b/Mage.Sets/src/mage/cards/h/HuatlisSnubhorn.java index 5ea7d6a700..74a2c6ea24 100644 --- a/Mage.Sets/src/mage/cards/h/HuatlisSnubhorn.java +++ b/Mage.Sets/src/mage/cards/h/HuatlisSnubhorn.java @@ -29,6 +29,7 @@ package mage.cards.h; import java.util.UUID; import mage.MageInt; +import mage.constants.SubType; import mage.abilities.keyword.VigilanceAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; @@ -42,8 +43,8 @@ public class HuatlisSnubhorn extends CardImpl { public HuatlisSnubhorn(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{1}{W}"); - - this.subtype.add("Dinosaur"); + + this.subtype.add(SubType.DINOSAUR); this.power = new MageInt(2); this.toughness = new MageInt(2); diff --git a/Mage.Sets/src/mage/cards/t/TempleOfAclazotz.java b/Mage.Sets/src/mage/cards/t/TempleOfAclazotz.java index ea8908af27..456e62b94c 100644 --- a/Mage.Sets/src/mage/cards/t/TempleOfAclazotz.java +++ b/Mage.Sets/src/mage/cards/t/TempleOfAclazotz.java @@ -62,7 +62,7 @@ public class TempleOfAclazotz extends CardImpl { this.addAbility(new BlackManaAbility()); // {T}, Sacrifice a creature: You gain life equal to the sacrificed creature’s toughness. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new MirenTheMoallEffect(), new TapSourceCost()); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new TempleOfAclazotzEffect(), new TapSourceCost()); ability.addCost(new SacrificeTargetCost(new TargetControlledCreaturePermanent(1, 1, new FilterControlledCreaturePermanent("a creature"), true))); this.addAbility(ability); } @@ -77,20 +77,20 @@ public class TempleOfAclazotz extends CardImpl { } } -class MirenTheMoallEffect extends OneShotEffect { +class TempleOfAclazotzEffect extends OneShotEffect { - public MirenTheMoallEffect() { + public TempleOfAclazotzEffect() { super(Outcome.GainLife); this.staticText = "You gain life equal to the sacrificed creature's toughness"; } - public MirenTheMoallEffect(final MirenTheMoallEffect effect) { + public TempleOfAclazotzEffect(final TempleOfAclazotzEffect effect) { super(effect); } @Override - public MirenTheMoallEffect copy() { - return new MirenTheMoallEffect(this); + public TempleOfAclazotzEffect copy() { + return new TempleOfAclazotzEffect(this); } @Override diff --git a/Utils/cardClass.tmpl b/Utils/cardClass.tmpl index e5afa68f0a..587020011c 100644 --- a/Utils/cardClass.tmpl +++ b/Utils/cardClass.tmpl @@ -34,6 +34,9 @@ if ($power || $power eq 0) { }else { $OUT .= "\nimport mage.MageInt;" } +if ($hasSubTypes eq 'true') { + $OUT .="\nimport mage.constants.SubType;" +} } =][=$abilitiesImports=] import mage.cards.CardImpl; diff --git a/Utils/gen-card.pl b/Utils/gen-card.pl index 9f011e081f..b39fc0bbbc 100755 --- a/Utils/gen-card.pl +++ b/Utils/gen-card.pl @@ -186,6 +186,7 @@ $vars{'toughness'} = $card[7]; my @types; $vars{'planeswalker'} = 'false'; $vars{'subType'} = ''; +$vars{'hasSubTypes'} = 'false'; my $cardAbilities = $card[8]; my $type = $card[5]; while ($type =~ m/([a-zA-Z]+)( )*/g) { @@ -197,7 +198,9 @@ while ($type =~ m/([a-zA-Z]+)( )*/g) { } } else { if (@types) { - $vars{'subType'} .= "\n this.subtype.add(\"$1\");"; + my $st = uc($1); + $vars{'subType'} .= "\n this.subtype.add(SubType.$st);"; + $vars{'hasSubTypes'} = 'true'; } else { my $st = uc($1); $vars{'subType'} .= "\n addSuperType(SuperType.$st);";