Simplify and modernise Brion Stoutarm

This commit is contained in:
PurpleCrowbar 2023-02-09 04:42:44 +00:00
parent 9d28b6a20d
commit 5cc1a4efe5

View file

@ -3,21 +3,18 @@ package mage.cards.b;
import mage.MageInt;
import mage.abilities.Ability;
import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.Cost;
import mage.abilities.costs.common.SacrificeTargetCost;
import mage.abilities.costs.common.TapSourceCost;
import mage.abilities.costs.mana.ManaCostsImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.dynamicvalue.common.SacrificeCostCreaturesPower;
import mage.abilities.effects.common.DamageTargetEffect;
import mage.abilities.keyword.LifelinkAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.constants.SubType;
import mage.constants.SuperType;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.target.common.TargetControlledPermanent;
import mage.target.common.TargetPlayerOrPlaneswalker;
@ -39,8 +36,10 @@ public final class BrionStoutarm extends CardImpl {
// Lifelink
this.addAbility(LifelinkAbility.getInstance());
// {R}, {tap}, Sacrifice a creature other than Brion Stoutarm: Brion Stoutarm deals damage equal to the sacrificed creature's power to target player.
Ability ability = new SimpleActivatedAbility(new BrionStoutarmEffect(), new ManaCostsImpl<>("{R}"));
// {R}, {T}, Sacrifice a creature other than Brion Stoutarm: Brion Stoutarm deals damage
// equal to the sacrificed creature's power to target player or planeswalker.
Ability ability = new SimpleActivatedAbility(new DamageTargetEffect(SacrificeCostCreaturesPower.instance)
.setText("{this} deals damage equal to the sacrificed creature's power to target player or planeswalker"), new ManaCostsImpl<>("{R}"));
ability.addCost(new TapSourceCost());
ability.addCost(new SacrificeTargetCost(new TargetControlledPermanent(StaticFilters.FILTER_CONTROLLED_ANOTHER_CREATURE)));
ability.addTarget(new TargetPlayerOrPlaneswalker());
@ -56,35 +55,3 @@ public final class BrionStoutarm extends CardImpl {
return new BrionStoutarm(this);
}
}
class BrionStoutarmEffect extends OneShotEffect {
public BrionStoutarmEffect() {
super(Outcome.Benefit);
this.staticText = "{this} deals damage equal to the sacrificed creature's power to target player or planeswalker";
}
public BrionStoutarmEffect(final BrionStoutarmEffect effect) {
super(effect);
}
@Override
public BrionStoutarmEffect copy() {
return new BrionStoutarmEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
int amount = 0;
for (Cost cost : source.getCosts()) {
if (cost instanceof SacrificeTargetCost && !((SacrificeTargetCost) cost).getPermanents().isEmpty()) {
amount = ((SacrificeTargetCost) cost).getPermanents().get(0).getPower().getValue();
break;
}
}
if (amount > 0) {
return new DamageTargetEffect(amount).apply(game, source);
}
return true;
}
}