mirror of
https://github.com/correl/mage.git
synced 2025-01-12 03:00:13 +00:00
CardUtil overflow
This commit is contained in:
parent
ab3128975a
commit
2bb4f07df2
1 changed files with 2 additions and 2 deletions
|
@ -1760,7 +1760,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
GameEvent event = new GameEvent(GameEvent.EventType.LOSE_LIFE, playerId, playerId, playerId, amount, atCombat);
|
||||
if (!game.replaceEvent(event)) {
|
||||
// this.life -= event.getAmount();
|
||||
this.life = game.subtractWithOverflowCheck(this.life, event.getAmount());
|
||||
this.life = CardUtil.subtractWithOverflowCheck(this.life, event.getAmount());
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(this.getLogName() + " loses " + event.getAmount() + " life");
|
||||
}
|
||||
|
@ -1792,7 +1792,7 @@ public abstract class PlayerImpl implements Player, Serializable {
|
|||
// TODO: lock life at Integer.MAX_VALUE if reached, until it's set to a different amount
|
||||
// (https://magic.wizards.com/en/articles/archive/news/unstable-faqawaslfaqpaftidawabiajtbt-2017-12-06 - "infinite" life total stays infinite no matter how much is gained or lost)
|
||||
// this.life += event.getAmount();
|
||||
this.life = game.addWithOverflowCheck(this.life, event.getAmount());
|
||||
this.life = CardUtil.addWithOverflowCheck(this.life, event.getAmount());
|
||||
if (!game.isSimulation()) {
|
||||
game.informPlayers(this.getLogName() + " gains " + event.getAmount() + " life");
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue