Task #3: pouch capacity rework (8 base, 16 upgraded)
Base pouch_capacity drops from a flat 16 to 8 (GameConfig). A new "pouch_upgrade" (Bigger pouch, Scarecrow track, wood 10 + straw 8) raises it to 16, bought once at the workbench like straw_stuffing. Upgrades.buy() special-cases "pouch_capacity" the same way it already does scarecrow_max_hp, writing straight to the live ResourceStore value so it carries into the next morning, survives a save, and comes back with a retry. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
0124020167
commit
d0bb1f4433
4 changed files with 54 additions and 5 deletions
|
|
@ -6,13 +6,14 @@ extends RefCounted
|
|||
## Systems ask value() for a stat with the owned upgrades applied instead of reading GameConfig
|
||||
## directly: the corn shooter's fire rate and shot damage, fear's radius and cooldown, fences' and gates'
|
||||
## health (barrier_hp), the automated defense's range, and the traps' slow time. Straw stuffing
|
||||
## raises the scarecrow's max health (FarmState) when bought. Sprint, the corn shooter, and
|
||||
## pumpkin bombs change no stat: owning them unlocks sprinting (PlayerCharacter) and the two
|
||||
## weapons (ScarecrowCombat). Rapid fire and heavy seeds need the corn shooter first ("requires").
|
||||
## raises the scarecrow's max health (FarmState) when bought, and the Bigger pouch upgrade raises
|
||||
## pouch_capacity (ResourceStore) the same way. Sprint, the corn shooter, and pumpkin bombs change
|
||||
## no stat: owning them unlocks sprinting (PlayerCharacter) and the two weapons (ScarecrowCombat).
|
||||
## Rapid fire and heavy seeds need the corn shooter first ("requires").
|
||||
|
||||
## Menu order, grouped by track.
|
||||
const ORDER: Array[String] = ["corn_shooter", "rapid_fire", "heavy_seeds", "pumpkin_bomb", "wide_fear", "quick_fear",
|
||||
"straw_stuffing", "sprint", "reinforced_fences", "long_range", "sticky_tar"]
|
||||
"straw_stuffing", "pouch_upgrade", "sprint", "reinforced_fences", "long_range", "sticky_tar"]
|
||||
|
||||
|
||||
static func owned(state: FarmState, id: String) -> bool:
|
||||
|
|
@ -104,4 +105,6 @@ static func buy(campaign: CampaignController, id: String, structures: StructureS
|
|||
for e in s.structures:
|
||||
if e["type"] == "fence" or e["type"] == "gate":
|
||||
e["hp"] = mini(roundi(int(e["hp"]) * k), structures.max_hp(e["type"]) if structures != null else 1 << 20)
|
||||
"pouch_capacity": # the live value lives in ResourceStore, not read from cfg each time
|
||||
s.resources.pouch_capacity += int(u.get("add", 0))
|
||||
return "%s done: %s" % [u.get("name", id), String(u.get("text", "")).to_lower()]
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue