diff --git a/src/combat.cpp b/src/combat.cpp index d9b7a1e8053..41e7d47c521 100644 --- a/src/combat.cpp +++ b/src/combat.cpp @@ -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; } @@ -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; diff --git a/src/droid.cpp b/src/droid.cpp index bc793790e31..2bfd7e3e49d 100644 --- a/src/droid.cpp +++ b/src/droid.cpp @@ -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; } } }