feat(enemy): afegeix estat "wounded" amb timer i API base (Fase 1)

- Defaults::Palette::WOUNDED ({255,215,0}) dorat per a parpadeig
- Defaults::Enemies::Wounded::{DURATION, BLINK_HZ}
- Enemy: wounded_timer_, wound_expired_this_frame_
- API: herir(), isWounded(), getWoundedTimer(),
  woundExpiredThisFrame(), consumeWoundExpired(), applyImpulse()
- update() decrementa timer i marca expiració al creuar 0
- destruir() reseteja l'estat wounded

Sense efectes visuals ni canvis de comportament: cap callsite invoca
encara herir() ni applyImpulse(). Build verda i smoke test xvfb OK.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
This commit is contained in:
2026-05-21 10:20:42 +02:00
parent 23bcd0816f
commit d169a1997c
4 changed files with 123 additions and 81 deletions
+21
View File
@@ -177,6 +177,17 @@ void Enemy::update(float delta_time) {
return;
}
// Decremento de timer "herido"; al cruzar 0 marca expiración para que el
// system layer dispare la explosión diferida.
wound_expired_this_frame_ = false;
if (wounded_timer_ > 0.0F) {
wounded_timer_ -= delta_time;
if (wounded_timer_ <= 0.0F) {
wounded_timer_ = 0.0F;
wound_expired_this_frame_ = true;
}
}
// Decremento de invulnerabilidad + LERP de brightness
if (timer_invulnerabilitat_ > 0.0F) {
timer_invulnerabilitat_ -= delta_time;
@@ -242,6 +253,16 @@ void Enemy::destruir() {
body_.velocity = Vec2{};
body_.angular_velocity = 0.0F;
body_.radius = 0.0F; // No colisiona mientras está inactivo
wounded_timer_ = 0.0F;
wound_expired_this_frame_ = false;
}
void Enemy::herir() {
wounded_timer_ = Defaults::Enemies::Wounded::DURATION;
}
void Enemy::applyImpulse(const Vec2& impulse) {
body_.applyImpulse(impulse);
}
void Enemy::setVelocity(float speed) {