Refactoring: replace custom creature tokens with basic class (5 cards)

This commit is contained in:
Oleg Agafonov 2018-05-17 19:32:03 +04:00
parent 4940b3a7a4
commit 7e08d20f6d
5 changed files with 61 additions and 139 deletions

View file

@ -28,6 +28,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
@ -37,24 +38,33 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author LoneFox
*/
public class ChimericSphere extends CardImpl {
public ChimericSphere(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{3}");
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}");
// {2}: Until end of turn, Chimeric Sphere becomes a 2/1 Construct artifact creature with flying.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericSphereFlyingToken(),
"", Duration.EndOfTurn), new ManaCostsImpl("{2}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(2, 1, "2/1 Construct artifact creature with flying")
.withSubType(SubType.CONSTRUCT)
.withType(CardType.ARTIFACT)
.withAbility(FlyingAbility.getInstance()),
"", Duration.EndOfTurn), new ManaCostsImpl("{2}")));
// {2}: Until end of turn, Chimeric Sphere becomes a 3/2 Construct artifact creature without flying.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChimericSphereNotFlyingToken(),
"", Duration.EndOfTurn), new ManaCostsImpl("{2}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(3, 2, "3/2 Construct artifact creature without flying")
.withSubType(SubType.CONSTRUCT)
.withType(CardType.ARTIFACT),
"", Duration.EndOfTurn), new ManaCostsImpl("{2}")));
}
public ChimericSphere(final ChimericSphere card) {
@ -67,41 +77,3 @@ public class ChimericSphere extends CardImpl {
}
}
class ChimericSphereFlyingToken extends TokenImpl {
public ChimericSphereFlyingToken() {
super("Chimeric Sphere", "2/1 Construct artifact creature with flying");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
power = new MageInt(2);
toughness = new MageInt(1);
this.addAbility(FlyingAbility.getInstance());
}
public ChimericSphereFlyingToken(final ChimericSphereFlyingToken token) {
super(token);
}
public ChimericSphereFlyingToken copy() {
return new ChimericSphereFlyingToken(this);
}
}
class ChimericSphereNotFlyingToken extends TokenImpl {
public ChimericSphereNotFlyingToken() {
super("Chimeric Sphere", "3/2 Construct artifact creature without flying");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
power = new MageInt(3);
toughness = new MageInt(2);
}
public ChimericSphereNotFlyingToken(final ChimericSphereNotFlyingToken token) {
super(token);
}
public ChimericSphereNotFlyingToken copy() {
return new ChimericSphereNotFlyingToken(this);
}
}

View file

@ -28,6 +28,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.LimitedTimesPerTurnActivatedAbility;
@ -52,9 +53,9 @@ import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author emerald000
*/
public class ChronatogTotem extends CardImpl {
@ -66,7 +67,12 @@ public class ChronatogTotem extends CardImpl {
this.addAbility(new BlueManaAbility());
// {1}{U}: Chronatog Totem becomes a 1/2 blue Atog artifact creature until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new ChronatogTotemToken(), "", Duration.EndOfTurn), new ManaCostsImpl<>("{1}{U}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(1, 2, "1/2 blue Atog artifact creature")
.withColor("U")
.withSubType(SubType.ATOG)
.withType(CardType.ARTIFACT),
"", Duration.EndOfTurn), new ManaCostsImpl<>("{1}{U}")));
// {0}: Chronatog Totem gets +3/+3 until end of turn. You skip your next turn. Activate this ability only once each turn and only if Chronatog Totem is a creature.
Ability ability = new ChronatogTotemAbility(
@ -123,26 +129,6 @@ class ChronatogTotemAbility extends LimitedTimesPerTurnActivatedAbility {
}
}
class ChronatogTotemToken extends TokenImpl {
ChronatogTotemToken() {
super("Atog", "1/2 blue Atog artifact creature");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
subtype.add(SubType.ATOG);
power = new MageInt(1);
toughness = new MageInt(2);
color.setBlue(true);
}
public ChronatogTotemToken(final ChronatogTotemToken token) {
super(token);
}
public ChronatogTotemToken copy() {
return new ChronatogTotemToken(this);
}
}
class ChronatogTotemCondition implements Condition {
@Override

View file

@ -29,6 +29,7 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.EntersBattlefieldTappedAbility;
import mage.abilities.common.SimpleActivatedAbility;
@ -45,15 +46,15 @@ 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;
/**
*
* @author Loki
*/
public class CreepingTarPit extends CardImpl {
public CreepingTarPit (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.LAND},null);
public CreepingTarPit(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.LAND}, null);
// Creeping Tar Pit enters the battlefield tapped.
this.addAbility(new EntersBattlefieldTappedAbility());
@ -61,12 +62,17 @@ public class CreepingTarPit extends CardImpl {
// {T}: Add {U} or {B}.
this.addAbility(new BlueManaAbility());
this.addAbility(new BlackManaAbility());
// {1}{U}{B}: Until end of turn, Creeping Tar Pit becomes a 3/2 blue and black Elemental creature and can't be blocked. It's still a land.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new CreepingTarPitToken(), "land", Duration.EndOfTurn), new ManaCostsImpl("{1}{U}{B}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(3, 2, "3/2 blue and black Elemental creature and can't be blocked")
.withColor("BU")
.withSubType(SubType.ELEMENTAL)
.withAbility(new CantBeBlockedSourceAbility()),
"land", Duration.EndOfTurn), new ManaCostsImpl("{1}{U}{B}")));
}
public CreepingTarPit (final CreepingTarPit card) {
public CreepingTarPit(final CreepingTarPit card) {
super(card);
}
@ -76,23 +82,3 @@ public class CreepingTarPit extends CardImpl {
}
}
class CreepingTarPitToken extends TokenImpl {
public CreepingTarPitToken() {
super("", "3/2 blue and black Elemental creature and can't be blocked");
cardType.add(CardType.CREATURE);
subtype.add(SubType.ELEMENTAL);
color.setBlue(true);
color.setBlack(true);
power = new MageInt(3);
toughness = new MageInt(2);
this.addAbility(new CantBeBlockedSourceAbility());
}
public CreepingTarPitToken(final CreepingTarPitToken token) {
super(token);
}
public CreepingTarPitToken copy() {
return new CreepingTarPitToken(this);
}
}

