implement [MH3] Ashling, Flame Dancer

This commit is contained in:
Susucre 2024-06-05 21:22:38 +02:00
parent ed031b476d
commit 48ffa3ba84
3 changed files with 78 additions and 9 deletions

View file

@ -0,0 +1,62 @@
package mage.cards.a;
import mage.MageInt;
import mage.Mana;
import mage.abilities.Ability;
import mage.abilities.common.MagecraftAbility;
import mage.abilities.common.SimpleStaticAbility;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.effects.common.DamagePlayersEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.IfAbilityHasResolvedXTimesEffect;
import mage.abilities.effects.common.continuous.YouDontLoseManaEffect;
import mage.abilities.effects.common.discard.DiscardControllerEffect;
import mage.abilities.effects.mana.BasicManaEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.*;
import mage.filter.StaticFilters;
import mage.watchers.common.AbilityResolvedWatcher;
import java.util.UUID;
/**
* @author Susucr
*/
public final class AshlingFlameDancer extends CardImpl {
public AshlingFlameDancer(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{R}{R}");
this.supertype.add(SuperType.LEGENDARY);
this.subtype.add(SubType.ELEMENTAL);
this.subtype.add(SubType.SHAMAN);
this.power = new MageInt(4);
this.toughness = new MageInt(4);
// You don't lose unspent red mana as steps and phases end.
this.addAbility(new SimpleStaticAbility(new YouDontLoseManaEffect(ManaType.RED)));
// Magecraft -- Whenever you cast or copy an instant or sorcery spell, discard a card, then draw a card. If this is the second time this ability has resolved this turn, Ashling, Flame Dancer deals 2 damage to each opponent and each creature they control. If it's the third time, add {R}{R}{R}{R}.
Ability ability = new MagecraftAbility(new DiscardControllerEffect(1));
ability.addEffect(new DrawCardSourceControllerEffect(1).concatBy(", then"));
ability.addEffect(new IfAbilityHasResolvedXTimesEffect(
Outcome.Damage, 2,
new DamagePlayersEffect(2, TargetController.OPPONENT),
new DamageAllEffect(2, StaticFilters.FILTER_OPPONENTS_PERMANENT_CREATURE)
));
ability.addEffect(new IfAbilityHasResolvedXTimesEffect(
3, new BasicManaEffect(Mana.RedMana(4))
));
this.addAbility(ability, new AbilityResolvedWatcher());
}
private AshlingFlameDancer(final AshlingFlameDancer card) {
super(card);
}
@Override
public AshlingFlameDancer copy() {
return new AshlingFlameDancer(this);
}
}

View file

@ -35,6 +35,7 @@ public final class ModernHorizons3 extends ExpansionSet {
cards.add(new SetCardInfo("Arcbound Condor", 81, Rarity.UNCOMMON, mage.cards.a.ArcboundCondor.class));
cards.add(new SetCardInfo("Argent Dais", 20, Rarity.RARE, mage.cards.a.ArgentDais.class));
cards.add(new SetCardInfo("Arna Kennerud, Skycaptain", 178, Rarity.MYTHIC, mage.cards.a.ArnaKennerudSkycaptain.class));
cards.add(new SetCardInfo("Ashling, Flame Dancer", 115, Rarity.MYTHIC, mage.cards.a.AshlingFlameDancer.class));
cards.add(new SetCardInfo("Barbarian Ring", 299, Rarity.UNCOMMON, mage.cards.b.BarbarianRing.class));
cards.add(new SetCardInfo("Basking Broodscale", 145, Rarity.COMMON, mage.cards.b.BaskingBroodscale.class));
cards.add(new SetCardInfo("Bespoke Battlewagon", 52, Rarity.UNCOMMON, mage.cards.b.BespokeBattlewagon.class));

View file

@ -4,6 +4,7 @@ import mage.abilities.Ability;
import mage.abilities.Mode;
import mage.abilities.effects.ContinuousEffect;
import mage.abilities.effects.Effect;
import mage.abilities.effects.Effects;
import mage.abilities.effects.OneShotEffect;
import mage.constants.Outcome;
import mage.game.Game;
@ -16,22 +17,22 @@ import mage.watchers.common.AbilityResolvedWatcher;
public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
private final int resolutionNumber;
private final Effect effect;
private final Effects effects;
public IfAbilityHasResolvedXTimesEffect(int resolutionNumber, Effect effect) {
this(effect.getOutcome(), resolutionNumber, effect);
}
public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, Effect effect) {
public IfAbilityHasResolvedXTimesEffect(Outcome outcome, int resolutionNumber, Effect... effect) {
super(outcome);
this.resolutionNumber = resolutionNumber;
this.effect = effect;
this.effects = new Effects(effect);
}
private IfAbilityHasResolvedXTimesEffect(final IfAbilityHasResolvedXTimesEffect effect) {
super(effect);
this.resolutionNumber = effect.resolutionNumber;
this.effect = effect.effect;
this.effects = effect.effects.copy();
}
@Override
@ -44,11 +45,16 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
if (AbilityResolvedWatcher.getResolutionCount(game, source) != resolutionNumber) {
return false;
}
if (effect instanceof OneShotEffect) {
return effect.apply(game, source);
boolean result = false;
for (Effect effect : effects) {
if (effect instanceof OneShotEffect) {
result |= effect.apply(game, source);
continue;
}
game.addEffect((ContinuousEffect) effect, source);
result = true;
}
game.addEffect((ContinuousEffect) effect, source);
return true;
return result;
}
@Override
@ -57,6 +63,6 @@ public class IfAbilityHasResolvedXTimesEffect extends OneShotEffect {
return staticText;
}
return "if this is the " + CardUtil.numberToOrdinalText(resolutionNumber) +
" time this ability has resolved this turn, " + effect.getText(mode);
" time this ability has resolved this turn, " + effects.getText(mode);
}
}