Skip to content

Commit

Permalink
Merge pull request #3556 from X0-11/experimental-combat-changes
Browse files Browse the repository at this point in the history
Experimental combat changes
  • Loading branch information
BDpuffy420 authored May 25, 2024
2 parents f0d76a8 + f9b585d commit 3860ed0
Show file tree
Hide file tree
Showing 11 changed files with 80 additions and 40 deletions.
7 changes: 7 additions & 0 deletions code/__defines/chemistry.dm
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,13 @@

#define REAGENTS_OVERDOSE 30

//For chemical effects with diminishing returns, how much %wise should we lose for each second the chem is in us?
#define DIMINISHING_RETURNS_PERSECOND_LOSS 0.007
//What is the lowest our multiplier can get?
#define DIMINISHING_RETURNS_CAP 0.4

#define ADRENAL_RUSH_TIME 4 SECONDS

#define CHEM_SYNTH_ENERGY 500 // How much energy does it take to synthesize 1 unit of chemical, in Joules.

// Some on_mob_life() procs check for alien races.
Expand Down
6 changes: 3 additions & 3 deletions code/__defines/suppression.dm
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@

#define SUPPRESS_LARGE 5
#define SUPPRESS_MID 3
#define SUPPRESS_SMALL 2
#define SUPPRESS_LARGE 9
#define SUPPRESS_MID 6
#define SUPPRESS_SMALL 3
#define SUPPRESSION_FULLSCREEN_TYPE /obj/screen/fullscreen/oxy
2 changes: 1 addition & 1 deletion code/game/gamemodes/cult/runes.dm
Original file line number Diff line number Diff line change
Expand Up @@ -575,7 +575,7 @@
M.AdjustStunned(-1)
M.AdjustWeakened(-1)
M.add_chemical_effect(CE_PAINKILLER, 40)
M.add_chemical_effect(CE_SPEEDBOOST, 1)
M.add_chemical_effect_diminishing(CE_SPEEDBOOST, 1,dose,metabolism)
M.adjustOxyLoss(-10 * removed)
M.heal_organ_damage(5 * removed, 5 * removed)
M.adjustToxLoss(-5 * removed)
Expand Down
10 changes: 5 additions & 5 deletions code/modules/halo/chemicals/medicine.dm
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@
description = "The remnants of biofoam, clogging the person's body and stopping further biofoam usage."
reagent_state = LIQUID
color = "#edd9c0"
metabolism = REM*3
metabolism = REM*2
overdose = 0
scannable = 1

Expand Down Expand Up @@ -173,7 +173,7 @@

/datum/reagent/hyperzine/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
M.adjustToxLoss(0.5)
M.add_chemical_effect(CE_SLOWREMOVE, 1)
M.add_chemical_effect_diminishing(CE_SLOWREMOVE, 1,dose,metabolism)
M.add_chemical_effect(CE_PULSE, 2)

/datum/reagent/hyperzine_concentrated
Expand All @@ -192,7 +192,7 @@
H.adjustToxLoss(0.75)
if(prob(10))
H.emote(pick("twitch", "blink_r", "shiver"))
H.add_chemical_effect(CE_SPEEDBOOST, 1)
H.add_chemical_effect_diminishing(CE_SPEEDBOOST, 1,dose,metabolism)
H.add_chemical_effect(CE_PULSE, 2)

/datum/reagent/hyperzine_concentrated/overdose(var/mob/living/carbon/human/H)
Expand Down Expand Up @@ -262,7 +262,7 @@
flags = IGNORE_MOB_SIZE

/datum/reagent/ketoprofen/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
M.add_chemical_effect(CE_PAINKILLER, 40)
M.add_chemical_effect_diminishing(CE_PAINKILLER, 40,dose,metabolism)
M.add_chemical_effect(CE_CRYO, -1)

var/target = 310 //Target body temperature
Expand All @@ -286,7 +286,7 @@
flags = IGNORE_MOB_SIZE

