extends RefCounted const START_GOLD=240 const SPAWN_INTERVAL=5.0 const XP_THRESHOLDS=[0,90,210,370,570,810,1090,1410,1770,2170] const BASE_WORK_SECONDS=[1.8,3.0,5.0,3.35,6.0,7.0] const TOOL_VALUE=[0,2,5,5,8,11] const TOOL_PRICES=[40,80,120,170,220,280] const BLUEPRINT_PRICES=[0,55,85,120,160,200] const HIRE_PRICES=[6,18,36] const HASTE_PRICES=[5,12,22] const DILIGENCE_PRICES=[8,18,32] const AUTOMATION_PRICE=4 const PRESSURE_GRACE=12.0 const PENALTY_INTERVAL=5.0 const GOLD_RESERVE=60 const SOUL_RESERVE=6 static func level(xp): var result=1 for threshold in XP_THRESHOLDS: if xp>=threshold:result=XP_THRESHOLDS.find(threshold)+1 return result static func tier(xp):return mini(4,int((level(xp)-1)/2)) static func work_multiplier(xp):return 1.0+.18*(level(xp)-1) static func recipe_size(_id,_xp,available): return mini(1,available) static func reward(required,xp): var count=required.size();var value=0;var xp_bonus=0 for kind in required:value+=TOOL_VALUE[kind];xp_bonus+=kind*2 return {"gold":12+10*(count-1)+value+tier(xp)*2,"souls":count,"xp":18+12*(count-1)+xp_bonus} static func penalty(xp,pressure_seconds): return {"gold":3+tier(xp)*2+(2 if pressure_seconds>=30 else 0)+(3 if pressure_seconds>=60 else 0),"souls":2 if pressure_seconds>=45 else 1}