mirror of
https://github.com/correl/mage.git
synced 2024-11-15 11:09:30 +00:00
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:
parent
2ecb415b4d
commit
52fa369024
2 changed files with 21 additions and 2 deletions
|
@ -192,4 +192,22 @@ public class DoublingSeasonTest extends CardTestPlayerBase {
|
|||
assertLife(playerA, 20);
|
||||
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testDoublePlaneswalkerLoyalty() {
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Tibalt, the Fiend-Blooded");
|
||||
|
||||
addCard(Zone.BATTLEFIELD, playerA, "Doubling Season");
|
||||
|
||||
|
||||
activateAbility(1, PhaseStep.PRECOMBAT_MAIN, playerA,"+1: Draw a card, then discard a card at random.");
|
||||
|
||||
setStopAt(1, PhaseStep.END_TURN);
|
||||
execute();
|
||||
|
||||
assertLife(playerA, 20);
|
||||
assertLife(playerB, 20);
|
||||
|
||||
assertCounterCount("Tibalt, the Fiend-Blooded", CounterType.LOYALTY, 4);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue