24 lines
960 B
GDScript
24 lines
960 B
GDScript
extends RefCounted
|
|
const MAX_SPEED := 240.0
|
|
const MAX_BOOST_SPEED := 600.0
|
|
const ENERGY_REGEN_FRACTION := 0.15
|
|
const SHIELD_REGEN_FRACTION := 0.03
|
|
const SHIELD_LEECH_FRACTION := 0.05
|
|
const POLARIZATION_FRACTION := 0.05
|
|
const BONUS_CAPS := {"speed_percent":60.0,"damage_percent":100.0,"critical_chance_percent":40.0,"critical_damage_percent":100.0,"shield_on_damage_percent":10.0}
|
|
|
|
static func bonuses(raw: Dictionary) -> Dictionary:
|
|
var result := raw.duplicate()
|
|
for key in BONUS_CAPS:
|
|
result[key] = clampf(float(result.get(key,0.0)),0.0,BONUS_CAPS[key])
|
|
return result
|
|
|
|
static func speed(base: float, flat: float, percent: float) -> float:
|
|
return minf(MAX_SPEED,(base+flat)*(1.0+clampf(percent,0.0,60.0)/100.0))
|
|
|
|
static func energy_regen(value: float, maximum: float) -> float:
|
|
return minf(value,maxf(5.0,maximum*ENERGY_REGEN_FRACTION))
|
|
|
|
static func shield_regen(value: float, maximum: float) -> float:
|
|
return minf(value,maximum*SHIELD_REGEN_FRACTION)
|