From cbc6853814b0d1c4cd58784ee8e5c619c6491323 Mon Sep 17 00:00:00 2001 From: nathansmithsmith Date: Fri, 18 Aug 2023 22:13:36 -0600 Subject: Caporale has higher hit damage when on low health now --- src/entities/caporale.c | 7 ++++++- src/entities/caporale.h | 2 ++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/src/entities/caporale.c b/src/entities/caporale.c index ff5e6b2..e4566dd 100644 --- a/src/entities/caporale.c +++ b/src/entities/caporale.c @@ -62,8 +62,13 @@ void updateGunsCaporale(Game * game, Entity * entity) { Vector3 direction = Vector3Subtract(player->position, entity->position); direction = Vector3Normalize(direction); + float damage = CAPORALE_BULLET_DAMAGE; + + if (entity->health <= CAPORALE_LOW_HEALTH_THRESHOLD) + damage = CAPORALE_LOW_HEALTH_BULLET_DAMAGE; + // Create bullet and shoot. - Bullet bullet = createBulletFromDirection(*entity, direction, CAPORALE_BULLET_DAMAGE); + Bullet bullet = createBulletFromDirection(*entity, direction, damage); shootBulletAtEntity(player, bullet); } diff --git a/src/entities/caporale.h b/src/entities/caporale.h index effba16..ac4be6f 100644 --- a/src/entities/caporale.h +++ b/src/entities/caporale.h @@ -9,6 +9,8 @@ #define CAPORALE_COOLDOWN 0.5 #define CAPORALE_BULLET_DAMAGE 0.01 #define CAPORALE_CHANGE_OF_HIT 10 +#define CAPORALE_LOW_HEALTH_THRESHOLD 0.9 +#define CAPORALE_LOW_HEALTH_BULLET_DAMAGE 0.02 typedef struct Caporale { EntityFlyToPointInfo flyToPlayer; -- cgit v1.2.3