From 56fab9ec44deab5f0521eb01aa5dd89cd3a3ec12 Mon Sep 17 00:00:00 2001 From: Susucre <34709007+Susucre@users.noreply.github.com> Date: Fri, 18 Aug 2023 15:17:30 +0200 Subject: [PATCH] [WOE] Implement Callous Sell-Sword (#10848) --- .../src/mage/cards/c/CallousSellSword.java | 117 ++++++++++++++++++ Mage.Sets/src/mage/sets/WildsOfEldraine.java | 1 + 2 files changed, 118 insertions(+) create mode 100644 Mage.Sets/src/mage/cards/c/CallousSellSword.java diff --git a/Mage.Sets/src/mage/cards/c/CallousSellSword.java b/Mage.Sets/src/mage/cards/c/CallousSellSword.java new file mode 100644 index 00000000000..a49d520326f --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/CallousSellSword.java @@ -0,0 +1,117 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAbility; +import mage.abilities.dynamicvalue.DynamicValue; +import mage.abilities.effects.Effect; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.DamageWithPowerFromOneToAnotherTargetEffect; +import mage.abilities.effects.common.counter.AddCountersSourceEffect; +import mage.abilities.hint.Hint; +import mage.abilities.hint.ValueHint; +import mage.cards.AdventureCard; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.counters.CounterType; +import mage.game.Game; +import mage.game.permanent.Permanent; +import mage.target.common.TargetAnyTarget; +import mage.target.common.TargetControlledCreaturePermanent; +import mage.watchers.common.CreaturesDiedWatcher; + +import java.util.UUID; + +/** + * @author Susucr + */ +public final class CallousSellSword extends AdventureCard { + + private static final Hint hint = new ValueHint( + "Creatures that died under your control this turn", CallousSellSwordValue.instance + ); + + public CallousSellSword(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, new CardType[]{CardType.SORCERY}, "{1}{B}", "Burn Together", "{R}"); + + this.subtype.add(SubType.HUMAN); + this.subtype.add(SubType.SOLDIER); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // Callous Sell-Sword enters the battlefield with a +1/+1 counter on it for each creature that died under your control this turn. + this.addAbility(new EntersBattlefieldAbility( + new AddCountersSourceEffect( + CounterType.P1P1.createInstance(0), + CallousSellSwordValue.instance, true + ).setText("with a +1/+1 counter on it for each creature that died under your control this turn.") + ).addHint(hint)); + + // Burn Together + // Target creature you control deals damage equal to its power to any other target. Then sacrifice it. + this.getSpellCard().getSpellAbility().addEffect(new DamageWithPowerFromOneToAnotherTargetEffect()); + this.getSpellCard().getSpellAbility().addTarget(new TargetControlledCreaturePermanent().setTargetTag(1)); + this.getSpellCard().getSpellAbility().addTarget(new TargetAnyTarget().setTargetTag(2)); + this.getSpellCard().getSpellAbility().addEffect(new CallousSellSwordSacrificeFirstTargetEffect().concatBy(". Then")); + } + + private CallousSellSword(final CallousSellSword card) { + super(card); + } + + @Override + public CallousSellSword copy() { + return new CallousSellSword(this); + } +} + +enum CallousSellSwordValue implements DynamicValue { + instance; + + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + return game.getState() + .getWatcher(CreaturesDiedWatcher.class) + .getAmountOfCreaturesDiedThisTurnByController(sourceAbility.getControllerId()); + } + + @Override + public CallousSellSwordValue copy() { + return this; + } + + @Override + public String getMessage() { + return "creature that died under your control this turn"; + } + + @Override + public String toString() { + return "1"; + } +} + +class CallousSellSwordSacrificeFirstTargetEffect extends OneShotEffect { + + CallousSellSwordSacrificeFirstTargetEffect() { + super(Outcome.Sacrifice); + staticText = "sacrifice it"; + } + + private CallousSellSwordSacrificeFirstTargetEffect(final CallousSellSwordSacrificeFirstTargetEffect effect) { + super(effect); + } + + @Override + public CallousSellSwordSacrificeFirstTargetEffect copy() { + return new CallousSellSwordSacrificeFirstTargetEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = game.getPermanent(source.getFirstTarget()); + return permanent != null && permanent.sacrifice(source, game); + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/WildsOfEldraine.java b/Mage.Sets/src/mage/sets/WildsOfEldraine.java index ebb0871dea5..dbd332ec5e6 100644 --- a/Mage.Sets/src/mage/sets/WildsOfEldraine.java +++ b/Mage.Sets/src/mage/sets/WildsOfEldraine.java @@ -26,6 +26,7 @@ public final class WildsOfEldraine extends ExpansionSet { cards.add(new SetCardInfo("Besotted Knight", 4, Rarity.COMMON, mage.cards.b.BesottedKnight.class)); cards.add(new SetCardInfo("Bitter Chill", 44, Rarity.UNCOMMON, mage.cards.b.BitterChill.class)); cards.add(new SetCardInfo("Break the Spell", 5, Rarity.COMMON, mage.cards.b.BreakTheSpell.class)); + cards.add(new SetCardInfo("Callous Sell-Sword", 221, Rarity.UNCOMMON, mage.cards.c.CallousSellSword.class)); cards.add(new SetCardInfo("Conceited Witch", 84, Rarity.COMMON, mage.cards.c.ConceitedWitch.class)); cards.add(new SetCardInfo("Cruel Somnophage", 222, Rarity.RARE, mage.cards.c.CruelSomnophage.class)); cards.add(new SetCardInfo("Cursed Courtier", 9, Rarity.UNCOMMON, mage.cards.c.CursedCourtier.class));