diff --git a/Mage.Sets/src/mage/cards/a/AnthousaSetessanHero.java b/Mage.Sets/src/mage/cards/a/AnthousaSetessanHero.java index 99f8f2cb32b..0a3831fcd01 100644 --- a/Mage.Sets/src/mage/cards/a/AnthousaSetessanHero.java +++ b/Mage.Sets/src/mage/cards/a/AnthousaSetessanHero.java @@ -41,6 +41,7 @@ import mage.constants.SuperType; import mage.filter.common.FilterControlledLandPermanent; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import mage.target.common.TargetControlledPermanent; /** @@ -59,7 +60,7 @@ public class AnthousaSetessanHero extends CardImpl { this.toughness = new MageInt(5); // Heroic - Whenever you cast a spell that targets Anthousa, Setessan Hero, up to three target lands you control each become 2/2 Warrior creatures until end of turn. They're still lands. - Ability ability = new HeroicAbility(new BecomesCreatureTargetEffect(new AnthousaWarriorToken(), false, true, Duration.EndOfTurn)); + Ability ability = new HeroicAbility(new BecomesCreatureTargetEffect(new CreatureToken(2, 2, "2/2 Warrior creature", SubType.WARRIOR),false,true, Duration.EndOfTurn)); ability.addTarget(new TargetControlledPermanent(0,3,new FilterControlledLandPermanent("lands"), false)); this.addAbility(ability); } @@ -72,23 +73,4 @@ public class AnthousaSetessanHero extends CardImpl { public AnthousaSetessanHero copy() { return new AnthousaSetessanHero(this); } -} - -class AnthousaWarriorToken extends TokenImpl { - - public AnthousaWarriorToken() { - super("", "2/2 Warrior creatures"); - cardType.add(CardType.CREATURE); - subtype.add(SubType.WARRIOR); - power = new MageInt(2); - toughness = new MageInt(2); - } - public AnthousaWarriorToken(final AnthousaWarriorToken token) { - super(token); - } - - public AnthousaWarriorToken copy() { - return new AnthousaWarriorToken(this); - } - } \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/e/ElvishBranchbender.java b/Mage.Sets/src/mage/cards/e/ElvishBranchbender.java index 8607e795b7d..bb7331da6e1 100644 --- a/Mage.Sets/src/mage/cards/e/ElvishBranchbender.java +++ b/Mage.Sets/src/mage/cards/e/ElvishBranchbender.java @@ -106,7 +106,7 @@ class ElvishBranchbenderEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { int xValue = new PermanentsOnBattlefieldCount(filter).calculate(game, source, this); - ContinuousEffect effect = new BecomesCreatureTargetEffect(new ElvishBranchbenderToken(xValue), false, false, Duration.EndOfTurn); + ContinuousEffect effect = new BecomesCreatureTargetEffect(new ElvishBranchbenderToken(xValue), false, false, Duration.EndOfTurn); // fix effect.setTargetPointer(targetPointer); game.addEffect(effect, source); return false; diff --git a/Mage.Sets/src/mage/cards/f/FendeepSummoner.java b/Mage.Sets/src/mage/cards/f/FendeepSummoner.java index 5573da9132f..fcc7d7e45b6 100644 --- a/Mage.Sets/src/mage/cards/f/FendeepSummoner.java +++ b/Mage.Sets/src/mage/cards/f/FendeepSummoner.java @@ -43,7 +43,9 @@ import mage.filter.common.FilterLandPermanent; import mage.filter.predicate.mageobject.SubtypePredicate; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import mage.target.common.TargetLandPermanent; +import mage.util.SubTypeList; /** * @author anonymous @@ -65,7 +67,9 @@ public class FendeepSummoner extends CardImpl { this.toughness = new MageInt(5); // {T}: Up to two target Swamps each become 3/5 Treefolk Warrior creatures in addition to their other types until end of turn. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new FendeepSummonerToken(), false, false, Duration.EndOfTurn), new TapSourceCost()); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect( + new CreatureToken(3, 5, "3/5 Treefolk Warrior", new SubTypeList(SubType.TREEFOLK, SubType.WARRIOR)), + false, false, Duration.EndOfTurn), new TapSourceCost()); ability.addTarget(new TargetLandPermanent(0, 2, filter, false)); this.addAbility(ability); } @@ -79,22 +83,3 @@ public class FendeepSummoner extends CardImpl { return new FendeepSummoner(this); } } - -class FendeepSummonerToken extends TokenImpl { - - public FendeepSummonerToken() { - super("", "3/5 Treefolk Warrior"); - this.cardType.add(CardType.CREATURE); - this.subtype.add(SubType.TREEFOLK); - this.subtype.add(SubType.WARRIOR); - this.power = new MageInt(3); - this.toughness = new MageInt(5); - } - public FendeepSummonerToken(final FendeepSummonerToken token) { - super(token); - } - - public FendeepSummonerToken copy() { - return new FendeepSummonerToken(this); - } -} diff --git a/Mage.Sets/src/mage/cards/o/Omnibian.java b/Mage.Sets/src/mage/cards/o/Omnibian.java index 943ed6b4c74..04c91e69c7a 100644 --- a/Mage.Sets/src/mage/cards/o/Omnibian.java +++ b/Mage.Sets/src/mage/cards/o/Omnibian.java @@ -41,6 +41,7 @@ import mage.constants.Duration; import mage.constants.Zone; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import mage.target.common.TargetCreaturePermanent; /** @@ -57,7 +58,9 @@ public class Omnibian extends CardImpl { this.toughness = new MageInt(3); // {T}: Target creature becomes a 3/3 Frog until end of turn. - Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new OmnibianFrogToken(), false, false, Duration.EndOfTurn), new TapSourceCost()); + Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect( + new CreatureToken(3, 3, "3/3 Frog", SubType.FROG), + false, false, Duration.EndOfTurn), new TapSourceCost()); ability.addTarget(new TargetCreaturePermanent()); this.addAbility(ability); } @@ -70,21 +73,4 @@ public class Omnibian extends CardImpl { public Omnibian copy() { return new Omnibian(this); } -} - -class OmnibianFrogToken extends TokenImpl { - - public OmnibianFrogToken() { - super("", "3/3 Frog"); - this.subtype.add(SubType.FROG); - this.power = new MageInt(3); - this.toughness = new MageInt(3); - } - public OmnibianFrogToken(final OmnibianFrogToken token) { - super(token); - } - - public OmnibianFrogToken copy() { - return new OmnibianFrogToken(this); - } -} +} \ No newline at end of file diff --git a/Mage/src/main/java/mage/game/permanent/token/custom/CreatureToken.java b/Mage/src/main/java/mage/game/permanent/token/custom/CreatureToken.java index d7cd2e4527e..26a7c3bbb9b 100644 --- a/Mage/src/main/java/mage/game/permanent/token/custom/CreatureToken.java +++ b/Mage/src/main/java/mage/game/permanent/token/custom/CreatureToken.java @@ -2,7 +2,9 @@ package mage.game.permanent.token.custom; import mage.MageInt; import mage.constants.CardType; +import mage.constants.SubType; import mage.game.permanent.token.TokenImpl; +import mage.util.SubTypeList; /** * @@ -15,8 +17,21 @@ public class CreatureToken extends TokenImpl { } public CreatureToken(int power, int toughness) { - super("", String.format("%d/%d creature", power, toughness)); + this(power, toughness, String.format("%d/%d creature", power, toughness)); + } + + public CreatureToken(int power, int toughness, String description) { + this(power, toughness, description, (SubTypeList) null); + } + + public CreatureToken(int power, int toughness, String description, SubType extraSubType) { + this(power, toughness, description, new SubTypeList(extraSubType)); + } + + public CreatureToken(int power, int toughness, String description, SubTypeList extraSubTypes) { + super("", description); this.cardType.add(CardType.CREATURE); + this.subtype.addAll(extraSubTypes); this.power = new MageInt(power); this.toughness = new MageInt(toughness); } diff --git a/Mage/src/main/java/mage/util/SubTypeList.java b/Mage/src/main/java/mage/util/SubTypeList.java index cf6fd8ef9e8..84b4fa74912 100644 --- a/Mage/src/main/java/mage/util/SubTypeList.java +++ b/Mage/src/main/java/mage/util/SubTypeList.java @@ -10,7 +10,15 @@ import java.util.stream.Collectors; public class SubTypeList extends ArrayList { + public SubTypeList(SubType firstSubType) { + super(); + this.add(firstSubType); + } + public SubTypeList(SubType... subTypesList) { + super(); + Collections.addAll(this, subTypesList); + } @Deprecated public boolean addAll(List subtypes) {