diff --git a/Mage.Sets/src/mage/cards/h/HornOfTheMark.java b/Mage.Sets/src/mage/cards/h/HornOfTheMark.java new file mode 100644 index 0000000000..5b171cc753 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HornOfTheMark.java @@ -0,0 +1,77 @@ +package mage.cards.h; + +import mage.abilities.TriggeredAbilityImpl; +import mage.abilities.effects.common.LookLibraryAndPickControllerEffect; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.constants.CardType; +import mage.constants.PutCards; +import mage.constants.SuperType; +import mage.constants.Zone; +import mage.filter.StaticFilters; +import mage.game.Controllable; +import mage.game.Game; +import mage.game.events.DefenderAttackedEvent; +import mage.game.events.GameEvent; + +import java.util.UUID; + +/** + * @author TheElk801 + */ +public final class HornOfTheMark extends CardImpl { + + public HornOfTheMark(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); + + this.supertype.add(SuperType.LEGENDARY); + + // Whenever two or more creatures you control attack a player, look at the top five cards of your library. You may reveal a creature card from among them and put it into your hand. Put the rest on the bottom of your library in a random order. + this.addAbility(new HornOfTheMarkTriggeredAbility()); + } + + private HornOfTheMark(final HornOfTheMark card) { + super(card); + } + + @Override + public HornOfTheMark copy() { + return new HornOfTheMark(this); + } +} + +class HornOfTheMarkTriggeredAbility extends TriggeredAbilityImpl { + + HornOfTheMarkTriggeredAbility() { + super(Zone.BATTLEFIELD, new LookLibraryAndPickControllerEffect( + 5, 1, StaticFilters.FILTER_CARD_CREATURE_A, PutCards.HAND, PutCards.BOTTOM_RANDOM + )); + this.setTriggerPhrase("Whenever two or more creatures you control attack a player, "); + } + + private HornOfTheMarkTriggeredAbility(final HornOfTheMarkTriggeredAbility ability) { + super(ability); + } + + @Override + public HornOfTheMarkTriggeredAbility copy() { + return new HornOfTheMarkTriggeredAbility(this); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.DEFENDER_ATTACKED; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + DefenderAttackedEvent dEvent = ((DefenderAttackedEvent) event); + return game.getPlayer(dEvent.getTargetId()) != null + && dEvent + .getAttackers(game) + .stream() + .map(Controllable::getControllerId) + .filter(this::isControlledBy) + .count() >= 2; + } +} diff --git a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java index 25d3a6d421..f1537b2b14 100644 --- a/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java +++ b/Mage.Sets/src/mage/sets/TheLordOfTheRingsTalesOfMiddleEarth.java @@ -119,6 +119,7 @@ public final class TheLordOfTheRingsTalesOfMiddleEarth extends ExpansionSet { cards.add(new SetCardInfo("Hithlain Knots", 54, Rarity.COMMON, mage.cards.h.HithlainKnots.class)); cards.add(new SetCardInfo("Hobbit's Sting", 20, Rarity.COMMON, mage.cards.h.HobbitsSting.class)); cards.add(new SetCardInfo("Horn of Gondor", 240, Rarity.RARE, mage.cards.h.HornOfGondor.class)); + cards.add(new SetCardInfo("Horn of the Mark", 241, Rarity.RARE, mage.cards.h.HornOfTheMark.class)); cards.add(new SetCardInfo("Horses of the Bruinen", 55, Rarity.UNCOMMON, mage.cards.h.HorsesOfTheBruinen.class)); cards.add(new SetCardInfo("Improvised Club", 137, Rarity.COMMON, mage.cards.i.ImprovisedClub.class)); cards.add(new SetCardInfo("Inherited Envelope", 242, Rarity.COMMON, mage.cards.i.InheritedEnvelope.class));