[TLA] Implement Avatar's Wrath

This commit is contained in:
theelk801 2025-11-13 09:28:13 -05:00
parent 694f5332cc
commit 09d3d89045
2 changed files with 116 additions and 0 deletions

View file

@ -0,0 +1,114 @@
package mage.cards.a;
import mage.abilities.Ability;
import mage.abilities.effects.ContinuousRuleModifyingEffectImpl;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.ExileSpellEffect;
import mage.abilities.effects.keyword.AirbendTargetEffect;
import mage.cards.Card;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Duration;
import mage.constants.Outcome;
import mage.constants.Zone;
import mage.filter.StaticFilters;
import mage.game.Game;
import mage.game.events.GameEvent;
import mage.game.permanent.Permanent;
import mage.target.common.TargetCreaturePermanent;
import mage.target.targetpointer.FixedTargets;
import java.util.List;
import java.util.Optional;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class AvatarsWrath extends CardImpl {
public AvatarsWrath(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{2}{W}{W}");
// Choose up to one target creature, then airbend all other creatures.
this.getSpellAbility().addEffect(new AvatarsWrathAirbendEffect());
this.getSpellAbility().addTarget(new TargetCreaturePermanent(0, 1));
// Until your next turn, your opponents can't cast spells from anywhere other than their hand.
this.getSpellAbility().addEffect(new AvatarsWrathRuleEffect());
// Exile Avatar's Wrath.
this.getSpellAbility().addEffect(new ExileSpellEffect().concatBy("<br>"));
}
private AvatarsWrath(final AvatarsWrath card) {
super(card);
}
@Override
public AvatarsWrath copy() {
return new AvatarsWrath(this);
}
}
class AvatarsWrathAirbendEffect extends OneShotEffect {
AvatarsWrathAirbendEffect() {
super(Outcome.Benefit);
staticText = "choose up to one target creature, then airbend all other creatures";
}
private AvatarsWrathAirbendEffect(final AvatarsWrathAirbendEffect effect) {
super(effect);
}
@Override
public AvatarsWrathAirbendEffect copy() {
return new AvatarsWrathAirbendEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
List<Permanent> permanents = game
.getBattlefield()
.getActivePermanents(StaticFilters.FILTER_PERMANENT_CREATURE, source.getControllerId(), source, game);
Optional.ofNullable(game.getPermanent(getTargetPointer().getFirst(game, source)))
.ifPresent(permanents::remove);
return !permanents.isEmpty()
&& new AirbendTargetEffect()
.setTargetPointer(new FixedTargets(permanents, game))
.apply(game, source);
}
}
class AvatarsWrathRuleEffect extends ContinuousRuleModifyingEffectImpl {
AvatarsWrathRuleEffect() {
super(Duration.UntilYourNextTurn, Outcome.Benefit);
staticText = "<br>Until your next turn, your opponents can't cast spells from anywhere other than their hand.";
}
private AvatarsWrathRuleEffect(final AvatarsWrathRuleEffect effect) {
super(effect);
}
@Override
public AvatarsWrathRuleEffect copy() {
return new AvatarsWrathRuleEffect(this);
}
@Override
public boolean checksEventType(GameEvent event, Game game) {
return event.getType() == GameEvent.EventType.CAST_SPELL;
}
@Override
public boolean applies(GameEvent event, Ability source, Game game) {
if (!game.getOpponents(source.getControllerId()).contains(event.getPlayerId())) {
return false;
}
Card card = game.getCard(event.getSourceId());
return card != null && game.getState().getZone(card.getId()) != Zone.HAND;
}
}

View file

@ -66,6 +66,8 @@ public final class AvatarTheLastAirbender extends ExpansionSet {
cards.add(new SetCardInfo("Avatar Aang", 308, Rarity.MYTHIC, mage.cards.a.AvatarAang.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Avatar Aang", 363, Rarity.MYTHIC, mage.cards.a.AvatarAang.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Avatar Enthusiasts", 11, Rarity.COMMON, mage.cards.a.AvatarEnthusiasts.class));
cards.add(new SetCardInfo("Avatar's Wrath", 12, Rarity.RARE, mage.cards.a.AvatarsWrath.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Avatar's Wrath", 365, Rarity.RARE, mage.cards.a.AvatarsWrath.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Azula Always Lies", 84, Rarity.COMMON, mage.cards.a.AzulaAlwaysLies.class));
cards.add(new SetCardInfo("Azula, On the Hunt", 85, Rarity.UNCOMMON, mage.cards.a.AzulaOnTheHunt.class));
cards.add(new SetCardInfo("Ba Sing Se", 266, Rarity.RARE, mage.cards.b.BaSingSe.class, NON_FULL_USE_VARIOUS));