Implemented Font of Agonies

This commit is contained in:
Evan Kranzler 2019-01-09 12:43:15 -05:00
parent fb9b69ae9a
commit 6aeedac387
4 changed files with 89 additions and 2 deletions

View file

@ -1,15 +1,16 @@
package mage.abilities.costs.common;
import java.util.UUID;
import mage.abilities.Ability;
import mage.abilities.costs.Cost;
import mage.abilities.costs.CostImpl;
import mage.abilities.dynamicvalue.DynamicValue;
import mage.abilities.dynamicvalue.common.StaticValue;
import mage.game.Game;
import mage.game.events.GameEvent;
import java.util.UUID;
/**
*
* @author BetaSteward_at_googlemail.com
*/
public class PayLifeCost extends CostImpl {
@ -49,6 +50,9 @@ public class PayLifeCost extends CostImpl {
public boolean pay(Ability ability, Game game, UUID sourceId, UUID controllerId, boolean noMana, Cost costToPay) {
int lifeToPayAmount = amount.calculate(game, ability, null);
this.paid = game.getPlayer(controllerId).loseLife(lifeToPayAmount, game, false) == lifeToPayAmount;
if (paid) {
game.fireEvent(GameEvent.getEvent(GameEvent.EventType.LIFE_PAID, controllerId, sourceId, controllerId, lifeToPayAmount));
}
return paid;
}

View file

@ -221,6 +221,7 @@ public class GameEvent implements Serializable {
PLANESWALK, PLANESWALKED,
PAID_CUMULATIVE_UPKEEP,
DIDNT_PAY_CUMULATIVE_UPKEEP,
LIFE_PAID,
//permanent events
ENTERS_THE_BATTLEFIELD_SELF, /* 616.1a If any of the replacement and/or prevention effects are self-replacement effects (see rule 614.15),
one of them must be chosen. If not, proceed to rule 616.1b. */