diff --git a/game/RULES.md b/game/RULES.md index d30f006..f82e607 100644 --- a/game/RULES.md +++ b/game/RULES.md @@ -258,7 +258,8 @@ Implemented in Step 4. The numbers are in `GameConfig`. - Fence breakers hit for 2 HP every 1.5 s, but only while fighting the scarecrow. Crows never fight. - **Weapons**, in two slots; hold a button to keep attacking. Every scarecrow starts with the - **pitchfork**; the **corn shooter** and **pumpkin bombs** are bought at the workbench (below). + **pitchfork**; the **corn shooter**, **pumpkin bombs**, and the other weapons are bought at the + supply shed, each from the day it arrives there (Upgrades, below). - **Main weapon** (left mouse / RT): the pitchfork or the corn shooter, in the right hand. Switch with **Tab / d-pad down** (the next one owned) or **1 / 2**, outside build mode (there those keys pick structures). diff --git a/game/scripts/end_panel.gd b/game/scripts/end_panel.gd index 3c9cb99..e30b3ab 100644 --- a/game/scripts/end_panel.gd +++ b/game/scripts/end_panel.gd @@ -211,8 +211,8 @@ func _totals_text(t: Dictionary, finished: bool) -> String: _count(t["crops_recovered"], "crop"), _count(t["animals_recovered"], "animal"), int(t["supplies_recovered"]), _count(t["crops_lost"], "crop"), _count(t["animals_lost"], "animal"), int(t["supplies_lost"])]) lines.append("Built %d, repaired %d, broken %d. Upgrades: %d of %d. Patched up %s, %d damage taken." % [ - int(t["structures_built"]), int(t["repairs"]), int(t["structures_destroyed"]), s.upgrades.size(), - Upgrades.ORDER.size(), _count(t["patches"], "time"), int(t["scarecrow_damage"])]) + int(t["structures_built"]), int(t["repairs"]), int(t["structures_destroyed"]), Upgrades.levels_bought(campaign.config, s), + Upgrades.levels_total(campaign.config), _count(t["patches"], "time"), int(t["scarecrow_damage"])]) lines.append("Gathered %s. Spent %s." % [Assessment.materials_line(t, "gathered_"), Assessment.materials_line(t, "spent_")]) return "\n".join(lines) diff --git a/game/scripts/review_panel.gd b/game/scripts/review_panel.gd index cac2798..6ca244b 100644 --- a/game/scripts/review_panel.gd +++ b/game/scripts/review_panel.gd @@ -114,7 +114,7 @@ func refresh() -> void: _title.text = "The farmers are away" lines.append("Keep the farm safe for %d nights until they come home: the crops, the animals in the pen, and the supplies in the shed." % nights) lines.append("By day, gather wood, scrap, and straw (hold E), store them at the barn, and build defenses (B). There's more to gather off the farm, to the north, east, and south.") - lines.append("At night, stab aliens with your pitchfork (left mouse), scare them off (Q), and pick up anything they drop. Animals roam loose until you lead them into the pen: walk up to one and it follows you. The supply shed sells a corn shooter (switch weapons with Tab or 1-2) and pumpkin bombs (throw them with right mouse).") + lines.append("At night, stab aliens with your pitchfork (left mouse), scare them off (Q), and pick up anything they drop. Animals roam loose until you lead them into the pen: walk up to one and it follows you. The supply shed sells a corn shooter (switch weapons with Tab or 1-2), and more weapons arrive there over the days.") else: var e: Dictionary = s.night_log[s.night_log.size() - 1] _title.text = "Morning of day %d of %d" % [s.night, nights] @@ -136,7 +136,8 @@ func refresh() -> void: var plan := waves.tonight() if waves != null else null if plan != null and plan.title != "": if structures != null and structures.has_workbench(): - lines.append("Tonight: %s. Upgrades at the work area: %d of %d done." % [plan.title, _upgrades_done(), Upgrades.ORDER.size()]) + lines.append("Tonight: %s. Upgrades: %d of %d levels." % [plan.title, Upgrades.levels_bought(campaign.config, s), + Upgrades.levels_total(campaign.config)]) else: # #9: the Workbench hasn't been granted yet -- it arrives once Night 1 is survived lines.append("Tonight: %s. The work area will be set up once you survive tonight." % plan.title) _body.text = "\n".join(lines) @@ -210,14 +211,6 @@ func _damage_line() -> String: return "Needs repair (marked with health bars): %s." % ", ".join(parts) -func _upgrades_done() -> int: - var n := 0 - for id in Upgrades.ORDER: - if Upgrades.owned(campaign.state, id): - n += 1 - return n - - func _label(parent: Node, font_size: int, color: Color = Color(0.92, 0.92, 0.88)) -> Label: var l := Label.new() l.add_theme_font_size_override("font_size", font_size) diff --git a/game/scripts/tutorial.gd b/game/scripts/tutorial.gd index 4c52170..55fef3f 100644 --- a/game/scripts/tutorial.gd +++ b/game/scripts/tutorial.gd @@ -17,7 +17,7 @@ const TEXT := { "store": "Your pouch only holds so much: walk onto the barn's apron (the Supply Shed) to store what you carry.", "build": "Press [B / d-pad up] to build. Pick a fence [1], place it with left mouse / RT. Aliens have to break through fences.", "dusk": "Dusk: aliens come at nightfall, from every side of the farm.", - "shoot": "Aim with the mouse or the right stick and hold left mouse / RT to stab with your pitchfork. The supply shed sells a corn shooter (switch with [Tab / 1-2]) and pumpkin bombs for your off-hand: throw them with [right mouse / LT].", + "shoot": "Aim with the mouse or the right stick and hold left mouse / RT to stab with your pitchfork. The supply shed sells a corn shooter (switch with [Tab / 1-2]); more weapons arrive there over the days, like pumpkin bombs for your off-hand (throw them with [right mouse / LT]).", "fear": "Crowded? [Q / LB] Fear scares off everything nearby, and they drop what they carry.", "recover": "Something was dropped! Walk over it to bring it home. A dropped animal follows you back to the pen.", "patch": "Hurt? Hold [F / Y] to patch up with straw. Health carries over to the next night.", diff --git a/game/scripts/upgrades.gd b/game/scripts/upgrades.gd index ac5dbc4..9c97c8f 100644 --- a/game/scripts/upgrades.gd +++ b/game/scripts/upgrades.gd @@ -47,6 +47,22 @@ static func maxed(cfg: GameConfig, state: FarmState, id: String) -> bool: return level(state, id) >= max_level(cfg, id) +## Levels bought across both shops, and how many there are in all (the "N of M" counts on the +## workbench, the morning screen, and the end screen). +static func levels_bought(cfg: GameConfig, state: FarmState) -> int: + var n := 0 + for id in ORDER: + n += mini(level(state, id), max_level(cfg, id)) + return n + + +static func levels_total(cfg: GameConfig) -> int: + var n := 0 + for id in ORDER: + n += max_level(cfg, id) + return n + + ## What buying this level costs: costs[id] for level 1, and upgrade_cost_growth times as much ## for each level after it (costs[id] x growth^(level - 1)), each material rounded up. ## next_cost() is the one the farm would buy now. diff --git a/game/scripts/workbench.gd b/game/scripts/workbench.gd index c1f7102..3cd7b44 100644 --- a/game/scripts/workbench.gd +++ b/game/scripts/workbench.gd @@ -42,9 +42,6 @@ func show_state(campaign: CampaignController, show: bool, focused: bool, broken: _label.text = "Broken -- repair it" if focused else "Broken" return _label.modulate = NORMAL_COLOR - var done := 0 - for id in Upgrades.ORDER: - if Upgrades.owned(campaign.state, id): - done += 1 var hint := ("[E / X] Upgrades" if campaign.is_daytime() else "Upgrades by day") if focused else "Upgrades" - _label.text = "%s\n%d of %d done" % [hint, done, Upgrades.ORDER.size()] + _label.text = "%s\n%d of %d levels" % [hint, Upgrades.levels_bought(campaign.config, campaign.state), + Upgrades.levels_total(campaign.config)]