Reimplement Cabal Executioner

This commit is contained in:
xenohedron 2023-05-26 02:43:45 -04:00
parent e626d8be5d
commit 1e1eb30e5a

View file

@ -1,27 +1,20 @@
package mage.cards.c;
import java.util.UUID;
import mage.MageInt;
import mage.abilities.TriggeredAbilityImpl;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.Effect;
import mage.abilities.effects.common.SacrificeEffect;
import mage.abilities.keyword.MorphAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.DamagedPlayerEvent;
import mage.game.events.GameEvent;
import mage.target.targetpointer.FixedTarget;
import java.util.UUID;
/**
*
* @author fireshoes
* @author xenohedron
*/
public final class CabalExecutioner extends CardImpl {
@ -33,7 +26,7 @@ public final class CabalExecutioner extends CardImpl {
this.toughness = new MageInt(2);
// Whenever Cabal Executioner deals combat damage to a player, that player sacrifices a creature.
this.addAbility(new CabalExecutionerAbility());
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new SacrificeEffect(StaticFilters.FILTER_PERMANENT_A_CREATURE, 1, "that player"), false, true));
// Morph {3}{B}{B}
this.addAbility(new MorphAbility(new ManaCostsImpl<>("{3}{B}{B}")));
@ -48,41 +41,3 @@ public final class CabalExecutioner extends CardImpl {
return new CabalExecutioner(this);
}
}
class CabalExecutionerAbility extends TriggeredAbilityImpl {
public CabalExecutionerAbility() {
super(Zone.BATTLEFIELD, new SacrificeEffect(StaticFilters.FILTER_PERMANENT_CREATURE, 1, ""));
}
public CabalExecutionerAbility(final CabalExecutionerAbility ability) {
super(ability);
}
@Override
public CabalExecutionerAbility copy() {
return new CabalExecutionerAbility(this);
}
@Override
public boolean checkEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.DAMAGED_PLAYER;
}
@Override
public boolean checkTrigger(GameEvent event, Game game) {
DamagedPlayerEvent damageEvent = (DamagedPlayerEvent) event;
if (damageEvent.isCombatDamage() && event.getSourceId().equals(this.getSourceId())) {
for (Effect effect : this.getEffects()) {
effect.setTargetPointer(new FixedTarget(event.getPlayerId()));
}
return true;
}
return false;
}
@Override
public String getRule() {
return "Whenever {this} deals combat damage to a player, that player sacrifices a creature.";
}
}