Task #24: nights by count, per-night enemy speed and HP
- Plans load by count: FarmSim.night_plan_path(n) ("res://game/resources/nights/night_%d.tres")
for n in 1..campaign_nights (FarmSim.load_night_plans). A missing file is a push_error and
that night plays the last plan that loaded. FarmSim.NIGHT_PLANS is gone. campaign_nights
stays 5.
- NightPlan.enemy_speed_scale / enemy_hp_scale (default 1; problems() flags non-positive ones).
At nightfall WaveDirector._on_phase_changed hands tonight's plan (or the F2 debug plan) to
EnemySystem.night_speed_scale / night_hp_scale, and the morning puts them back to 1.
EnemySystem.full_hp(type) = maxi(t_hp, floori(t_hp * night_hp_scale)) at spawn; steering
and max_speed() use t_speed * night_speed_scale (fleeing and carrying are shares of it).
Enemies have no HP bar (only structures do), and the co-op replica never simulates enemy HP,
so the wire format and CoopSession.PROTOCOL (5) are unchanged.
- Debug F3 / Shift+F3 (CampaignDebug.jump_morning; debug builds, morning review only, not on
a co-op partner's machine): next / previous day's morning with the farm as it is and
nights_survived = night - 1. It grants the Workbench and grows crops_total as a night's end
does, then re-enters the morning through CampaignController.load_state with save_path
blanked, so there's no autosave.
- test_nights: plan paths load in order (and a missing one repeats the last), spawn HP and
speed at default and 1.6 scales, and the F3 / Shift+F3 jump.
- RULES.md (The enemies: per-night scales), PLAYTEST.md (NIGHT_PLANS note), GameConfig
campaign_nights comment.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
parent
6a9575dfe4
commit
192a89770a
9 changed files with 259 additions and 22 deletions
|
|
@ -29,11 +29,8 @@ extends Node
|
|||
|
||||
const SCARECROW_RADIUS := 0.4
|
||||
const HUNT_INTERVAL := 0.4
|
||||
const NIGHT_PLANS: Array[String] = [
|
||||
"res://game/resources/nights/night_1.tres", "res://game/resources/nights/night_2.tres",
|
||||
"res://game/resources/nights/night_3.tres", "res://game/resources/nights/night_4.tres",
|
||||
"res://game/resources/nights/night_5.tres",
|
||||
]
|
||||
## Night n's plan file (night_plan_path), for n in 1..GameConfig.campaign_nights.
|
||||
const NIGHT_PLAN_PATH := "res://game/resources/nights/night_%d.tres"
|
||||
|
||||
@export var campaign: CampaignController
|
||||
@export var zones: FarmZones
|
||||
|
|
@ -117,6 +114,28 @@ var _rebuild_ticks: int = 0
|
|||
var _goop_rng := RandomNumberGenerator.new()
|
||||
|
||||
|
||||
## Where night n's plan lives: game/resources/nights/night_<n>.tres.
|
||||
static func night_plan_path(n: int) -> String:
|
||||
return NIGHT_PLAN_PATH % n
|
||||
|
||||
|
||||
## The plans of nights 1..nights, by night_plan_path. A missing (or unreadable) file is an error,
|
||||
## and that night plays the last plan that loaded (as WaveDirector.plan_for does past the end).
|
||||
static func load_night_plans(nights: int) -> Array[NightPlan]:
|
||||
var plans: Array[NightPlan] = []
|
||||
var last: NightPlan = null
|
||||
for n in range(1, nights + 1):
|
||||
var path := night_plan_path(n)
|
||||
var plan: NightPlan = load(path) as NightPlan if ResourceLoader.exists(path) else null
|
||||
if plan == null:
|
||||
push_error("Night %d has no plan at %s: it plays %s" % [n, path, "night %d's" % (n - 1) if last != null else "none"])
|
||||
plan = last
|
||||
else:
|
||||
last = plan
|
||||
plans.append(plan)
|
||||
return plans
|
||||
|
||||
|
||||
func _ready() -> void:
|
||||
var t0 := Time.get_ticks_msec()
|
||||
config = campaign.config
|
||||
|
|
@ -241,10 +260,7 @@ func _ready() -> void:
|
|||
waves = WaveDirector.new()
|
||||
waves.name = "Waves"
|
||||
add_child(waves)
|
||||
var plans: Array[NightPlan] = []
|
||||
for path in NIGHT_PLANS:
|
||||
plans.append(load(path) as NightPlan)
|
||||
waves.setup(campaign, enemies, zones, plans)
|
||||
waves.setup(campaign, enemies, zones, load_night_plans(config.campaign_nights))
|
||||
for c in _goals["escape"]:
|
||||
if animal_field[c] < FarmNavigation.UNREACHABLE: # not shut in by the props around it
|
||||
waves.ground_spawns.append(nav.cell_center(c))
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue