[FIC] Implement Ultimate Magic: Meteor

This commit is contained in:
theelk801 2025-05-22 21:15:17 -04:00
parent b8ffd6dcdc
commit c42c58c67d
2 changed files with 108 additions and 0 deletions

View file

@ -0,0 +1,106 @@
package mage.cards.u;
import mage.abilities.Ability;
import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DamageAllEffect;
import mage.abilities.keyword.ForetellAbility;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome;
import mage.filter.FilterPermanent;
import mage.filter.StaticFilters;
import mage.filter.predicate.Predicates;
import mage.filter.predicate.permanent.ControllerIdPredicate;
import mage.game.Game;
import mage.game.permanent.Permanent;
import mage.players.Player;
import mage.target.TargetPermanent;
import java.util.HashSet;
import java.util.Optional;
import java.util.Set;
import java.util.UUID;
/**
* @author TheElk801
*/
public final class UltimateMagicMeteor extends CardImpl {
public UltimateMagicMeteor(UUID ownerId, CardSetInfo setInfo) {
super(ownerId, setInfo, new CardType[]{CardType.SORCERY}, "{5}{R}");
// Ultimate Magic: Meteor deals 7 damage to each creature. If this spell was cast from exile, for each opponent, choose an artifact or land that player controls. Destroy the chosen permanents.
this.getSpellAbility().addEffect(new DamageAllEffect(7, StaticFilters.FILTER_PERMANENT_CREATURE));
this.getSpellAbility().addEffect(new UltimateMagicMeteorEffect());
// Foretell {5}{R}
this.addAbility(new ForetellAbility(this, "{5}{R}"));
}
private UltimateMagicMeteor(final UltimateMagicMeteor card) {
super(card);
}
@Override
public UltimateMagicMeteor copy() {
return new UltimateMagicMeteor(this);
}
}
class UltimateMagicMeteorEffect extends OneShotEffect {
private static final FilterPermanent filter = new FilterPermanent("artifact or land");
static {
filter.add(Predicates.or(
CardType.ARTIFACT.getPredicate(),
CardType.LAND.getPredicate()
));
}
UltimateMagicMeteorEffect() {
super(Outcome.Benefit);
staticText = "If this spell was cast from exile, for each opponent, " +
"choose an artifact or land that player controls. Destroy the chosen permanents";
}
private UltimateMagicMeteorEffect(final UltimateMagicMeteorEffect effect) {
super(effect);
}
@Override
public UltimateMagicMeteorEffect copy() {
return new UltimateMagicMeteorEffect(this);
}
@Override
public boolean apply(Game game, Ability source) {
Player player = game.getPlayer(source.getControllerId());
if (player == null) {
return false;
}
Set<Permanent> permanents = new HashSet<>();
for (UUID playerId : game.getOpponents(source.getControllerId())) {
FilterPermanent filter = this.filter.copy();
Optional.ofNullable(playerId)
.map(game::getPlayer)
.map(Player::getName)
.ifPresent(s -> filter.setMessage("artifact or land controlled by " + s));
filter.add(new ControllerIdPredicate(playerId));
if (!game.getBattlefield().contains(filter, source.getControllerId(), source, game, 1)) {
continue;
}
TargetPermanent target = new TargetPermanent(filter);
target.withNotTarget(true);
player.choose(outcome, target, source, game);
permanents.add(game.getPermanent(target.getFirstTarget()));
}
for (Permanent permanent : permanents) {
if (permanent != null) {
permanent.destroy(source, game);
}
}
return true;
}
}

View file

@ -383,6 +383,8 @@ public final class FinalFantasyCommander extends ExpansionSet {
cards.add(new SetCardInfo("Tromell, Seymour's Butler", 73, Rarity.RARE, mage.cards.t.TromellSeymoursButler.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ultimate Magic: Holy", 110, Rarity.RARE, mage.cards.u.UltimateMagicHoly.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ultimate Magic: Holy", 32, Rarity.RARE, mage.cards.u.UltimateMagicHoly.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ultimate Magic: Meteor", 121, Rarity.RARE, mage.cards.u.UltimateMagicMeteor.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Ultimate Magic: Meteor", 62, Rarity.RARE, mage.cards.u.UltimateMagicMeteor.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Umaro, Raging Yeti", 156, Rarity.RARE, mage.cards.u.UmaroRagingYeti.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Umaro, Raging Yeti", 63, Rarity.RARE, mage.cards.u.UmaroRagingYeti.class, NON_FULL_USE_VARIOUS));
cards.add(new SetCardInfo("Underground River", 439, Rarity.RARE, mage.cards.u.UndergroundRiver.class));