Shield smash bug fix.
This commit is contained in:
parent
310637b4eb
commit
691068a634
|
@ -79,7 +79,24 @@ void doEntities(void)
|
||||||
self = e;
|
self = e;
|
||||||
|
|
||||||
e->reload = MAX(e->reload - 1, 0);
|
e->reload = MAX(e->reload - 1, 0);
|
||||||
e->shieldRecharge = MAX(e->shieldRecharge - 1, 0);
|
|
||||||
|
if (e->shieldRechargeRate)
|
||||||
|
{
|
||||||
|
if (e->shield >= 0)
|
||||||
|
{
|
||||||
|
if (--e->shieldRecharge <= 0)
|
||||||
|
{
|
||||||
|
e->shield = MIN(e->shield + 1, e->maxShield);
|
||||||
|
|
||||||
|
e->shieldRecharge = e->shieldRechargeRate;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
e->shield++;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
e->armourHit = MAX(e->armourHit - 25, 0);
|
e->armourHit = MAX(e->armourHit - 25, 0);
|
||||||
e->shieldHit = MAX(e->shieldHit - 5, 0);
|
e->shieldHit = MAX(e->shieldHit - 5, 0);
|
||||||
e->systemHit = MAX(e->systemHit - 25, 0);
|
e->systemHit = MAX(e->systemHit - 25, 0);
|
||||||
|
|
|
@ -198,12 +198,6 @@ void doFighter(void)
|
||||||
addEngineEffect();
|
addEngineEffect();
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!self->shieldRecharge)
|
|
||||||
{
|
|
||||||
self->shield = MIN(self->shield + 1, self->maxShield);
|
|
||||||
self->shieldRecharge = self->shieldRechargeRate;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (self->health <= 0)
|
if (self->health <= 0)
|
||||||
{
|
{
|
||||||
self->health = 0;
|
self->health = 0;
|
||||||
|
@ -403,13 +397,16 @@ void damageFighter(Entity *e, int amount, long flags)
|
||||||
}
|
}
|
||||||
else if (flags & BF_SHIELD_DAMAGE)
|
else if (flags & BF_SHIELD_DAMAGE)
|
||||||
{
|
{
|
||||||
e->shield = MAX(-(FPS * 10), e->shield - amount);
|
e->shield -= amount;
|
||||||
|
|
||||||
if (e->shield <= 0 && prevShield > 0)
|
if (e->shield <= 0 && prevShield > 0)
|
||||||
{
|
{
|
||||||
playBattleSound(SND_SHIELD_BREAK, e->x, e->y);
|
playBattleSound(SND_SHIELD_BREAK, e->x, e->y);
|
||||||
addShieldSplinterEffect(e);
|
addShieldSplinterEffect(e);
|
||||||
|
e->shield = -(FPS * 10);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
e->shield = MAX(-(FPS * 10), e->shield);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
@ -436,6 +433,9 @@ void damageFighter(Entity *e, int amount, long flags)
|
||||||
{
|
{
|
||||||
e->shieldHit = 255;
|
e->shieldHit = 255;
|
||||||
|
|
||||||
|
/* don't allow the shield to recharge immediately after taking a hit */
|
||||||
|
e->shieldRecharge = e->shieldRechargeRate;
|
||||||
|
|
||||||
playBattleSound(SND_SHIELD_HIT, e->x, e->y);
|
playBattleSound(SND_SHIELD_HIT, e->x, e->y);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue