diff --git a/Mage.Sets/src/mage/cards/a/AmbushCommander.java b/Mage.Sets/src/mage/cards/a/AmbushCommander.java index 54851fb9b33..f5a03b89350 100644 --- a/Mage.Sets/src/mage/cards/a/AmbushCommander.java +++ b/Mage.Sets/src/mage/cards/a/AmbushCommander.java @@ -45,6 +45,7 @@ import mage.filter.common.FilterControlledPermanent; 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.TargetControlledCreaturePermanent; import mage.target.common.TargetCreaturePermanent; @@ -69,9 +70,12 @@ public class AmbushCommander extends CardImpl { this.toughness = new MageInt(2); // Forests you control are 1/1 green Elf creatures that are still lands. - ContinuousEffect effect = new BecomesCreatureAllEffect(new AmbushCommanderToken(), "lands", filter2, Duration.WhileOnBattlefield); + ContinuousEffect effect = new BecomesCreatureAllEffect( + new CreatureToken(1, 1, "1/1 green Elf creature").withColor("G").withSubType(SubType.ELF), + "lands", filter2, Duration.WhileOnBattlefield, true); effect.getDependencyTypes().add(DependencyType.BecomeForest); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); + // {1}{G}, Sacrifice an Elf: Target creature gets +3/+3 until end of turn. Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(3, 3, Duration.EndOfTurn), new ManaCostsImpl("{1}{G}")); @@ -89,23 +93,3 @@ public class AmbushCommander extends CardImpl { return new AmbushCommander(this); } } - -class AmbushCommanderToken extends TokenImpl { - - public AmbushCommanderToken() { - super("Elf", "1/1 green Elf creatures"); - subtype.add(SubType.ELF); - cardType.add(CardType.CREATURE); - power = new MageInt(1); - toughness = new MageInt(1); - color.setGreen(true); - } - public AmbushCommanderToken(final AmbushCommanderToken token) { - super(token); - } - - public AmbushCommanderToken copy() { - return new AmbushCommanderToken(this); - } - -} diff --git a/Mage.Sets/src/mage/cards/d/Dragonshift.java b/Mage.Sets/src/mage/cards/d/Dragonshift.java index 8f6c7036df5..f83827191e4 100644 --- a/Mage.Sets/src/mage/cards/d/Dragonshift.java +++ b/Mage.Sets/src/mage/cards/d/Dragonshift.java @@ -48,6 +48,7 @@ import mage.filter.common.FilterCreaturePermanent; import mage.filter.predicate.permanent.ControllerPredicate; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; import mage.target.common.TargetControlledCreaturePermanent; /** @@ -64,16 +65,25 @@ public class Dragonshift extends CardImpl { public Dragonshift(UUID ownerId, CardSetInfo setInfo) { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{1}{U}{R}"); - // Until end of turn, target creature you control becomes a blue and red Dragon with base power and toughness 4/4, loses all abilities, and gains flying. - Effect effect = new BecomesCreatureTargetEffect(new DragonToken(), true, false, Duration.EndOfTurn); + Effect effect = new BecomesCreatureTargetEffect( + new CreatureToken(4, 4, "blue and red Dragon with base power and toughness 4/4") + .withSubType(SubType.DRAGON) + .withColor("UR") + .withAbility(FlyingAbility.getInstance()), + true, false, Duration.EndOfTurn); effect.setText("Until end of turn, target creature you control becomes a blue and red Dragon with base power and toughness 4/4, loses all abilities, and gains flying."); this.getSpellAbility().addEffect(effect); this.getSpellAbility().addTarget(new TargetControlledCreaturePermanent()); // Overload {3}{U}{U}{R}{R} Ability ability = new OverloadAbility(this, new LoseAllAbilitiesAllEffect(new FilterControlledCreaturePermanent(""), Duration.EndOfTurn), new ManaCostsImpl("{3}{U}{U}{R}{R}")); - ability.addEffect(new BecomesCreatureAllEffect(new DragonToken(), null, filter, Duration.EndOfTurn)); + ability.addEffect(new BecomesCreatureAllEffect( + new CreatureToken(4, 4, "blue and red Dragon with base power and toughness 4/4 and with flying") + .withColor("UR") + .withSubType(SubType.DRAGON) + .withAbility(FlyingAbility.getInstance()), + null, filter, Duration.EndOfTurn, true)); this.addAbility(ability); } @@ -85,26 +95,4 @@ public class Dragonshift extends CardImpl { public Dragonshift copy() { return new Dragonshift(this); } - - private class DragonToken extends TokenImpl { - - public DragonToken() { - super("Dragon", "blue and red Dragon with base power and toughness 4/4 and with flying"); - cardType.add(CardType.CREATURE); - color.setBlue(true); - color.setRed(true); - subtype.add(SubType.DRAGON); - power = new MageInt(4); - toughness = new MageInt(4); - this.addAbility(FlyingAbility.getInstance()); - } - public DragonToken(final DragonToken token) { - super(token); - } - - public DragonToken copy() { - return new DragonToken(this); - } - - } -} +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/cards/k/KormusBell.java b/Mage.Sets/src/mage/cards/k/KormusBell.java index db2597e79c0..df3b4a5520f 100644 --- a/Mage.Sets/src/mage/cards/k/KormusBell.java +++ b/Mage.Sets/src/mage/cards/k/KormusBell.java @@ -38,6 +38,7 @@ import mage.constants.*; import mage.filter.FilterPermanent; import mage.game.permanent.token.TokenImpl; import mage.game.permanent.token.Token; +import mage.game.permanent.token.custom.CreatureToken; /** * @@ -50,7 +51,9 @@ public class KormusBell extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{4}"); // All Swamps are 1/1 black creatures that are still lands. - ContinuousEffect effect = new BecomesCreatureAllEffect(new KormusBellToken(), "lands", new FilterPermanent(SubType.SWAMP, "Swamps"), Duration.WhileOnBattlefield); + ContinuousEffect effect = new BecomesCreatureAllEffect( + new CreatureToken(1, 1, "1/1 black creature").withColor("B"), + "lands", new FilterPermanent(SubType.SWAMP, "Swamps"), Duration.WhileOnBattlefield, true); effect.setDependedToType(DependencyType.BecomeSwamp); effect.addDependedToType(DependencyType.BecomeIsland); effect.addDependedToType(DependencyType.BecomeMountain); @@ -66,21 +69,3 @@ public class KormusBell extends CardImpl { return new KormusBell(this); } } - -class KormusBellToken extends TokenImpl { - - public KormusBellToken() { - super("", "1/1 black creatures"); - cardType.add(CardType.CREATURE); - power = new MageInt(1); - toughness = new MageInt(1); - color.setBlack(true); // black creatures - } - public KormusBellToken(final KormusBellToken token) { - super(token); - } - - public KormusBellToken copy() { - return new KormusBellToken(this); - } -} diff --git a/Mage.Sets/src/mage/cards/l/LifeDeath.java b/Mage.Sets/src/mage/cards/l/LifeDeath.java index 09ac7fd7104..6e8c8018e25 100644 --- a/Mage.Sets/src/mage/cards/l/LifeDeath.java +++ b/Mage.Sets/src/mage/cards/l/LifeDeath.java @@ -61,8 +61,9 @@ public class LifeDeath extends SplitCard { // Life // All lands you control become 1/1 creatures until end of turn. They're still lands. - getLeftHalfCard().getSpellAbility().addEffect(new BecomesCreatureAllEffect(new CreatureToken(1, 1), "lands", - new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn, false)); + getLeftHalfCard().getSpellAbility().addEffect(new BecomesCreatureAllEffect( + new CreatureToken(1, 1), + "lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn, false)); // Death // Return target creature card from your graveyard to the battlefield. You lose life equal to its converted mana cost. diff --git a/Mage.Sets/src/mage/cards/l/LivingLands.java b/Mage.Sets/src/mage/cards/l/LivingLands.java index cad2c48b2f5..08b25821847 100644 --- a/Mage.Sets/src/mage/cards/l/LivingLands.java +++ b/Mage.Sets/src/mage/cards/l/LivingLands.java @@ -58,7 +58,9 @@ public class LivingLands extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}"); // All Forests are 1/1 creatures that are still lands. - ContinuousEffect effect = new BecomesCreatureAllEffect(new CreatureToken(1, 1), "lands", filter, Duration.WhileOnBattlefield, false); + ContinuousEffect effect = new BecomesCreatureAllEffect( + new CreatureToken(1, 1), + "lands", filter, Duration.WhileOnBattlefield, false); effect.getDependencyTypes().add(DependencyType.BecomeForest); this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, effect)); } diff --git a/Mage.Sets/src/mage/cards/l/LivingPlane.java b/Mage.Sets/src/mage/cards/l/LivingPlane.java index 6eb10ce1cdd..86694ca1811 100644 --- a/Mage.Sets/src/mage/cards/l/LivingPlane.java +++ b/Mage.Sets/src/mage/cards/l/LivingPlane.java @@ -53,7 +53,9 @@ public class LivingPlane extends CardImpl { this.addSuperType(SuperType.WORLD); // All lands are 1/1 creatures that are still lands. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new CreatureToken(1, 1), "lands", StaticFilters.FILTER_LANDS, Duration.WhileOnBattlefield, false))); + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect( + new CreatureToken(1, 1), + "lands", StaticFilters.FILTER_LANDS, Duration.WhileOnBattlefield, false))); } public LivingPlane(final LivingPlane card) { diff --git a/Mage.Sets/src/mage/cards/n/NaturalAffinity.java b/Mage.Sets/src/mage/cards/n/NaturalAffinity.java index 54f15726540..ab338324804 100644 --- a/Mage.Sets/src/mage/cards/n/NaturalAffinity.java +++ b/Mage.Sets/src/mage/cards/n/NaturalAffinity.java @@ -53,7 +53,9 @@ public class NaturalAffinity extends CardImpl { super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}"); // All lands become 2/2 creatures until end of turn. They're still lands. - this.getSpellAbility().addEffect(new BecomesCreatureAllEffect(new CreatureToken(2, 2), "lands", StaticFilters.FILTER_LANDS, Duration.EndOfTurn, false)); + this.getSpellAbility().addEffect(new BecomesCreatureAllEffect( + new CreatureToken(2, 2), + "lands", StaticFilters.FILTER_LANDS, Duration.EndOfTurn, false)); } public NaturalAffinity(final NaturalAffinity card) { diff --git a/Mage.Sets/src/mage/cards/n/NaturesRevolt.java b/Mage.Sets/src/mage/cards/n/NaturesRevolt.java index 8520a39f4ad..510992dce1a 100644 --- a/Mage.Sets/src/mage/cards/n/NaturesRevolt.java +++ b/Mage.Sets/src/mage/cards/n/NaturesRevolt.java @@ -52,7 +52,8 @@ public class NaturesRevolt extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{G}{G}"); // All lands are 2/2 creatures that are still lands. - this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect(new CreatureToken(2, 2), + this.addAbility(new SimpleStaticAbility(Zone.BATTLEFIELD, new BecomesCreatureAllEffect( + new CreatureToken(2, 2), "lands", new FilterLandPermanent(), Duration.WhileOnBattlefield, false))); } diff --git a/Mage.Sets/src/mage/cards/r/RudeAwakening.java b/Mage.Sets/src/mage/cards/r/RudeAwakening.java index 8a3c0dda106..90ac29b8bcf 100644 --- a/Mage.Sets/src/mage/cards/r/RudeAwakening.java +++ b/Mage.Sets/src/mage/cards/r/RudeAwakening.java @@ -58,7 +58,9 @@ public class RudeAwakening extends CardImpl { this.getSpellAbility().addEffect(new UntapAllLandsControllerEffect()); // or until end of turn, lands you control become 2/2 creatures that are still lands. Mode mode = new Mode(); - mode.getEffects().add(new BecomesCreatureAllEffect(new CreatureToken(2, 2), "lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn, false)); + mode.getEffects().add(new BecomesCreatureAllEffect( + new CreatureToken(2, 2), + "lands", new FilterControlledLandPermanent("lands you control"), Duration.EndOfTurn, false)); this.getSpellAbility().getModes().addMode(mode); // Entwine {2}{G} diff --git a/Mage.Sets/src/mage/cards/s/SylvanAwakening.java b/Mage.Sets/src/mage/cards/s/SylvanAwakening.java index cdecc5c2f5d..8fd3fc6f81d 100644 --- a/Mage.Sets/src/mage/cards/s/SylvanAwakening.java +++ b/Mage.Sets/src/mage/cards/s/SylvanAwakening.java @@ -40,6 +40,7 @@ import mage.constants.Duration; import mage.constants.SubType; import mage.filter.common.FilterControlledLandPermanent; import mage.game.permanent.token.TokenImpl; +import mage.game.permanent.token.custom.CreatureToken; /** * @@ -52,7 +53,11 @@ public class SylvanAwakening extends CardImpl { // Until your next turn, all lands you control become 2/2 Elemental creatures with reach, indestructible, and haste. They're still lands. this.getSpellAbility().addEffect(new BecomesCreatureAllEffect( - new SylvanAwakeningToken(), + new CreatureToken(2, 2, "2/2 Elemental creatures with reach, indestructible, and haste") + .withSubType(SubType.ELEMENTAL) + .withAbility(ReachAbility.getInstance()) + .withAbility(IndestructibleAbility.getInstance()) + .withAbility(HasteAbility.getInstance()), "lands", new FilterControlledLandPermanent("all lands you control"), Duration.UntilYourNextTurn, @@ -69,26 +74,3 @@ public class SylvanAwakening extends CardImpl { return new SylvanAwakening(this); } } - -class SylvanAwakeningToken extends TokenImpl { - - public SylvanAwakeningToken() { - super("", "2/2 Elemental creatures with reach, indestructible, and haste"); - cardType.add(CardType.CREATURE); - this.subtype.add(SubType.ELEMENTAL); - power = new MageInt(2); - toughness = new MageInt(2); - this.addAbility(ReachAbility.getInstance()); - this.addAbility(IndestructibleAbility.getInstance()); - this.addAbility(HasteAbility.getInstance()); - } - - public SylvanAwakeningToken(final SylvanAwakeningToken token) { - super(token); - } - - public SylvanAwakeningToken copy() { - return new SylvanAwakeningToken(this); - } - -} diff --git a/Mage.Sets/src/mage/cards/t/TheloniteDruid.java b/Mage.Sets/src/mage/cards/t/TheloniteDruid.java index 31accefe2f4..1bec2cecff1 100644 --- a/Mage.Sets/src/mage/cards/t/TheloniteDruid.java +++ b/Mage.Sets/src/mage/cards/t/TheloniteDruid.java @@ -68,7 +68,9 @@ public class TheloniteDruid extends CardImpl { this.toughness = new MageInt(1); // {1}{G}, {tap}, Sacrifice a creature: Forests you control become 2/3 creatures until end of turn. They're still lands. - ContinuousEffect effect = new BecomesCreatureAllEffect(new CreatureToken(2, 3), "Forests", filter, Duration.EndOfTurn, false); + ContinuousEffect effect = new BecomesCreatureAllEffect( + new CreatureToken(2, 3), + "Forests", filter, Duration.EndOfTurn, false); effect.getDependencyTypes().add(DependencyType.BecomeForest); Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, effect, diff --git a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java index acafb0666af..bf405711521 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/continuous/BecomesCreatureAllEffect.java @@ -52,14 +52,14 @@ import java.util.Set; public class BecomesCreatureAllEffect extends ContinuousEffectImpl { protected Token token; - protected String type; + protected String theyAreStillType; private final FilterPermanent filter; private boolean loseColor = true; - public BecomesCreatureAllEffect(Token token, String type, FilterPermanent filter, Duration duration, boolean loseColor) { + public BecomesCreatureAllEffect(Token token, String theyAreStillType, FilterPermanent filter, Duration duration, boolean loseColor) { super(duration, Outcome.BecomeCreature); this.token = token; - this.type = type; + this.theyAreStillType = theyAreStillType; this.filter = filter; this.loseColor = loseColor; } @@ -67,7 +67,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { public BecomesCreatureAllEffect(final BecomesCreatureAllEffect effect) { super(effect); this.token = effect.token.copy(); - this.type = effect.type; + this.theyAreStillType = effect.theyAreStillType; this.filter = effect.filter.copy(); this.loseColor = effect.loseColor; } @@ -110,7 +110,7 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { } } } - if (type == null) { + if (theyAreStillType == null) { permanent.getSubtype(game).clear(); } if (!token.getSubtype(game).isEmpty()) { @@ -183,8 +183,8 @@ public class BecomesCreatureAllEffect extends ContinuousEffectImpl { sb.append(" become "); } sb.append(token.getDescription()); - if (type != null && !type.isEmpty()) { - sb.append(". They're still ").append(type); + if (theyAreStillType != null && !theyAreStillType.isEmpty()) { + sb.append(". They're still ").append(theyAreStillType); } return sb.toString(); } 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 ed54559d736..bad6c840a1b 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 @@ -1,6 +1,8 @@ package mage.game.permanent.token.custom; import mage.MageInt; +import mage.ObjectColor; +import mage.abilities.Ability; import mage.constants.CardType; import mage.constants.SubType; import mage.game.permanent.token.TokenImpl; @@ -39,6 +41,31 @@ public class CreatureToken extends TokenImpl { } } + public CreatureToken withAbility(Ability ability) { + this.addAbility(ability); + return this; + } + + public CreatureToken withColor(String extraColors) { + ObjectColor extraColorsList = new ObjectColor(extraColors); + this.getColor(null).addColor(extraColorsList); + return this; + } + + public CreatureToken withType(CardType extraType) { + if (!this.cardType.contains(extraType)) { + this.cardType.add(extraType); + } + return this; + } + + public CreatureToken withSubType(SubType extraSubType) { + if (!this.subtype.contains(extraSubType)) { + this.subtype.add(extraSubType); + } + return this; + } + public CreatureToken(final CreatureToken token) { super(token); }