diff --git a/Mage.Sets/src/mage/cards/i/InvokeTheAncients.java b/Mage.Sets/src/mage/cards/i/InvokeTheAncients.java new file mode 100644 index 00000000000..1fe3454c314 --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/InvokeTheAncients.java @@ -0,0 +1,93 @@ +package mage.cards.i; + +import mage.abilities.Ability; +import mage.abilities.effects.OneShotEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.choices.Choice; +import mage.choices.ChoiceImpl; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.game.permanent.token.SpiritGreenToken; +import mage.game.permanent.token.Token; +import mage.players.Player; + +import java.util.Arrays; +import java.util.Locale; +import java.util.Set; +import java.util.UUID; +import java.util.stream.Collectors; + +/** + * @author TheElk801 + */ +public final class InvokeTheAncients extends CardImpl { + + public InvokeTheAncients(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{1}{G}{G}{G}{G}"); + + // Create two 4/5 green Spirit creature tokens. For each of them, put your choice of a vigilance counter, a reach counter, or a trample counter on it. + this.getSpellAbility().addEffect(new InvokeTheAncientsEffect()); + } + + private InvokeTheAncients(final InvokeTheAncients card) { + super(card); + } + + @Override + public InvokeTheAncients copy() { + return new InvokeTheAncients(this); + } +} + +class InvokeTheAncientsEffect extends OneShotEffect { + + private static final Token token = new SpiritGreenToken(); + private static final Set choices = Arrays.asList( + "Vigilance", "Reach", "Trample" + ).stream().collect(Collectors.toSet()); + + InvokeTheAncientsEffect() { + super(Outcome.Benefit); + staticText = "create two 4/5 green Spirit creature tokens. For each of them, " + + "put your choice of a vigilance counter, a reach counter, or a trample counter on it"; + } + + private InvokeTheAncientsEffect(final InvokeTheAncientsEffect effect) { + super(effect); + } + + @Override + public InvokeTheAncientsEffect copy() { + return new InvokeTheAncientsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + token.putOntoBattlefield(1, game, source, source.getControllerId()); + for (UUID tokenId : token.getLastAddedTokenIds()) { + Permanent permanent = game.getPermanent(tokenId); + if (permanent == null) { + continue; + } + Choice choice = new ChoiceImpl(true); + choice.setMessage("Choose vigilance, reach, or trample counter"); + choice.setChoices(choices); + player.choose(outcome, choice, game); + String chosen = choice.getChoice(); + if (chosen != null) { + permanent.addCounters(CounterType.findByName( + chosen.toLowerCase(Locale.ENGLISH) + ).createInstance(), source.getControllerId(), source, game); + } + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java index 0dbec3dd8b1..3e2924bd71a 100644 --- a/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java +++ b/Mage.Sets/src/mage/sets/KamigawaNeonDynasty.java @@ -88,6 +88,7 @@ public final class KamigawaNeonDynasty extends ExpansionSet { cards.add(new SetCardInfo("Imperial Recovery Unit", 18, Rarity.UNCOMMON, mage.cards.i.ImperialRecoveryUnit.class)); cards.add(new SetCardInfo("Imperial Subduer", 19, Rarity.COMMON, mage.cards.i.ImperialSubduer.class)); cards.add(new SetCardInfo("Inkrise Infiltrator", 100, Rarity.COMMON, mage.cards.i.InkriseInfiltrator.class)); + cards.add(new SetCardInfo("Invoke the Ancients", 193, Rarity.RARE, mage.cards.i.InvokeTheAncients.class)); cards.add(new SetCardInfo("Invoke the Winds", 58, Rarity.RARE, mage.cards.i.InvokeTheWinds.class)); cards.add(new SetCardInfo("Island", 285, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Isshin, Two Heavens as One", 224, Rarity.RARE, mage.cards.i.IsshinTwoHeavensAsOne.class)); diff --git a/Mage/src/main/java/mage/game/permanent/token/SpiritGreenToken.java b/Mage/src/main/java/mage/game/permanent/token/SpiritGreenToken.java new file mode 100644 index 00000000000..25caf91f278 --- /dev/null +++ b/Mage/src/main/java/mage/game/permanent/token/SpiritGreenToken.java @@ -0,0 +1,28 @@ +package mage.game.permanent.token; + +import mage.MageInt; +import mage.constants.CardType; +import mage.constants.SubType; + +/** + * @author TheElk801 + */ +public final class SpiritGreenToken extends TokenImpl { + + public SpiritGreenToken() { + super("Spirit token", "4/5 green Spirit creature token"); + cardType.add(CardType.CREATURE); + subtype.add(SubType.SPIRIT); + color.setGreen(true); + power = new MageInt(4); + toughness = new MageInt(5); + } + + public SpiritGreenToken(final SpiritGreenToken token) { + super(token); + } + + public SpiritGreenToken copy() { + return new SpiritGreenToken(this); + } +}