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
|
|
@ -109,7 +109,7 @@ extends Resource
|
|||
@export_range(0, 999) var start_straw: int = 4
|
||||
@export_range(0, 999) var start_alien_goop: int = 0
|
||||
## The scarecrow's pouch holds this many units in total; it empties into the shed on entry.
|
||||
## Raised to 16 by the Bigger pouch upgrade (Upgrades, "pouch_capacity").
|
||||
## Raised by each level of the Bigger pouch upgrade (Upgrades, "pouch_capacity").
|
||||
@export_range(1, 200) var pouch_capacity: int = 8
|
||||
## Seconds of holding interact per gather (each takes one charge of the gather point).
|
||||
@export var gather_time: float = 1.5
|
||||
|
|
@ -140,32 +140,59 @@ extends Resource
|
|||
}
|
||||
|
||||
@export_group("Upgrades")
|
||||
## Bought once each by day, for costs[id] (Upgrades), either at the work area's workbench (the
|
||||
## default shop) or the supply shed's counter ("shop": "shed": weapons and other purchasable
|
||||
## items, Upgrades.shop_of, UpgradePanel's shop filter). Each changes one stat: "mult" multiplies
|
||||
## it, "add" adds to it. Stats are GameConfig settings, plus scarecrow_max_hp (the scarecrow's, in
|
||||
## FarmState) and barrier_hp (fences' and gates' health). One without a stat unlocks something
|
||||
## instead (sprint: PlayerCharacter; the corn shooter and pumpkin bombs: ScarecrowCombat).
|
||||
## "requires": another upgrade that must be bought first (from either shop).
|
||||
## What the two shops sell (Upgrades), by day, for costs[id]: either the work area's workbench
|
||||
## (the default shop) or the supply shed's counter ("shop": "shed": weapons and other purchasable
|
||||
## items, Upgrades.shop_of, UpgradePanel's shop filter). The keys:
|
||||
## "name", "track" (the menu's heading), "text": what it does.
|
||||
## "stat": the one stat it changes. Stats are GameConfig settings, plus scarecrow_max_hp (the
|
||||
## scarecrow's, in FarmState) and barrier_hp (fences' and gates' health). One without a stat
|
||||
## unlocks something instead (sprint: PlayerCharacter; the weapons: ScarecrowCombat; radar:
|
||||
## RadarHud).
|
||||
## "mult" multiplies the stat, "add" adds to it: a number (the same every level) or an Array
|
||||
## with one entry per level. Each owned level's entry applies in turn, so they stack.
|
||||
## "levels": how many times it can be bought (1 by default). Level L costs costs[id] x
|
||||
## upgrade_cost_growth^(L - 1) and opens on day upgrade_level_days[L - 1] (or its own
|
||||
## "level_days": [day, ...]).
|
||||
## "texts": one description per level, shown instead of "text" (the menu shows the next one).
|
||||
## "from_day": the day it arrives in stock, before which it can't be bought (1 by default).
|
||||
## Day N is the day before night N (FarmState.night).
|
||||
## "requires": another upgrade that must be bought first (from either shop).
|
||||
## "hidden", "reveal_goop": see hidden_reveal_goop below.
|
||||
@export var upgrades: Dictionary = {
|
||||
"corn_shooter": {"name": "Corn shooter", "text": "A gun that fires corn kernels, from afar", "track": "Weapon", "shop": "shed"},
|
||||
"rapid_fire": {"name": "Rapid fire", "text": "The corn shooter fires a third faster", "track": "Weapon", "stat": "fire_rate", "mult": 1.333, "requires": "corn_shooter"},
|
||||
"heavy_seeds": {"name": "Heavy seeds", "text": "Each kernel does 2 damage", "track": "Weapon", "stat": "shot_damage", "add": 1, "requires": "corn_shooter"},
|
||||
"pumpkin_bomb": {"name": "Pumpkin bombs", "text": "Throw a pumpkin that bursts, hurting everything within 3 m (one every 4 s)", "track": "Weapon", "shop": "shed"},
|
||||
"potato_cannon": {"name": "Potato cannon", "text": "A slow heavy potato shot that hits hard from afar", "track": "Weapon", "shop": "shed"},
|
||||
"shurikens": {"name": "Shurikens", "text": "Fast, cheap throws for a quick hit", "track": "Weapon", "shop": "shed"},
|
||||
"propane_torch": {"name": "Propane torch", "text": "A jet of flame that burns everything in a band ahead of you while held", "track": "Weapon", "shop": "shed"},
|
||||
"alien_ray": {"name": "Alien ray", "text": "A salvaged alien weapon: a long beam that pierces everything in its line while held", "track": "Weapon", "shop": "shed", "hidden": true},
|
||||
"radar": {"name": "Radar", "text": "A minimap showing nearby enemy positions", "track": "Item", "shop": "shed", "hidden": true},
|
||||
"wide_fear": {"name": "Wide fear", "text": "Fear reaches 30% farther", "track": "Fear", "stat": "fear_radius", "mult": 1.3},
|
||||
"quick_fear": {"name": "Quick fear", "text": "Fear recharges 20% faster", "track": "Fear", "stat": "fear_cooldown", "mult": 0.8},
|
||||
"straw_stuffing": {"name": "Straw stuffing", "text": "+2 max health", "track": "Scarecrow", "stat": "scarecrow_max_hp", "add": 2},
|
||||
"pouch_upgrade": {"name": "Bigger pouch", "text": "+8 pouch capacity (16 total)", "track": "Scarecrow", "stat": "pouch_capacity", "add": 8},
|
||||
"corn_shooter": {"name": "Corn shooter", "text": "A gun that fires corn kernels, from afar", "track": "Weapon", "shop": "shed", "from_day": 1},
|
||||
"rapid_fire": {"name": "Rapid fire", "track": "Weapon", "stat": "fire_rate", "mult": [1.333, 1.25, 1.25], "levels": 3, "requires": "corn_shooter",
|
||||
"texts": ["The corn shooter fires a third faster", "The corn shooter fires another 25% faster", "The corn shooter fires 25% faster again"]},
|
||||
"heavy_seeds": {"name": "Heavy seeds", "track": "Weapon", "stat": "shot_damage", "add": [1, 1, 1], "levels": 3, "requires": "corn_shooter",
|
||||
"texts": ["Each kernel does 2 damage", "Each kernel does 3 damage", "Each kernel does 4 damage"]},
|
||||
"pumpkin_bomb": {"name": "Pumpkin bombs", "text": "Throw a pumpkin that bursts, hurting everything within 3 m (one every 4 s)", "track": "Weapon", "shop": "shed", "from_day": 3},
|
||||
"potato_cannon": {"name": "Potato cannon", "text": "A slow heavy potato shot that hits hard from afar", "track": "Weapon", "shop": "shed", "from_day": 6},
|
||||
"shurikens": {"name": "Shurikens", "text": "Fast, cheap throws for a quick hit", "track": "Weapon", "shop": "shed", "from_day": 2},
|
||||
"propane_torch": {"name": "Propane torch", "text": "A jet of flame that burns everything in a band ahead of you while held", "track": "Weapon", "shop": "shed", "from_day": 10},
|
||||
"alien_ray": {"name": "Alien ray", "text": "A salvaged alien weapon: a long beam that pierces everything in its line while held", "track": "Weapon", "shop": "shed", "hidden": true, "from_day": 14},
|
||||
"radar": {"name": "Radar", "text": "A minimap showing nearby enemy positions", "track": "Item", "shop": "shed", "hidden": true, "from_day": 8},
|
||||
"wide_fear": {"name": "Wide fear", "track": "Fear", "stat": "fear_radius", "mult": [1.3, 1.15, 1.15], "levels": 3,
|
||||
"texts": ["Fear reaches 30% farther", "Fear reaches another 15% farther", "Fear reaches 15% farther again"]},
|
||||
"quick_fear": {"name": "Quick fear", "track": "Fear", "stat": "fear_cooldown", "mult": [0.8, 0.9, 0.9], "levels": 3,
|
||||
"texts": ["Fear recharges 20% faster", "Fear recharges another 10% faster", "Fear recharges 10% faster again"]},
|
||||
"straw_stuffing": {"name": "Straw stuffing", "track": "Scarecrow", "stat": "scarecrow_max_hp", "add": [2, 2, 2], "levels": 3,
|
||||
"texts": ["+2 max health", "+2 more max health", "+2 more max health"]},
|
||||
"pouch_upgrade": {"name": "Bigger pouch", "track": "Scarecrow", "stat": "pouch_capacity", "add": [8, 4, 4], "levels": 3,
|
||||
"texts": ["+8 pouch capacity (16 total)", "+4 pouch capacity (20 total)", "+4 pouch capacity (24 total)"]},
|
||||
"sprint": {"name": "Sprint", "text": "Sprint 80% faster for 4 s at a time, every 10 s", "track": "Scarecrow"},
|
||||
"reinforced_fences": {"name": "Reinforced fences", "text": "Fences and gates +50% health", "track": "Defenses", "stat": "barrier_hp", "mult": 1.5},
|
||||
"long_range": {"name": "Long-range defenses", "text": "Turrets reach 30% farther", "track": "Defenses", "stat": "turret_range", "mult": 1.3},
|
||||
"sticky_tar": {"name": "Sticky tar", "text": "Tar patches hold 50% longer", "track": "Defenses", "stat": "trap_slow_time", "mult": 1.5},
|
||||
"reinforced_fences": {"name": "Reinforced fences", "track": "Defenses", "stat": "barrier_hp", "mult": [1.5, 1.25, 1.25], "levels": 3,
|
||||
"texts": ["Fences and gates +50% health", "Fences and gates another +25% health", "Fences and gates +25% health again"]},
|
||||
"long_range": {"name": "Long-range defenses", "track": "Defenses", "stat": "turret_range", "mult": [1.3, 1.15, 1.15], "levels": 3,
|
||||
"texts": ["Turrets reach 30% farther", "Turrets reach another 15% farther", "Turrets reach 15% farther again"]},
|
||||
"sticky_tar": {"name": "Sticky tar", "track": "Defenses", "stat": "trap_slow_time", "mult": [1.5, 1.25, 1.25], "levels": 3,
|
||||
"texts": ["Tar patches hold 50% longer", "Tar patches hold another 25% longer", "Tar patches hold 25% longer again"]},
|
||||
}
|
||||
## Each further level of an upgrade with "levels" costs this many times the one before: level L
|
||||
## costs costs[id] x upgrade_cost_growth^(L - 1), each material rounded up (Upgrades.cost).
|
||||
@export_range(1.0, 5.0, 0.05) var upgrade_cost_growth: float = 1.8
|
||||
## The day each level of an upgrade with "levels" can first be bought: level L from day
|
||||
## upgrade_level_days[L - 1] (the last entry for any level past its end). An upgrade's own
|
||||
## "level_days" overrides it. Day N is the day before night N.
|
||||
@export var upgrade_level_days: Array[int] = [1, 8, 16]
|
||||
## An upgrade with "hidden": true (e.g. Alien Ray, Radar, #7/#8) shows only a "?" (no name, text,
|
||||
## or cost) and can't be bought until the player has collected this much Alien Goop in total
|
||||
## (Upgrades.goop_collected); then it shows and buys normally for its defined cost. Overridable
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue