diff --git a/Mage.Sets/src/mage/cards/h/HeraldOfTheDreadhorde.java b/Mage.Sets/src/mage/cards/h/HeraldOfTheDreadhorde.java new file mode 100644 index 0000000000..ef383f86e4 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HeraldOfTheDreadhorde.java @@ -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); + } +} diff --git a/Mage.Sets/src/mage/sets/WarOfTheSpark.java b/Mage.Sets/src/mage/sets/WarOfTheSpark.java index 3e89e8f300..0db8aa0191 100644 --- a/Mage.Sets/src/mage/sets/WarOfTheSpark.java +++ b/Mage.Sets/src/mage/sets/WarOfTheSpark.java @@ -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)); diff --git a/Mage/src/main/java/mage/abilities/effects/keyword/AmassEffect.java b/Mage/src/main/java/mage/abilities/effects/keyword/AmassEffect.java new file mode 100644 index 0000000000..c218a960e5 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/keyword/AmassEffect.java @@ -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 + " (Put " + CardUtil.numberToText(amassNumber) + + " +1/+1 counter" + (amassNumber > 1 ? "s" : "") + + "on an Army you control. If you don’t control one, " + + "create a 0/0 black Zombie Army creature token first.)"; + } + + public AmassEffect(DynamicValue amassNumber) { + super(Outcome.BoostCreature); + this.amassNumber = amassNumber; + staticText = "Amass " + amassNumber.getMessage() + " (Put X +1/+1 counters" + + "on an Army you control. If you don’t control one, " + + "create a 0/0 black Zombie Army creature token first.)"; + } + + 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; + } +} diff --git a/Mage/src/main/java/mage/constants/SubType.java b/Mage/src/main/java/mage/constants/SubType.java index 4cefbd0685..2a4ed036c2 100644 --- a/Mage/src/main/java/mage/constants/SubType.java +++ b/Mage/src/main/java/mage/constants/SubType.java @@ -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), diff --git a/Mage/src/main/java/mage/game/permanent/token/AmassToken.java b/Mage/src/main/java/mage/game/permanent/token/AmassToken.java new file mode 100644 index 0000000000..82785f7229 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/AmassToken.java @@ -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); + } +}