42 lines
1.4 KiB
GDScript
42 lines
1.4 KiB
GDScript
class_name GearRandom
|
|
extends Gear
|
|
|
|
|
|
func _init():
|
|
# generate random stats piece of gear with tier and quality
|
|
randomize()
|
|
var randStatValues = {}
|
|
# max tier of 10, max stats of 1000
|
|
var randStatMax = tier*100
|
|
match quality:
|
|
0:
|
|
# white, common
|
|
randStatValues[STATLIST.CON] = randi_range(0, randStatMax)
|
|
1:
|
|
# green, uncommon
|
|
randStatValues[STATLIST.CON] = randi_range(0, randStatMax)
|
|
randStatValues[STATLIST.STR] = randi_range(0, randStatMax)
|
|
randStatValues[STATLIST.DEX] = randi_range(0, randStatMax)
|
|
randStatValues[STATLIST.INT] = randi_range(0, randStatMax)
|
|
2:
|
|
# blue, rare
|
|
for stat in STATLIST:
|
|
randStatValues[stat] = randi_range(0, randStatMax)
|
|
3:
|
|
# purple, epic
|
|
for stat in STATLIST:
|
|
randStatValues[stat] = randi_range(0.3*randStatMax, randStatMax)
|
|
4:
|
|
# orange?, legendary
|
|
for stat in STATLIST:
|
|
randStatValues[stat] = randi_range(0.6*randStatMax, randStatMax)
|
|
5:
|
|
# yellow or red?, artifact
|
|
for stat in STATLIST:
|
|
randStatValues[stat] = randi_range(0.9*randStatMax, randStatMax)
|
|
_:
|
|
# should never occur, but just in case...
|
|
print("ERROR: Attempt to use unknown equipment quality")
|
|
|
|
self.statValues = randStatValues
|