- Keep the default tactical camera in the projector blackout; lights go out ~2 s after crossing the screen (Pending phase with normal play/grace) - Remove the blackout task HUD (progress card, dots, instructions); replace with close-range world-anchored FBC inspection placards for the screen, phones and the glass case - Fix manual J/K/U presses feeling dead: queue a press while the skill is on cooldown and flash the HUD stamp immediately; clear the queue on autoplay toggle and during the pocket. Add regression test - Add --blackout-near-phone QA hook; update design docs and README
84 lines
3.1 KiB
C++
84 lines
3.1 KiB
C++
// Projector-screen blackout: 20 phone chain, glass case claim, skill reward.
|
|
#include <cstdio>
|
|
|
|
#include "game/game.hpp"
|
|
|
|
namespace {
|
|
|
|
constexpr float kDt = 1.0f / 60.0f;
|
|
bool failed = false;
|
|
|
|
void check(bool ok, const char* what) {
|
|
if (!ok) {
|
|
std::printf("FAIL: %s\n", what);
|
|
failed = true;
|
|
}
|
|
}
|
|
|
|
int count_events(const Game& game, EventType type) {
|
|
int n = 0;
|
|
for (int i = 0; i < game.events.count; ++i)
|
|
if (game.events.items[i].type == type) ++n;
|
|
return n;
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int main() {
|
|
Game game(42);
|
|
const BlackoutSequence& b = game.blackout;
|
|
check(!b.active() && !b.complete(), "blackout starts idle");
|
|
check(!game.skill_system.fluorescent_unlocked, "reward starts locked");
|
|
|
|
// Walking into the non-colliding screen arms the puzzle; the room stays
|
|
// lit and the camera stays normal for ~2 s before the lights go out.
|
|
game.player.pos = b.screen_pos();
|
|
game.update(InputState{}, kDt);
|
|
check(b.pending() && !b.active(), "entering the screen only arms the blackout");
|
|
check(count_events(game, EventType::BlackoutStart) == 0,
|
|
"no lights-out event during the grace period");
|
|
game.update(InputState{}, 2.1f);
|
|
check(b.active(), "lights go out ~2 s after entering the screen");
|
|
check(count_events(game, EventType::BlackoutStart) == 1,
|
|
"blackout start event emitted when lights go out");
|
|
|
|
// Every unanswered phone can be activated by walking over it; order does
|
|
// not matter and an already-answered phone is inert.
|
|
for (int pass = 0; pass < 2; ++pass) {
|
|
for (int i = 0; i < BlackoutSequence::kPhoneCount; ++i) {
|
|
game.player.pos = b.phone(i);
|
|
game.blackout.update(0.7f, game.player, game.events, false);
|
|
}
|
|
}
|
|
check(b.answered() == BlackoutSequence::kPhoneCount,
|
|
"all 20 phones answer exactly once");
|
|
check(b.phase() == BlackoutPhase::CaseRevealed,
|
|
"case reveals after the last phone");
|
|
check(count_events(game, EventType::BlackoutPhone) ==
|
|
BlackoutSequence::kPhoneCount,
|
|
"one phone event per phone");
|
|
check(count_events(game, EventType::BlackoutCase) == 1,
|
|
"case reveal event emitted");
|
|
|
|
// Entering the case completes the ritual and restores the lights.
|
|
game.player.pos = b.case_pos();
|
|
game.update(InputState{}, kDt);
|
|
check(b.complete(), "entering the case completes the ritual");
|
|
check(count_events(game, EventType::BlackoutComplete) == 1,
|
|
"completion event emitted");
|
|
check(game.skill_system.fluorescent_unlocked,
|
|
"completion unlocks the FLUORESCENT skill");
|
|
|
|
// Re-entering the screen after completion does nothing.
|
|
game.player.pos = b.screen_pos();
|
|
game.update(InputState{}, kDt);
|
|
check(!b.active(), "the ritual cannot be restarted after completion");
|
|
|
|
// Floor jump / reset make it claimable again, but the unlock persists.
|
|
game.blackout.reset();
|
|
check(!b.complete() && b.answered() == 0, "reset clears puzzle progress");
|
|
|
|
if (failed) return 1;
|
|
std::printf("blackout ritual: all checks passed\n");
|
|
return 0;
|
|
}
|