* Brain in a Jar - Fixed that first ability fizzled when it was sacrificed before the ability resolved (fixes #3247).

This commit is contained in:
LevelX2 2017-05-17 11:39:26 +02:00
parent d6ddff8d68
commit 85c394c29b

View file

@ -27,8 +27,8 @@
*/ */
package mage.cards.b; package mage.cards.b;
import java.util.UUID;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.constants.ComparisonType;
import mage.abilities.common.SimpleActivatedAbility; import mage.abilities.common.SimpleActivatedAbility;
import mage.abilities.costs.common.RemoveVariableCountersSourceCost; import mage.abilities.costs.common.RemoveVariableCountersSourceCost;
import mage.abilities.costs.common.TapSourceCost; import mage.abilities.costs.common.TapSourceCost;
@ -40,6 +40,7 @@ import mage.cards.Card;
import mage.cards.CardImpl; import mage.cards.CardImpl;
import mage.cards.CardSetInfo; import mage.cards.CardSetInfo;
import mage.constants.CardType; import mage.constants.CardType;
import mage.constants.ComparisonType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.Zone; import mage.constants.Zone;
import mage.counters.CounterType; import mage.counters.CounterType;
@ -51,8 +52,6 @@ import mage.game.permanent.Permanent;
import mage.players.Player; import mage.players.Player;
import mage.target.common.TargetCardInHand; import mage.target.common.TargetCardInHand;
import java.util.UUID;
/** /**
* *
* @author LevelX2 * @author LevelX2
@ -104,7 +103,7 @@ class BrainInAJarCastEffect extends OneShotEffect {
@Override @Override
public boolean apply(Game game, Ability source) { public boolean apply(Game game, Ability source) {
Player controller = game.getPlayer(source.getControllerId()); Player controller = game.getPlayer(source.getControllerId());
Permanent sourceObject = game.getPermanent(source.getSourceId()); Permanent sourceObject = game.getPermanentOrLKIBattlefield(source.getSourceId());
if (controller != null && sourceObject != null) { if (controller != null && sourceObject != null) {
int counters = sourceObject.getCounters(game).getCount(CounterType.CHARGE); int counters = sourceObject.getCounters(game).getCount(CounterType.CHARGE);
FilterCard filter = new FilterInstantOrSorceryCard(); FilterCard filter = new FilterInstantOrSorceryCard();