diff --git a/Mage.Sets/src/mage/cards/i/InfernoHellion.java b/Mage.Sets/src/mage/cards/i/InfernoHellion.java new file mode 100644 index 00000000000..d253009030e --- /dev/null +++ b/Mage.Sets/src/mage/cards/i/InfernoHellion.java @@ -0,0 +1,78 @@ +package mage.cards.i; + +import java.util.UUID; +import mage.MageInt; +import mage.MageObjectReference; +import mage.abilities.Ability; +import mage.abilities.common.BeginningOfEndStepTriggeredAbility; +import mage.abilities.condition.Condition; +import mage.abilities.decorator.ConditionalTriggeredAbility; +import mage.abilities.effects.common.ShuffleIntoLibrarySourceEffect; +import mage.constants.SubType; +import mage.abilities.keyword.TrampleAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.TargetController; +import mage.game.Game; +import mage.watchers.common.AttackedThisTurnWatcher; +import mage.watchers.common.BlockedThisTurnWatcher; + +/** + * + * @author TheElk801 + */ +public final class InfernoHellion extends CardImpl { + + public InfernoHellion(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add(SubType.HELLION); + this.power = new MageInt(7); + this.toughness = new MageInt(3); + + // Trample + this.addAbility(TrampleAbility.getInstance()); + + // At the beginning of each end step, if Inferno Hellion attacked or blocked this turn, its owner shuffles it into their library. + Ability ability = new ConditionalTriggeredAbility( + new BeginningOfEndStepTriggeredAbility( + new ShuffleIntoLibrarySourceEffect(), + TargetController.ANY, false + ), + InfernoHellionCondition.instance, + "At the beginning of each end step, " + + "if {this} attacked or blocked this turn, " + + "its owner shuffles it into their library." + ); + ability.addWatcher(new AttackedThisTurnWatcher()); + ability.addWatcher(new BlockedThisTurnWatcher()); + this.addAbility(ability); + } + + public InfernoHellion(final InfernoHellion card) { + super(card); + } + + @Override + public InfernoHellion copy() { + return new InfernoHellion(this); + } +} + +enum InfernoHellionCondition implements Condition { + + instance; + + @Override + public boolean apply(Game game, Ability source) { + AttackedThisTurnWatcher watcherAttacked = (AttackedThisTurnWatcher) game.getState().getWatchers().get(AttackedThisTurnWatcher.class.getSimpleName()); + BlockedThisTurnWatcher watcherBlocked = (BlockedThisTurnWatcher) game.getState().getWatchers().get(BlockedThisTurnWatcher.class.getSimpleName()); + MageObjectReference mor = new MageObjectReference(source.getSourceId(), game); + if (watcherAttacked == null || watcherBlocked == null) { + return false; + } + return watcherAttacked.getAttackedThisTurnCreatures().contains(mor) + || watcherBlocked.getBlockedThisTurnCreatures().contains(mor); + } +} diff --git a/Mage.Sets/src/mage/sets/CoreSet2019.java b/Mage.Sets/src/mage/sets/CoreSet2019.java index 61955db1319..5ffc862cc6c 100644 --- a/Mage.Sets/src/mage/sets/CoreSet2019.java +++ b/Mage.Sets/src/mage/sets/CoreSet2019.java @@ -157,6 +157,7 @@ public final class CoreSet2019 extends ExpansionSet { cards.add(new SetCardInfo("Infectious Horror", 101, Rarity.COMMON, mage.cards.i.InfectiousHorror.class)); cards.add(new SetCardInfo("Infernal Reckoning", 102, Rarity.RARE, mage.cards.i.InfernalReckoning.class)); cards.add(new SetCardInfo("Infernal Scarring", 103, Rarity.COMMON, mage.cards.i.InfernalScarring.class)); + cards.add(new SetCardInfo("Inferno Hellion", 148, Rarity.UNCOMMON, mage.cards.i.InfernoHellion.class)); cards.add(new SetCardInfo("Inspired Charge", 15, Rarity.COMMON, mage.cards.i.InspiredCharge.class)); cards.add(new SetCardInfo("Invoke the Divine", 16, Rarity.COMMON, mage.cards.i.InvokeTheDivine.class)); cards.add(new SetCardInfo("Isareth the Awakener", 104, Rarity.RARE, mage.cards.i.IsarethTheAwakener.class));