From 98756596bc1731876cdbebfebf375853695592aa Mon Sep 17 00:00:00 2001 From: theelk801 Date: Tue, 20 May 2025 15:42:38 -0400 Subject: [PATCH] [FIN] Implement The Wind Crystal --- .../src/mage/cards/a/AlhammarretsArchive.java | 37 +--------- .../src/mage/cards/b/BoonReflection.java | 44 +----------- .../src/mage/cards/p/PhialOfGaladriel.java | 65 ++++-------------- .../src/mage/cards/r/RhoxFaithmender.java | 54 ++------------- .../src/mage/cards/t/TheWindCrystal.java | 67 +++++++++++++++++++ Mage.Sets/src/mage/sets/FinalFantasy.java | 2 + .../GainDoubleLifeReplacementEffect.java | 45 +++++++++++++ 7 files changed, 138 insertions(+), 176 deletions(-) create mode 100644 Mage.Sets/src/mage/cards/t/TheWindCrystal.java create mode 100644 Mage/src/main/java/mage/abilities/effects/common/replacement/GainDoubleLifeReplacementEffect.java diff --git a/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java b/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java index 1ce92cda1b2..8c76d02891c 100644 --- a/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java +++ b/Mage.Sets/src/mage/cards/a/AlhammarretsArchive.java @@ -3,13 +3,13 @@ package mage.cards.a; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.replacement.GainDoubleLifeReplacementEffect; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.*; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; -import mage.util.CardUtil; import mage.watchers.common.CardsDrawnDuringDrawStepWatcher; import java.util.UUID; @@ -24,7 +24,7 @@ public final class AlhammarretsArchive extends CardImpl { this.supertype.add(SuperType.LEGENDARY); // If you would gain life, you gain twice that much life instead. - this.addAbility(new SimpleStaticAbility(new AlhammarretsArchiveEffect())); + this.addAbility(new SimpleStaticAbility(new GainDoubleLifeReplacementEffect())); // If you draw a card except the first one you draw in each of your draw steps, draw two cards instead. this.addAbility(new SimpleStaticAbility(new AlhammarretsArchiveReplacementEffect()), new CardsDrawnDuringDrawStepWatcher()); @@ -40,39 +40,6 @@ public final class AlhammarretsArchive extends CardImpl { } } -class AlhammarretsArchiveEffect extends ReplacementEffectImpl { - - AlhammarretsArchiveEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If you would gain life, you gain twice that much life instead"; - } - - private AlhammarretsArchiveEffect(final AlhammarretsArchiveEffect effect) { - super(effect); - } - - @Override - public AlhammarretsArchiveEffect copy() { - return new AlhammarretsArchiveEffect(this); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(CardUtil.overflowMultiply(event.getAmount(), 2)); - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAIN_LIFE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return event.getPlayerId().equals(source.getControllerId()) && (source.getControllerId() != null); - } -} - class AlhammarretsArchiveReplacementEffect extends ReplacementEffectImpl { AlhammarretsArchiveReplacementEffect() { diff --git a/Mage.Sets/src/mage/cards/b/BoonReflection.java b/Mage.Sets/src/mage/cards/b/BoonReflection.java index b377bebe77a..846442bdece 100644 --- a/Mage.Sets/src/mage/cards/b/BoonReflection.java +++ b/Mage.Sets/src/mage/cards/b/BoonReflection.java @@ -1,17 +1,10 @@ package mage.cards.b; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.replacement.GainDoubleLifeReplacementEffect; 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.game.Game; -import mage.game.events.GameEvent; -import mage.util.CardUtil; import java.util.UUID; @@ -24,7 +17,7 @@ public final class BoonReflection extends CardImpl { super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{4}{W}"); // If you would gain life, you gain twice that much life instead. - this.addAbility(new SimpleStaticAbility(new BoonReflectionEffect())); + this.addAbility(new SimpleStaticAbility(new GainDoubleLifeReplacementEffect())); } private BoonReflection(final BoonReflection card) { @@ -36,36 +29,3 @@ public final class BoonReflection extends CardImpl { return new BoonReflection(this); } } - -class BoonReflectionEffect extends ReplacementEffectImpl { - - BoonReflectionEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If you would gain life, you gain twice that much life instead"; - } - - private BoonReflectionEffect(final BoonReflectionEffect effect) { - super(effect); - } - - @Override - public BoonReflectionEffect copy() { - return new BoonReflectionEffect(this); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(CardUtil.overflowMultiply(event.getAmount(), 2)); - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAIN_LIFE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return event.getPlayerId().equals(source.getControllerId()) && (source.getControllerId() != null); - } -} diff --git a/Mage.Sets/src/mage/cards/p/PhialOfGaladriel.java b/Mage.Sets/src/mage/cards/p/PhialOfGaladriel.java index c91fa0fdc2f..bb42297564b 100644 --- a/Mage.Sets/src/mage/cards/p/PhialOfGaladriel.java +++ b/Mage.Sets/src/mage/cards/p/PhialOfGaladriel.java @@ -2,33 +2,40 @@ package mage.cards.p; import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.condition.common.FatefulHourCondition; +import mage.abilities.decorator.ConditionalReplacementEffect; import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.replacement.GainDoubleLifeReplacementEffect; import mage.abilities.mana.AnyColorManaAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; -import mage.constants.*; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.constants.SuperType; import mage.game.Game; import mage.game.events.GameEvent; import mage.players.Player; -import mage.util.CardUtil; import java.util.UUID; /** - * * @author Susucr */ public final class PhialOfGaladriel extends CardImpl { public PhialOfGaladriel(UUID ownerId, CardSetInfo setInfo) { super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{3}"); - + this.supertype.add(SuperType.LEGENDARY); // If you would draw a card while you have no cards in hand, draw two cards instead. this.addAbility(new SimpleStaticAbility(new PhialOfGaladrielDrawEffect())); + // If you would gain life while you have 5 or less life, you gain twice that much life instead. - this.addAbility(new SimpleStaticAbility(new PhialOfGaladrielLifeEffect())); + this.addAbility(new SimpleStaticAbility(new ConditionalReplacementEffect( + new GainDoubleLifeReplacementEffect(), FatefulHourCondition.instance + ).setText("if you would gain life while you have 5 or less life, you gain twice that much life instead"))); // {T}: Add one mana of any color. this.addAbility(new AnyColorManaAbility()); @@ -44,50 +51,6 @@ public final class PhialOfGaladriel extends CardImpl { } } -class PhialOfGaladrielLifeEffect extends ReplacementEffectImpl { - - PhialOfGaladrielLifeEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If you would gain life while you have 5 or less life, " + - "you gain twice that much life instead"; - } - - private PhialOfGaladrielLifeEffect(final PhialOfGaladrielLifeEffect effect) { - super(effect); - } - - @Override - public PhialOfGaladrielLifeEffect copy() { - return new PhialOfGaladrielLifeEffect(this); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(CardUtil.overflowMultiply(event.getAmount(), 2)); - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAIN_LIFE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - UUID playerId = source.getControllerId(); - if(playerId == null || !event.getPlayerId().equals(playerId)){ - return false; - } - - Player player = game.getPlayer(playerId); - if(player == null){ - return false; - } - - return player.getLife() <= 5; - } -} - class PhialOfGaladrielDrawEffect extends ReplacementEffectImpl { PhialOfGaladrielDrawEffect() { @@ -121,12 +84,12 @@ class PhialOfGaladrielDrawEffect extends ReplacementEffectImpl { @Override public boolean applies(GameEvent event, Ability source, Game game) { UUID playerId = source.getControllerId(); - if(playerId == null || !event.getPlayerId().equals(playerId)){ + if (playerId == null || !event.getPlayerId().equals(playerId)) { return false; } Player player = game.getPlayer(playerId); - if(player == null){ + if (player == null) { return false; } diff --git a/Mage.Sets/src/mage/cards/r/RhoxFaithmender.java b/Mage.Sets/src/mage/cards/r/RhoxFaithmender.java index 72266f131b0..bd9acdd0781 100644 --- a/Mage.Sets/src/mage/cards/r/RhoxFaithmender.java +++ b/Mage.Sets/src/mage/cards/r/RhoxFaithmender.java @@ -1,32 +1,23 @@ - package mage.cards.r; -import java.util.UUID; import mage.MageInt; -import mage.abilities.Ability; import mage.abilities.common.SimpleStaticAbility; -import mage.abilities.effects.ReplacementEffectImpl; +import mage.abilities.effects.common.replacement.GainDoubleLifeReplacementEffect; import mage.abilities.keyword.LifelinkAbility; import mage.cards.CardImpl; import mage.cards.CardSetInfo; import mage.constants.CardType; import mage.constants.SubType; -import mage.constants.Duration; -import mage.constants.Outcome; -import mage.constants.Zone; -import mage.game.Game; -import mage.game.events.GameEvent; -import mage.game.events.GameEvent.EventType; -import mage.util.CardUtil; + +import java.util.UUID; /** - * * @author noxx and jeffwadsworth */ public final class RhoxFaithmender extends CardImpl { public RhoxFaithmender(UUID ownerId, CardSetInfo setInfo) { - super(ownerId,setInfo,new CardType[]{CardType.CREATURE},"{3}{W}"); + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{W}"); this.subtype.add(SubType.RHINO); this.subtype.add(SubType.MONK); @@ -35,9 +26,9 @@ public final class RhoxFaithmender extends CardImpl { // Lifelink this.addAbility(LifelinkAbility.getInstance()); - + // If you would gain life, you gain twice that much life instead. - this.addAbility(new SimpleStaticAbility(new RhoxFaithmenderEffect())); + this.addAbility(new SimpleStaticAbility(new GainDoubleLifeReplacementEffect())); } private RhoxFaithmender(final RhoxFaithmender card) { @@ -49,36 +40,3 @@ public final class RhoxFaithmender extends CardImpl { return new RhoxFaithmender(this); } } - -class RhoxFaithmenderEffect extends ReplacementEffectImpl { - - RhoxFaithmenderEffect() { - super(Duration.WhileOnBattlefield, Outcome.Benefit); - staticText = "If you would gain life, you gain twice that much life instead"; - } - - private RhoxFaithmenderEffect(final RhoxFaithmenderEffect effect) { - super(effect); - } - - @Override - public RhoxFaithmenderEffect copy() { - return new RhoxFaithmenderEffect(this); - } - - @Override - public boolean replaceEvent(GameEvent event, Ability source, Game game) { - event.setAmount(CardUtil.overflowMultiply(event.getAmount(), 2)); - return false; - } - - @Override - public boolean checksEventType(GameEvent event, Game game) { - return event.getType() == GameEvent.EventType.GAIN_LIFE; - } - - @Override - public boolean applies(GameEvent event, Ability source, Game game) { - return event.getPlayerId().equals(source.getControllerId()) && (source.getControllerId() != null); - } -} diff --git a/Mage.Sets/src/mage/cards/t/TheWindCrystal.java b/Mage.Sets/src/mage/cards/t/TheWindCrystal.java new file mode 100644 index 00000000000..0dcfa19b7ed --- /dev/null +++ b/Mage.Sets/src/mage/cards/t/TheWindCrystal.java @@ -0,0 +1,67 @@ +package mage.cards.t; + +import mage.ObjectColor; +import mage.abilities.Ability; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.common.SimpleStaticAbility; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.costs.mana.ManaCostsImpl; +import mage.abilities.effects.common.continuous.GainAbilityControlledEffect; +import mage.abilities.effects.common.cost.SpellsCostReductionControllerEffect; +import mage.abilities.effects.common.replacement.GainDoubleLifeReplacementEffect; +import mage.abilities.keyword.FlyingAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.SuperType; +import mage.filter.FilterCard; +import mage.filter.StaticFilters; +import mage.filter.predicate.mageobject.ColorPredicate; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class TheWindCrystal extends CardImpl { + + private static final FilterCard filter = new FilterCard("white spells"); + + static { + filter.add(new ColorPredicate(ObjectColor.WHITE)); + } + + public TheWindCrystal(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}{W}{W}"); + + this.supertype.add(SuperType.LEGENDARY); + + // White spells you cast cost {1} less to cast. + this.addAbility(new SimpleStaticAbility(new SpellsCostReductionControllerEffect(filter, 1))); + + // If you would gain life, you gain twice that much life instead. + this.addAbility(new SimpleStaticAbility(new GainDoubleLifeReplacementEffect())); + + // {4}{W}{W}, {T}: Creatures you control gain flying and lifelink until end of turn. + Ability ability = new SimpleActivatedAbility(new GainAbilityControlledEffect( + FlyingAbility.getInstance(), Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_CREATURE + ).setText("creatures you control gain flying"), new ManaCostsImpl<>("{4}{W}{W}")); + ability.addCost(new TapSourceCost()); + ability.addEffect(new GainAbilityControlledEffect( + FlyingAbility.getInstance(), Duration.EndOfTurn, + StaticFilters.FILTER_PERMANENT_CREATURE + ).setText("and lifelink until end of turn")); + this.addAbility(ability); + } + + private TheWindCrystal(final TheWindCrystal card) { + super(card); + } + + @Override + public TheWindCrystal copy() { + return new TheWindCrystal(this); + } +} diff --git a/Mage.Sets/src/mage/sets/FinalFantasy.java b/Mage.Sets/src/mage/sets/FinalFantasy.java index 7f9903e3dda..4ba4897a0a2 100644 --- a/Mage.Sets/src/mage/sets/FinalFantasy.java +++ b/Mage.Sets/src/mage/sets/FinalFantasy.java @@ -331,6 +331,8 @@ public final class FinalFantasy extends ExpansionSet { cards.add(new SetCardInfo("The Prima Vista", 64, Rarity.UNCOMMON, mage.cards.t.ThePrimaVista.class)); cards.add(new SetCardInfo("The Water Crystal", 333, Rarity.RARE, mage.cards.t.TheWaterCrystal.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("The Water Crystal", 85, Rarity.RARE, mage.cards.t.TheWaterCrystal.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Wind Crystal", 330, Rarity.RARE, mage.cards.t.TheWindCrystal.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("The Wind Crystal", 43, Rarity.RARE, mage.cards.t.TheWindCrystal.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Tidus, Blitzball Star", 512, Rarity.UNCOMMON, mage.cards.t.TidusBlitzballStar.class)); cards.add(new SetCardInfo("Tifa Lockhart", 206, Rarity.RARE, mage.cards.t.TifaLockhart.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Tifa Lockhart", 391, Rarity.RARE, mage.cards.t.TifaLockhart.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/replacement/GainDoubleLifeReplacementEffect.java b/Mage/src/main/java/mage/abilities/effects/common/replacement/GainDoubleLifeReplacementEffect.java new file mode 100644 index 00000000000..593c7636950 --- /dev/null +++ b/Mage/src/main/java/mage/abilities/effects/common/replacement/GainDoubleLifeReplacementEffect.java @@ -0,0 +1,45 @@ +package mage.abilities.effects.common.replacement; + +import mage.abilities.Ability; +import mage.abilities.effects.ReplacementEffectImpl; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.util.CardUtil; + +/** + * @author TheElk801 + */ +public class GainDoubleLifeReplacementEffect extends ReplacementEffectImpl { + + public GainDoubleLifeReplacementEffect() { + super(Duration.WhileOnBattlefield, Outcome.Benefit); + staticText = "if you would gain life, you gain twice that much life instead"; + } + + private GainDoubleLifeReplacementEffect(final GainDoubleLifeReplacementEffect effect) { + super(effect); + } + + @Override + public GainDoubleLifeReplacementEffect copy() { + return new GainDoubleLifeReplacementEffect(this); + } + + @Override + public boolean replaceEvent(GameEvent event, Ability source, Game game) { + event.setAmount(CardUtil.overflowMultiply(event.getAmount(), 2)); + return false; + } + + @Override + public boolean checksEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.GAIN_LIFE; + } + + @Override + public boolean applies(GameEvent event, Ability source, Game game) { + return source.isControlledBy(event.getPlayerId()); + } +}