mirror of
https://github.com/CHOMPStation2/CHOMPStation2.git
synced 2025-12-11 18:53:06 +00:00
Tweak/refactor external organ droplimb mechanics
This commit is contained in:
@@ -1,6 +1,12 @@
|
|||||||
/****************************************************
|
/****************************************************
|
||||||
EXTERNAL ORGANS
|
EXTERNAL ORGANS
|
||||||
****************************************************/
|
****************************************************/
|
||||||
|
|
||||||
|
//These control the damage thresholds for the various ways of removing limbs
|
||||||
|
#define DROPLIMB_THRESHOLD_EDGE 5
|
||||||
|
#define DROPLIMB_THRESHOLD_TEAROFF 2
|
||||||
|
#define DROPLIMB_THRESHOLD_DESTROY 1
|
||||||
|
|
||||||
/obj/item/organ/external
|
/obj/item/organ/external
|
||||||
name = "external"
|
name = "external"
|
||||||
min_broken_damage = 30
|
min_broken_damage = 30
|
||||||
@@ -235,6 +241,7 @@
|
|||||||
//If we can't inflict the full amount of damage, spread the damage in other ways
|
//If we can't inflict the full amount of damage, spread the damage in other ways
|
||||||
//How much damage can we actually cause?
|
//How much damage can we actually cause?
|
||||||
var/can_inflict = max_damage * config.organ_health_multiplier - (brute_dam + burn_dam)
|
var/can_inflict = max_damage * config.organ_health_multiplier - (brute_dam + burn_dam)
|
||||||
|
var/spillover = 0
|
||||||
if(can_inflict)
|
if(can_inflict)
|
||||||
if (brute > 0)
|
if (brute > 0)
|
||||||
//Inflict all burte damage we can
|
//Inflict all burte damage we can
|
||||||
@@ -246,16 +253,17 @@
|
|||||||
//How much mroe damage can we inflict
|
//How much mroe damage can we inflict
|
||||||
can_inflict = max(0, can_inflict - brute)
|
can_inflict = max(0, can_inflict - brute)
|
||||||
//How much brute damage is left to inflict
|
//How much brute damage is left to inflict
|
||||||
brute = max(0, brute - temp)
|
spillover += max(0, brute - temp)
|
||||||
|
|
||||||
if (burn > 0 && can_inflict)
|
if (burn > 0 && can_inflict)
|
||||||
//Inflict all burn damage we can
|
//Inflict all burn damage we can
|
||||||
createwound(BURN, min(burn,can_inflict))
|
createwound(BURN, min(burn,can_inflict))
|
||||||
//How much burn damage is left to inflict
|
//How much burn damage is left to inflict
|
||||||
burn = max(0, burn - can_inflict)
|
spillover += max(0, burn - can_inflict)
|
||||||
|
|
||||||
//If there are still hurties to dispense
|
//If there are still hurties to dispense
|
||||||
if (burn || brute)
|
if (spillover)
|
||||||
owner.shock_stage += (brute+burn) * config.organ_damage_spillover_multiplier
|
owner.shock_stage += spillover * config.organ_damage_spillover_multiplier
|
||||||
|
|
||||||
// sync the organ's damage with its wounds
|
// sync the organ's damage with its wounds
|
||||||
src.update_damages()
|
src.update_damages()
|
||||||
@@ -264,26 +272,30 @@
|
|||||||
//If limb took enough damage, try to cut or tear it off
|
//If limb took enough damage, try to cut or tear it off
|
||||||
if(owner && loc == owner)
|
if(owner && loc == owner)
|
||||||
if(!cannot_amputate && config.limbs_can_break && (brute_dam + burn_dam) >= (max_damage * config.organ_health_multiplier))
|
if(!cannot_amputate && config.limbs_can_break && (brute_dam + burn_dam) >= (max_damage * config.organ_health_multiplier))
|
||||||
var/threshold = max_damage
|
//organs can come off in three cases
|
||||||
var/dropped
|
//1. If the damage source is edge_eligible and the brute damage dealt exceeds the edge threshold, then the organ is cut off.
|
||||||
if((burn >= threshold) && prob(burn/3))
|
//2. If the damage amount dealt exceeds the disintegrate threshold, the organ is completely obliterated.
|
||||||
dropped = 1
|
//3. If the organ has already reached or would be put over it's max damage amount (currently redundant),
|
||||||
droplimb(0,DROPLIMB_BURN)
|
// and the brute damage dealt exceeds the tearoff threshold, the organ is torn off.
|
||||||
if(!dropped && prob(brute))
|
|
||||||
var/edge_eligible = 0
|
//Check edge eligibility
|
||||||
if(edge)
|
var/edge_eligible = 0
|
||||||
if(istype(used_weapon,/obj/item))
|
if(edge)
|
||||||
var/obj/item/W = used_weapon
|
if(istype(used_weapon,/obj/item))
|
||||||
if(W.w_class >= w_class)
|
var/obj/item/W = used_weapon
|
||||||
edge_eligible = 1
|
if(W.w_class >= w_class)
|
||||||
else
|
|
||||||
edge_eligible = 1
|
edge_eligible = 1
|
||||||
|
else
|
||||||
|
edge_eligible = 1
|
||||||
|
|
||||||
if(brute >= threshold || (edge_eligible && brute >= threshold/3))
|
if(edge_eligible && brute >= max_damage / DROPLIMB_THRESHOLD_EDGE && prob(brute))
|
||||||
if(edge)
|
droplimb(0, DROPLIMB_EDGE)
|
||||||
droplimb(0,DROPLIMB_EDGE)
|
else if(burn >= max_damage / DROPLIMB_THRESHOLD_DESTROY && prob(burn/3))
|
||||||
else
|
droplimb(0, DROPLIMB_BURN)
|
||||||
droplimb(0,DROPLIMB_BLUNT)
|
else if(brute >= max_damage / DROPLIMB_THRESHOLD_DESTROY && prob(brute))
|
||||||
|
droplimb(0, DROPLIMB_BLUNT)
|
||||||
|
else if(brute >= max_damage / DROPLIMB_THRESHOLD_TEAROFF && prob(brute/3))
|
||||||
|
droplimb(0, DROPLIMB_EDGE)
|
||||||
|
|
||||||
return update_icon()
|
return update_icon()
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user