- 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
186 lines
6.9 KiB
C++
186 lines
6.9 KiB
C++
// Active skills: CONCRETE CALL and WARP — manual casts, autoplay, effects.
|
|
#include <cstdio>
|
|
|
|
#include "game/game.hpp"
|
|
|
|
namespace {
|
|
|
|
constexpr float kDt = 1.0f / 60.0f;
|
|
|
|
float total_hp(const EnemySystem& enemies) {
|
|
float hp = 0.0f;
|
|
for (const Enemy& e : enemies.enemies) hp += e.hp;
|
|
return hp;
|
|
}
|
|
|
|
void spawn_crowd(Game& game) {
|
|
game.enemy_system.clear();
|
|
game.player.pos = {0.0f, 0.0f};
|
|
game.enemy_system.spawn(EnemyType::HissBrute, {1.5f, 0.0f}, game.corruption);
|
|
game.enemy_system.spawn(EnemyType::HissBrute, {2.5f, 0.0f}, game.corruption);
|
|
game.enemy_system.spawn(EnemyType::HissBrute, {2.0f, 1.0f}, game.corruption);
|
|
}
|
|
|
|
bool failed = false;
|
|
|
|
void check(bool ok, const char* what) {
|
|
if (!ok) {
|
|
std::printf("FAIL: %s\n", what);
|
|
failed = true;
|
|
}
|
|
}
|
|
|
|
} // namespace
|
|
|
|
int main() {
|
|
// --- Manual cast (J) ---
|
|
{
|
|
Game game(7);
|
|
spawn_crowd(game);
|
|
const float hp_before = total_hp(game.enemy_system);
|
|
|
|
InputState in{};
|
|
in.skill_concrete = true;
|
|
game.update(in, kDt);
|
|
check(game.skill_system.piles.size() == 1, "J spawns a concrete pile");
|
|
check(game.skill_system.cooldowns[static_cast<int>(SkillType::ConcreteCall)] > 0.0f,
|
|
"J starts the skill cooldown");
|
|
check(!game.skill_system.autoplay_active(), "manual press pauses autoplay");
|
|
bool cast_event = false;
|
|
for (int i = 0; i < game.events.count; ++i)
|
|
if (game.events.items[i].type == EventType::SkillCast) cast_event = true;
|
|
check(cast_event, "J emits a SkillCast event");
|
|
game.events.clear();
|
|
|
|
in.skill_concrete = false;
|
|
bool detonated = false;
|
|
for (int tick = 0; tick < 120; ++tick) {
|
|
game.update(in, kDt);
|
|
for (int i = 0; i < game.events.count; ++i) {
|
|
const GameEvent& e = game.events.items[i];
|
|
if (e.type == EventType::AreaDetonation
|
|
&& (e.flags & kDetonateConcrete)) detonated = true;
|
|
}
|
|
game.events.clear();
|
|
}
|
|
check(detonated, "pile detonates with concrete debris");
|
|
check(total_hp(game.enemy_system) < hp_before - 100.0f,
|
|
"detonation damages the crowd");
|
|
}
|
|
|
|
// --- Autoplay without any key press (generic for future skills) ---
|
|
{
|
|
Game game(8);
|
|
spawn_crowd(game);
|
|
InputState in{}; // no skill button
|
|
game.update(in, kDt);
|
|
check(game.skill_system.piles.size() == 1, "skill autoplays when idle");
|
|
check(game.skill_system.autoplay_active(), "autoplay stays active");
|
|
game.events.clear();
|
|
for (int tick = 0; tick < 120; ++tick) {
|
|
game.update(in, kDt);
|
|
game.events.clear();
|
|
}
|
|
check(game.skill_system.piles.empty(), "autoplayed pile completes");
|
|
}
|
|
|
|
// --- Autoplay can be switched off; manual casts still work ---
|
|
{
|
|
Game game(9);
|
|
spawn_crowd(game);
|
|
InputState in{};
|
|
in.toggle_autoplay = true;
|
|
game.update(in, kDt);
|
|
check(!game.skill_system.autoplay_enabled, "L disables autoplay");
|
|
check(!game.skill_system.autoplay_active(), "disabled autoplay is inactive");
|
|
game.events.clear();
|
|
|
|
in.toggle_autoplay = false;
|
|
in.skill_concrete = true;
|
|
game.update(in, kDt);
|
|
check(game.skill_system.piles.size() == 1,
|
|
"manual cast works with autoplay off");
|
|
game.events.clear();
|
|
}
|
|
|
|
// --- WARP (K): enemies magnetize together, then burst ---
|
|
{
|
|
Game game(10);
|
|
game.enemy_system.clear();
|
|
game.player.pos = {0.0f, 0.0f};
|
|
game.enemy_system.spawn(EnemyType::HissBrute, {2.0f, 0.0f}, game.corruption);
|
|
game.enemy_system.spawn(EnemyType::HissBrute, {5.0f, 0.0f}, game.corruption);
|
|
game.enemy_system.spawn(EnemyType::HissBrute, {3.0f, 2.0f}, game.corruption);
|
|
const float hp_before = total_hp(game.enemy_system);
|
|
const auto spread = [](const EnemySystem& enemies, Vec2 center) {
|
|
float sum = 0.0f;
|
|
for (const Enemy& e : enemies.enemies) sum += distance(e.pos, center);
|
|
return sum / static_cast<float>(enemies.enemies.size());
|
|
};
|
|
|
|
InputState in{};
|
|
in.skill_warp = true;
|
|
game.update(in, kDt);
|
|
check(game.skill_system.warps.size() == 1, "K spawns a warp field");
|
|
check(game.skill_system.cooldowns[static_cast<int>(SkillType::Warp)] > 0.0f,
|
|
"K starts the warp cooldown");
|
|
bool cast_event = false;
|
|
for (int i = 0; i < game.events.count; ++i) {
|
|
const GameEvent& e = game.events.items[i];
|
|
if (e.type == EventType::SkillCast
|
|
&& e.flags == static_cast<unsigned>(SkillType::Warp))
|
|
cast_event = true;
|
|
}
|
|
check(cast_event, "warp emits a tagged SkillCast event");
|
|
const Vec2 center = game.skill_system.warps[0].pos;
|
|
const float spread_before = spread(game.enemy_system, center);
|
|
|
|
in.skill_warp = false;
|
|
for (int tick = 0; tick < 30; ++tick) {
|
|
game.update(in, kDt);
|
|
game.events.clear();
|
|
}
|
|
check(spread(game.enemy_system, center) < spread_before * 0.8f,
|
|
"warp pulls enemies together");
|
|
|
|
bool burst = false;
|
|
for (int tick = 0; tick < 40; ++tick) {
|
|
game.update(in, kDt);
|
|
for (int i = 0; i < game.events.count; ++i)
|
|
if (game.events.items[i].type == EventType::WarpBurst) burst = true;
|
|
game.events.clear();
|
|
}
|
|
check(burst, "warp field collapses with a burst event");
|
|
check(game.skill_system.warps.empty(), "warp field is consumed");
|
|
check(total_hp(game.enemy_system) < hp_before - 100.0f,
|
|
"warp burst damages the crowd");
|
|
}
|
|
|
|
// --- A manual press during cooldown is queued, not dropped -------------
|
|
{
|
|
Game game(11);
|
|
spawn_crowd(game);
|
|
game.skill_system.autoplay_enabled = false;
|
|
const int ci = static_cast<int>(SkillType::ConcreteCall);
|
|
game.skill_system.cooldowns[ci] = 0.5f;
|
|
|
|
InputState in{};
|
|
in.skill_concrete = true;
|
|
game.update(in, kDt);
|
|
check(game.skill_system.piles.empty(), "press on cooldown does not double-cast");
|
|
check(game.skill_system.queued[ci], "manual press is queued while cooling down");
|
|
check(game.skill_system.press_feedback[ci] > 0.0f,
|
|
"manual press flashes the HUD stamp immediately");
|
|
|
|
in.skill_concrete = false;
|
|
for (int tick = 0; tick < 45 && game.skill_system.piles.empty(); ++tick)
|
|
game.update(in, kDt);
|
|
check(game.skill_system.piles.size() == 1,
|
|
"queued manual cast fires as soon as the cooldown ends");
|
|
check(!game.skill_system.queued[ci], "queue clears after the cast");
|
|
}
|
|
|
|
if (failed) return 1;
|
|
std::printf("skills: OK\n");
|
|
return 0;
|
|
}
|