/datum/reagent/polypseudomorphine/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
M.add_chemical_effect(CE_PAINKILLER, POLYPSEUDOMORPHINE_PAINKILL)
M.add_chemical_effect_diminishing(CE_PAINKILLER, POLYPSEUDOMORPHINE_PAINKILL,dose,metabolism)
for(var/datum/reagents/reag_hold in list(M.bloodstr,M.ingested,M.touching))
reag_hold.remove_reagent(/datum/reagent/hyperzine,100)
reag_hold.remove_reagent(/datum/reagent/hyperzine_concentrated,100)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@

/datum/reagent/tallista_spice/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed)
..()
M.add_chemical_effect(CE_SPEEDBOOST, 1)
M.add_chemical_effect(CE_SLOWREMOVE, 1)
M.add_chemical_effect_diminishing(CE_SPEEDBOOST, 1,dose,metabolism)
M.add_chemical_effect_diminishing(CE_SLOWREMOVE, 2,dose,metabolism)
M.add_chemical_effect(CE_PULSE, 0.1)
M.add_chemical_effect(CE_PAINKILLER, 50)
M.add_chemical_effect_diminishing(CE_PAINKILLER, 100,dose,metabolism)
10 changes: 5 additions & 5 deletions code/modules/halo/misc/suppression.dm
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,22 @@
return
var/seconds_since_suppression = (world.time - time_last_suppressed)/10
var/shake_chance = SUPPRESSION_SHAKE_CHANCE
var/shake_multiplier = 0
var/shake_intensity = 0
if(seconds_since_suppression <= 1.5)
overlay_fullscreen("suppress",SUPPRESSION_FULLSCREEN_TYPE, SUPPRESS_LARGE)
shake_multiplier = 1.5
shake_intensity = 1.25
//severe supression effects
else if(seconds_since_suppression <=4)
overlay_fullscreen("suppress",SUPPRESSION_FULLSCREEN_TYPE, SUPPRESS_MID)
shake_multiplier = 1
shake_intensity = 0.75
//medium supression effects
else if(seconds_since_suppression <=8)
overlay_fullscreen("suppress",SUPPRESSION_FULLSCREEN_TYPE, SUPPRESS_SMALL)
shake_multiplier = 0.5
shake_intensity = 0.25
//low supression effects

if(prob(shake_chance))
shake_camera(src, round(0.25 SECONDS * shake_multiplier), round(1*shake_multiplier))
shake_camera(src, round(0.25 SECONDS * shake_intensity), shake_intensity)
if(prob(SUPPRESSION_SCREAM_CHANCE))
emote("painscream",AUDIBLE_MESSAGE)
time_last_suppressed = world.time
15 changes: 15 additions & 0 deletions code/modules/mob/living/carbon/carbon.dm
Original file line number Diff line number Diff line change
Expand Up @@ -384,6 +384,21 @@
else
chem_effects[effect] = magnitude

/mob/living/carbon/proc/add_chemical_effect_diminishing(var/effect,var/magnitude,var/dose,var/metab,var/reverse)
//This does some preprocessing to lower the final effect by how much has already been processed.
//How long has this been processing in us (seconds)?
var/dose_time = (dose / metab)/10
var/dose_mult_step1 = DIMINISHING_RETURNS_PERSECOND_LOSS * dose_time
var/dose_mult = 1
if(reverse)
dose_mult = min(dose_mult_step1,1)
else
dose_mult = max(1 - dose_mult_step1,DIMINISHING_RETURNS_CAP)
add_chemical_effect(effect,magnitude*dose_mult)

/mob/living/carbon/proc/add_chemical_effect_diminishing_reverse(var/effect,var/magnitude,var/dose,var/metab)
add_chemical_effect_diminishing(effect,magnitude,dose,metab,1)

