Add red and white Soldier token with haste and use it for existing cards. Kill unnecessary custom effect from Assemble the Legion.

This commit is contained in:
LoneFox 2015-09-26 10:35:31 +03:00
parent 66a341e1a2
commit 06440fd606
5 changed files with 76 additions and 102 deletions

View file

@ -31,22 +31,20 @@ package mage.sets.dragonsmaze;
import java.util.ArrayList;
import java.util.List;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.MageInt;
import mage.MageObject;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.events.GameEvent.EventType;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.SoldierTokenWithHaste;
import mage.game.stack.StackObject;
/**
@ -82,12 +80,13 @@ public class BlazeCommando extends CardImpl {
}
}
class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl {
private final List<UUID> handledStackObjects = new ArrayList<>();
public BlazeCommandoTriggeredAbility() {
super(Zone.BATTLEFIELD, new CreateTokenEffect(new BlazeCommandoSoldierToken(), 2), false);
super(Zone.BATTLEFIELD, new CreateTokenEffect(new SoldierTokenWithHaste(), 2), false);
}
public BlazeCommandoTriggeredAbility(final BlazeCommandoTriggeredAbility ability) {
@ -138,17 +137,3 @@ class BlazeCommandoTriggeredAbility extends TriggeredAbilityImpl {
return new StringBuilder("Whenever an instant or sorcery spell you control deals damage, ").append(super.getRule()).toString();
}
}
class BlazeCommandoSoldierToken extends Token {
public BlazeCommandoSoldierToken() {
super("Soldier", "1/1 red and white Soldier creature tokens with haste");
cardType.add(CardType.CREATURE);
color.setRed(true);
color.setWhite(true);
subtype.add("Soldier");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(HasteAbility.getInstance());
}
}

View file

@ -28,20 +28,17 @@
package mage.sets.gatecrash;
import java.util.UUID;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.constants.Zone;
import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.dynamicvalue.common.CountersCount;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.counters.Counter;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.constants.CardType;
import mage.constants.Rarity;
import mage.constants.TargetController;
import mage.counters.CounterType;
import mage.game.permanent.token.SoldierTokenWithHaste;
/**
*
@ -55,7 +52,9 @@ public class AssembleTheLegion extends CardImpl {
// At the beginning of your upkeep, put a muster counter on Assemble the Legion. Then put a 1/1 red and white Soldier creature token with haste onto the battlefield for each muster counter on Assemble the Legion.
this.addAbility(new BeginningOfUpkeepTriggeredAbility(new AssembleTheLegionEffect(), TargetController.YOU, false));
Ability ability = new BeginningOfUpkeepTriggeredAbility(new AddCountersSourceEffect(CounterType.MUSTER.createInstance()), TargetController.YOU, false);
ability.addEffect(new CreateTokenEffect(new SoldierTokenWithHaste(), new CountersCount(CounterType.MUSTER)));
this.addAbility(ability);
}
public AssembleTheLegion(final AssembleTheLegion card) {
@ -67,46 +66,3 @@ public class AssembleTheLegion extends CardImpl {
return new AssembleTheLegion(this);
}
}
class AssembleTheLegionEffect extends OneShotEffect {
private static final String MUSTER_COUNTER_NAME = "Muster";
public AssembleTheLegionEffect() {
super(Outcome.Copy);
this.staticText = "put a muster counter on {this}. Then put a 1/1 red and white Soldier creature token with haste onto the battlefield for each muster counter on {this}";
}
public AssembleTheLegionEffect(final AssembleTheLegionEffect effect) {
super(effect);
}
@Override
public AssembleTheLegionEffect copy() {
return new AssembleTheLegionEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
/* 1/24/2013: If Assemble the Legion isnt on the battlefield when its ability resolves,
* use the number of muster counters it had when it was last on the battlefield to
* determine how many Soldier tokens to put onto the battlefield.
*/
Permanent sourcePermanent = game.getPermanent(source.getSourceId());
int amountCounters = 0;
if (sourcePermanent == null) {
Permanent lki = (Permanent) game.getLastKnownInformation(source.getSourceId(), Zone.BATTLEFIELD);
if (lki != null) {
amountCounters = lki.getCounters().getCount(MUSTER_COUNTER_NAME);
}
} else {
new AddCountersSourceEffect(new Counter(MUSTER_COUNTER_NAME),false).apply(game, source);
amountCounters = sourcePermanent.getCounters().getCount(MUSTER_COUNTER_NAME);
}
if (amountCounters > 0) {
return new CreateTokenEffect(new SoldierToken(), amountCounters).apply(game, source);
}
return false;
}
}

View file

@ -34,13 +34,12 @@ import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.abilities.effects.common.continuous.BoostControlledEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Rarity;
import mage.constants.Zone;
import mage.game.permanent.token.Token;
import mage.game.permanent.token.SoldierTokenWithHaste;
/**
*
@ -54,17 +53,14 @@ public class SunhomeGuildmage extends CardImpl {
this.subtype.add("Human");
this.subtype.add("Wizard");
this.power = new MageInt(2);
this.toughness = new MageInt(2);
//{1}{R}{W}: Creatures you control get +1/+0 until end of turn.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new BoostControlledEffect(1, 0, Duration.EndOfTurn), new ManaCostsImpl("{1}{R}{W}")));
//{2}{R}{W}: Put a 1/1 red and white Soldier creature token with haste onto the battlefield.
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SoldierToken()), new ManaCostsImpl("{2}{R}{W}")));
this.addAbility(new SimpleActivatedAbility(Zone.BATTLEFIELD, new CreateTokenEffect(new SoldierTokenWithHaste()), new ManaCostsImpl("{2}{R}{W}")));
}
public SunhomeGuildmage(final SunhomeGuildmage card) {
@ -76,20 +72,3 @@ public class SunhomeGuildmage extends CardImpl {
return new SunhomeGuildmage(this);
}
}
class SoldierToken extends Token {
public SoldierToken() {
super("Soldier", "1/1 red and white Soldier creature token with haste");
cardType.add(CardType.CREATURE);
color.setWhite(true);
color.setRed(true);
subtype.add("Soldier");
power = new MageInt(1);
toughness = new MageInt(1);
this.addAbility(HasteAbility.getInstance());
}
}

View file

@ -71,6 +71,7 @@ public enum CounterType {
M1M1(new BoostCounter(-1, -1).name),
M2M2(new BoostCounter(-2, -2).name),
MINING("mining"),
MUSTER("muster"),
P1P0(new BoostCounter(1, 0).name),
P1P1(new BoostCounter(1, 1).name),
P2P2(new BoostCounter(2, 2).name),

View file

@ -0,0 +1,53 @@
/*
* 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 mage.constants.CardType;
import mage.MageInt;
import mage.abilities.keyword.HasteAbility;
/**
*
* @author LoneFox
*/
public class SoldierTokenWithHaste extends Token {
public SoldierTokenWithHaste() {
super("Soldier", "1/1 red and white Soldier creature token with haste");
cardType.add(CardType.CREATURE);
color.setWhite(true);
color.setRed(true);
subtype.add("Soldier");
power = new MageInt(1);
toughness = new MageInt(1);
addAbility(HasteAbility.getInstance());
setOriginalExpansionSetCode("GTC");
}
}