diff --git a/Mage.Sets/src/mage/cards/b/BurnAway.java b/Mage.Sets/src/mage/cards/b/BurnAway.java index 69db42a5dd..54e6e9344d 100644 --- a/Mage.Sets/src/mage/cards/b/BurnAway.java +++ b/Mage.Sets/src/mage/cards/b/BurnAway.java @@ -62,7 +62,7 @@ class BurnAwayDelayedTriggeredAbility extends DelayedTriggeredAbility { public boolean checkTrigger(GameEvent event, Game game) { ZoneChangeEvent zEvent = (ZoneChangeEvent) event; if (zEvent.isDiesEvent() && zEvent.getTarget() != null && zEvent.getTargetId().equals(getTargets().getFirstTarget())) { - this.getTargets().clear(); // else spell fizzels because target creature died + this.getTargets().clear(); // else spell fizzles because target creature died Target target = new TargetPlayer(); target.add(zEvent.getTarget().getControllerId(), game); this.addTarget(target); diff --git a/Mage.Sets/src/mage/cards/h/HeartWolf.java b/Mage.Sets/src/mage/cards/h/HeartWolf.java new file mode 100644 index 0000000000..6692e3fd00 --- /dev/null +++ b/Mage.Sets/src/mage/cards/h/HeartWolf.java @@ -0,0 +1,113 @@ +package mage.cards.h; + +import java.util.UUID; +import mage.MageInt; +import mage.abilities.Ability; +import mage.abilities.DelayedTriggeredAbility; +import mage.abilities.common.SimpleActivatedAbility; +import mage.abilities.condition.common.IsPhaseCondition; +import mage.abilities.costs.common.TapSourceCost; +import mage.abilities.decorator.ConditionalActivatedAbility; +import mage.abilities.effects.common.CreateDelayedTriggeredAbilityEffect; +import mage.abilities.effects.common.ExileGraveyardAllTargetPlayerEffect; +import mage.abilities.effects.common.SacrificeSourceEffect; +import mage.abilities.effects.common.continuous.BoostTargetEffect; +import mage.abilities.effects.common.continuous.GainAbilityTargetEffect; +import mage.constants.*; +import mage.abilities.keyword.FirstStrikeAbility; +import mage.cards.CardImpl; +import mage.cards.CardSetInfo; +import mage.filter.common.FilterCreaturePermanent; +import mage.filter.predicate.mageobject.SubtypePredicate; +import mage.game.Game; +import mage.game.events.GameEvent; +import mage.game.events.ZoneChangeEvent; +import mage.game.turn.Phase; +import mage.target.Target; +import mage.target.TargetPlayer; +import mage.target.common.TargetCreaturePermanent; + +/** + * + * @author noahg + */ +public final class HeartWolf extends CardImpl { + + private final static FilterCreaturePermanent filter = new FilterCreaturePermanent(); + + static { + filter.add(new SubtypePredicate(SubType.DWARF)); + } + + public HeartWolf(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.CREATURE}, "{3}{R}"); + + this.subtype.add(SubType.WOLF); + this.power = new MageInt(2); + this.toughness = new MageInt(2); + + // First strike + this.addAbility(FirstStrikeAbility.getInstance()); + + // {tap}: Target Dwarf creature gets +2/+0 and gains first strike until end of turn. When that creature leaves the battlefield this turn, sacrifice Heart Wolf. Activate this ability only during combat. + Ability ability = new ConditionalActivatedAbility(Zone.BATTLEFIELD, new BoostTargetEffect(2, 0, Duration.EndOfTurn) + .setText("Target Dwarf creature gets +2/+0"), new TapSourceCost(), new IsPhaseCondition(TurnPhase.COMBAT)); + ability.addEffect(new GainAbilityTargetEffect(FirstStrikeAbility.getInstance(), + Duration.EndOfTurn).setText("and gains first strike until end of turn")); + ability.addTarget(new TargetCreaturePermanent(filter)); + ability.addEffect(new CreateDelayedTriggeredAbilityEffect(new HeartWolfDelayedTriggeredAbility(), true)); + this.addAbility(ability); + } + + public HeartWolf(final HeartWolf card) { + super(card); + } + + @Override + public HeartWolf copy() { + return new HeartWolf(this); + } +} + +class HeartWolfDelayedTriggeredAbility extends DelayedTriggeredAbility { + + public HeartWolfDelayedTriggeredAbility() { + super(new SacrificeSourceEffect(), Duration.EndOfTurn, false); + } + + public HeartWolfDelayedTriggeredAbility(HeartWolfDelayedTriggeredAbility ability) { + super(ability); + } + + @Override + public boolean checkEventType(GameEvent event, Game game) { + return event.getType() == GameEvent.EventType.ZONE_CHANGE; + } + + @Override + public boolean checkTrigger(GameEvent event, Game game) { + System.out.println("Source: "+game.getCard(sourceId).getLogName()); + System.out.println("Source ID: "+sourceId); + ZoneChangeEvent zEvent = (ZoneChangeEvent) event; + if(zEvent.getFromZone() == Zone.BATTLEFIELD && zEvent.getTarget() != null && zEvent.getTargetId().equals(getTargets().getFirstTarget())){ + this.getTargets().clear(); // else spell fizzles because target creature died + return true; + } + return false; + } + + @Override + public HeartWolfDelayedTriggeredAbility copy() { + return new HeartWolfDelayedTriggeredAbility(this); + } + + @Override + public String getRule() { + return "When that creature leaves the battlefield this turn, sacrifice {this}."; + } + + @Override + public String toString() { + return "HeartWolfDelayedTriggeredAbility as a string!"; + } +} \ No newline at end of file diff --git a/Mage.Sets/src/mage/sets/Homelands.java b/Mage.Sets/src/mage/sets/Homelands.java index 4502fe8dbd..bd16aacd6c 100644 --- a/Mage.Sets/src/mage/sets/Homelands.java +++ b/Mage.Sets/src/mage/sets/Homelands.java @@ -108,6 +108,7 @@ public final class Homelands extends ExpansionSet { cards.add(new SetCardInfo("Greater Werewolf", 51, Rarity.UNCOMMON, mage.cards.g.GreaterWerewolf.class)); cards.add(new SetCardInfo("Hazduhr the Abbot", 8, Rarity.RARE, mage.cards.h.HazduhrTheAbbot.class)); cards.add(new SetCardInfo("Headstone", 52, Rarity.COMMON, mage.cards.h.Headstone.class)); + cards.add(new SetCardInfo("Heart Wolf", 75, Rarity.RARE, mage.cards.h.HeartWolf.class)); cards.add(new SetCardInfo("Hungry Mist", "88a", Rarity.COMMON, mage.cards.h.HungryMist.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Hungry Mist", "88b", Rarity.COMMON, mage.cards.h.HungryMist.class, NON_FULL_USE_VARIOUS)); cards.add(new SetCardInfo("Ihsan's Shade", 53, Rarity.UNCOMMON, mage.cards.i.IhsansShade.class)); diff --git a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java index 26e828dc58..8918989958 100644 --- a/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java +++ b/Mage/src/main/java/mage/abilities/effects/common/SacrificeSourceEffect.java @@ -31,7 +31,9 @@ public class SacrificeSourceEffect extends OneShotEffect { @Override public boolean apply(Game game, Ability source) { + System.out.println("Source class: "+ source.getClass().getName()); MageObject sourceObject = source.getSourceObjectIfItStillExists(game); + System.out.println("Source object: "+sourceObject); if (sourceObject == null) { // Check if the effect was installed by the spell the source was cast by (e.g. Necromancy), if not don't sacrifice the permanent if (source.getSourceObject(game) instanceof Spell) {