diff --git a/Mage.Sets/src/mage/cards/u/UnlicensedHearse.java b/Mage.Sets/src/mage/cards/u/UnlicensedHearse.java index b203a2ea492..98a4b4aa89d 100644 --- a/Mage.Sets/src/mage/cards/u/UnlicensedHearse.java +++ b/Mage.Sets/src/mage/cards/u/UnlicensedHearse.java @@ -22,77 +22,78 @@ import mage.filter.StaticFilters; import mage.game.ExileZone; import mage.game.Game; import mage.target.common.TargetCardInASingleGraveyard; -import mage.util.CardUtil; import java.util.UUID; +import mage.cards.Card; +import mage.util.CardUtil; /** * @author TheElk801 */ enum UnlicensedHearseValue implements DynamicValue { - instance; + instance; - @Override - public int calculate(Game game, Ability sourceAbility, Effect effect) { - ExileZone cardsExiledWithUnlicensedHearse = - game.getExile() - .getExileZone( - CardUtil.getExileZoneId( - game, - sourceAbility.getSourceId(), - game.getState().getZoneChangeCounter(sourceAbility.getSourceId()))); - if (cardsExiledWithUnlicensedHearse == null) { - return 0; + @Override + public int calculate(Game game, Ability sourceAbility, Effect effect) { + Card unlicensedHearse = game.getCard(sourceAbility.getSourceId()); + if (unlicensedHearse == null) { + return 0; + } + // use the source card, not the source object of the ability to grab the correct zcc + ExileZone cardsExiledWithUnlicensedHearse + = game.getExile().getExileZone( + CardUtil.getExileZoneId(game, unlicensedHearse.getId(), unlicensedHearse.getZoneChangeCounter(game))); + if (cardsExiledWithUnlicensedHearse == null) { + return 0; + } + return cardsExiledWithUnlicensedHearse.size(); } - return cardsExiledWithUnlicensedHearse.size(); - } + @Override + public UnlicensedHearseValue copy() { + return this; + } - @Override - public UnlicensedHearseValue copy() { - return this; - } - - @Override - public String getMessage() { - return "cards exiled with it"; - } + @Override + public String getMessage() { + return "cards exiled with it"; + } } public final class UnlicensedHearse extends CardImpl { - private static final Hint hint = new ValueHint("Cards exiled", UnlicensedHearseValue.instance); + private static final Hint hint = new ValueHint("Cards exiled", UnlicensedHearseValue.instance); - public UnlicensedHearse(UUID ownerId, CardSetInfo setInfo) { - super(ownerId, setInfo, new CardType[] {CardType.ARTIFACT}, "{2}"); + public UnlicensedHearse(UUID ownerId, CardSetInfo setInfo) { + super(ownerId, setInfo, new CardType[]{CardType.ARTIFACT}, "{2}"); - this.subtype.add(SubType.VEHICLE); - this.power = new MageInt(0); - this.toughness = new MageInt(0); + this.subtype.add(SubType.VEHICLE); + this.power = new MageInt(0); + this.toughness = new MageInt(0); - // {T}: Exile up to two target cards from a single graveyard. - Ability ability = - new SimpleActivatedAbility(new ExileTargetForSourceEffect(), new TapSourceCost()); - ability.addTarget(new TargetCardInASingleGraveyard(0, 2, StaticFilters.FILTER_CARD_CARDS)); - this.addAbility(ability); + // {T}: Exile up to two target cards from a single graveyard. + Ability ability + = new SimpleActivatedAbility(new ExileTargetForSourceEffect(), new TapSourceCost()); + ability.addTarget(new TargetCardInASingleGraveyard(0, 2, StaticFilters.FILTER_CARD_CARDS)); + this.addAbility(ability); - // Unlicensed Hearse's power and toughness are each equal to the number of cards exiled with it. - this.addAbility( - new SimpleStaticAbility( - Zone.ALL, - new SetPowerToughnessSourceEffect(UnlicensedHearseValue.instance, Duration.Custom)) - .addHint(hint)); + // Unlicensed Hearse's power and toughness are each equal to the number of cards exiled with it. + this.addAbility( + new SimpleStaticAbility( + Zone.ALL, + new SetPowerToughnessSourceEffect(UnlicensedHearseValue.instance, Duration.EndOfGame)) + .addHint(hint)); - // Crew 2 - this.addAbility(new CrewAbility(2)); - } + // Crew 2 + this.addAbility(new CrewAbility(2)); + } - private UnlicensedHearse(final UnlicensedHearse card) { - super(card); - } + private UnlicensedHearse(final UnlicensedHearse card) { + super(card); + } - @Override - public UnlicensedHearse copy() { - return new UnlicensedHearse(this); - } + @Override + public UnlicensedHearse copy() { + return new UnlicensedHearse(this); + } }