mirror of
https://github.com/correl/mage.git
synced 2025-04-10 01:01:05 -09:00
Refactoring: replace custom creature tokens with basic class
This commit is contained in:
parent
a65c1f5c3f
commit
483853658b
6 changed files with 45 additions and 96 deletions
Mage.Sets/src/mage/cards
Mage/src/main/java/mage/game/permanent/token/custom
|
@ -36,6 +36,7 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.game.permanent.token.TokenImpl;
|
import mage.game.permanent.token.TokenImpl;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
import mage.game.permanent.token.custom.CreatureToken;
|
||||||
import mage.target.common.TargetLandPermanent;
|
import mage.target.common.TargetLandPermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -48,7 +49,7 @@ public class AnimateLand extends CardImpl {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G}");
|
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{G}");
|
||||||
|
|
||||||
// Until end of turn, target land becomes a 3/3 creature that's still a land.
|
// Until end of turn, target land becomes a 3/3 creature that's still a land.
|
||||||
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new AnimatedLand(), false, true, Duration.EndOfTurn));
|
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new CreatureToken(3, 3), false, true, Duration.EndOfTurn));
|
||||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -60,21 +61,4 @@ public class AnimateLand extends CardImpl {
|
||||||
public AnimateLand copy() {
|
public AnimateLand copy() {
|
||||||
return new AnimateLand(this);
|
return new AnimateLand(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AnimatedLand extends TokenImpl {
|
|
||||||
|
|
||||||
public AnimatedLand() {
|
|
||||||
super("", "3/3 creature");
|
|
||||||
this.cardType.add(CardType.CREATURE);
|
|
||||||
this.power = new MageInt(3);
|
|
||||||
this.toughness = new MageInt(3);
|
|
||||||
}
|
|
||||||
public AnimatedLand(final AnimatedLand token) {
|
|
||||||
super(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnimatedLand copy() {
|
|
||||||
return new AnimatedLand(this);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -46,6 +46,7 @@ import mage.filter.predicate.permanent.ControllerIdPredicate;
|
||||||
import mage.game.Game;
|
import mage.game.Game;
|
||||||
import mage.game.permanent.token.TokenImpl;
|
import mage.game.permanent.token.TokenImpl;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
import mage.game.permanent.token.custom.CreatureToken;
|
||||||
import mage.players.Player;
|
import mage.players.Player;
|
||||||
import mage.target.TargetPlayer;
|
import mage.target.TargetPlayer;
|
||||||
import mage.target.common.TargetCardInHand;
|
import mage.target.common.TargetCardInHand;
|
||||||
|
@ -104,26 +105,9 @@ class JolraelEmpressOfBeastsEffect extends OneShotEffect {
|
||||||
if (targetPlayer != null) {
|
if (targetPlayer != null) {
|
||||||
FilterPermanent filter = new FilterLandPermanent();
|
FilterPermanent filter = new FilterLandPermanent();
|
||||||
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
|
filter.add(new ControllerIdPredicate(targetPlayer.getId()));
|
||||||
game.addEffect(new BecomesCreatureAllEffect(new JolraelLandsToken(), "lands", filter, Duration.EndOfTurn), source);
|
game.addEffect(new BecomesCreatureAllEffect(new CreatureToken(3, 3), "lands", filter, Duration.EndOfTurn), source);
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class JolraelLandsToken extends TokenImpl {
|
|
||||||
|
|
||||||
public JolraelLandsToken() {
|
|
||||||
super("", "3/3 creature");
|
|
||||||
cardType.add(CardType.CREATURE);
|
|
||||||
power = new MageInt(3);
|
|
||||||
toughness = new MageInt(3);
|
|
||||||
}
|
|
||||||
public JolraelLandsToken(final JolraelLandsToken token) {
|
|
||||||
super(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public JolraelLandsToken copy() {
|
|
||||||
return new JolraelLandsToken(this);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -44,6 +44,7 @@ import mage.constants.Duration;
|
||||||
import mage.constants.Zone;
|
import mage.constants.Zone;
|
||||||
import mage.game.permanent.token.TokenImpl;
|
import mage.game.permanent.token.TokenImpl;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
import mage.game.permanent.token.custom.CreatureToken;
|
||||||
import mage.target.common.TargetLandPermanent;
|
import mage.target.common.TargetLandPermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -56,7 +57,7 @@ public class LifesparkSpellbomb extends CardImpl {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
|
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{1}");
|
||||||
|
|
||||||
// {G}, Sacrifice Lifespark Spellbomb: Until end of turn, target land becomes a 3/3 creature that's still a land.
|
// {G}, Sacrifice Lifespark Spellbomb: Until end of turn, target land becomes a 3/3 creature that's still a land.
|
||||||
Ability firstAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new LifesparkSpellbombToken(), false, true, Duration.EndOfTurn), new ColoredManaCost(ColoredManaSymbol.G));
|
Ability firstAbility = new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureTargetEffect(new CreatureToken(3, 3), false, true, Duration.EndOfTurn), new ColoredManaCost(ColoredManaSymbol.G));
|
||||||
firstAbility.addCost(new SacrificeSourceCost());
|
firstAbility.addCost(new SacrificeSourceCost());
|
||||||
firstAbility.addTarget(new TargetLandPermanent());
|
firstAbility.addTarget(new TargetLandPermanent());
|
||||||
this.addAbility(firstAbility);
|
this.addAbility(firstAbility);
|
||||||
|
@ -76,22 +77,4 @@ public class LifesparkSpellbomb extends CardImpl {
|
||||||
return new LifesparkSpellbomb(this);
|
return new LifesparkSpellbomb(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class LifesparkSpellbombToken extends TokenImpl {
|
|
||||||
|
|
||||||
public LifesparkSpellbombToken() {
|
|
||||||
super("", "3/3 creature");
|
|
||||||
this.cardType.add(CardType.CREATURE);
|
|
||||||
|
|
||||||
this.power = new MageInt(3);
|
|
||||||
this.toughness = new MageInt(3);
|
|
||||||
}
|
|
||||||
public LifesparkSpellbombToken(final LifesparkSpellbombToken token) {
|
|
||||||
super(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LifesparkSpellbombToken copy() {
|
|
||||||
return new LifesparkSpellbombToken(this);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -41,6 +41,7 @@ import mage.constants.Duration;
|
||||||
import mage.filter.StaticFilters;
|
import mage.filter.StaticFilters;
|
||||||
import mage.game.permanent.token.TokenImpl;
|
import mage.game.permanent.token.TokenImpl;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
import mage.game.permanent.token.custom.CreatureToken;
|
||||||
import mage.target.common.TargetLandPermanent;
|
import mage.target.common.TargetLandPermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -57,7 +58,7 @@ public class Soilshaper extends CardImpl {
|
||||||
this.toughness = new MageInt(1);
|
this.toughness = new MageInt(1);
|
||||||
|
|
||||||
// Whenever you cast a Spirit or Arcane spell, target land becomes a 3/3 creature until end of turn. It's still a land.
|
// Whenever you cast a Spirit or Arcane spell, target land becomes a 3/3 creature until end of turn. It's still a land.
|
||||||
Ability ability = new SpellCastControllerTriggeredAbility(new BecomesCreatureTargetEffect(new SoilshaperToken(), false, true, Duration.EndOfTurn), StaticFilters.SPIRIT_OR_ARCANE_CARD, false);
|
Ability ability = new SpellCastControllerTriggeredAbility(new BecomesCreatureTargetEffect(new CreatureToken(3, 3), false, true, Duration.EndOfTurn), StaticFilters.SPIRIT_OR_ARCANE_CARD, false);
|
||||||
ability.addTarget(new TargetLandPermanent());
|
ability.addTarget(new TargetLandPermanent());
|
||||||
this.addAbility(ability);
|
this.addAbility(ability);
|
||||||
}
|
}
|
||||||
|
@ -71,22 +72,4 @@ public class Soilshaper extends CardImpl {
|
||||||
return new Soilshaper(this);
|
return new Soilshaper(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
class SoilshaperToken extends TokenImpl {
|
|
||||||
|
|
||||||
public SoilshaperToken() {
|
|
||||||
super("", "3/3 creature");
|
|
||||||
this.cardType.add(CardType.CREATURE);
|
|
||||||
|
|
||||||
this.power = new MageInt(3);
|
|
||||||
this.toughness = new MageInt(3);
|
|
||||||
}
|
|
||||||
public SoilshaperToken(final SoilshaperToken token) {
|
|
||||||
super(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public SoilshaperToken copy() {
|
|
||||||
return new SoilshaperToken(this);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -37,6 +37,7 @@ import mage.constants.CardType;
|
||||||
import mage.constants.Duration;
|
import mage.constants.Duration;
|
||||||
import mage.game.permanent.token.TokenImpl;
|
import mage.game.permanent.token.TokenImpl;
|
||||||
import mage.game.permanent.token.Token;
|
import mage.game.permanent.token.Token;
|
||||||
|
import mage.game.permanent.token.custom.CreatureToken;
|
||||||
import mage.target.common.TargetLandPermanent;
|
import mage.target.common.TargetLandPermanent;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -49,7 +50,7 @@ public class Vivify extends CardImpl {
|
||||||
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}");
|
super(ownerId,setInfo,new CardType[]{CardType.INSTANT},"{2}{G}");
|
||||||
|
|
||||||
// Target land becomes a 3/3 creature until end of turn. It's still a land.
|
// Target land becomes a 3/3 creature until end of turn. It's still a land.
|
||||||
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new AnimatedLand(), false, true, Duration.EndOfTurn));
|
this.getSpellAbility().addEffect(new BecomesCreatureTargetEffect(new CreatureToken(3, 3), false, true, Duration.EndOfTurn));
|
||||||
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
this.getSpellAbility().addTarget(new TargetLandPermanent());
|
||||||
// Draw a card.
|
// Draw a card.
|
||||||
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
|
this.getSpellAbility().addEffect(new DrawCardSourceControllerEffect(1));
|
||||||
|
@ -64,20 +65,3 @@ public class Vivify extends CardImpl {
|
||||||
return new Vivify(this);
|
return new Vivify(this);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
class AnimatedLand extends TokenImpl {
|
|
||||||
|
|
||||||
public AnimatedLand() {
|
|
||||||
super("", "3/3 creature");
|
|
||||||
this.cardType.add(CardType.CREATURE);
|
|
||||||
this.power = new MageInt(3);
|
|
||||||
this.toughness = new MageInt(3);
|
|
||||||
}
|
|
||||||
public AnimatedLand(final AnimatedLand token) {
|
|
||||||
super(token);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AnimatedLand copy() {
|
|
||||||
return new AnimatedLand(this);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -0,0 +1,31 @@
|
||||||
|
package mage.game.permanent.token.custom;
|
||||||
|
|
||||||
|
import mage.MageInt;
|
||||||
|
import mage.constants.CardType;
|
||||||
|
import mage.game.permanent.token.TokenImpl;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author JayDi85
|
||||||
|
*/
|
||||||
|
public class CreatureToken extends TokenImpl {
|
||||||
|
|
||||||
|
public CreatureToken() {
|
||||||
|
this(0, 0);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreatureToken(int power, int toughness) {
|
||||||
|
super("", String.format("%d/%d creature", power, toughness));
|
||||||
|
this.cardType.add(CardType.CREATURE);
|
||||||
|
this.power = new MageInt(power);
|
||||||
|
this.toughness = new MageInt(toughness);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreatureToken(final CreatureToken token) {
|
||||||
|
super(token);
|
||||||
|
}
|
||||||
|
|
||||||
|
public CreatureToken copy() {
|
||||||
|
return new CreatureToken(this);
|
||||||
|
}
|
||||||
|
}
|
Loading…
Add table
Reference in a new issue