This commit is contained in:
Jeff Wadsworth 2021-11-15 15:40:44 -06:00
parent e989c05247
commit a6ca9a095c

View file

@ -2,6 +2,7 @@
package mage.cards.c; package mage.cards.c;
import java.util.UUID; import java.util.UUID;
import mage.MageObject;
import mage.target.common.TargetCreaturePermanent; import mage.target.common.TargetCreaturePermanent;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfUpkeepTriggeredAbility; import mage.abilities.common.BeginningOfUpkeepTriggeredAbility;
@ -91,9 +92,10 @@ class GiveControlEffect extends ContinuousEffectImpl {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Permanent permanent = (Permanent) source.getSourceObjectIfItStillExists(game); MageObject mageObject = source.getSourceObjectIfItStillExists(game);
if (permanent != null) { if (mageObject != null
return permanent.changeControllerId(source.getFirstTarget(), game, source); && mageObject instanceof Permanent) {
return ((Permanent) mageObject).changeControllerId(source.getFirstTarget(), game, source);
} else { } else {
discard(); discard();
} }