def raiseStat(unit, stat, amount): # Don't lower stat to less than 0 if -amount > unit[stat]: amount = -unit[stat] unit[stat] += round(amount) storeResult.statChange(stat, amount, unit)
def scaleStat(unit, stat, factor): v1 = unit[stat] v2 = round(v1 * factor) unit[stat] = v2 # Calculate and store the change in the affected stat amount = v2 - v1 storeResult.statChange(stat, amount, unit) return amount