mirror of
https://github.com/ParadiseSS13/Paradise.git
synced 2026-08-23 03:57:13 +01:00
First commit of the addiction system
This commit is contained in:
@@ -0,0 +1,132 @@
|
||||
/datum/disease/addiction
|
||||
name = "Chemical Addiction"
|
||||
max_stages = 5
|
||||
spread = "None"
|
||||
spread_type = SPECIAL
|
||||
cure = "Unknown"
|
||||
cure_id = list("fixer", "water")
|
||||
cure_chance = 3
|
||||
affected_species = list("Human", "Monkey", "Skrell", "Unathi", "Tajaran", "Kidan", "Grey")
|
||||
var/datum/reagent/addicted_to
|
||||
var/addiction_countdown = 1800 // Three minutes
|
||||
|
||||
/datum/disease/addiction/New()
|
||||
if(addicted_to)
|
||||
src.name = "[addicted_to.name] Addiction"
|
||||
src.cure = addicted_to.id
|
||||
//affected_mob.addictions += addicted_to
|
||||
..()
|
||||
|
||||
/datum/disease/addiction/proc/has_addict_reagent()
|
||||
var/result = 0
|
||||
if(affected_mob.reagents.has_reagent(addicted_to))
|
||||
result = 1
|
||||
return result
|
||||
|
||||
/datum/disease/addiction/process()
|
||||
if(!holder) return
|
||||
var/addict_reagent_present = has_addict_reagent()
|
||||
|
||||
if(affected_mob)
|
||||
for(var/datum/disease/D in affected_mob.viruses)
|
||||
if(D != src)
|
||||
if(istype(src, D.type))
|
||||
if(istype(src.addicted_to, D:addicted_to)) // Allow for multiple addictions as long as each addiction is for a different reagent
|
||||
del(src) // if there are somehow two viruses of the same kind in the system, delete the other one
|
||||
|
||||
if(holder == affected_mob)
|
||||
if(affected_mob.stat < 2) //he's alive
|
||||
if(addict_reagent_present) //he's taken the reagent to which he's addicted
|
||||
stage = 1
|
||||
if(prob(20))
|
||||
affected_mob << "\blue You feel a wave of euphoria as [addicted_to.name] surges through your bloodstream..."
|
||||
spawn(addiction_countdown)
|
||||
stage_act()
|
||||
else //he's ignored his addiction or hasn't taken the reagent
|
||||
stage_act()
|
||||
else //he's dead.
|
||||
if(spread_type!=SPECIAL)
|
||||
spread_type = CONTACT_GENERAL
|
||||
affected_mob = null
|
||||
if(!affected_mob) //the virus is in inanimate obj
|
||||
if(prob(70))
|
||||
if(--longevity<=0)
|
||||
cure(0)
|
||||
return
|
||||
|
||||
/datum/disease/addiction/stage_act()
|
||||
var/cure_present = has_cure()
|
||||
var/addict_reagent_present = has_addict_reagent()
|
||||
|
||||
if(carrier&&!cure_present)
|
||||
return
|
||||
|
||||
spread = (cure_present?"Remissive":initial(spread))
|
||||
|
||||
if(stage > max_stages)
|
||||
stage = max_stages
|
||||
if(stage_prob != 0 && prob(stage_prob) && stage != max_stages && !cure_present && !addict_reagent_present) //now the disease shouldn't get back up to stage 4 in no time
|
||||
stage++
|
||||
if(stage != 1 && (prob(1) || (cure_present && prob(cure_chance))))
|
||||
stage--
|
||||
else if(stage <= 1 && ((prob(1) && curable) || (cure_present && prob(cure_chance))))
|
||||
cure()
|
||||
return
|
||||
|
||||
switch(stage)
|
||||
if(2)
|
||||
if(prob(5))
|
||||
affected_mob << "\red You can't stop thinking about [addicted_to.name]!"
|
||||
if(affected_mob.sleeping && prob(1))
|
||||
affected_mob << "\blue You feel better."
|
||||
stage--
|
||||
if(prob(1))
|
||||
if(prob(1))
|
||||
stage--
|
||||
if(3)
|
||||
if(prob(5))
|
||||
affected_mob << "\red You gotta have some [addicted_to.name]!"
|
||||
if(affected_mob.sleeping && prob(1))
|
||||
affected_mob << "\blue You feel better."
|
||||
stage--
|
||||
if(prob(1))
|
||||
if(prob(1))
|
||||
stage--
|
||||
if(4)
|
||||
if(prob(7))
|
||||
affected_mob << "\red Gotta have some [addicted_to.name]!"
|
||||
if(prob(10))
|
||||
affected_mob.take_organ_damage(1)
|
||||
if(prob(2))
|
||||
affected_mob << "\red Your stomach hurts."
|
||||
if(prob(5))
|
||||
affected_mob.emote("blink")
|
||||
if(prob(10))
|
||||
affected_mob.toxloss += 1
|
||||
affected_mob.updatehealth()
|
||||
if(affected_mob.sleeping && prob(1))
|
||||
affected_mob << "\blue You feel better."
|
||||
stage--
|
||||
if(prob(1))
|
||||
if(prob(1))
|
||||
stage--
|
||||
if(5)
|
||||
if(prob(5))
|
||||
affected_mob << "\red \bold You can't stand not having [addicted_to.name]!"
|
||||
if(prob(20))
|
||||
affected_mob.toxloss += 2
|
||||
affected_mob.updatehealth()
|
||||
if(prob(2))
|
||||
affected_mob << "\red \bold [addicted_to.name] calls out to your mind!"
|
||||
for(var/mob/O in viewers(affected_mob, null))
|
||||
O.show_message(text("\red [] rakes at their eyes!", affected_mob), 1)
|
||||
affected_mob.eye_blind = 2
|
||||
affected_mob.eye_blurry = 3
|
||||
if(prob(1))
|
||||
affected_mob.emote("twitch")
|
||||
if(affected_mob.sleeping && prob(1))
|
||||
affected_mob << "\blue You feel better."
|
||||
stage--
|
||||
if(prob(1))
|
||||
if(prob(1))
|
||||
stage--
|
||||
@@ -30,6 +30,7 @@ datum
|
||||
var/mildly_toxic = 0
|
||||
var/overdose = 0
|
||||
var/overdose_dam = 1
|
||||
var/addictiveness = 1
|
||||
//var/list/viruses = list()
|
||||
var/color = "#000000" // rgb: 0, 0, 0 (does not support alpha channels - yet!)
|
||||
|
||||
@@ -64,6 +65,14 @@ datum
|
||||
if(prob(chance) && !block)
|
||||
if(M.reagents)
|
||||
M.reagents.add_reagent(self.id,self.volume/2)
|
||||
|
||||
|
||||
if(method == INGEST)
|
||||
if(prob(1 * addictiveness))
|
||||
if(prob(1 * volume))
|
||||
var/datum/disease/addiction/A
|
||||
A.addicted_to = src
|
||||
M.contract_disease(new A(0),1)
|
||||
return 1
|
||||
|
||||
reaction_obj(var/obj/O, var/volume) //By default we transfer a small part of the reagent to the object
|
||||
@@ -579,6 +588,7 @@ datum
|
||||
description = "An illegal chemical compound used as drug."
|
||||
reagent_state = LIQUID
|
||||
color = "#60A584" // rgb: 96, 165, 132
|
||||
addictiveness = 25
|
||||
|
||||
on_mob_life(var/mob/living/M as mob)
|
||||
if(!M) M = holder.my_atom
|
||||
@@ -1145,6 +1155,7 @@ datum
|
||||
color = "#C855DC"
|
||||
overdose_dam = 0
|
||||
overdose = 60
|
||||
addictiveness = 5
|
||||
|
||||
on_mob_life(var/mob/living/M as mob)
|
||||
if(!M) M = holder.my_atom
|
||||
@@ -1186,6 +1197,7 @@ datum
|
||||
description = "A simple, yet effective painkiller."
|
||||
reagent_state = LIQUID
|
||||
color = "#FAEBD7" //rgb 250, 235, 215
|
||||
addictiveness = 50
|
||||
|
||||
oxycodone
|
||||
name = "Oxycodone"
|
||||
@@ -1193,6 +1205,7 @@ datum
|
||||
description = "An effective and very addictive painkiller."
|
||||
reagent_state = LIQUID
|
||||
color = "#8A2BE2" // rgb 138, 43, 226
|
||||
addictiveness = 80
|
||||
|
||||
virus_food
|
||||
name = "Virus Food"
|
||||
@@ -1874,6 +1887,7 @@ datum
|
||||
description = "Hyperzine is a highly effective, long lasting, muscle stimulant. It is highly addictive."
|
||||
reagent_state = SOLID
|
||||
color = "#FFFFFF" // rgb: 255,255,255
|
||||
addictiveness = 80
|
||||
|
||||
on_mob_life(var/mob/living/M as mob)
|
||||
if(!M) M = holder.my_atom
|
||||
@@ -2012,6 +2026,7 @@ datum
|
||||
reagent_state = LIQUID
|
||||
color = "#B31008" // rgb: 139, 166, 233
|
||||
custom_metabolism = 0.05
|
||||
addictiveness = 15
|
||||
|
||||
on_mob_life(var/mob/living/M)
|
||||
if(!M) M = holder.my_atom
|
||||
@@ -2099,6 +2114,7 @@ datum
|
||||
description = "A highly addictive stimulant extracted from the tobacco plant."
|
||||
reagent_state = LIQUID
|
||||
color = "#181818" // rgb: 24, 24, 24
|
||||
addictiveness = 90
|
||||
/*
|
||||
ethanol
|
||||
name = "Ethanol"
|
||||
|
||||
Reference in New Issue
Block a user