* Fecundity - Fixed that not always LKI was retrieved to check if a creature died (fixes #6867).

This commit is contained in:
LevelX2 2020-07-22 00:04:29 +02:00
parent ba7a8ecb82
commit 73395aabd4

View file

@ -1,4 +1,3 @@
package mage.cards.f; package mage.cards.f;
import java.util.UUID; import java.util.UUID;
@ -21,7 +20,7 @@ import mage.players.Player;
public final class Fecundity extends CardImpl { public final class Fecundity extends CardImpl {
public Fecundity(UUID ownerId, CardSetInfo setInfo) { public Fecundity(UUID ownerId, CardSetInfo setInfo) {
super(ownerId,setInfo,new CardType[]{CardType.ENCHANTMENT},"{2}{G}"); super(ownerId, setInfo, new CardType[]{CardType.ENCHANTMENT}, "{2}{G}");
// Whenever a creature dies, that creature's controller may draw a card. // Whenever a creature dies, that creature's controller may draw a card.
this.addAbility(new DiesCreatureTriggeredAbility(new FecundityEffect(), false, false, true)); this.addAbility(new DiesCreatureTriggeredAbility(new FecundityEffect(), false, false, true));
@ -55,7 +54,9 @@ class FecundityEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) game.getLastKnownInformation(this.getTargetPointer().getFirst(game, source), Zone.BATTLEFIELD); Permanent permanent = (Permanent) game.getLastKnownInformation(this.getTargetPointer()
// Card can be moved again (e.g. commander replacement) so we need the row id from fixed target to check
.getFixedTarget(game, source).getTarget(), Zone.BATTLEFIELD);
if (permanent != null) { if (permanent != null) {
Player controller = game.getPlayer(permanent.getControllerId()); Player controller = game.getPlayer(permanent.getControllerId());
if (controller != null) { if (controller != null) {