implemented Herald of the Dreadhorde

This commit is contained in:
Evan Kranzler 2019-03-31 12:29:23 -04:00
parent 0fb987f25d
commit bebc8a8ac4
5 changed files with 162 additions and 0 deletions

View file

@ -0,0 +1,38 @@
package mage.cards.h;
import mage.MageInt;
import mage.abilities.common.DiesTriggeredAbility;
import mage.abilities.effects.keyword.AmassEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class HeraldOfTheDreadhorde extends CardImpl {
public HeraldOfTheDreadhorde(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{B}");
this.subtype.add(SubType.ZOMBIE);
this.subtype.add(SubType.WARRIOR);
this.power = new MageInt(3);
this.toughness = new MageInt(2);
// When Herald of the Dreadhorde dies, amass 2.
this.addAbility(new DiesTriggeredAbility(new AmassEffect(2)));
}
private HeraldOfTheDreadhorde(final HeraldOfTheDreadhorde card) {
super(card);
}
@Override
public HeraldOfTheDreadhorde copy() {
return new HeraldOfTheDreadhorde(this);
}
}

View file

@ -24,6 +24,7 @@ public final class WarOfTheSpark extends ExpansionSet {
this.maxCardNumberInBooster = 264;
cards.add(new SetCardInfo("Ajani's Pridemate", 4, Rarity.UNCOMMON, mage.cards.a.AjanisPridemate.class));
cards.add(new SetCardInfo("Herald of the Dreadhorde", 93, Rarity.COMMON, mage.cards.h.HeraldOfTheDreadhorde.class));
cards.add(new SetCardInfo("Plains", 250, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Plains", 251, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Plains", 252, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));

View file

@ -0,0 +1,91 @@
package mage.abilities.effects.keyword;
import mage.abilities.Ability;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.CreateTokenEffect;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.counters.CounterType;
import mage.filter.FilterPermanent;
import mage.filter.common.FilterControlledPermanent;
import mage.filter.predicate.mageobject.SubtypePredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.AmassToken;
import mage.players.Player;
import mage.target.Target;
import mage.target.TargetPermanent;
import mage.util.CardUtil;
import java.util.UUID;
/**
* @author TheElk801
*/
public class AmassEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterControlledPermanent("Army you control");
static {
filter.add(new SubtypePredicate(SubType.ARMY));
}
private final DynamicValue amassNumber;
private UUID amassedCreatureId = null;
public AmassEffect(int amassNumber) {
this(new StaticValue(amassNumber));
staticText = "Amass " + amassNumber + " <i>(Put " + CardUtil.numberToText(amassNumber) +
" +1/+1 counter" + (amassNumber > 1 ? "s" : "") +
"on an Army you control. If you dont control one, " +
"create a 0/0 black Zombie Army creature token first.)</i>";
}
public AmassEffect(DynamicValue amassNumber) {
super(Outcome.BoostCreature);
this.amassNumber = amassNumber;
staticText = "Amass " + amassNumber.getMessage() + " <i>(Put X +1/+1 counters" +
"on an Army you control. If you dont control one, " +
"create a 0/0 black Zombie Army creature token first.)</i>";
}
private AmassEffect(final AmassEffect effect) {
super(effect);
this.amassNumber = effect.amassNumber;
}
@Override
public AmassEffect copy() {
return new AmassEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int xValue = amassNumber.calculate(game, source, this);
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
if (!game.getBattlefield().contains(filter, 1, game)) {
new CreateTokenEffect(new AmassToken()).apply(game, source);
}
Target target = new TargetPermanent(filter);
target.setNotTarget(true);
if (!player.choose(outcome, target, source.getSourceId(), game)) {
return false;
}
Permanent permanent = game.getPermanent(target.getFirstTarget());
if (permanent == null) {
return false;
}
permanent.addCounters(CounterType.P1P1.createInstance(xValue), source, game);
this.amassedCreatureId = permanent.getId();
return true;
}
public UUID getAmassedCreatureId() {
return amassedCreatureId;
}
}

View file

@ -53,6 +53,7 @@ public enum SubType {
ARCHER("Archer", SubTypeSet.CreatureType),
ARCHON("Archon", SubTypeSet.CreatureType),
ARTIFICER("Artificer", SubTypeSet.CreatureType),
ARMY("Army", SubTypeSet.CreatureType),
ARTIFICIER("Artificier", SubTypeSet.CreatureType, true),
ASSASSIN("Assassin", SubTypeSet.CreatureType),
ASSEMBLY_WORKER("Assembly-Worker", SubTypeSet.CreatureType),

View file

@ -0,0 +1,31 @@
package mage.game.permanent.token;
import mage.MageInt;
import mage.constants.CardType;
import mage.constants.SubType;
/**
* @author TheElk801
*/
public final class AmassToken extends TokenImpl {
public AmassToken() {
super("Zombie Army", "0/0 black Zombie Army creature token");
cardType.add(CardType.CREATURE);
color.setBlack(true);
subtype.add(SubType.ZOMBIE);
subtype.add(SubType.ARMY);
power = new MageInt(0);
toughness = new MageInt(0);
}
private AmassToken(final AmassToken token) {
super(token);
}
@Override
public AmassToken copy() {
return new AmassToken(this);
}
}