mirror of
https://github.com/Card-Forge/forge.git
synced 2025-11-15 10:18:01 +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) {
|
||||
// return empty strings and constants
|
||||
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);
|
||||
|
||||
// Strip and save sign for calculations
|
||||
boolean startsWithPlus = amount.charAt(0) == '+';
|
||||
boolean startsWithMinus = amount.charAt(0) == '-';
|
||||
int multiplier = startsWithMinus ? -1 : 1;
|
||||
if(startsWithMinus || startsWithPlus )
|
||||
if(startsWithPlus )
|
||||
amount = amount.substring(1);
|
||||
|
||||
// These are some special cases - who is implementing them?
|
||||
|
||||
Reference in New Issue
Block a user