diff --git a/Mage.Sets/src/mage/cards/o/OpenTheOmenpaths.java b/Mage.Sets/src/mage/cards/o/OpenTheOmenpaths.java new file mode 100644 index 0000000000..e76e3239da --- /dev/null +++ b/Mage.Sets/src/mage/cards/o/OpenTheOmenpaths.java @@ -0,0 +1,98 @@ +package mage.cards.o; + +import mage.ConditionalMana; +import mage.MageObject; +import mage.Mana; +import mage.abilities.Ability; +import mage.abilities.Mode; +import mage.abilities.SpellAbility; +import mage.abilities.condition.Condition; +import mage.abilities.costs.Cost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.continuous.BoostControlledEffect; +import mage.abilities.mana.conditional.ManaCondition; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.choices.ManaChoice; +import mage.constants.CardType; +import mage.constants.Duration; +import mage.constants.Outcome; +import mage.game.Game; +import mage.players.Player; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class OpenTheOmenpaths extends CardImpl { + + public OpenTheOmenpaths(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.INSTANT}, "{2}{R}"); + + // Choose one — + // • Add two mana of any one color and two mana of any other color. Spend this mana only to cast creature or enchantment spells. + this.getSpellAbility().addEffect(new OpenTheOmenpathsEffect()); + + // • Creatures you control get +1/+0 until end of turn. + this.getSpellAbility().addMode(new Mode(new BoostControlledEffect(1, 0, Duration.EndOfTurn))); + } + + private OpenTheOmenpaths(final OpenTheOmenpaths card) { + super(card); + } + + @Override + public OpenTheOmenpaths copy() { + return new OpenTheOmenpaths(this); + } +} + +class OpenTheOmenpathsEffect extends OneShotEffect { + + OpenTheOmenpathsEffect() { + super(Outcome.Benefit); + staticText = "add two mana of any one color and two mana of any other color. " + + "Spend this mana only to cast creature or enchantment spells"; + } + + private OpenTheOmenpathsEffect(final OpenTheOmenpathsEffect effect) { + super(effect); + } + + @Override + public OpenTheOmenpathsEffect copy() { + return new OpenTheOmenpathsEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Player player = game.getPlayer(source.getControllerId()); + if (player == null) { + return false; + } + Mana mana = ManaChoice.chooseTwoDifferentColors(player, game); + mana.add(mana); + ConditionalMana conditionalMana = new ConditionalMana(mana); + conditionalMana.addCondition(new OpenTheOmenpathsCondition()); + player.getManaPool().addMana(conditionalMana, game, source); + return true; + } +} + +class OpenTheOmenpathsCondition extends ManaCondition implements Condition { + + @Override + public boolean apply(Game game, Ability source) { + if (!(source instanceof SpellAbility)) { + return false; + } + MageObject object = game.getObject(source.getSourceId()); + return object != null && (object.isCreature() || object.isEnchantment()); + } + + @Override + public boolean apply(Game game, Ability source, UUID originalId, Cost costToPay) { + return apply(game, source); + } +} diff --git a/Mage.Sets/src/mage/sets/Kaldheim.java b/Mage.Sets/src/mage/sets/Kaldheim.java index 9fee3a793e..307251f6c3 100644 --- a/Mage.Sets/src/mage/sets/Kaldheim.java +++ b/Mage.Sets/src/mage/sets/Kaldheim.java @@ -239,6 +239,7 @@ public final class Kaldheim extends ExpansionSet { cards.add(new SetCardInfo("Narfi, Betrayer King", 224, Rarity.UNCOMMON, mage.cards.n.NarfiBetrayerKing.class)); cards.add(new SetCardInfo("Niko Aris", 225, Rarity.MYTHIC, mage.cards.n.NikoAris.class)); cards.add(new SetCardInfo("Old-Growth Troll", 185, Rarity.RARE, mage.cards.o.OldGrowthTroll.class)); + cards.add(new SetCardInfo("Open the Omenpaths", 143, Rarity.COMMON, mage.cards.o.OpenTheOmenpaths.class)); cards.add(new SetCardInfo("Orvar, the All-Form", 70, Rarity.MYTHIC, mage.cards.o.OrvarTheAllForm.class)); cards.add(new SetCardInfo("Path to the World Tree", 186, Rarity.UNCOMMON, mage.cards.p.PathToTheWorldTree.class)); cards.add(new SetCardInfo("Pilfering Hawk", 71, Rarity.COMMON, mage.cards.p.PilferingHawk.class));