diff --git a/Mage.Sets/src/mage/cards/h/HeartOfKiran.java b/Mage.Sets/src/mage/cards/h/HeartOfKiran.java index 3bdcfa81c9..78d9b9d421 100644 --- a/Mage.Sets/src/mage/cards/h/HeartOfKiran.java +++ b/Mage.Sets/src/mage/cards/h/HeartOfKiran.java @@ -1,7 +1,6 @@ package mage.cards.h; -import java.util.UUID; import mage.MageInt; import mage.abilities.Ability; import mage.abilities.common.SimpleActivatedAbility; @@ -23,6 +22,8 @@ import mage.game.permanent.Permanent; import mage.target.Target; import mage.target.common.TargetControlledPermanent; +import java.util.UUID; + /** * @author JRHerlehy */ @@ -100,7 +101,6 @@ class HeartOfKiranAlternateCrewCost extends CostImpl { if (paid) { game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREWED_VEHICLE, target.getFirstTarget(), source, controllerId)); } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.VEHICLE_CREWED, source.getSourceId(), source, controllerId)); } return paid; diff --git a/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java b/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java index e5f206f760..48d5821752 100644 --- a/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java +++ b/Mage/src/main/java/mage/abilities/keyword/CrewAbility.java @@ -6,6 +6,7 @@ import mage.abilities.common.CrewWithToughnessAbility; import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.costs.Cost; import mage.abilities.costs.CostImpl; +import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.common.continuous.AddCardTypeSourceEffect; import mage.abilities.hint.HintUtils; import mage.abilities.icon.abilities.CrewAbilityIcon; @@ -34,8 +35,8 @@ public class CrewAbility extends SimpleActivatedAbility { private final int value; public CrewAbility(int value) { - super(Zone.BATTLEFIELD, new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT), new CrewCost(value)); - this.addEffect(new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE)); + super(Zone.BATTLEFIELD, new AddCardTypeSourceEffect(Duration.EndOfTurn, CardType.ARTIFACT, CardType.CREATURE), new CrewCost(value)); + this.addEffect(new CrewEventEffect()); this.addIcon(CrewAbilityIcon.instance); this.value = value; } @@ -56,6 +57,34 @@ public class CrewAbility extends SimpleActivatedAbility { } } +class CrewEventEffect extends OneShotEffect { + + CrewEventEffect() { + super(Outcome.Benefit); + } + + private CrewEventEffect(final CrewEventEffect effect) { + super(effect); + } + + @Override + public CrewEventEffect copy() { + return new CrewEventEffect(this); + } + + @Override + public boolean apply(Game game, Ability source) { + if (source.getSourcePermanentIfItStillExists(game) != null) { + game.fireEvent(GameEvent.getEvent( + GameEvent.EventType.VEHICLE_CREWED, + source.getSourceId(), + source, source.getControllerId() + )); + } + return true; + } +} + class CrewCost extends CostImpl { private static final FilterControlledCreaturePermanent filter = new FilterControlledCreaturePermanent("another untapped creature you control"); @@ -112,7 +141,6 @@ class CrewCost extends CostImpl { for (UUID targetId : target.getTargets()) { game.fireEvent(GameEvent.getEvent(GameEvent.EventType.CREWED_VEHICLE, targetId, source, controllerId)); } - game.fireEvent(GameEvent.getEvent(GameEvent.EventType.VEHICLE_CREWED, source.getSourceId(), source, controllerId)); } } else { return false;