From 95950f23900ad138cd09e7e7d71e463f53d7906f Mon Sep 17 00:00:00 2001 From: Grant Bagwell Date: Wed, 5 Apr 2023 20:08:10 +0200 Subject: [PATCH] Updated ratios per difficulty --- .../jni/OpenJK/codeJK2/game/NPC_combat.cpp | 33 +++++++++++++++++-- 1 file changed, 31 insertions(+), 2 deletions(-) diff --git a/Projects/Android/jni/OpenJK/codeJK2/game/NPC_combat.cpp b/Projects/Android/jni/OpenJK/codeJK2/game/NPC_combat.cpp index 216976c..8a3982e 100644 --- a/Projects/Android/jni/OpenJK/codeJK2/game/NPC_combat.cpp +++ b/Projects/Android/jni/OpenJK/codeJK2/game/NPC_combat.cpp @@ -2035,11 +2035,40 @@ int NPC_ShotEntity( gentity_t *ent, vec3_t impactPos ) } int location = Q_irand(0, 99); - if (location < 65 || cg.renderingThirdPerson || + int torsoRatio = 65; + int legsRatio = 20; + int headRatio = 15; + + switch ( g_spskill->integer ) + { + //Easiest difficulty, low chance of hittitng anything else + case 0: + torsoRatio = 90; + legsRatio = 5; + headRatio = 5; + break; + + //Medium difficulty, half-half chance of picking up the player + case 1: + torsoRatio = 60; + legsRatio = 25; + headRatio = 15; + break; + + //Hardest difficulty, always turn on attacking player + case 2: + default: + torsoRatio = 50; + legsRatio = 35; + headRatio = 15; + break; + } + + if (location < torsoRatio || 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 < 85) { + } else if (location < legsRatio + torsoRatio) { // 20% chance CalcEntitySpot(ent, SPOT_LEGS, targ); } else {