P06-01: Implement approved A06 finite Mana reserve (MP-01-r02 recommended)

Initial 100, capacity 300, world tree +20 per 10 game minutes. Each boundary
pays registered upkeep demand before storing surplus; overflow is discarded
and recorded, 0 stops the whole tower. Furnace offers are judged after
generation and demand payment. New saves carry mana_reserve and Operations
rollback includes it; legacy saves keep a 0..300 amount and reject others.

Outage tests that relied on Mana 0 persisting now hold the outage with a
disabled demand sink, since the world tree recovers at the next boundary.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Takeshi
2026-10-19 17:20:04 +09:00
co-authored by Claude Opus 5.5
parent c366012446
commit ae0f998ff4
18 changed files with 424 additions and 17 deletions
+3 -2
View File
@@ -1,4 +1,5 @@
extends SceneTree
const ManaOutage = preload("res://tests/helpers/mana_outage.gd")
var checks := 0
var failures := 0
var runtime: Variant
@@ -40,11 +41,11 @@ func run() -> void:
expect(runtime.create_snapshot()==arrived,"staff movement and recovery replay exactly")
worker=runtime.staff_service.get_staff(&"dorm_sleeper")
var health:=worker.health
state.set_resource(&"mana",0);clock.advance_minutes(30)
ManaOutage.hold(runtime, state);clock.advance_minutes(30)
expect(worker.health==health and not runtime.get_staff_rest_report(worker.staff_id).get(&"resting",false),"unpowered dormitory stops recovery")
expect(runtime.restore_snapshot(runtime.create_snapshot()),"stopped dormitory and staff position restore")
worker=runtime.staff_service.get_staff(&"dorm_sleeper")
state.set_resource(&"mana",100);clock.advance_minutes(40)
ManaOutage.release(runtime, state);clock.advance_minutes(40)
expect(worker.health>health,"power recovery resumes rest")
runtime.facility_service.set_operational_status(room_id,{&"operator_open":false},clock.absolute_minute)
health=worker.health;clock.advance_minutes(30)