diff --git a/code/__HELPERS/lists.dm b/code/__HELPERS/lists.dm
index 827a6348c26..501a6d8c473 100644
--- a/code/__HELPERS/lists.dm
+++ b/code/__HELPERS/lists.dm
@@ -304,4 +304,9 @@ proc/listclearnulls(list/list)
if(bitfield & bit)
r += bit
- return r
\ No newline at end of file
+ return r
+
+/proc/safe_pick_list(var/list/L)
+ if(L.len)
+ return pick(L)
+ return null
\ No newline at end of file
diff --git a/code/datums/disease.dm b/code/datums/disease.dm
index d273f272a49..deb0f80c9fb 100644
--- a/code/datums/disease.dm
+++ b/code/datums/disease.dm
@@ -17,7 +17,7 @@ to null does not delete the object itself. Thank you.
*/
-var/list/diseases = typesof(/datum/disease, /datum/disease/advance) - /datum/disease - /datum/disease/advance
+var/list/diseases = typesof(/datum/disease) - /datum/disease
/datum/disease
diff --git a/code/datums/diseases/advance/advance.dm b/code/datums/diseases/advance/advance.dm
index f01eacf9f79..53a7ee1588f 100644
--- a/code/datums/diseases/advance/advance.dm
+++ b/code/datums/diseases/advance/advance.dm
@@ -24,11 +24,10 @@ var/list/archive_diseases = list()
form = "Advance Disease" // Will let med-scanners know that this disease was engineered.
agent = "advance microbes"
max_stages = 5
-
+ spread = "Unknown"
// NEW VARS
- var/alpha_level = 0 // To determine if the advanced disease will overwrite another advance disease.
var/list/symptoms = list() // The symptoms of the disease.
/*
@@ -37,7 +36,7 @@ var/list/archive_diseases = list()
*/
-/datum/disease/advance/New(var/process = 1, var/datum/disease/advance/D)
+/datum/disease/advance/New(var/process = 1, var/datum/disease/advance/D, var/copy = 0)
// Setup our dictionary if it hasn't already.
if(!dictionary_symptoms.len)
@@ -53,7 +52,8 @@ var/list/archive_diseases = list()
symptoms = GenerateSymptoms()
else
symptoms = D.symptoms
- Refresh() // Refresh our properties and cure.
+ name = D.name
+ Refresh(!copy)
..(process, D)
return
@@ -98,6 +98,12 @@ var/list/archive_diseases = list()
for(var/datum/symptom/S in possible_symptoms)
AddSymptom(new S.type)
+/datum/disease/advance/proc/HasSymptom(var/datum/symptom/S)
+ for(var/datum/symptom/symp in symptoms)
+ if(symp.id == S.id)
+ return 1
+ return 0
+
// Will generate new unique symptoms, use this if there are none. Returns a list of symptoms that were generated.
/datum/disease/advance/proc/GenerateSymptoms(var/type_level_limit = RANDOM_STARTING_LEVEL, var/amount_get = 0)
@@ -107,28 +113,34 @@ var/list/archive_diseases = list()
var/list/possible_symptoms = list()
for(var/symp in list_symptoms)
var/datum/symptom/S = new symp
- if((S.level <= type_level_limit) && !(S in symptoms))
- possible_symptoms += S
+ if(S.level <= type_level_limit)
+ if(!HasSymptom(S))
+ possible_symptoms += S
+
+ if(!possible_symptoms.len)
+ return
+ //error("Advance Disease - We weren't able to get any possible symptoms in GenerateSymptoms([type_level_limit], [amount_get])")
// Random chance to get more than one symptom
var/number_of = amount_get
if(!amount_get)
number_of = 1
- while(prob(10))
+ while(prob(20))
number_of += 1
- for(var/i = 0; number_of >= i; i++)
+ for(var/i = 1; number_of >= i; i++)
var/datum/symptom/S = pick(possible_symptoms)
generated += S
possible_symptoms -= S
return generated
-/datum/disease/advance/proc/Refresh()
+/datum/disease/advance/proc/Refresh(var/save = 1)
//world << "[src.name] \ref[src] - REFRESH!"
var/list/properties = GenerateProperties()
AssignProperties(properties)
- archive_diseases[GetDiseaseID()] = src
+ if(save)
+ archive_diseases[GetDiseaseID()] = new /datum/disease/advance(0, src, 1)
//Generate disease properties based on the effects. Returns an associated list.
/datum/disease/advance/proc/GenerateProperties()
@@ -137,7 +149,7 @@ var/list/archive_diseases = list()
CRASH("We did not have any symptoms before generating properties.")
return
- var/list/properties = list("resistance" = 0, "stealth" = 0, "stage_rate" = 0, "tansmittable" = 0, "severity" = 0)
+ var/list/properties = list("resistance" = 1, "stealth" = 1, "stage_rate" = 1, "tansmittable" = 1, "severity" = 1)
for(var/datum/symptom/S in symptoms)
@@ -156,30 +168,32 @@ var/list/archive_diseases = list()
hidden = list( (properties["stealth"] > 2), (properties["stealth"] > 3) )
// The more symptoms we have, the less transmittable it is but some symptoms can make up for it.
- SetSpread(max(BLOOD, min(properties["tansmittable"] - symptoms.len, AIRBORNE)))
+ SetSpread(max(BLOOD, min(round(properties["tansmittable"] - (symptoms.len / 2)), AIRBORNE)))
permeability_mod = 0.5 * properties["transmittable"]
stage_prob = max(properties["stage_rate"], 1)
SetSeverity(properties["severity"])
GenerateCure(properties)
+ else
+ CRASH("Our properties were empty or null!")
// Assign the spread type and give it the correct description.
/datum/disease/advance/proc/SetSpread(var/spread_id)
- //world << "Setting spread type to [spread_id]"
switch(spread_id)
if(NON_CONTAGIOUS)
- spread = "None"
+ src.spread = "None"
if(SPECIAL)
- spread = "None"
+ src.spread = "None"
if(CONTACT_GENERAL, CONTACT_HANDS, CONTACT_FEET)
- spread = "On contact"
+ src.spread = "On contact"
if(AIRBORNE)
- spread = "Airborne"
+ src.spread = "Airborne"
if(BLOOD)
- spread = "Blood"
+ src.spread = "Blood"
spread_type = spread_id
+ //world << "Setting spread type to [spread_id]/[spread]"
/datum/disease/advance/proc/SetSeverity(var/level_sev)
@@ -204,9 +218,9 @@ var/list/archive_diseases = list()
// Will generate a random cure, the less resistance the symptoms have, the harder the cure.
/datum/disease/advance/proc/GenerateCure(var/list/properties = list())
if(properties && properties.len)
- var/res = max(properties["resistance"] - symptoms.len, 0)
+ var/res = max(properties["resistance"] - (symptoms.len / 2), 0)
//world << "Res = [res]"
- switch(res)
+ switch(round(res))
// Due to complications, I cannot randomly generate cures or randomly give cures.
if(0)
cure_id = "nutriment"
@@ -244,8 +258,10 @@ var/list/archive_diseases = list()
// Randomly generate a symptom, has a chance to lose or gain a symptom.
/datum/disease/advance/proc/Evolve(var/level = 2)
- AddSymptom(pick(GenerateSymptoms(level, 1)))
- Refresh()
+ var/s = safe_pick_list(GenerateSymptoms(level, 1))
+ if(s)
+ AddSymptom(s)
+ Refresh()
return
// Name the disease.
@@ -253,6 +269,7 @@ var/list/archive_diseases = list()
src.name = name
return
+// Return a unique ID of the disease.
/datum/disease/advance/proc/GetDiseaseID()
var/list/L = list()
for(var/datum/symptom/S in symptoms)
@@ -264,9 +281,8 @@ var/list/archive_diseases = list()
// we take a random symptom away and add the new one.
/datum/disease/advance/proc/AddSymptom(var/datum/symptom/S)
- for(var/datum/symptom/symp in symptoms)
- if(S.id == symp.id)
- return
+ if(HasSymptom(S))
+ return
if(symptoms.len < 4 + rand(-1, 1))
symptoms += S
@@ -275,7 +291,7 @@ var/list/archive_diseases = list()
symptoms += S
return
-// Simply removes the symptom at the moment.
+// Simply removes the symptom and refreshes.
/datum/disease/advance/proc/RemoveSymptom(var/datum/symptom/S)
symptoms -= S
return
diff --git a/code/datums/diseases/advance/symptoms/fever.dm b/code/datums/diseases/advance/symptoms/fever.dm
new file mode 100644
index 00000000000..9cd9585eabf
--- /dev/null
+++ b/code/datums/diseases/advance/symptoms/fever.dm
@@ -0,0 +1,32 @@
+/*
+//////////////////////////////////////
+
+Fever
+
+ No change to hidden.
+ Increases resistance.
+ Increases stage speed.
+ Low level.
+
+Bonus
+ Heats up your body.
+
+//////////////////////////////////////
+*/
+
+/datum/symptom/fever
+
+ name = "Fever"
+ stealth = 0
+ resistance = 3
+ stage_speed = 3
+ level = 2
+
+/datum/symptom/fever/Activate(var/datum/disease/advance/A)
+ ..()
+ if(prob(SYMPTOM_ACTIVATION_PROB))
+ var/mob/living/carbon/M = A.affected_mob
+ M << "[pick("You feel hot.", "You feel like you're burning.")]"
+ M.bodytemperature += 30 * A.stage
+
+ return
diff --git a/code/datums/diseases/advance/symptoms/headache.dm b/code/datums/diseases/advance/symptoms/headache.dm
index 86dd12ad5d1..bb6708b2957 100644
--- a/code/datums/diseases/advance/symptoms/headache.dm
+++ b/code/datums/diseases/advance/symptoms/headache.dm
@@ -5,7 +5,7 @@ Headache
Noticable.
Highly resistant.
- Doesn't increase stage speed..
+ Increases stage speed..
Low Level.
BONUS
@@ -20,7 +20,7 @@ BONUS
name = "Headache"
stealth = -1
resistance = 4
- stage_speed = 0
+ stage_speed = 2
level = 1
/datum/symptom/cough/Activate(var/datum/disease/advance/A)
diff --git a/code/datums/diseases/advance/symptoms/itching.dm b/code/datums/diseases/advance/symptoms/itching.dm
new file mode 100644
index 00000000000..90bfbeba63a
--- /dev/null
+++ b/code/datums/diseases/advance/symptoms/itching.dm
@@ -0,0 +1,31 @@
+/*
+//////////////////////////////////////
+
+Itching
+
+ Not noticable or unnoticable.
+ Resistant.
+ Increases stage speed..
+ Low Level.
+
+BONUS
+ Displays an annoying message!
+ Should be used for buffing your disease.
+
+//////////////////////////////////////
+*/
+
+/datum/symptom/itching
+
+ name = "Itching"
+ stealth = 0
+ resistance = 3
+ stage_speed = 3
+ level = 1
+
+/datum/symptom/itching/Activate(var/datum/disease/advance/A)
+ ..()
+ if(prob(SYMPTOM_ACTIVATION_PROB))
+ var/mob/living/M = A.affected_mob
+ M << "Your [pick("back", "arm", "leg", "elbow", "head")] itches."
+ return
\ No newline at end of file
diff --git a/code/datums/diseases/advance/symptoms/sneeze.dm b/code/datums/diseases/advance/symptoms/sneeze.dm
index 5bd7413da4f..a47e0a8b91c 100644
--- a/code/datums/diseases/advance/symptoms/sneeze.dm
+++ b/code/datums/diseases/advance/symptoms/sneeze.dm
@@ -4,7 +4,7 @@
Sneezing
Very Noticable.
- Decreases resistance.
+ Increases resistance.
Doesn't increase stage speed.
Low Level.
@@ -19,17 +19,17 @@ Bonus
name = "Sneezing"
stealth = -2
- resistance = -1
+ resistance = 2
stage_speed = 0
level = 1
/datum/symptom/sneeze/Activate(var/datum/disease/advance/A)
..()
- if(prob(SYMPTOM_ACTIVATION_PROB + (A.stage * 2)))
+ if(prob(SYMPTOM_ACTIVATION_PROB))
var/mob/living/M = A.affected_mob
switch(A.stage)
- if(1, 2, 3, 4)
- M.emote("sniffs")
+ if(1, 2, 3)
+ M.visible_message("[M] sniffs.")
else
M.emote("sneeze")
A.spread(A.holder, 5, AIRBORNE)
diff --git a/code/datums/diseases/advance/symptoms/vomit.dm b/code/datums/diseases/advance/symptoms/vomit.dm
index 5acbfde1998..099478a80e2 100644
--- a/code/datums/diseases/advance/symptoms/vomit.dm
+++ b/code/datums/diseases/advance/symptoms/vomit.dm
@@ -41,7 +41,7 @@ Bonus
/datum/symptom/vomit/proc/Vomit(var/mob/living/M)
M.Stun(5)
- M.emote("vomits on the floor")
+ M.visible_message("[M] vomits on the floor!")
M.nutrition -= 20
M.adjustToxLoss(-3)
@@ -79,7 +79,7 @@ Bonus
/datum/symptom/vomit/blood/Vomit(var/mob/living/M)
M.Stun(5)
- M.emote("vomits on the floor")
+ M.visible_message("[M] vomits on the floor!")
// They lose blood and health.
var/brute_dam = M.getBruteLoss()
diff --git a/code/modules/reagents/Chemistry-Machinery.dm b/code/modules/reagents/Chemistry-Machinery.dm
index aafa471762e..23ad3db0826 100644
--- a/code/modules/reagents/Chemistry-Machinery.dm
+++ b/code/modules/reagents/Chemistry-Machinery.dm
@@ -503,7 +503,8 @@
D = archive_diseases[path]
vaccine_type = path
else
- D = new vaccine_type(0, null)
+ if(vaccine_type in diseases)
+ D = new vaccine_type(0, null)
if(D)
B.name = "[D.name] vaccine bottle"
@@ -531,9 +532,11 @@
var/datum/disease/D = null
if(!type)
var/datum/disease/advance/A = archive_diseases[href_list["create_virus_culture"]]
- D = new A.type(0, A)
+ if(A)
+ D = new A.type(0, A)
else
- D = new type(0, null)
+ if(type in diseases) // Make sure this is a disease
+ D = new type(0, null)
var/list/data = list("viruses"=list(D))
var/name = sanitize(input(usr,"Name:","Name the culture",D.name))
if(!name || name == " ") name = D.name
@@ -597,6 +600,8 @@
dat += "The beaker is empty
"
else if(!Blood)
dat += "No blood sample found in beaker"
+ else if(!Blood.data)
+ dat += "No blood data found in beaker."
else
dat += "