/mob/living/carbon/proc/add_up_to_chemical_effect(var/effect, var/magnitude = 1)
if(effect in chem_effects)
chem_effects[effect] = max(magnitude, chem_effects[effect])
Expand Down
11 changes: 10 additions & 1 deletion code/modules/mob/living/carbon/human/life.dm
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,8 @@

handle_medical_side_effects()

handle_armour_regen()

if(!client && !mind)
species.handle_npc(src)

Expand Down Expand Up @@ -1210,4 +1212,11 @@
/mob/living/carbon/human/handle_flight_failure()
if(species.handle_flight_failure(src)) //If our species returns 1, then they're fully handling this.
return
. = ..()
. = ..()

/mob/living/carbon/human/proc/handle_armour_regen()
for(var/i in list(head,wear_suit,w_uniform,shoes,gloves))
var/obj/item/clothing/c = i
if(istype(c))
if(c.armor_thickness < c.armor_thickness_max)
c.armor_thickness = min(c.armor_thickness + 0.1,c.armor_thickness_max)
7 changes: 4 additions & 3 deletions code/modules/projectiles/projectile/bullets.dm
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@
muzzle_type = /obj/effect/projectile/bullet/muzzle

/obj/item/projectile/bullet/on_hit(var/atom/target, var/blocked = 0)
if (..(target, blocked))
/* if (..(target, blocked))
var/mob/living/L = target
shake_camera(L, 3, 2)

The Suppression system should be handling screenshakes.
shake_camera(L, 2, 1.5)
*/
/obj/item/projectile/bullet/attack_mob(var/mob/living/target_mob, var/distance, var/miss_modifier)
if(penetrating > 0 && damage > 20 && prob(damage))
mob_passthrough_check = 1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -866,7 +866,7 @@

/datum/reagent/drink/nuka_cola/affect_ingest(var/mob/living/carbon/M, var/alien, var/removed)
..()
M.add_chemical_effect(CE_SPEEDBOOST, 1)
M.add_chemical_effect_diminishing(CE_SPEEDBOOST, 1,dose,metabolism)
M.make_jittery(20)
M.druggy = max(M.druggy, 30)
M.dizziness += 5
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
/datum/reagent/inaprovaline/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
if(alien != IS_DIONA)
M.add_chemical_effect(CE_STABLE)
M.add_chemical_effect(CE_PAINKILLER, 10)
M.add_chemical_effect_diminishing(CE_PAINKILLER, 10,dose,metabolism)
M.add_chemical_effect(CE_BRAIN_REGEN, 1) // Slowly repairs brain damage.
M.add_chemical_effect(CE_PULSE, -1)

Expand Down Expand Up @@ -234,11 +234,11 @@
color = "#C8A5DC"
overdose = 60
scannable = 1
metabolism = 0.02
metabolism = REM * 0.5
flags = IGNORE_MOB_SIZE

/datum/reagent/paracetamol/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
M.add_chemical_effect(CE_PAINKILLER, 25)
M.add_chemical_effect_diminishing(CE_PAINKILLER, 25,dose,metabolism)

/datum/reagent/paracetamol/overdose(var/mob/living/carbon/M, var/alien)
..()
Expand All @@ -252,11 +252,11 @@
color = "#CB68FC"
overdose = 30
scannable = 1
metabolism = 0.02
metabolism = REM
flags = IGNORE_MOB_SIZE

/datum/reagent/tramadol/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
M.add_chemical_effect(CE_PAINKILLER, 80)
M.add_chemical_effect_diminishing(CE_PAINKILLER, 80,dose,metabolism)

/datum/reagent/tramadol/overdose(var/mob/living/carbon/M, var/alien)
..()
Expand All @@ -273,11 +273,11 @@
flags = IGNORE_MOB_SIZE

/datum/reagent/oxycodone/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
M.add_chemical_effect(CE_PAINKILLER, 200)
M.add_chemical_effect_diminishing_reverse(CE_PAINKILLER, 120,dose,metabolism)
M.druggy = max(M.druggy, 10)

