mirror of
https://github.com/correl/mage.git
synced 2024-12-24 11:50:45 +00:00
Add Warrior token and use it for existing cards.
This commit is contained in:
parent
9279d81c24
commit
10695ddf4c
6 changed files with 79 additions and 93 deletions
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -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) {
|
||||||
|
@ -90,7 +90,7 @@ class HeraldOfAnafenzaTriggeredAbility extends TriggeredAbilityImpl {
|
||||||
public HeraldOfAnafenzaTriggeredAbility copy() {
|
public HeraldOfAnafenzaTriggeredAbility copy() {
|
||||||
return new HeraldOfAnafenzaTriggeredAbility(this);
|
return new HeraldOfAnafenzaTriggeredAbility(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public boolean checkEventType(GameEvent event, Game game) {
|
public boolean checkEventType(GameEvent event, Game game) {
|
||||||
return event.getType() == GameEvent.EventType.ACTIVATED_ABILITY;
|
return event.getType() == GameEvent.EventType.ACTIVATED_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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -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;
|
||||||
|
@ -61,12 +60,12 @@ import mage.target.targetpointer.FixedTarget;
|
||||||
public class MarduCharm extends CardImpl {
|
public class MarduCharm extends CardImpl {
|
||||||
|
|
||||||
private static final FilterCard filter = new FilterCard("a noncreature, nonland card");
|
private static final FilterCard filter = new FilterCard("a noncreature, nonland card");
|
||||||
|
|
||||||
static {
|
static {
|
||||||
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
|
filter.add(Predicates.not(new CardTypePredicate(CardType.CREATURE)));
|
||||||
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
filter.add(Predicates.not(new CardTypePredicate(CardType.LAND)));
|
||||||
}
|
}
|
||||||
|
|
||||||
public MarduCharm(UUID ownerId) {
|
public MarduCharm(UUID ownerId) {
|
||||||
super(ownerId, 186, "Mardu Charm", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}{W}{B}");
|
super(ownerId, 186, "Mardu Charm", Rarity.UNCOMMON, new CardType[]{CardType.INSTANT}, "{R}{W}{B}");
|
||||||
this.expansionSetCode = "KTK";
|
this.expansionSetCode = "KTK";
|
||||||
|
@ -76,18 +75,18 @@ public class MarduCharm extends CardImpl {
|
||||||
// <strong>*</strong> Mardu Charm deals 4 damage to target creature.
|
// <strong>*</strong> Mardu Charm deals 4 damage to target creature.
|
||||||
this.getSpellAbility().addEffect(new DamageTargetEffect(4));
|
this.getSpellAbility().addEffect(new DamageTargetEffect(4));
|
||||||
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
this.getSpellAbility().addTarget(new TargetCreaturePermanent());
|
||||||
|
|
||||||
// <strong>*</strong> Put two 1/1 white Warrior creature tokens onto the battlefield. They gain first strike until end of turn.
|
// <strong>*</strong> Put two 1/1 white Warrior creature tokens onto the battlefield. They gain first strike until end of turn.
|
||||||
Mode mode = new Mode();
|
Mode mode = new Mode();
|
||||||
mode.getEffects().add(new MarduCharmCreateTokenEffect());
|
mode.getEffects().add(new MarduCharmCreateTokenEffect());
|
||||||
this.getSpellAbility().addMode(mode);
|
this.getSpellAbility().addMode(mode);
|
||||||
|
|
||||||
// <strong>*</strong> Target opponent reveals his or her hand. You choose a noncreature, nonland card from it. That player discards that card.
|
// <strong>*</strong> Target opponent reveals his or her hand. You choose a noncreature, nonland card from it. That player discards that card.
|
||||||
mode = new Mode();
|
mode = new Mode();
|
||||||
mode.getEffects().add(new DiscardCardYouChooseTargetEffect(filter));
|
mode.getEffects().add(new DiscardCardYouChooseTargetEffect(filter));
|
||||||
mode.getTargets().add(new TargetOpponent());
|
mode.getTargets().add(new TargetOpponent());
|
||||||
this.getSpellAbility().addMode(mode);
|
this.getSpellAbility().addMode(mode);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public MarduCharm(final MarduCharm card) {
|
public MarduCharm(final MarduCharm card) {
|
||||||
|
@ -101,26 +100,26 @@ public class MarduCharm extends CardImpl {
|
||||||
}
|
}
|
||||||
|
|
||||||
class MarduCharmCreateTokenEffect extends OneShotEffect {
|
class MarduCharmCreateTokenEffect extends OneShotEffect {
|
||||||
|
|
||||||
public MarduCharmCreateTokenEffect() {
|
public MarduCharmCreateTokenEffect() {
|
||||||
super(Outcome.PutCreatureInPlay);
|
super(Outcome.PutCreatureInPlay);
|
||||||
this.staticText = "Put two 1/1 white Warrior creature tokens onto the battlefield. They gain first strike until end of turn";
|
this.staticText = "Put two 1/1 white Warrior creature tokens onto the battlefield. They gain first strike until end of turn";
|
||||||
}
|
}
|
||||||
|
|
||||||
public MarduCharmCreateTokenEffect(final MarduCharmCreateTokenEffect effect) {
|
public MarduCharmCreateTokenEffect(final MarduCharmCreateTokenEffect effect) {
|
||||||
super(effect);
|
super(effect);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public MarduCharmCreateTokenEffect copy() {
|
public MarduCharmCreateTokenEffect copy() {
|
||||||
return new MarduCharmCreateTokenEffect(this);
|
return new MarduCharmCreateTokenEffect(this);
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
|
@ -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);
|
|
||||||
}
|
|
||||||
}
|
|
59
Mage/src/mage/game/permanent/token/WarriorToken.java
Normal file
59
Mage/src/mage/game/permanent/token/WarriorToken.java
Normal 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);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in a new issue