View file

@ -29,6 +29,7 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.GenericManaCost;
@ -38,23 +39,32 @@ import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author Loki
*/
public class DarksteelBrute extends CardImpl {
public DarksteelBrute (UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ARTIFACT},"{2}");
public DarksteelBrute(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}");
// Indestructible
this.addAbility(IndestructibleAbility.getInstance());
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(new DarksteelBruteToken(), "", Duration.EndOfTurn), new GenericManaCost(3)));
// {3}: Darksteel Brute becomes a 2/2 Beast artifact creature until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BecomesCreatureSourceEffect(
new CreatureToken(2, 2, "2/2 Beast artifact creature")
.withSubType(SubType.BEAST)
.withType(CardType.ARTIFACT),
"", Duration.EndOfTurn), new GenericManaCost(3)));
}
public DarksteelBrute (final DarksteelBrute card) {
public DarksteelBrute(final DarksteelBrute card) {
super(card);
}
@ -63,21 +73,4 @@ public class DarksteelBrute extends CardImpl {
return new DarksteelBrute(this);
}
}
class DarksteelBruteToken extends TokenImpl {
public DarksteelBruteToken() {
super("", "2/2 Beast artifact creature");
cardType.add(CardType.ARTIFACT);
cardType.add(CardType.CREATURE);
power = new MageInt(2);
toughness = new MageInt(2);
}
public DarksteelBruteToken(final DarksteelBruteToken token) {
super(token);
}
public DarksteelBruteToken copy() {
return new DarksteelBruteToken(this);
}
}
}

View file

@ -28,6 +28,7 @@
package mage.cards.d;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.abilityword.ConstellationAbility;
import mage.abilities.effects.common.continuous.BecomesCreatureSourceEffect;
@ -40,18 +41,23 @@ import mage.constants.SubType;
import mage.constants.Duration;
import mage.game.permanent.token.TokenImpl;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.custom.CreatureToken;
/**
*
* @author fireshoes
*/
public class DaxossTorment extends CardImpl {
public DaxossTorment(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{3}{B}");
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{3}{B}");
// Constellation - Whenever Daxos's Torment or another enchantment enters the battlefield under your control, Daxos's Torment becomes a 5/5 Demon creature with flying and haste until end of turn in addition to its other types.
this.addAbility(new ConstellationAbility(new BecomesCreatureSourceEffect(new DaxossTormentToken(), "", Duration.EndOfTurn)));
this.addAbility(new ConstellationAbility(new BecomesCreatureSourceEffect(
new CreatureToken(5, 5, "5/5 Demon creature with flying and haste")
.withSubType(SubType.DEMON)
.withAbility(FlyingAbility.getInstance())
.withAbility(HasteAbility.getInstance()),
"previous types", Duration.EndOfTurn)));
}
public DaxossTorment(final DaxossTorment card) {
@ -63,24 +69,3 @@ public class DaxossTorment extends CardImpl {
return new DaxossTorment(this);
}
}
class DaxossTormentToken extends TokenImpl {
public DaxossTormentToken() {
super("", "5/5 Demon creature with flying and haste");
cardType.add(CardType.CREATURE);
subtype.add(SubType.DEMON);
power = new MageInt(5);
toughness = new MageInt(5);
addAbility(FlyingAbility.getInstance());
addAbility(HasteAbility.getInstance());
}
public DaxossTormentToken(final DaxossTormentToken token) {
super(token);
}
public DaxossTormentToken copy() {
return new DaxossTormentToken(this);
}
}