[STX] Implemented Multiple Choice

This commit is contained in:
Evan Kranzler 2021-03-30 21:53:37 -04:00
parent c43dd6a1a9
commit 4f1b0a4b90
2 changed files with 98 additions and 0 deletions

View file

@ -0,0 +1,97 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.game.permanent.token.PrismariToken;
import mage.players.Player;
import mage.target.TargetPermanent;
import mage.target.TargetPlayer;
import mage.target.common.TargetControlledCreaturePermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MultipleChoice extends CardImpl {
public MultipleChoice(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{U}");
// If X is 1, scry 1, then draw a card.
// If X is 2, you may choose a player. They return a creature they control to its owner's hand.
// If X is 3, create a 4/4 blue and red Elemental creature token.
// If X is 4 or more, do all of the above.
this.getSpellAbility().addEffect(new MultipleChoiceEffect());
}
private MultipleChoice(final MultipleChoice card) {
super(card);
}
@Override
public MultipleChoice copy() {
return new MultipleChoice(this);
}
}
class MultipleChoiceEffect extends OneShotEffect {
MultipleChoiceEffect() {
super(Outcome.Benefit);
staticText = "If X is 1, scry 1, then draw a card.<br>" +
"If X is 2, you may choose a player. They return a creature they control to its owner's hand.<br>" +
"If X is 3, create a 4/4 blue and red Elemental creature token.<br>" +
"If X is 4 or more, do all of the above.";
}
private MultipleChoiceEffect(final MultipleChoiceEffect effect) {
super(effect);
}
@Override
public MultipleChoiceEffect copy() {
return new MultipleChoiceEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null) {
return false;
}
int xValue = source.getManaCostsToPay().getX();
if (xValue == 1 || xValue >= 4) {
controller.scry(1, source, game);
controller.drawCards(1, source, game);
}
if (xValue == 3 || xValue >= 4) {
new PrismariToken().putOntoBattlefield(1, game, source, source.getControllerId());
}
if (xValue != 2 && xValue < 4) {
return true;
}
TargetPlayer targetPlayer = new TargetPlayer(0, 1, true);
controller.choose(Outcome.Detriment, targetPlayer, source.getSourceId(), game);
Player player = game.getPlayer(targetPlayer.getFirstTarget());
if (player == null || game.getBattlefield().count(
StaticFilters.FILTER_CONTROLLED_CREATURE,
source.getSourceId(), player.getId(), game
) <= 0) {
return true;
}
TargetPermanent targetPermanent = new TargetControlledCreaturePermanent();
targetPermanent.setNotTarget(true);
player.choose(Outcome.ReturnToHand, targetPermanent, source.getSourceId(), game);
Permanent permanent = game.getPermanent(targetPermanent.getFirstTarget());
return permanent == null || player.moveCards(permanent, Zone.HAND, source, game);
}
}

View file

@ -69,6 +69,7 @@ public final class StrixhavenSchoolOfMages extends ExpansionSet {
cards.add(new SetCardInfo("Mage Hunter", 76, Rarity.UNCOMMON, mage.cards.m.MageHunter.class)); cards.add(new SetCardInfo("Mage Hunter", 76, Rarity.UNCOMMON, mage.cards.m.MageHunter.class));
cards.add(new SetCardInfo("Magma Opus", 203, Rarity.MYTHIC, mage.cards.m.MagmaOpus.class)); cards.add(new SetCardInfo("Magma Opus", 203, Rarity.MYTHIC, mage.cards.m.MagmaOpus.class));
cards.add(new SetCardInfo("Mountain", 372, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Mountain", 372, Rarity.LAND, mage.cards.basiclands.Mountain.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Multiple Choice", 48, Rarity.RARE, mage.cards.m.MultipleChoice.class));
cards.add(new SetCardInfo("Necroblossom Snarl", 269, Rarity.RARE, mage.cards.n.NecroblossomSnarl.class)); cards.add(new SetCardInfo("Necroblossom Snarl", 269, Rarity.RARE, mage.cards.n.NecroblossomSnarl.class));
cards.add(new SetCardInfo("Pest Summoning", 211, Rarity.COMMON, mage.cards.p.PestSummoning.class)); cards.add(new SetCardInfo("Pest Summoning", 211, Rarity.COMMON, mage.cards.p.PestSummoning.class));
cards.add(new SetCardInfo("Plains", 366, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Plains", 366, Rarity.LAND, mage.cards.basiclands.Plains.class, NON_FULL_USE_VARIOUS));