/datum/reagent/oxycodone/overdose(var/mob/living/carbon/M, var/alien)
..()
M.druggy = max(M.druggy, 10)
M.hallucination = max(M.hallucination, 3)

/* Other medicine */
Expand All @@ -302,7 +302,7 @@
holder.remove_reagent(/datum/reagent/mindbreaker, 5)
M.hallucination = max(0, M.hallucination - 10)
M.adjustToxLoss(10 * removed) // Reduced from 12 to 10 to make its toxin buildup a little more sane with its slow metabolism.
M.add_chemical_effect(CE_PAINKILLER, 20)
M.add_chemical_effect_diminishing(CE_PAINKILLER, 20,dose,metabolism)

/datum/reagent/alkysine
name = "Alkysine"
Expand All @@ -318,7 +318,7 @@
/datum/reagent/alkysine/affect_blood(var/mob/living/carbon/M, var/alien, var/removed)
if(alien == IS_DIONA)
return
M.add_chemical_effect(CE_PAINKILLER, 10)
M.add_chemical_effect_diminishing(CE_PAINKILLER, 10,dose,metabolism)
M.add_chemical_effect(CE_BRAIN_REGEN, 2) // 1 to 2. Heals the brain twice as fast.
M.adjustToxLoss(10 * removed) // Removed confusion and drowsiness, added toxin buildup.

Expand Down Expand Up @@ -701,7 +701,7 @@
if(alien == IS_DIONA)
return

M.add_chemical_effect(CE_PAINKILLER, 15)
M.add_chemical_effect_diminishing(CE_PAINKILLER, 15,dose,metabolism)
M.add_chemical_effect(CE_ANTIVIRAL, 1)

/datum/reagent/antidexafen/overdose(var/mob/living/carbon/M, var/alien)
Expand All @@ -716,25 +716,33 @@
color = "#C8A5DC"
scannable = 1
overdose = 0
var/metab_adr = null
var/adrenal_break = 0

/datum/reagent/adrenaline/affect_blood(var/mob/living/carbon/human/M, var/alien, var/removed)
if(alien == IS_DIONA)
return
if(dose > 1) //not that effective after initial rush
M.add_chemical_effect(CE_PAINKILLER, min(10*volume, 20))
M.add_chemical_effect(CE_PULSE, 1)
var/break_threshold = M.species.adrenal_break_threshold
if(!metab_adr)//Caching
metab_adr = initial(metabolism) * ADRENAL_RUSH_TIME
if(volume > break_threshold)
metabolism = break_threshold*1.5
adrenal_break = 1
else
if(adrenal_break)
adrenal_break = 0
metabolism = initial(metabolism)
if(adrenal_break || dose < (metabolism * ADRENAL_RUSH_TIME)) //not that effective after initial rush
M.add_chemical_effect(CE_PAINKILLER, min(30*volume, 80))
M.add_chemical_effect(CE_PULSE, 1) // 2 -> 1 due to brutes breaking their hearts on this stuff.
M.add_chemical_effect(CE_PULSE, 2)
else
M.add_chemical_effect(CE_PAINKILLER, min(10*volume, 45))
M.add_chemical_effect(CE_PULSE, 1)
if(dose > 5)
M.make_jittery(5)
if(volume >= 5 && M.is_asystole())
remove_self(5)
M.resuscitate()
while(volume >= M.species.adrenal_break_threshold)//slightly more than 100/5.
M.add_chemical_effect(CE_PAINKILLER,120*(M.species.adrenal_break_threshold/30)) //Reach a threshold of adrenaline, massive painkill effect
M.add_chemical_effect(CE_PULSE,2) //But your heart goes mental. 3 -> 2 due to brutes breaking their hearts on this stuff.
remove_self(M.species.adrenal_break_threshold) //And your body consumes the adrenaline for that last final push

/datum/reagent/adrenaline/overdose(var/mob/living/carbon/M, var/alien)
return

0 comments on commit 3860ed0

Please sign in to comment.