diff --git a/Mage.Sets/src/mage/cards/c/ChampionOfThePath.java b/Mage.Sets/src/mage/cards/c/ChampionOfThePath.java new file mode 100644 index 00000000000..543a9bc1b76 --- /dev/null +++ b/Mage.Sets/src/mage/cards/c/ChampionOfThePath.java @@ -0,0 +1,97 @@ +package mage.cards.c; + +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.common.EntersBattlefieldAllTriggeredAbility; +import mage.abilities.common.LeavesBattlefieldTriggeredAbility; +import mage.abilities.costs.common.BeholdAndExileCost; +import mage.abilities.effects.OneShotEffect; +import mage.abilities.effects.common.ReturnExiledCardToHandEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.BeholdType; +import mage.constants.CardType; +import mage.constants.Outcome; +import mage.constants.SubType; +import mage.filter.FilterPermanent; +import mage.filter.common.FilterControlledPermanent; +import mage.filter.predicate.mageobject.AnotherPredicate; +import mage.game.Game; +import mage.game.permanent.Permanent; + +import java.util.Optional; +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class ChampionOfThePath extends CardImpl { + + private static final FilterPermanent filter = new FilterControlledPermanent(SubType.ELEMENTAL, "another Elemental you control"); + + static { + filter.add(AnotherPredicate.instance); + } + + public ChampionOfThePath(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add(SubType.ELEMENTAL); + this.subtype.add(SubType.SORCERER); + this.power = new MageInt(7); + this.toughness = new MageInt(3); + + // As an additional cost to cast this spell, behold an Elemental and exile it. + this.getSpellAbility().addCost(new BeholdAndExileCost(BeholdType.ELEMENTAL)); + + // Whenever another Elemental you control enters, it deals damage equal to its power to each opponent. + this.addAbility(new EntersBattlefieldAllTriggeredAbility(new ChampionOfThePathEffect(), filter)); + + // When this creature leaves the battlefield, return the exiled card to its owner's hand. + this.addAbility(new LeavesBattlefieldTriggeredAbility(new ReturnExiledCardToHandEffect())); + } + + private ChampionOfThePath(final ChampionOfThePath card) { + super(card); + } + + @Override + public ChampionOfThePath copy() { + return new ChampionOfThePath(this); + } +} + +class ChampionOfThePathEffect extends OneShotEffect { + + ChampionOfThePathEffect() { + super(Outcome.Benefit); + staticText = "it deals damage equal to its power to each opponent"; + } + + private ChampionOfThePathEffect(final ChampionOfThePathEffect effect) { + super(effect); + } + + @Override + public ChampionOfThePathEffect copy() { + return new ChampionOfThePathEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + Permanent permanent = (Permanent) getValue("permanentEnteringBattlefield"); + if (permanent == null) { + return false; + } + int power = permanent.getPower().getValue(); + if (power < 1) { + return false; + } + for (UUID opponentId : game.getOpponents(source.getControllerId())) { + Optional.of(opponentId) + .map(game::getPlayer) + .ifPresent(player -> player.damage(power, permanent.getId(), source, game)); + } + return true; + } +} diff --git a/Mage.Sets/src/mage/sets/LorwynEclipsed.java b/Mage.Sets/src/mage/sets/LorwynEclipsed.java index 1b77802ebad..3a2718f5b50 100644 --- a/Mage.Sets/src/mage/sets/LorwynEclipsed.java +++ b/Mage.Sets/src/mage/sets/LorwynEclipsed.java @@ -71,6 +71,8 @@ public final class LorwynEclipsed extends ExpansionSet { cards.add(new SetCardInfo("Catharsis", 292, Rarity.MYTHIC, mage.cards.c.Catharsis.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Champion of the Clachan", 353, Rarity.RARE, mage.cards.c.ChampionOfTheClachan.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Champion of the Clachan", 9, Rarity.RARE, mage.cards.c.ChampionOfTheClachan.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Champion of the Path", 130, Rarity.RARE, mage.cards.c.ChampionOfThePath.class, NON_FULL_USE_VARIOUS)); + cards.add(new SetCardInfo("Champion of the Path", 362, Rarity.RARE, mage.cards.c.ChampionOfThePath.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Champion of the Weird", 360, Rarity.RARE, mage.cards.c.ChampionOfTheWeird.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Champion of the Weird", 95, Rarity.RARE, mage.cards.c.ChampionOfTheWeird.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Champions of the Perfect", 171, Rarity.RARE, mage.cards.c.ChampionsOfThePerfect.class, NON_FULL_USE_VARIOUS)); diff --git a/Mage/src/main/java/mage/constants/BeholdType.java b/Mage/src/main/java/mage/constants/BeholdType.java index 3e365aea31b..82b57822cec 100644 --- a/Mage/src/main/java/mage/constants/BeholdType.java +++ b/Mage/src/main/java/mage/constants/BeholdType.java @@ -22,6 +22,7 @@ import java.util.UUID; public enum BeholdType { DRAGON(SubType.DRAGON), GOBLIN(SubType.GOBLIN), + ELEMENTAL(SubType.ELEMENTAL), ELF(SubType.ELF), KITHKIN(SubType.KITHKIN), MERFOLK(SubType.MERFOLK);