diff --git a/tests/test_whip_attack.cpp b/tests/test_whip_attack.cpp index 7aef493..cf43c07 100644 --- a/tests/test_whip_attack.cpp +++ b/tests/test_whip_attack.cpp @@ -213,8 +213,10 @@ namespace { auto whip = makeWhip(WhipAttack::Direction::EAST, BOX, 48.0F); whip->setWorldContext(&manager, nullptr); - // 60 ms → frame 1 (active). active_frames: [1, 2]. - whip->update(0.06F); + // frame_ms=80 al YAML → frame 0 viu [0, 80] ms, frame 1 [80, 160] ms. + // active_frames=[1, 2], així que cal arribar com a mínim a 80 ms + // perquè `isFrameActive()` retorne true i `applyDamage()` corra. + whip->update(0.09F); REQUIRE(mummy_raw->getState() == Mummy::State::HURT); } @@ -272,8 +274,9 @@ namespace { auto whip = makeWhip(WhipAttack::Direction::EAST, BOX, 48.0F); whip->setWorldContext(&manager, nullptr); - // Primera passada (frame 1, actiu) → mòmia a HURT. - whip->update(0.06F); + // frame_ms=80 → frame 0 [0, 80] ms; cal ≥ 80 ms per entrar al + // frame 1 (primer dels active_frames=[1, 2]). + whip->update(0.09F); REQUIRE(mummy_raw->getState() == Mummy::State::HURT); const float HURT_INITIAL = mummy_raw->getHurtRemainingS(); @@ -285,7 +288,9 @@ namespace { const float HURT_AFTER_MUMMY_TICK = mummy_raw->getHurtRemainingS(); REQUIRE(HURT_AFTER_MUMMY_TICK < HURT_INITIAL); - whip->update(0.05F); // frame 2, encara actiu + // Segon tick del whip: acumulat 0.09 + 0.05 = 0.14 s, encara + // dins del frame 1 ([80, 160] ms). already_hit_ ha de bloquejar. + whip->update(0.05F); REQUIRE(mummy_raw->getHurtRemainingS() == HURT_AFTER_MUMMY_TICK); }