Fix planeswalker loyalty counters.

They should be added like normal counters, firing events that can be
intercepted by cards like doubling season.
This commit is contained in:
Nathaniel Brandes 2017-03-08 23:57:11 -08:00
parent 2ecb415b4d
commit 52fa369024
2 changed files with 21 additions and 2 deletions

View file

@ -27,7 +27,6 @@
*/
package mage.abilities.costs.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
@ -35,6 +34,8 @@ import mage.counters.CounterType;
import mage.game.Game;
import mage.game.permanent.Permanent;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
@ -67,7 +68,7 @@ public class PayLoyaltyCost extends CostImpl {
Permanent planeswalker = game.getPermanent(sourceId);
if (planeswalker != null && planeswalker.getCounters(game).getCount(CounterType.LOYALTY) + amount >= 0 && planeswalker.canLoyaltyBeUsed(game)) {
if (amount > 0) {
planeswalker.getCounters(game).addCounter(CounterType.LOYALTY.createInstance(amount));
planeswalker.addCounters(CounterType.LOYALTY.createInstance(amount), ability, game, null);
} else if (amount < 0) {
planeswalker.removeCounters(CounterType.LOYALTY.getName(), Math.abs(amount), game);
}