Skip to content

Commit

Permalink
Fixes disarm chance calculation (#5111)
Browse files Browse the repository at this point in the history
# About the pull request

I was testing stuff out for a different PR and thought the disarm chance
(for human vs human) seemed weird at times, so I forced it to output
attacker_skill_level and defender_skill_level to chat every time a
disarm was done. And then found out it's not calculating it properly.
This seems to fix it in limited testing but might need more testing. I'm
kinda surprised it wasn't noticed earlier cause there's two signs it's
wrong in certain situations even with skill_level variables being
invisible: the "tackled" message should only appear when the attacker's
CQC level is two or higher (otherwise it should say pushed/shoved), and
also, anyone that has a CQC advantage is still disarm-stunning everyone
for the same amount of time as anyone else on average ('on average'
because there was apparently some variance with a tick offset bug before
the TG status effect testmerge) - the code implies it should be longer.

# Explain why it's good for the game

Bugs should be fixed. From a balance perspective I don't know if it
'should' be fixed from what it is currently in it's bugged state... but
regardless, it's a bug.


# Testing Photographs and Procedure
<details>
<summary>Screenshots & Videos</summary>

Put screenshots and videos here with an empty line between the
screenshots and the `<details>` tags.

</details>


# Changelog
:cl:
fix: disarm chance wasn't calculating properly
/:cl:

---------

Co-authored-by: Drathek <[email protected]>
  • Loading branch information
zzzmike and Drulikar committed Dec 6, 2023
1 parent 6972e40 commit 01ec6e3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion code/modules/mob/living/carbon/human/human_attackhand.dm
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@
return held_weapon.afterattack(target,src)

var/disarm_chance = rand(1, 100)
var/attacker_skill_level = skills && attacking_mob.skills ? skills.get_skill_level(SKILL_CQC) : SKILL_CQC_MAX // No skills, so assume max
var/attacker_skill_level = attacking_mob.skills ? attacking_mob.skills.get_skill_level(SKILL_CQC) : SKILL_CQC_MAX // No skills, so assume max
var/defender_skill_level = skills ? skills.get_skill_level(SKILL_CQC) : SKILL_CQC_MAX // No skills, so assume max
disarm_chance -= 5 * attacker_skill_level
disarm_chance += 5 * defender_skill_level
Expand Down

0 comments on commit 01ec6e3

Please sign in to comment.