Randoloot/scripts/game/debug_rewards.gd
2026-10-20 19:57:00 +02:00

52 lines
2.6 KiB
GDScript

extends RefCounted
const MATERIALS := 10000
const CREDITS := 1000000
const DEUTER := 1000000
const CRYSTALS := 10000
const SAMPLES := 1000
const ORBS := 25
const LEARNING_POINTS := 100
const AMMUNITION := 10000
const RADIATION_AMMUNITION := 1000
const MISSILES := 1000
const POWERBANKS := 100
const TOOLTIP := "+1 000 000 kredytów i deuteru\n+10 000 każdego minerału, części i kryształów czasu\n+1000 próbek, +25 każdego orba, +100 punktów nauki\n+10 000 amunicji, +1000 radiacyjnej i rakiet, +100 powerbanków\nMapy: poziomy 2, obecny +1/+5, 120, 125 i 130 (bez duplikatów)\nPo 1 każdego rodzaju wyposażenia do magazynu fregaty oraz sprzęt kapitana."
static func grant(captain: Resource, inventory: Node, level: int) -> Dictionary:
var progress: Resource = captain.expedition
var target_level := clampi(level,1,1000)
for material in preload("res://scripts/planets/planet_rewards.gd").MATERIAL_KEYS:
if material != "parts": captain.minerals[material] = int(captain.minerals.get(material,0))+MATERIALS
captain.parts += MATERIALS
captain.credits += CREDITS
captain.learning_points += LEARNING_POINTS
captain.prepare_skill_offers()
progress.deuter += DEUTER
progress.time_crystals += CRYSTALS
progress.analysis_samples += SAMPLES
for orb in preload("res://scripts/items/special_orbs.gd").IDS:
progress.orbs[orb] = int(progress.orbs.get(orb,0))+ORBS
var new_maps := 0
for destination in [2,maxi(2,level+1),maxi(2,level+5),120,125,130]:
var id := "debug:sector:%d" % destination
if progress.distant_maps.has(id): continue
progress.distant_maps[id] = {"id":id,"level":destination,"seed":maxi(1,id.hash()),"source_level":maxi(1,destination-1),"source_planet":"Pakiet DEBUG","name":"DEBUG · sektor %03d" % destination}
new_maps += 1
var generator := preload("res://scripts/items/item_generator.gd")
for definition in generator.DEFINITIONS:
progress.freighter_storage.append(generator.generate_for_definition(definition,target_level,2))
var gear := preload("res://scripts/planets/captain_equipment.gd")
for kind in gear.KINDS:
captain.gear_items.append({"uid":captain.gear_next_uid,"kind":kind,"level":target_level})
captain.gear_next_uid += 1
if inventory != null:
inventory.ammunition += AMMUNITION
inventory.irradiated_ammunition += RADIATION_AMMUNITION
inventory.missile_ammunition += MISSILES
inventory.energy_banks += POWERBANKS
inventory.ammunition_changed.emit()
inventory.inventory_changed.emit()
progress.emit_changed()
captain.emit_changed()
return {"maps_added":new_maps,"equipment_added":generator.DEFINITIONS.size(),"gear_added":gear.KINDS.size()}