From 7b59cbec5cb9d5886daf9cdc25073fa4743f31f1 Mon Sep 17 00:00:00 2001 From: unknown Date: Mon, 16 Jun 2014 18:42:17 -0400 Subject: [PATCH] Fixes large amounts of damage being carried by minor wound types --- code/modules/organs/organ_external.dm | 24 +++++++++++++++--------- code/modules/organs/wound.dm | 19 +++++++++++++++++++ 2 files changed, 34 insertions(+), 9 deletions(-) diff --git a/code/modules/organs/organ_external.dm b/code/modules/organs/organ_external.dm index 0e6ba4942c..245bbdb9d3 100644 --- a/code/modules/organs/organ_external.dm +++ b/code/modules/organs/organ_external.dm @@ -232,16 +232,22 @@ This function completely restores a damaged organ to perfect condition. owner.custom_pain("You feel something rip in your [display_name]!", 1) // first check whether we can widen an existing wound - if(wounds.len > 0 && prob(max(50+(owner.number_wounds-1)*10,90))) + if(wounds.len > 0 && prob(max(50+(number_wounds-1)*10,90))) if((type == CUT || type == BRUISE) && damage >= 5) - var/datum/wound/W = pick(wounds) - if(W.amount == 1) - W.open_wound(damage) - if(prob(25)) - owner.visible_message("\red The wound on [owner.name]'s [display_name] widens with a nasty ripping voice.",\ - "\red The wound on your [display_name] widens with a nasty ripping voice.",\ - "You hear a nasty ripping noise, as if flesh is being torn apart.") - return + //we need to make sure that the wound we are going to worsen is compatible with the type of damage... + var/list/compatible_wounds = list() + for (var/datum/wound/W in wounds) + if (W.can_worsen(type, damage)) + compatible_wounds += W + + var/datum/wound/W = pick(compatible_wounds) + W.open_wound(damage) + if(prob(25)) + //maybe have a separate message for BRUISE type damage? + owner.visible_message("\red The wound on [owner.name]'s [display_name] widens with a nasty ripping voice.",\ + "\red The wound on your [display_name] widens with a nasty ripping voice.",\ + "You hear a nasty ripping noise, as if flesh is being torn apart.") + return //Creating wound var/wound_type = get_wound_type(type, damage) diff --git a/code/modules/organs/wound.dm b/code/modules/organs/wound.dm index 22ad0723c6..cdd732da5a 100644 --- a/code/modules/organs/wound.dm +++ b/code/modules/organs/wound.dm @@ -161,6 +161,25 @@ src.desc = desc_list[current_stage] src.min_damage = damage_list[current_stage] + // returns whether this wound can absorb the given amount of damage. + // this will prevent large amounts of damage being trapped in less severe wound types + proc/can_worsen(damage_type, damage) + if (src.damage_type != damage_type) + return 0 //incompatible damage types + + if (src.amount > 1) + return 0 + + //with 1.5*, a shallow cut will be able to carry at most 30 damage, + //37.5 for a deep cut + //52.5 for a flesh wound, etc. + var/max_wound_damage = 1.5*src.damage_list[1] + if (src.damage + damage > max_wound_damage) + return 0 + + return 1 + + proc/bleeding() // internal wounds don't bleed in the sense of this function return ((damage > 30 || bleed_timer > 0) && !(bandaged||clamped) && (damage_type == BRUISE && damage >= 20 || damage_type == CUT && damage >= 5) && current_stage <= max_bleeding_stage && !src.internal)