Refactoring: replace custom creature tokens with basic class

This commit is contained in:
Oleg Agafonov 2018-05-05 14:42:37 +04:00
parent 483853658b
commit b87e954a99
5 changed files with 11 additions and 91 deletions

View file

@ -39,6 +39,7 @@ import mage.filter.common.FilterLandPermanent;
import mage.filter.predicate.mageobject.SupertypePredicate;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.TargetPermanent;
import java.util.UUID;
@ -63,7 +64,7 @@ public class BalduvianConjurer extends CardImpl {
this.toughness = new MageInt(2);
// {tap}: Target snow land becomes a 2/2 creature until end of turn. It's still a land.
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new AnimatedLand(), false, true, Duration.EndOfTurn), new TapSourceCost());
Ability ability = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new CreatureToken(2, 2), false, true, Duration.EndOfTurn), new TapSourceCost());
ability.addTarget(new TargetPermanent(filter));
this.addAbility(ability);
}
@ -77,20 +78,3 @@ public class BalduvianConjurer extends CardImpl {
return new BalduvianConjurer(this);
}
}
class AnimatedLand extends TokenImpl {
public AnimatedLand() {
super("", "2/2 creature");
this.cardType.add(CardType.CREATURE);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
}
public AnimatedLand(final AnimatedLand token) {
super(token);
}
public AnimatedLand copy() {
return new AnimatedLand(this);
}
}

View file

@ -45,6 +45,7 @@ import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetLandPermanent;
/**
@ -65,7 +66,7 @@ public class KamahlFistOfKrosa extends CardImpl {
// {G}: Target land becomes a 1/1 creature until end of turn. It's still a land.
SimpleActivatedAbility ability = new SimpleActivatedAbility(Zone.BATTLEFIELD,
new BecomesCreatureTargetEffect(new KamahlFistOfKrosaLandToken(), false, true, Duration.EndOfTurn),
new BecomesCreatureTargetEffect(new CreatureToken(1, 1), false, true, Duration.EndOfTurn),
new ManaCostsImpl("{G}"));
ability.addTarget(new TargetLandPermanent());
this.addAbility(ability);
@ -87,21 +88,3 @@ public class KamahlFistOfKrosa extends CardImpl {
return new KamahlFistOfKrosa(this);
}
}
class KamahlFistOfKrosaLandToken extends TokenImpl {
public KamahlFistOfKrosaLandToken() {
super("", "1/1 creature");
this.cardType.add(CardType.CREATURE);
this.power = new MageInt(1);
this.toughness = new MageInt(1);
}
public KamahlFistOfKrosaLandToken(final KamahlFistOfKrosaLandToken token) {
super(token);
}
public KamahlFistOfKrosaLandToken copy() {
return new KamahlFistOfKrosaLandToken(this);
}
}

View file

@ -41,6 +41,7 @@ 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.TargetPermanent;
/**
@ -61,8 +62,9 @@ public class SiegeOfTowers extends CardImpl {
// Replicate {1}{R}
this.addAbility(new ReplicateAbility(this, "{1}{R}"));
// Target Mountain becomes a 3/1 creature. It's still a land.
Effect effect = new BecomesCreatureTargetEffect(new SiegeOfTowersToken(), false, true, Duration.EndOfGame);
Effect effect = new BecomesCreatureTargetEffect(new CreatureToken(3, 1), false, true, Duration.EndOfGame);
effect.setText("Target Mountain becomes a 3/1 creature. It's still a land");
this.getSpellAbility().addEffect(effect);
this.getSpellAbility().addTarget(new TargetPermanent(filter));
@ -77,20 +79,4 @@ public class SiegeOfTowers extends CardImpl {
public SiegeOfTowers copy() {
return new SiegeOfTowers(this);
}
}
class SiegeOfTowersToken extends TokenImpl {
public SiegeOfTowersToken() {
super("", "3/1 creature");
cardType.add(CardType.CREATURE);
power = new MageInt(3);
toughness = new MageInt(1);
}
public SiegeOfTowersToken(final SiegeOfTowersToken token) {
super(token);
}
public SiegeOfTowersToken copy() {
return new SiegeOfTowersToken(this);
}
}

View file

@ -46,6 +46,7 @@ import mage.constants.Zone;
import mage.counters.CounterType;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetLandPermanent;
@ -72,7 +73,7 @@ public class SpikeTiller extends CardImpl {
this.addAbility(ability);
// {2}, Remove a +1/+1 counter from Spike Tiller: Target land becomes a 2/2 creature that's still a land. Put a +1/+1 counter on it.
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new SpikeTillerToken(), false, true, Duration.EndOfGame).setText("Target land becomes a 2/2 creature that's still a land. "), new GenericManaCost(2));
Ability ability2 = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new CreatureToken(2, 2), false, true, Duration.EndOfGame).setText("Target land becomes a 2/2 creature that's still a land. "), new GenericManaCost(2));
ability2.addCost(new RemoveCountersSourceCost(CounterType.P1P1.createInstance()));
ability2.addEffect(new AddCountersTargetEffect(CounterType.P1P1.createInstance()).setText("Put a +1/+1 counter on it."));
ability2.addTarget(new TargetLandPermanent());
@ -88,20 +89,3 @@ public class SpikeTiller extends CardImpl {
return new SpikeTiller(this);
}
}
class SpikeTillerToken extends TokenImpl {
public SpikeTillerToken() {
super("", "2/2 creature");
cardType.add(CardType.CREATURE);
power = new MageInt(2);
toughness = new MageInt(2);
}
public SpikeTillerToken(final SpikeTillerToken token) {
super(token);
}
public SpikeTillerToken copy() {
return new SpikeTillerToken(this);
}
}

View file

@ -37,6 +37,7 @@ import mage.constants.CardType;
import mage.constants.Duration;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
import mage.target.common.TargetLandPermanent;
/**
@ -52,7 +53,7 @@ public class VerdantTouch extends CardImpl {
this.addAbility(new BuybackAbility("{3}"));
// Target land becomes a 2/2 creature that's still a land.
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new VerdantTouchLandToken(), false, true, Duration.Custom));
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new CreatureToken(2, 2), false, true, Duration.Custom));
this.getSpellAbility().addTarget(new TargetLandPermanent());
}
@ -64,22 +65,4 @@ public class VerdantTouch extends CardImpl {
public VerdantTouch copy() {
return new VerdantTouch(this);
}
}
class VerdantTouchLandToken extends TokenImpl {
public VerdantTouchLandToken() {
super("", "2/2 creature");
this.cardType.add(CardType.CREATURE);
this.power = new MageInt(2);
this.toughness = new MageInt(2);
}
public VerdantTouchLandToken(final VerdantTouchLandToken token) {
super(token);
}
public VerdantTouchLandToken copy() {
return new VerdantTouchLandToken(this);
}
}