From ce733c4e1e798c5cb4fb27d1b9fd08ab1818cd09 Mon Sep 17 00:00:00 2001 From: Jeff Date: Tue, 6 Feb 2018 11:13:19 -0600 Subject: [PATCH] - Fixed Djinn Illuminatus #4489 --- Mage.Sets/src/mage/cards/d/DjinnIlluminatus.java | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/Mage.Sets/src/mage/cards/d/DjinnIlluminatus.java b/Mage.Sets/src/mage/cards/d/DjinnIlluminatus.java index ffccf10059f..94c30a7febe 100644 --- a/Mage.Sets/src/mage/cards/d/DjinnIlluminatus.java +++ b/Mage.Sets/src/mage/cards/d/DjinnIlluminatus.java @@ -44,6 +44,7 @@ import mage.game.stack.StackObject; import java.util.HashMap; import java.util.Map; import java.util.UUID; +import mage.game.permanent.Permanent; /** * @@ -98,9 +99,16 @@ class DjinnIlluminatusGainReplicateEffect extends ContinuousEffectImpl { @Override public boolean apply(Game game, Ability source) { + Permanent djinn = game.getPermanent(source.getSourceId()); + if (djinn == null) { + return false; + } for (StackObject stackObject : game.getStack()) { // only spells cast, so no copies of spells - if ((stackObject instanceof Spell) && !stackObject.isCopy() && stackObject.getControllerId().equals(source.getControllerId())) { + if ((stackObject instanceof Spell) + && !stackObject.isCopy() + && stackObject.getControllerId().equals(source.getControllerId()) + && djinn.getControllerId().equals(source.getControllerId())) { // verify that the controller of the djinn cast that spell Spell spell = (Spell) stackObject; if (filter.match(stackObject, game)) { ReplicateAbility replicateAbility = replicateAbilities.computeIfAbsent(spell.getId(), k -> new ReplicateAbility(spell.getCard(), spell.getSpellAbility().getManaCosts().getText()));