[DSK] Implement Unstoppable Slasher

This commit is contained in:
PurpleCrowbar 2024-11-13 16:45:46 +00:00
parent 94a8c921dc
commit c4de2e916c
2 changed files with 76 additions and 0 deletions

View file

@ -0,0 +1,73 @@
package mage.cards.u;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.DealsCombatDamageToAPlayerTriggeredAbility;
import mage.abilities.common.DiesSourceTriggeredAbility;
import mage.abilities.condition.Condition;
import mage.abilities.decorator.ConditionalInterveningIfTriggeredAbility;
import mage.abilities.effects.common.LoseHalfLifeTargetEffect;
import mage.abilities.effects.common.ReturnSourceFromGraveyardToBattlefieldWithCounterEffect;
import mage.abilities.keyword.DeathtouchAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.SubType;
import mage.counters.Counter;
import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
* @author PurpleCrowbar
*/
public final class UnstoppableSlasher extends CardImpl {
public UnstoppableSlasher(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{B}");
this.subtype.add(SubType.ZOMBIE, SubType.ASSASSIN);
this.power = new MageInt(2);
this.toughness = new MageInt(3);
// Deathtouch
this.addAbility(DeathtouchAbility.getInstance());
// Whenever Unstoppable Slasher deals combat damage to a player, they lose half their life, rounded up.
this.addAbility(new DealsCombatDamageToAPlayerTriggeredAbility(new LoseHalfLifeTargetEffect()
.setText("they lose half their life, rounded up"), false, true));
// When Unstoppable Slasher dies, if it had no counters on it, return it to the battlefield tapped under its owner's control with two stun counters on it.
this.addAbility(new ConditionalInterveningIfTriggeredAbility(new DiesSourceTriggeredAbility(new ReturnSourceFromGraveyardToBattlefieldWithCounterEffect(
CounterType.STUN.createInstance(2), true, true, false, false
), false), UnstoppableSlasherCondition.instance, "When {this} dies, if it had no counters on it, return it to the battlefield tapped under its owner's control with two stun counters on it"));
}
private UnstoppableSlasher(final UnstoppableSlasher card) {
super(card);
}
@Override
public UnstoppableSlasher copy() {
return new UnstoppableSlasher(this);
}
}
enum UnstoppableSlasherCondition implements Condition {
instance;
@Override
public boolean apply(Game game, Ability source) {
Permanent permanent = source.getSourcePermanentOrLKI(game);
if (permanent == null) {
return false;
}
return permanent
.getCounters(game)
.values()
.stream()
.mapToInt(Counter::getCount)
.sum() == 0;
}
}

View file

@ -226,6 +226,9 @@ public final class DuskmournHouseOfHorror extends ExpansionSet {
cards.add(new SetCardInfo("Unidentified Hovership", 37, Rarity.RARE, mage.cards.u.UnidentifiedHovership.class));
cards.add(new SetCardInfo("Unnerving Grasp", 80, Rarity.UNCOMMON, mage.cards.u.UnnervingGrasp.class));
cards.add(new SetCardInfo("Unsettling Twins", 38, Rarity.COMMON, mage.cards.u.UnsettlingTwins.class));
cards.add(new SetCardInfo("Unstoppable Slasher", 119, Rarity.RARE, mage.cards.u.UnstoppableSlasher.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Unstoppable Slasher", 294, Rarity.RARE, mage.cards.u.UnstoppableSlasher.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Unstoppable Slasher", 312, Rarity.RARE, mage.cards.u.UnstoppableSlasher.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Untimely Malfunction", 161, Rarity.UNCOMMON, mage.cards.u.UntimelyMalfunction.class));
cards.add(new SetCardInfo("Unwanted Remake", 39, Rarity.UNCOMMON, mage.cards.u.UnwantedRemake.class));
cards.add(new SetCardInfo("Unwilling Vessel", 81, Rarity.UNCOMMON, mage.cards.u.UnwillingVessel.class));