Add Warrior token and use it for existing cards.

This commit is contained in:
LoneFox 2015-09-23 16:34:20 +03:00
parent 9279d81c24
commit 10695ddf4c
6 changed files with 79 additions and 93 deletions

View file

@ -28,13 +28,12 @@
package mage.sets.dragonsoftarkir; package mage.sets.dragonsoftarkir;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.abilities.dynamicvalue.common.ManacostVariableValue; import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.permanent.token.Token; import mage.game.permanent.token.WarriorToken;
/** /**
* *
@ -47,7 +46,7 @@ public class SecureTheWastes extends CardImpl {
this.expansionSetCode = "DTK"; this.expansionSetCode = "DTK";
// Put X 1/1 white Warrior creature tokens onto the battlefield. // Put X 1/1 white Warrior creature tokens onto the battlefield.
this.getSpellAbility().addEffect(new CreateTokenEffect(new SecureTheWastesToken(), new ManacostVariableValue())); this.getSpellAbility().addEffect(new CreateTokenEffect(new WarriorToken(), new ManacostVariableValue()));
} }
public SecureTheWastes(final SecureTheWastes card) { public SecureTheWastes(final SecureTheWastes card) {
@ -59,17 +58,3 @@ public class SecureTheWastes extends CardImpl {
return new SecureTheWastes(this); return new SecureTheWastes(this);
} }
} }
class SecureTheWastesToken extends Token {
SecureTheWastesToken() {
super("Warrior", "1/1 white Warrior creature token");
this.setOriginalExpansionSetCode("DTK");
cardType.add(CardType.CREATURE);
subtype.add("Warrior");
color.setWhite(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -40,7 +40,7 @@ import mage.constants.Zone;
import mage.game.Game; import mage.game.Game;
import mage.game.events.GameEvent; import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType; import mage.game.events.GameEvent.EventType;
import mage.game.permanent.token.Token; import mage.game.permanent.token.WarriorToken;
import mage.game.stack.StackAbility; import mage.game.stack.StackAbility;
/** /**
@ -79,7 +79,7 @@ public class HeraldOfAnafenza extends CardImpl {
class HeraldOfAnafenzaTriggeredAbility extends TriggeredAbilityImpl { class HeraldOfAnafenzaTriggeredAbility extends TriggeredAbilityImpl {
public HeraldOfAnafenzaTriggeredAbility() { public HeraldOfAnafenzaTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new HeraldOfAnafenzaWarriorToken()), false); super(Zone.BATTLEFIELD, new CreateTokenEffect(new WarriorToken()), false);
} }
public HeraldOfAnafenzaTriggeredAbility(final HeraldOfAnafenzaTriggeredAbility ability) { public HeraldOfAnafenzaTriggeredAbility(final HeraldOfAnafenzaTriggeredAbility ability) {
@ -112,18 +112,3 @@ class HeraldOfAnafenzaTriggeredAbility extends TriggeredAbilityImpl {
return "Whenever you activate {this}'s outlast ability, " + super.getRule(); return "Whenever you activate {this}'s outlast ability, " + super.getRule();
} }
} }
class HeraldOfAnafenzaWarriorToken extends Token {
public HeraldOfAnafenzaWarriorToken() {
super("Warrior", "1/1 white Warrior creature token");
this.setOriginalExpansionSetCode("KTK");
this.setTokenType(1);
cardType.add(CardType.CREATURE);
subtype.add("Warrior");
color.setWhite(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -28,7 +28,6 @@
package mage.sets.khansoftarkir; package mage.sets.khansoftarkir;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.Mode; import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffect; import mage.abilities.effects.ContinuousEffect;
@ -48,7 +47,7 @@ import mage.filter.predicate.Predicates;
import mage.filter.predicate.mageobject.CardTypePredicate; import mage.filter.predicate.mageobject.CardTypePredicate;
import mage.game.Game; import mage.game.Game;
import mage.game.permanent.Permanent; import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token; import mage.game.permanent.token.WarriorToken;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetOpponent; import mage.target.common.TargetOpponent;
@ -120,7 +119,7 @@ class MarduCharmCreateTokenEffect extends OneShotEffect {
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
if (controller != null) { if (controller != null) {
CreateTokenEffect effect = new CreateTokenEffect(new MarduCharmWarriorToken(), 2); CreateTokenEffect effect = new CreateTokenEffect(new WarriorToken(), 2);
effect.apply(game, source); effect.apply(game, source);
for (UUID tokenId :effect.getLastAddedTokenIds()) { for (UUID tokenId :effect.getLastAddedTokenIds()) {
Permanent token = game.getPermanent(tokenId); Permanent token = game.getPermanent(tokenId);
@ -135,16 +134,3 @@ class MarduCharmCreateTokenEffect extends OneShotEffect {
return false; return false;
} }
} }
class MarduCharmWarriorToken extends Token {
public MarduCharmWarriorToken() {
super("Warrior", "1/1 white Warrior creature token");
this.setOriginalExpansionSetCode("KTK");
this.setTokenType(2);
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Warrior");
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -36,7 +36,7 @@ import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.permanent.token.Token; import mage.game.permanent.token.WarriorToken;
import mage.watchers.common.PlayerAttackedWatcher; import mage.watchers.common.PlayerAttackedWatcher;
/** /**
@ -55,7 +55,7 @@ public class MarduHordechief extends CardImpl {
this.toughness = new MageInt(3); this.toughness = new MageInt(3);
// <i>Raid</i> - When Mardu Hordechief enters the battlefield, if you attacked with a creature this turn, put a 1/1 white Warrior creature token onto the battlefield // <i>Raid</i> - When Mardu Hordechief enters the battlefield, if you attacked with a creature this turn, put a 1/1 white Warrior creature token onto the battlefield
this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new MarduHordechiefToken())), RaidCondition.getInstance(), this.addAbility(new ConditionalTriggeredAbility(new EntersBattlefieldTriggeredAbility(new CreateTokenEffect(new WarriorToken())), RaidCondition.getInstance(),
"<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, put a 1/1 white Warrior creature token onto the battlefield."), "<i>Raid</i> - When {this} enters the battlefield, if you attacked with a creature this turn, put a 1/1 white Warrior creature token onto the battlefield."),
new PlayerAttackedWatcher()); new PlayerAttackedWatcher());
} }
@ -69,17 +69,3 @@ public class MarduHordechief extends CardImpl {
return new MarduHordechief(this); return new MarduHordechief(this);
} }
} }
class MarduHordechiefToken extends Token {
MarduHordechiefToken() {
super("Warrior", "1/1 white Warrior creature token");
this.setOriginalExpansionSetCode("KTK");
cardType.add(CardType.CREATURE);
subtype.add("Warrior");
color.setWhite(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -28,12 +28,11 @@
package mage.sets.khansoftarkir; package mage.sets.khansoftarkir;
import java.util.UUID; import java.util.UUID;
import mage.MageInt;
import mage.abilities.effects.common.CreateTokenEffect; import mage.abilities.effects.common.CreateTokenEffect;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.Rarity; import mage.constants.Rarity;
import mage.game.permanent.token.Token; import mage.game.permanent.token.WarriorToken;
/** /**
* *
@ -47,7 +46,7 @@ public class TakeUpArms extends CardImpl {
// Put three 1/1 white Warrior creature tokens onto the battlefield. // Put three 1/1 white Warrior creature tokens onto the battlefield.
this.getSpellAbility().addEffect(new CreateTokenEffect(new TakeUpArmsToken(), 3)); this.getSpellAbility().addEffect(new CreateTokenEffect(new WarriorToken(), 3));
} }
public TakeUpArms(final TakeUpArms card) { public TakeUpArms(final TakeUpArms card) {
@ -59,17 +58,3 @@ public class TakeUpArms extends CardImpl {
return new TakeUpArms(this); return new TakeUpArms(this);
} }
} }
class TakeUpArmsToken extends Token {
TakeUpArmsToken() {
super("Warrior", "1/1 white Warrior creature token");
this.setOriginalExpansionSetCode("KTK");
cardType.add(CardType.CREATURE);
subtype.add("Warrior");
color.setWhite(true);
power = new MageInt(1);
toughness = new MageInt(1);
}
}

View file

@ -0,0 +1,59 @@
/*
* Copyright 2010 BetaSteward_at_googlemail.com. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without modification, are
* permitted provided that the following conditions are met:
*
* 1. Redistributions of source code must retain the above copyright notice, this list of
* conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above copyright notice, this list
* of conditions and the following disclaimer in the documentation and/or other materials
* provided with the distribution.
*
* THIS SOFTWARE IS PROVIDED BY BetaSteward_at_googlemail.com ``AS IS'' AND ANY EXPRESS OR IMPLIED
* WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
* FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL BetaSteward_at_googlemail.com OR
* CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
* SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
* NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
* ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*
* The views and conclusions contained in the software and documentation are those of the
* authors and should not be interpreted as representing official policies, either expressed
* or implied, of BetaSteward_at_googlemail.com.
*/
package mage.game.permanent.token;
import java.util.Arrays;
import java.util.Random;
import mage.MageInt;
import mage.constants.CardType;
/**
*
* @author LoneFox
*/
public class WarriorToken extends Token {
public WarriorToken() {
super("Warrior", "1/1 white Warrior creature token");
cardType.add(CardType.CREATURE);
color.setWhite(true);
subtype.add("Warrior");
power = new MageInt(1);
toughness = new MageInt(1);
availableImageSetCodes.addAll(Arrays.asList("KTK", "DTK"));
}
@Override
public void setExpansionSetCodeForImage(String code) {
super.setExpansionSetCodeForImage(code);
if (getOriginalExpansionSetCode().equals("KTK")) {
this.setTokenType(new Random().nextInt(2) + 1);
}
}
}