core gameplay in! scavenging working!

This commit is contained in:
Tabby 2026-01-11 19:06:59 +11:00
parent c6a6171a81
commit b773e224c0
5 changed files with 38 additions and 4 deletions

View file

@ -3,4 +3,17 @@ class_name ScavengeRecipe
@export var input : ItemData
@export var rolls : int = 3
@export var loot_pool : Dictionary[int, ItemData]
@export var loot_pool : Array[RollableLoot]
func roll() -> ItemData:
var selected : ItemData
var total_chance : int = 0
for loot in loot_pool:
total_chance += loot.chance
var sel_chance : int = randi() % total_chance
for loot in loot_pool:
if sel_chance >= 0:
selected = loot.item
sel_chance -= loot.chance
return selected