semi-idle-arpg/scripts/gearRand.gd
2024-09-19 19:03:06 -06:00

40 lines
1.3 KiB
GDScript

class_name GearRandom extends "gear.gd"
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["con"] = randi_range(0,tier*100)
1:
# green, uncommon
var statListQual1 = STATLIST.slice(0, 4)
for stat in statListQual1:
randStatValues[stat] = 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("Unknown Equipment Quality")
self.statValues = randStatValues