[WOE] Implement Callous Sell-Sword (#10848)

This commit is contained in:
Susucre 2023-08-18 15:17:30 +02:00 committed by GitHub
parent 7d82b6b1be
commit 56fab9ec44
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 118 additions and 0 deletions

View file

@ -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);
}
}

View file

@ -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));