File tree Expand file tree Collapse file tree 2 files changed +13
-5
lines changed
godot/combat/battlers/stats Expand file tree Collapse file tree 2 files changed +13
-5
lines changed Original file line number Diff line number Diff line change 1+ """
2+ Represents a Battler's actual stats: health, strength, etc.
3+ See the child class GrowthStats.gd for stats growth curves
4+ and lookup tables
5+ """
16extends Resource
27
38class_name CharacterStats
@@ -91,9 +96,7 @@ func _get_experience() -> int:
9196 return experience
9297
9398func _set_experience (value ):
94- if value == null or value < 0 :
95- value = 0
96- experience = value
99+ experience = max (0 , value )
97100
98101func _get_level () -> int :
99102 return level
Original file line number Diff line number Diff line change 1- extends "res://combat/battlers/stats/CharacterStats.gd"
1+ """
2+ Uses curves and lookup tables to calculate a battler's stats
3+
4+ """
5+ extends CharacterStats
26
37class_name GrowthStats
48
9+ # level as a percentage of the max_level, in the [0.0, 1.0] range
510var _interpolated_level : float
611
712export var level_lookup : Array = []
@@ -16,7 +21,7 @@ func _set_experience(value : int = 0):
1621 Calculate level, which updates all stats
1722 """
1823 var max_level = len (level_lookup )
19- experience = value
24+ experience = max ( 0 , value )
2025 var l = level
2126 while l + 1 < max_level && experience > level_lookup [l + 1 ]:
2227 l += 1
You can’t perform that action at this time.
0 commit comments