Task #12 follow-up: theft alert for a claimed loose animal
AlertManager.collect() only raised the THEFT alert for a claimed Status.HOME item; a thief that claimed a loose (Status.LOOSE) animal raised no alert at all. The acceptance criteria call for loose animals to behave per the existing theft rules, and the alert is part of that UX, so treat LOOSE like HOME there too. Added a check to test_targets.gd 's _loose_start confirming a claimed loose animal raises the same THEFT alert as a penned one (same AlertManager pattern test_roster.gd's _alerts uses). Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
parent
13efe6603f
commit
ffeec30873
2 changed files with 8 additions and 4 deletions
|
|
@ -56,9 +56,10 @@ func run(r: GameTestRunner) -> void:
|
|||
|
||||
|
||||
## Task #12: animals start loose, scattered outside the pen, grazing in place; a thief can still
|
||||
## claim and steal one (same rule as any theft once it's dropped); the player leads one in with the
|
||||
## follow-trail mechanic, entering the pen makes it home, and FarmState records it as penned so a
|
||||
## morning resync keeps it home (and the rest loose) instead of resetting the herd into the pen.
|
||||
## claim and steal one (raising the same theft alert as for a penned one, and same rule as any
|
||||
## theft once it's dropped); the player leads one in with the follow-trail mechanic, entering the
|
||||
## pen makes it home, and FarmState records it as penned so a morning resync keeps it home (and the
|
||||
## rest loose) instead of resetting the herd into the pen.
|
||||
func _loose_start(r: GameTestRunner) -> void:
|
||||
var farm := (load("res://game/scenes/farm.tscn") as PackedScene).instantiate() as Node3D
|
||||
r.root.add_child(farm)
|
||||
|
|
@ -99,6 +100,9 @@ func _loose_start(r: GameTestRunner) -> void:
|
|||
var item1 := sim.enemies.target[sim.enemies.resolve_handle(h)]
|
||||
r.check(item1 > 0 and loot.category[item1] == C.ANIMAL and loot.status[item1] == S.LOOSE,
|
||||
"a thief claims a loose animal, not just a penned one")
|
||||
var am := farm.get_node("Hud/Alerts") as AlertManager
|
||||
var theft_alerts := am.collect().filter(func(a: Dictionary) -> bool: return a["kind"] == AlertManager.Kind.THEFT and int(a["category"]) == C.ANIMAL)
|
||||
r.check(not theft_alerts.is_empty(), "claiming a loose animal raises the same theft alert as a penned one")
|
||||
var caught := _until(sim, func() -> bool: return loot.status[item1] == S.CARRIED, 60.0)
|
||||
r.check(caught < 60.0, "and catches it (%.1f s)" % caught)
|
||||
var dh := sim.enemies.resolve_handle(h)
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue