From f452b9cf067cfce74f0cdbd099a93d6d59f54801 Mon Sep 17 00:00:00 2001 From: Simon Date: Tue, 28 Mar 2023 13:51:49 +0100 Subject: [PATCH] Slight tweak to NPC Combat --- .../Android/jni/OpenJK/code/game/NPC_combat.cpp | 13 ++++++++----- .../Android/jni/OpenJK/codeJK2/game/NPC_combat.cpp | 13 ++++++++----- 2 files changed, 16 insertions(+), 10 deletions(-) diff --git a/Projects/Android/jni/OpenJK/code/game/NPC_combat.cpp b/Projects/Android/jni/OpenJK/code/game/NPC_combat.cpp index 2a4f65b..9500f45 100644 --- a/Projects/Android/jni/OpenJK/code/game/NPC_combat.cpp +++ b/Projects/Android/jni/OpenJK/code/game/NPC_combat.cpp @@ -2256,13 +2256,16 @@ int NPC_ShotEntity( gentity_t *ent, vec3_t impactPos ) CalcEntitySpot( NPC, SPOT_WEAPON, muzzle ); } - int location = Q_irand(0, 9); - if (location <= 4 || cg.renderingThirdPerson || - ent->client == NULL || ent->client->ps.clientNum != 0) { //50% chance (unless ent is not the player, then always go for chest, which is original behaviour) + int location = Q_irand(0, 99); + if (location < 65 || cg.renderingThirdPerson || + ent->client == NULL || ent->client->ps.clientNum != 0) { + // 65% chance (unless ent is not the player, then always go for chest, which is original behaviour) CalcEntitySpot(ent, SPOT_CHEST, targ); - } else if (location <= 7) { //30% chance + } else if (location < 85) { + // 20% chance CalcEntitySpot(ent, SPOT_LEGS, targ); - } else { // 20% chance + } else { + // 15% chance CalcEntitySpot(ent, SPOT_HEAD, targ); } diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/NPC_combat.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/NPC_combat.cpp index 878794b..216976c 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/NPC_combat.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/NPC_combat.cpp @@ -2034,13 +2034,16 @@ int NPC_ShotEntity( gentity_t *ent, vec3_t impactPos ) CalcEntitySpot( NPC, SPOT_WEAPON, muzzle ); } - int location = Q_irand(0, 9); - if (location <= 4 || cg.renderingThirdPerson || - ent->client == NULL || ent->client->ps.clientNum != 0) { //50% chance (unless ent is not the player, then always go for chest, which is original behaviour) + int location = Q_irand(0, 99); + if (location < 65 || cg.renderingThirdPerson || + ent->client == NULL || ent->client->ps.clientNum != 0) { + // 65% chance (unless ent is not the player, then always go for chest, which is original behaviour) CalcEntitySpot(ent, SPOT_CHEST, targ); - } else if (location <= 7) { //30% chance + } else if (location < 85) { + // 20% chance CalcEntitySpot(ent, SPOT_LEGS, targ); - } else { // 20% chance + } else { + // 15% chance CalcEntitySpot(ent, SPOT_HEAD, targ); }