Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Обновленная медицинская система: Шанс провалов #461

Open
wants to merge 13 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 12 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion code/modules/surgery/surgery_step.dm
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,7 @@
var/modded_time = time * speed_mod


fail_prob = min(max(0, modded_time - (time * SURGERY_SLOWDOWN_CAP_MULTIPLIER)),99)//if modded_time > time * modifier, then fail_prob = modded_time - time*modifier. starts at 0, caps at 99
fail_prob = get_failure_probability(user,target,tool,modded_time,)//if modded_time > time * modifier, then fail_prob = modded_time - time*modifier. starts at 0, caps at 99
modded_time = min(modded_time, time * SURGERY_SLOWDOWN_CAP_MULTIPLIER)//also if that, then cap modded_time at time*modifier

if(iscyborg(user))//any immunities to surgery slowdown should go in this check.
Expand Down
1 change: 1 addition & 0 deletions modular_bandastation/medical/_medical.dme
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#include "_medical.dm"

#include "code/surgery/vocal_cords.dm"
#include "code/surgery/surgery_fail_chance.dm"
12 changes: 12 additions & 0 deletions modular_bandastation/medical/code/surgery/surgery_fail_chance.dm
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/datum/surgery_step/proc/get_failure_probability(mob/living/user, mob/living/target, obj/item/tool, var/modded_time)
var/success_prob = implement_type ? implements[implement_type] : 100
var/turf/user_turf = get_turf(user)
var/light_amount = user_turf.get_lumcount()
if (light_amount < 0.6)
success_prob -= (0.6 - clamp(light_amount, 0, 0.6)) * 20
if ((!(target.stat == UNCONSCIOUS || target.IsSleeping()) && target.stat != DEAD) && !HAS_TRAIT(target, TRAIT_ANALGESIA))
success_prob -= 80
var/fail_prob = 100 - success_prob
fail_prob *= modded_time / time

return fail_prob
Loading