Task #26: upgrade tiers and timed shed stock
Workbench stat upgrades get 3 levels: level L costs costs[id] x
upgrade_cost_growth (1.8) ^ (L - 1), each material rounded up, and opens on
day upgrade_level_days[L - 1] ([1, 8, 16]). Each owned level's "mult"/"add"
entry stacks. Level 1 keeps the user's values and costs (rapid fire 3.0x).
Shed items arrive on set days ("from_day"): corn shooter 1, shurikens 2,
pumpkin bombs 3, potato cannon 6, radar 8, propane torch 10, alien ray 14.
- Upgrades: level(), max_level(), maxed(), cost(cfg, id, level),
next_cost(), per_level(), text_at(), name_at() (roman numerals),
from_day(), level_day(), arrived(). owned() stays "level >= 1". blocker()
adds "Arrives on day N" and "Level N opens on day D"; buy() takes the next
level and applies that level's side effect; upgrades_bought counts every
level. FarmState.upgrades keeps id -> level, so saves don't change shape.
- UpgradePanel: "Rapid fire II" with the next level's text and cost, the
blocker reason, "Max" at the last level; a shed item before its day shows
its name greyed with "Arrives on day N" ("?" plus the day if hidden). The
title counts items at their last level. Every level bought jingles.
- Co-op: the host sends "bought" for any level (no wire change; PROTOCOL
stays 5).
- soak_night.gd buys the lowest next level first across UPGRADE_ORDER.
- Tests: level costs, day gates, stacking, from_day, save/morning/retry/co-op,
an old {"rapid_fire": 1} save as level 1. Existing tests set the day where
they buy stock that now arrives later.
- RULES.md Upgrades: per-level effects and costs, stock schedule.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6a9575dfe4
commit
91b9e52e96
12 changed files with 531 additions and 137 deletions
|
|
@ -211,8 +211,8 @@ func _empty_pouches() -> void:
|
|||
## #16: a pouch per scarecrow, one shared shed. P1 standing in the shed banks only P1's own pouch
|
||||
## (not what P2 carries); P2 banks its own by walking in; each pays for what it builds or buys
|
||||
## from its own pouch and the shed, never the other's pouch (the host pays P2's requests from
|
||||
## P2's); and one Bigger pouch grows both pouches. The partner's HUD, menus, and build mode go
|
||||
## by P2's pouch.
|
||||
## P2's); and one Bigger pouch grows both pouches, as does its level 2, which P2's request buys
|
||||
## once its day comes (#26). The partner's HUD, menus, and build mode go by P2's pouch.
|
||||
func _own_pouches() -> void:
|
||||
var res := host.campaign.state.resources
|
||||
r.check(client.resource_hud != null and client.resource_hud.slot == 1 and client.upgrade_panel.slot == 1 and client.shed_panel.slot == 1
|
||||
|
|
@ -290,6 +290,34 @@ func _own_pouches() -> void:
|
|||
r.check(res.pouch_capacity > room and res.pouch_room(0) == res.pouch_capacity - 3 and res.pouch_room(1) == res.pouch_capacity
|
||||
and _mine().pouch_capacity == res.pouch_capacity and _mine().pouch_room(1) == res.pouch_capacity,
|
||||
"one Bigger pouch grows both pouches (%d -> %d units, on both farms)" % [room, res.pouch_capacity])
|
||||
# Its level 2 (#26): the partner's request buys the next level, once that level's day comes;
|
||||
# the level reaches both farms, and the partner hears the jingle.
|
||||
var day := host.campaign.state.night
|
||||
var l2 := Upgrades.cost(host.config, "pouch_upgrade", 2)
|
||||
var grow := roundi(Upgrades.per_level(host.config.upgrades["pouch_upgrade"]["add"], 2))
|
||||
room = res.pouch_capacity
|
||||
_empty_pouches()
|
||||
res.shed = {"wood": 0, "scrap": 0, "straw": 0, "alien_goop": 0}
|
||||
res.shed.merge(l2, true)
|
||||
_pump(SETTLE)
|
||||
client.upgrade_panel._buy("pouch_upgrade")
|
||||
_pump(SETTLE * 2)
|
||||
r.check(Upgrades.level(host.campaign.state, "pouch_upgrade") == 1 and res.shed == l2.merged({"wood": 0, "scrap": 0, "straw": 0, "alien_goop": 0}),
|
||||
"the partner can't buy level 2 before day 8 (the host refuses: '%s')" % Upgrades.blocker(host.campaign, "pouch_upgrade", 1))
|
||||
host.campaign.state.night = 8 # (put back below, before any night)
|
||||
_pump(SETTLE)
|
||||
client.upgrade_panel.refresh()
|
||||
var row := client.upgrade_panel._rows["pouch_upgrade"] as Button
|
||||
r.check(not row.disabled and row.text.begins_with("Bigger pouch II —") and row.text.contains(ResourceStore.describe(l2)),
|
||||
"from day 8 the partner's menu offers Bigger pouch II for %s ('%s')" % [ResourceStore.describe(l2), row.text])
|
||||
var jingles := int(client.audio.played.get("upgrade", 0))
|
||||
client.upgrade_panel._buy("pouch_upgrade")
|
||||
_pump(SETTLE * 2)
|
||||
r.check(Upgrades.level(host.campaign.state, "pouch_upgrade") == 2 and Upgrades.level(client.campaign.state, "pouch_upgrade") == 2
|
||||
and res.shed_total() == 0 and res.pouch_capacity == room + grow and _mine().pouch_capacity == res.pouch_capacity,
|
||||
"P2 buys level 2: level 2 on both farms, the pouches %d -> %d units" % [room, res.pouch_capacity])
|
||||
r.check(int(client.audio.played.get("upgrade", 0)) == jingles + 1, "with the purchase's jingle on the partner's side")
|
||||
host.campaign.state.night = day
|
||||
_empty_pouches()
|
||||
_pump(6)
|
||||
|
||||
|
|
@ -364,6 +392,8 @@ func _shops() -> void:
|
|||
var id := "shurikens"
|
||||
var w := ScarecrowCombat.WEAPON_IDS.find(id)
|
||||
var cost: Dictionary = host.config.costs[id]
|
||||
var day := host.campaign.state.night
|
||||
host.campaign.state.night = Upgrades.from_day(host.config, id) # in stock (#26; put back below)
|
||||
client.player.global_position = at_counter
|
||||
_pump(20)
|
||||
_tap_interact()
|
||||
|
|
@ -386,6 +416,7 @@ func _shops() -> void:
|
|||
r.check(int(client.audio.played.get("upgrade", 0)) == jingles + 1, "with the purchase's jingle on the partner's side")
|
||||
client.shed_panel.close()
|
||||
host.campaign.state.upgrades.erase(id)
|
||||
host.campaign.state.night = day
|
||||
_empty_pouches()
|
||||
client.player.global_position = Vector3(0.5, 0.0, 6.0)
|
||||
_pump(SETTLE)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue