[BRO] Implemented Mishra's Command

This commit is contained in:
Evan Kranzler 2022-10-30 19:58:43 -04:00
parent 80b3065628
commit 3e5ba7e097
2 changed files with 99 additions and 0 deletions

View file

@ -0,0 +1,98 @@
package mage.cards.m;
import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.dynamicvalue.common.ManacostVariableValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.effects.common.continuous.BoostTargetEffect;
import mage.abilities.effects.common.continuous.GainAbilityTargetEffect;
import mage.abilities.keyword.HasteAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.game.Game;
import mage.players.Player;
import mage.target.TargetPlayer;
import mage.target.common.TargetCreaturePermanent;
import mage.target.common.TargetPlaneswalkerPermanent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class MishrasCommand extends CardImpl {
public MishrasCommand(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{X}{R}");
// Choose two --
this.getSpellAbility().getModes().setMinModes(2);
this.getSpellAbility().getModes().setMaxModes(2);
// * Choose target player. They may discard up to X cards. Then they draw a card for each card discarded this way.
this.getSpellAbility().addEffect(new MishrasCommandEffect());
this.getSpellAbility().addTarget(new TargetPlayer());
// * This spell deals X damage to target creature.
this.getSpellAbility().addMode(new Mode(new DamageTargetEffect(
ManacostVariableValue.REGULAR, "this spell"
)).addTarget(new TargetCreaturePermanent()));
// * This spell deals X damage to target planeswalker.
this.getSpellAbility().addMode(new Mode(new DamageTargetEffect(
ManacostVariableValue.REGULAR, "this spell"
)).addTarget(new TargetPlaneswalkerPermanent()));
// * Target creature gets +X/+0 and gains haste until end of turn.
this.getSpellAbility().addMode(new Mode(new BoostTargetEffect(
ManacostVariableValue.REGULAR, StaticValue.get(0), Duration.EndOfTurn
).setText("target creature gets +X/+0")).addEffect(new GainAbilityTargetEffect(
HasteAbility.getInstance(), Duration.EndOfTurn
).setText("and gains haste until end of turn")).addTarget(new TargetCreaturePermanent()));
}
private MishrasCommand(final MishrasCommand card) {
super(card);
}
@Override
public MishrasCommand copy() {
return new MishrasCommand(this);
}
}
class MishrasCommandEffect extends OneShotEffect {
MishrasCommandEffect() {
super(Outcome.Benefit);
staticText = "choose target player. They may discard up to X cards. " +
"Then they draw a card for each card discarded this way";
}
private MishrasCommandEffect(final MishrasCommandEffect effect) {
super(effect);
}
@Override
public MishrasCommandEffect copy() {
return new MishrasCommandEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(getTargetPointer().getFirst(game, source));
int xValue = source.getManaCostsToPay().getX();
if (player != null && xValue > 0) {
player.drawCards(player.discard(
0, xValue, false, source, game
).size(), source, game);
return true;
}
return false;
}
}

View file

@ -44,6 +44,7 @@ public final class TheBrothersWar extends ExpansionSet {
cards.add(new SetCardInfo("Hurkyl, Master Wizard", 51, Rarity.RARE, mage.cards.h.HurkylMasterWizard.class));
cards.add(new SetCardInfo("Island", 280, Rarity.LAND, mage.cards.basiclands.Island.class, FULL_ART_BFZ_VARIOUS));
cards.add(new SetCardInfo("Llanowar Wastes", 264, Rarity.RARE, mage.cards.l.LlanowarWastes.class));
cards.add(new SetCardInfo("Mishra's Command", 141, Rarity.RARE, mage.cards.m.MishrasCommand.class));
cards.add(new SetCardInfo("Mishra's Foundry", 265, Rarity.RARE, mage.cards.m.MishrasFoundry.class));
cards.add(new SetCardInfo("Mishra's Juggernaut", 161, Rarity.COMMON, mage.cards.m.MishrasJuggernaut.class));
cards.add(new SetCardInfo("Mishra, Claimed by Gix", 216, Rarity.MYTHIC, mage.cards.m.MishraClaimedByGix.class));