Skip to content

Commit

Permalink
[MKM] Implement Incinerator of the Guilty
Browse files Browse the repository at this point in the history
  • Loading branch information
DominionSpy committed Feb 22, 2024
1 parent bcbddaf commit cf2e310
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 52 deletions.
69 changes: 49 additions & 20 deletions Mage.Sets/src/mage/cards/i/IncineratorOfTheGuilty.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,22 +6,16 @@
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.delayed.ReflexiveTriggeredAbility;
import mage.abilities.costs.common.CollectEvidenceCost;
import mage.abilities.costs.common.CollectEvidenceXCost;
import mage.abilities.dynamicvalue.common.GetXValue;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageAllControlledTargetEffect;
import mage.abilities.effects.common.DoIfCostPaid;
import mage.abilities.effects.common.DoWhenCostPaid;
import mage.constants.Outcome;
import mage.constants.SetTargetPointer;
import mage.constants.SubType;
import mage.abilities.keyword.FlyingAbility;
import mage.abilities.keyword.TrampleAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
import mage.game.Game;
import mage.players.Player;
Expand All @@ -32,15 +26,6 @@
*/
public final class IncineratorOfTheGuilty extends CardImpl {

private static final FilterPermanent filter = new FilterPermanent("creature and each planeswalker");

static {
filter.add(
Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.PLANESWALKER.getPredicate()));
}

public IncineratorOfTheGuilty(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{4}{R}{R}");

Expand All @@ -56,11 +41,8 @@ public IncineratorOfTheGuilty(UUID ownerId, CardSetInfo setInfo) {

// Whenever Incinerator of the Guilty deals combat damage to a player, you may collect evidence X.
// When you do, Incinerator of the Guilty deals X damage to each creature and each planeswalker that player controls.
ReflexiveTriggeredAbility reflexive = new ReflexiveTriggeredAbility(new DamageAllControlledTargetEffect(GetXValue.instance, filter), false);
Ability ability = new DealsCombatDamageToAPlayerTriggeredAbility(
new DoWhenCostPaid(reflexive, new CollectEvidenceXCost(), "Collect evidence X to deal damage?"),
false, true);
this.addAbility(ability);
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(
new IncineratorOfTheGuiltyEffect(), false, true));
}

private IncineratorOfTheGuilty(final IncineratorOfTheGuilty card) {
Expand All @@ -72,3 +54,50 @@ public IncineratorOfTheGuilty copy() {
return new IncineratorOfTheGuilty(this);
}
}

class IncineratorOfTheGuiltyEffect extends OneShotEffect {

private static final FilterPermanent filter = new FilterPermanent("creature and each planeswalker");

static {
filter.add(
Predicates.or(
CardType.CREATURE.getPredicate(),
CardType.PLANESWALKER.getPredicate()));
}

IncineratorOfTheGuiltyEffect() {
super(Outcome.Benefit);
staticText = "you may collect evidence X. When you do, Incinerator of the Guilty deals X damage " +
"to each creature and each planeswalker that player controls.";
}

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

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

@Override
public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId());
if (controller == null || !controller.chooseUse(outcome, "Collect evidence X?", source, game)) {
return false;
}

int xValue = controller.announceXMana(0, Integer.MAX_VALUE, "Announce the value for X", game, source);
CollectEvidenceCost cost = new CollectEvidenceCost(xValue);
if (!cost.pay(source, game, source, source.getControllerId(), false, null)) {
return false;
}

ReflexiveTriggeredAbility ability = new ReflexiveTriggeredAbility(
new DamageAllControlledTargetEffect(xValue, filter)
.setTargetPointer(getTargetPointer()), false);
game.fireReflexiveTriggeredAbility(ability, source);
return true;
}
}

This file was deleted.

0 comments on commit cf2e310

Please sign in to comment.