Skip to content

Commit

Permalink
[DSK] Implement Meathook Massacre II (#13085)
Browse files Browse the repository at this point in the history
  • Loading branch information
Cguy7777 authored Nov 30, 2024
1 parent 0a25dbe commit d3439c8
Show file tree
Hide file tree
Showing 2 changed files with 117 additions and 0 deletions.
114 changes: 114 additions & 0 deletions Mage.Sets/src/mage/cards/m/MeathookMassacreII.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,114 @@
package mage.cards.m;

import mage.abilities.Ability;
import mage.abilities.common.DiesCreatureTriggeredAbility;
import mage.abilities.common.EntersBattlefieldTriggeredAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.PayLifeCost;
import mage.abilities.dynamicvalue.common.GetXValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.ReturnFromGraveyardToBattlefieldWithCounterTargetEffect;
import mage.abilities.effects.common.SacrificeAllEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SuperType;
import mage.counters.CounterType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.players.Player;
import mage.target.targetpointer.FixedTarget;

import java.util.UUID;

/**
* @author Cguy7777
*/
public final class MeathookMassacreII extends CardImpl {

public MeathookMassacreII(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{X}{X}{B}{B}{B}{B}");

this.supertype.add(SuperType.LEGENDARY);

// When Meathook Massacre II enters, each player sacrifices X creatures of their choice.
this.addAbility(new EntersBattlefieldTriggeredAbility(
new SacrificeAllEffect(GetXValue.instance, StaticFilters.FILTER_PERMANENT_CREATURES)));

// Whenever a creature you control dies, you may pay 3 life.
// If you do, return that card under your control with a finality counter on it.
this.addAbility(new DiesCreatureTriggeredAbility(
new DoIfCostPaid(
new ReturnFromGraveyardToBattlefieldWithCounterTargetEffect(
CounterType.FINALITY.createInstance())
.setText("return that card under your control with a finality counter on it"),
new PayLifeCost(3)),
false,
StaticFilters.FILTER_CONTROLLED_A_CREATURE,
true));

// Whenever a creature an opponent controls dies, they may pay 3 life.
// If they don't, return that card under your control with a finality counter on it.
this.addAbility(new DiesCreatureTriggeredAbility(
new MeathookMassacreIIEffect(),
false,
StaticFilters.FILTER_OPPONENTS_PERMANENT_A_CREATURE,
true));
}

private MeathookMassacreII(final MeathookMassacreII card) {
super(card);
}

@Override
public MeathookMassacreII copy() {
return new MeathookMassacreII(this);
}
}

class MeathookMassacreIIEffect extends OneShotEffect {

MeathookMassacreIIEffect() {
super(Outcome.PutCreatureInPlay);
staticText = "they may pay 3 life. " +
"If they don't, return that card under your control with a finality counter on it";
}

private MeathookMassacreIIEffect(final MeathookMassacreIIEffect effect) {
super(effect);
}

@Override
public boolean apply(Game game, Ability source) {
Player player = getTargetPointer().getControllerOfFirstTargetOrLKI(game, source);
if (player == null) {
return false;
}

// Whenever a creature an opponent controls dies, they may pay 3 life.
// If they don't, return that card under your control with a finality counter on it.
Cost cost = new PayLifeCost(3);
if (player.chooseUse(Outcome.Detriment, "Pay 3 life to prevent this effect?", source, game)
&& cost.pay(source, game, source, player.getId(), true)) {
return true;
}

// If a token died, card will be null and nothing will be returned to the battlefield
Card card = game.getCard(getTargetPointer().getFirst(game, source));
if (card == null) {
return true;
}
new ReturnFromGraveyardToBattlefieldWithCounterTargetEffect(CounterType.FINALITY.createInstance())
.setTargetPointer(new FixedTarget(card, game))
.apply(game, source);
return true;
}

@Override
public MeathookMassacreIIEffect copy() {
return new MeathookMassacreIIEffect(this);
}
}
3 changes: 3 additions & 0 deletions Mage.Sets/src/mage/sets/DuskmournHouseOfHorror.java
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,9 @@ private DuskmournHouseOfHorror() {
cards.add(new SetCardInfo("Manifest Dread", 189, Rarity.COMMON, mage.cards.m.ManifestDread.class));
cards.add(new SetCardInfo("Marina Vendrell's Grimoire", 64, Rarity.RARE, mage.cards.m.MarinaVendrellsGrimoire.class));
cards.add(new SetCardInfo("Marvin, Murderous Mimic", 253, Rarity.RARE, mage.cards.m.MarvinMurderousMimic.class));
cards.add(new SetCardInfo("Meathook Massacre II", 108, Rarity.MYTHIC, mage.cards.m.MeathookMassacreII.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Meathook Massacre II", 293, Rarity.MYTHIC, mage.cards.m.MeathookMassacreII.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Meathook Massacre II", 311, Rarity.MYTHIC, mage.cards.m.MeathookMassacreII.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Miasma Demon", 109, Rarity.UNCOMMON, mage.cards.m.MiasmaDemon.class));
cards.add(new SetCardInfo("Midnight Mayhem", 222, Rarity.UNCOMMON, mage.cards.m.MidnightMayhem.class));
cards.add(new SetCardInfo("Most Valuable Slayer", 144, Rarity.COMMON, mage.cards.m.MostValuableSlayer.class));
Expand Down

0 comments on commit d3439c8

Please sign in to comment.