mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-16 10:48:00 +00:00
fixed a bug with incorrect recognition of numbers written as +N (titanic growth was affected)
This commit is contained in:
@@ -292,13 +292,15 @@ public class AbilityUtils {
|
|||||||
public static int calculateAmount(final Card card, String amount, final SpellAbility ability) {
|
public static int calculateAmount(final Card card, String amount, final SpellAbility ability) {
|
||||||
// return empty strings and constants
|
// return empty strings and constants
|
||||||
if (StringUtils.isBlank(amount)) return 0;
|
if (StringUtils.isBlank(amount)) return 0;
|
||||||
|
final boolean startsWithPlus = amount.charAt(0) == '+';
|
||||||
|
if(startsWithPlus) amount = amount.substring(1);
|
||||||
|
|
||||||
if (StringUtils.isNumeric(amount)) return Integer.parseInt(amount);
|
if (StringUtils.isNumeric(amount)) return Integer.parseInt(amount);
|
||||||
|
|
||||||
// Strip and save sign for calculations
|
// Strip and save sign for calculations
|
||||||
boolean startsWithPlus = amount.charAt(0) == '+';
|
|
||||||
boolean startsWithMinus = amount.charAt(0) == '-';
|
boolean startsWithMinus = amount.charAt(0) == '-';
|
||||||
int multiplier = startsWithMinus ? -1 : 1;
|
int multiplier = startsWithMinus ? -1 : 1;
|
||||||
if(startsWithMinus || startsWithPlus )
|
if(startsWithPlus )
|
||||||
amount = amount.substring(1);
|
amount = amount.substring(1);
|
||||||
|
|
||||||
// These are some special cases - who is implementing them?
|
// These are some special cases - who is implementing them?
|
||||||
|
|||||||
Reference in New Issue
Block a user