diff options
author | nathansmithsmith <nathansmith7@mailfence.com> | 2023-08-18 22:13:36 -0600 |
---|---|---|
committer | nathansmithsmith <nathansmith7@mailfence.com> | 2023-08-18 22:13:36 -0600 |
commit | cbc6853814b0d1c4cd58784ee8e5c619c6491323 (patch) | |
tree | a16559e61305223b097e5d96502d1c419575f06a /src/entities | |
parent | 97c711ab6b6823d09893582281203dcade1cfe9a (diff) |
Caporale has higher hit damage when on low health now
Diffstat (limited to 'src/entities')
-rw-r--r-- | src/entities/caporale.c | 7 | ||||
-rw-r--r-- | src/entities/caporale.h | 2 |
2 files changed, 8 insertions, 1 deletions
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; |