Fixed failure to use player_damage for explosions.

Also made one tweak: when shield gets to "low" or "critical",
damage delay is reset (so that you get more protection from rays).
This commit is contained in:
Julie Marchant 2019-05-11 02:49:21 -04:00
parent e406c8eecd
commit c5ee1b3e09
1 changed files with 8 additions and 3 deletions

View File

@ -28,6 +28,7 @@ along with this program. If not, see <http://www.gnu.org/licenses/>.
#include "game.h" #include "game.h"
#include "gfx.h" #include "gfx.h"
#include "info.h" #include "info.h"
#include "player.h"
#include "screen.h" #include "screen.h"
#include "weapons.h" #include "weapons.h"
#include "window.h" #include "window.h"
@ -112,13 +113,19 @@ void player_damage(int amount, int delay)
{ {
info_setLine("!!! WARNING: SHIELD LOW !!!", FONT_RED); info_setLine("!!! WARNING: SHIELD LOW !!!", FONT_RED);
if (game.difficulty != DIFFICULTY_ORIGINAL) if (game.difficulty != DIFFICULTY_ORIGINAL)
{
player.shield = engine.lowShield; player.shield = engine.lowShield;
player_damageDelay = 0;
}
} }
else if ((oldshield > 1) && (player.shield <= 1)) else if ((oldshield > 1) && (player.shield <= 1))
{ {
info_setLine("!!! WARNING: SHIELD CRITICAL !!!", FONT_RED); info_setLine("!!! WARNING: SHIELD CRITICAL !!!", FONT_RED);
if (game.difficulty != DIFFICULTY_ORIGINAL) if (game.difficulty != DIFFICULTY_ORIGINAL)
{
player.shield = 1; player.shield = 1;
player_damageDelay = 0;
}
} }
} }
} }
@ -141,9 +148,7 @@ void player_checkShockDamage(float x, float y)
if (distY >= 1) if (distY >= 1)
distY /= 5; distY /= 5;
player.shield -= (int)(10 - distX); player_damage((int)((10 - distX) + (10 - distY)), 0);
player.shield -= (int)(10 - distY);
LIMIT(player.shield, 0, player.maxShield);
player.hit = 10; player.hit = 10;
} }
} }