Fixed Unlicensed Hearse.
@@ -22,9 +22,10 @@ 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
@@ -34,17 +35,17 @@ enum UnlicensedHearseValue implements DynamicValue {
@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())));
+ 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();
}
@@ -71,8 +72,8 @@ public final class UnlicensedHearse extends CardImpl {
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 ability
+ = new SimpleActivatedAbility(new ExileTargetForSourceEffect(), new TapSourceCost());
ability.addTarget(new TargetCardInASingleGraveyard(0, 2, StaticFilters.FILTER_CARD_CARDS));
this.addAbility(ability);
@@ -80,7 +81,7 @@ public final class UnlicensedHearse extends CardImpl {
this.addAbility(
new SimpleStaticAbility(
Zone.ALL,
- new SetPowerToughnessSourceEffect(UnlicensedHearseValue.instance, Duration.Custom))
+ new SetPowerToughnessSourceEffect(UnlicensedHearseValue.instance, Duration.EndOfGame))
.addHint(hint));
// Crew 2
