Skip to content

Commit

Permalink
Make EMP deactivate shield completely
Browse files Browse the repository at this point in the history
  • Loading branch information
Monsterovich committed Oct 28, 2024
1 parent 935263b commit f1d501c
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 9 deletions.
8 changes: 7 additions & 1 deletion src/combat.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -429,6 +429,13 @@ int32_t objDamage(BASE_OBJECT *psObj, unsigned damage, unsigned originalhp, WEAP
// EMP weapon radius should not do actual damage
if (weaponSubClass == WSC_EMP && empRadiusHit)
{
if (psObj->type == OBJ_DROID)
{
DROID *psDroid = castDroid(psObj);

// EMP weapons kills droid shields completely
psDroid->shieldPoints = 0;
}
return 0;
}

Expand Down Expand Up @@ -514,7 +521,6 @@ int32_t objDamage(BASE_OBJECT *psObj, unsigned damage, unsigned originalhp, WEAP
psDroid->shieldPoints = 0;
// shields are interrupted, wait for a while until regeneration starts again
psDroid->shieldInterruptRegenTime = psDroid->time;
psDroid->shieldRegenTime = psDroid->time;
}

Vector3i dv;
Expand Down
15 changes: 7 additions & 8 deletions src/droid.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -969,19 +969,18 @@ void droidUpdateShields(DROID *psDroid)
}
else
{
if (gameTime - psDroid->shieldInterruptRegenTime >= droidCalculateShieldInterruptRegenTime(psDroid))
if (!((psDroid->lastHitWeapon == WSC_EMP) && ((gameTime - psDroid->timeLastHit) < EMP_DISABLE_TIME)) &&
gameTime - psDroid->shieldInterruptRegenTime > droidCalculateShieldInterruptRegenTime(psDroid) &&
gameTime - psDroid->shieldRegenTime > droidCalculateShieldRegenTime(psDroid))
{
if (gameTime - psDroid->shieldRegenTime >= droidCalculateShieldRegenTime(psDroid))
for (uint32_t i = 0; i < DROID_SHIELD_POINTS_STEP; i++)
{
for (uint32_t i = 0; i < DROID_SHIELD_POINTS_STEP; i++)
if (psDroid->shieldPoints < droidGetMaxShieldPoints(psDroid))
{
if (psDroid->shieldPoints < droidGetMaxShieldPoints(psDroid))
{
psDroid->shieldPoints += 1;
}
psDroid->shieldPoints += 1;
}
psDroid->shieldRegenTime = gameTime;
}
psDroid->shieldRegenTime = gameTime;
}
}
}
Expand Down

0 comments on commit f1d501c

Please sign in to comment.