|
| 1 | +package mage.cards.s; |
| 2 | + |
| 3 | +import mage.MageInt; |
| 4 | +import mage.abilities.TriggeredAbilityImpl; |
| 5 | +import mage.abilities.common.CantBeCounteredSourceAbility; |
| 6 | +import mage.abilities.effects.common.DrawCardSourceControllerEffect; |
| 7 | +import mage.abilities.keyword.TrampleAbility; |
| 8 | +import mage.cards.CardImpl; |
| 9 | +import mage.cards.CardSetInfo; |
| 10 | +import mage.constants.CardType; |
| 11 | +import mage.constants.SubType; |
| 12 | +import mage.constants.SuperType; |
| 13 | +import mage.constants.Zone; |
| 14 | +import mage.game.Game; |
| 15 | +import mage.game.events.GameEvent; |
| 16 | +import mage.game.permanent.Permanent; |
| 17 | +import mage.game.stack.Spell; |
| 18 | +import mage.game.stack.StackObject; |
| 19 | +import mage.util.CardUtil; |
| 20 | + |
| 21 | +import java.util.UUID; |
| 22 | + |
| 23 | +/** |
| 24 | + * @author TheElk801 |
| 25 | + */ |
| 26 | +public final class SurrakElusiveHunter extends CardImpl { |
| 27 | + |
| 28 | + public SurrakElusiveHunter(UUID ownerId, CardSetInfo setInfo) { |
| 29 | + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{2}{G}"); |
| 30 | + |
| 31 | + this.supertype.add(SuperType.LEGENDARY); |
| 32 | + this.subtype.add(SubType.HUMAN); |
| 33 | + this.subtype.add(SubType.WARRIOR); |
| 34 | + this.power = new MageInt(4); |
| 35 | + this.toughness = new MageInt(3); |
| 36 | + |
| 37 | + // This spell can't be countered. |
| 38 | + this.addAbility(new CantBeCounteredSourceAbility()); |
| 39 | + |
| 40 | + // Trample |
| 41 | + this.addAbility(TrampleAbility.getInstance()); |
| 42 | + |
| 43 | + // Whenever a creature you control or a creature spell you control becomes the target of a spell or ability an opponent controls, draw a card. |
| 44 | + this.addAbility(new SurrakElusiveHunterTriggeredAbility()); |
| 45 | + } |
| 46 | + |
| 47 | + private SurrakElusiveHunter(final SurrakElusiveHunter card) { |
| 48 | + super(card); |
| 49 | + } |
| 50 | + |
| 51 | + @Override |
| 52 | + public SurrakElusiveHunter copy() { |
| 53 | + return new SurrakElusiveHunter(this); |
| 54 | + } |
| 55 | +} |
| 56 | + |
| 57 | +class SurrakElusiveHunterTriggeredAbility extends TriggeredAbilityImpl { |
| 58 | + |
| 59 | + SurrakElusiveHunterTriggeredAbility() { |
| 60 | + super(Zone.BATTLEFIELD, new DrawCardSourceControllerEffect(1)); |
| 61 | + this.setTriggerPhrase("Whenever a creature you control or a creature spell you control " + |
| 62 | + "becomes the target of a spell or ability an opponent controls, "); |
| 63 | + } |
| 64 | + |
| 65 | + private SurrakElusiveHunterTriggeredAbility(final SurrakElusiveHunterTriggeredAbility ability) { |
| 66 | + super(ability); |
| 67 | + } |
| 68 | + |
| 69 | + @Override |
| 70 | + public SurrakElusiveHunterTriggeredAbility copy() { |
| 71 | + return new SurrakElusiveHunterTriggeredAbility(this); |
| 72 | + } |
| 73 | + |
| 74 | + @Override |
| 75 | + public boolean checkEventType(GameEvent event, Game game) { |
| 76 | + return event.getType() == GameEvent.EventType.TARGETED; |
| 77 | + } |
| 78 | + |
| 79 | + private boolean checkTargeted(UUID targetId, Game game) { |
| 80 | + Permanent permanent = game.getPermanentOrLKIBattlefield(targetId); |
| 81 | + if (permanent != null) { |
| 82 | + return permanent.isCreature(game) && permanent.isControlledBy(getControllerId()); |
| 83 | + } |
| 84 | + Spell spell = game.getSpellOrLKIStack(targetId); |
| 85 | + return spell != null && spell.isCreature(game) && spell.isControlledBy(getControllerId()); |
| 86 | + } |
| 87 | + |
| 88 | + @Override |
| 89 | + public boolean checkTrigger(GameEvent event, Game game) { |
| 90 | + if (!checkTargeted(event.getTargetId(), game)) { |
| 91 | + return false; |
| 92 | + } |
| 93 | + StackObject targetingObject = CardUtil.getTargetingStackObject(this.getId().toString(), event, game); |
| 94 | + return targetingObject != null |
| 95 | + && !game.getOpponents(getControllerId()).contains(targetingObject.getControllerId()) |
| 96 | + && !CardUtil.checkTargetedEventAlreadyUsed(this.getId().toString(), targetingObject, event, game) |
| 97 | + } |
| 98 | +} |
0 commit comments