* Bounty of the Luxa - Fixed handling of triggered ability if Bounty of the Luxa left the battlefield before resolving.

This commit is contained in:
LevelX2 2017-04-17 14:36:53 +02:00
parent 7ac35ebfbe
commit 2c6be695ba

View file

@ -27,16 +27,15 @@
*/ */
package mage.cards.b; package mage.cards.b;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import java.util.UUID; import java.util.UUID;
import mage.Mana; import mage.Mana;
import mage.abilities.Ability; import mage.abilities.Ability;
import mage.abilities.common.BeginningOfPreCombatMainTriggeredAbility; import mage.abilities.common.BeginningOfPreCombatMainTriggeredAbility;
import mage.abilities.effects.OneShotEffect; import mage.abilities.effects.OneShotEffect;
import mage.abilities.effects.common.DrawCardSourceControllerEffect;
import mage.abilities.effects.common.counter.AddCountersSourceEffect; import mage.abilities.effects.common.counter.AddCountersSourceEffect;
import mage.cards.CardImpl;
import mage.cards.CardSetInfo;
import mage.constants.CardType;
import mage.constants.Outcome; import mage.constants.Outcome;
import mage.constants.TargetController; import mage.constants.TargetController;
import mage.counters.CounterType; import mage.counters.CounterType;
@ -89,9 +88,12 @@ class BountyOfTheLuxaEffect extends OneShotEffect {
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 bountyOfLuxa = game.getPermanent(source.getSourceId()); Permanent bountyOfLuxa = game.getPermanent(source.getSourceId());
if (controller != null if (bountyOfLuxa != null && bountyOfLuxa.getZoneChangeCounter(game) != source.getSourceObjectZoneChangeCounter()) {
&& bountyOfLuxa != null) { bountyOfLuxa = null;
if (bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD) > 0) { }
if (controller != null) {
if (bountyOfLuxa != null
&& bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD) > 0) {
bountyOfLuxa.removeCounters(CounterType.FLOOD.createInstance(bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD)), game); bountyOfLuxa.removeCounters(CounterType.FLOOD.createInstance(bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD)), game);
if (bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD) == 0) { if (bountyOfLuxa.getCounters(game).getCount(CounterType.FLOOD) == 0) {
Mana manaToAdd = new Mana(); Mana manaToAdd = new Mana();
@ -101,8 +103,10 @@ class BountyOfTheLuxaEffect extends OneShotEffect {
controller.getManaPool().addMana(manaToAdd, game, source); controller.getManaPool().addMana(manaToAdd, game, source);
} }
} else { } else {
new AddCountersSourceEffect(CounterType.FLOOD.createInstance()).apply(game, source); if (bountyOfLuxa != null) {
new DrawCardSourceControllerEffect(1).apply(game, source); new AddCountersSourceEffect(CounterType.FLOOD.createInstance()).apply(game, source);
}
controller.drawCards(1, game);
} }
return true; return true;
} }