[MH2] Implemented Inevitable Betrayal

This commit is contained in:
Evan Kranzler 2021-06-03 08:23:53 -04:00
parent c26ef0774f
commit 28033c7c17
4 changed files with 85 additions and 1 deletions

View file

@ -0,0 +1,78 @@
package mage.cards.i;
import mage.abilities.Ability;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.keyword.SuspendAbility;
import mage.cards.Card;
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.players.Player;
import mage.target.common.TargetCardInLibrary;
import mage.target.common.TargetOpponent;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class InevitableBetrayal extends CardImpl {
public InevitableBetrayal(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "");
// Suspend 3{1}{U}{U}
this.addAbility(new SuspendAbility(3, new ManaCostsImpl<>("{1}{U}{U}"), this));
// Search target opponent's library for a creature card and put that card onto the battlefield under your control. Then that player shuffles.
this.getSpellAbility().addEffect(new InevitableBetrayalEffect());
this.getSpellAbility().addTarget(new TargetOpponent());
}
private InevitableBetrayal(final InevitableBetrayal card) {
super(card);
}
@Override
public InevitableBetrayal copy() {
return new InevitableBetrayal(this);
}
}
class InevitableBetrayalEffect extends OneShotEffect {
InevitableBetrayalEffect() {
super(Outcome.Benefit);
staticText = "search target opponent's library for a creature card and put that card " +
"onto the battlefield under your control. Then that player shuffles";
}
private InevitableBetrayalEffect(final InevitableBetrayalEffect effect) {
super(effect);
}
@Override
public InevitableBetrayalEffect copy() {
return new InevitableBetrayalEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
Player player = game.getPlayer(source.getFirstTarget());
if (controller == null || player == null) {
return false;
}
TargetCardInLibrary target = new TargetCardInLibrary(StaticFilters.FILTER_CARD_CREATURE);
controller.searchLibrary(target, source, game, player.getId());
Card card = player.getLibrary().getCard(target.getFirstTarget(), game);
controller.moveCards(card, Zone.BATTLEFIELD, source, game);
player.shuffleLibrary(source, game);
return true;
}
}

View file

@ -142,6 +142,7 @@ public final class ModernHorizons2 extends ExpansionSet {
cards.add(new SetCardInfo("Hunting Pack", 284, Rarity.UNCOMMON, mage.cards.h.HuntingPack.class));
cards.add(new SetCardInfo("Ignoble Hierarch", 166, Rarity.RARE, mage.cards.i.IgnobleHierarch.class));
cards.add(new SetCardInfo("Imperial Recruiter", 281, Rarity.MYTHIC, mage.cards.i.ImperialRecruiter.class));
cards.add(new SetCardInfo("Inevitable Betrayal", 47, Rarity.RARE, mage.cards.i.InevitableBetrayal.class));
cards.add(new SetCardInfo("Island", 483, Rarity.LAND, mage.cards.basiclands.Island.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Jade Avenger", 167, Rarity.COMMON, mage.cards.j.JadeAvenger.class));
cards.add(new SetCardInfo("Jewel-Eyed Cobra", 168, Rarity.COMMON, mage.cards.j.JewelEyedCobra.class));

View file

@ -263,7 +263,11 @@ foreach my $ability (@abilities) {
$ability =~ m/({.*})/g;
$vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(this, new ManaCostsImpl<>("' . fixCost($1) . '")));';
$vars{'abilitiesImports'} .= "\nimport mage.abilities.costs.mana.ManaCostsImpl;";
} elsif ($keywords{$kw} eq 'cost, card') {
} elsif ($keywords{$kw} eq 'number, cost, card') {
$ability =~ m/({.*})/g;
$vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(_, new ManaCostsImpl<>("' . fixCost($1) . '"), this));';
$vars{'abilitiesImports'} .= "\nimport mage.abilities.costs.mana.ManaCostsImpl;";
} elsif ($keywords{$kw} eq 'cost, card') {
$ability =~ m/({.*})/g;
$vars{'abilities'} .= "\n this.addAbility(new " . $kw . 'Ability(new ManaCostsImpl<>("' . fixCost($1) . '"), this));';
$vars{'abilitiesImports'} .= "\nimport mage.abilities.costs.mana.ManaCostsImpl;";

View file

@ -95,6 +95,7 @@ Skulk|new|
Spectacle|card, cost|
Storm|new|
Sunburst|new|
Suspend|number, cost, card|
Swampcycling|cost|
Swampwalk|new|
Totem armor|new|