Overflow check

This commit is contained in:
Zzooouhh 2017-12-22 22:50:37 +01:00 committed by GitHub
parent 8e2b397f1d
commit c0fb7b5cf0
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -72,7 +72,7 @@ class TargetPermanentPowerPlusToughnessCount implements DynamicValue {
public int calculate(Game game, Ability sourceAbility, Effect effect) {
Permanent sourcePermanent = game.getPermanent(sourceAbility.getFirstTarget());
if (sourcePermanent != null) {
return sourcePermanent.getPower().getValue() + sourcePermanent.getToughness().getValue();
return game.addWithOverflowCheck(sourcePermanent.getPower().getValue(), sourcePermanent.getToughness().getValue());
}
return 0;
}