Fixes for the fingerprint runtimes, other runtimes, the new damage system, and the new objective system, to reduce the super hard objectives.

This commit is contained in:
SkyMarshal
2012-03-31 22:01:21 -07:00
parent a90173c628
commit cd4a82a90b
17 changed files with 178 additions and 103 deletions
+27 -29
View File
@@ -81,16 +81,16 @@
/atom/proc/add_fingerprint(mob/living/M as mob)
if(isnull(M)) return
if(isnull(M.key)) return
if (!( src.flags ) & 256)
if (!( flags ) & 256)
return
if (ishuman(M))
if(!fingerprintshidden)
fingerprintshidden = list()
add_fibers(M)
if (M.mutations2 & mFingerprints)
if(src.fingerprintslast != M.key)
src.fingerprintshidden += "(Has no fingerprints) Real name: [M.real_name], Key: [M.key]"
src.fingerprintslast = M.key
if(fingerprintslast != M.key)
fingerprintshidden += "(Has no fingerprints) Real name: [M.real_name], Key: [M.key]"
fingerprintslast = M.key
return 0
var/mob/living/carbon/human/H = M
if (!istype(H.dna, /datum/dna) || !H.dna.uni_identity || (length(H.dna.uni_identity) != 32))
@@ -98,24 +98,24 @@
H.dna = new /datum/dna(null)
H.check_dna()
if (H.gloves && H.gloves != src)
if(src.fingerprintslast != H.key)
src.fingerprintshidden += text("(Wearing gloves). Real name: [], Key: []",H.real_name, H.key)
src.fingerprintslast = H.key
if(fingerprintslast != H.key)
fingerprintshidden += text("(Wearing gloves). Real name: [], Key: []",H.real_name, H.key)
fingerprintslast = H.key
H.gloves.add_fingerprint(M)
if(H.gloves != src)
if(prob(75) && istype(H.gloves, /obj/item/clothing/gloves/latex))
return 0
else if(H.gloves && !istype(H.gloves, /obj/item/clothing/gloves/latex))
return 0
if(src.fingerprintslast != H.key)
src.fingerprintshidden += text("Real name: [], Key: []",H.real_name, H.key)
src.fingerprintslast = H.key
if(fingerprintslast != H.key)
fingerprintshidden += text("Real name: [], Key: []",H.real_name, H.key)
fingerprintslast = H.key
if(!fingerprints)
fingerprints = list()
var/new_prints = 0
var/prints
for(var/i = 1, i <= src.fingerprints.len, i++)
var/list/L = params2list(src.fingerprints[i])
for(var/i = 1, i <= fingerprints.len, i++)
var/list/L = params2list(fingerprints[i])
if(L[num2text(1)] == md5(H.dna.uni_identity))
new_prints = i
prints = L[num2text(2)]
@@ -123,30 +123,28 @@
else
var/test_print = stars(L[num2text(2)], rand(80,90))
if(stringpercent(test_print) == 32)
if(src.fingerprints.len == 1)
src.fingerprints = list()
if(fingerprints.len == 1)
fingerprints = list()
else
for(var/j = i, j < (src.fingerprints.len), j++)
src.fingerprints[j] = src.fingerprints[j+1]
src.fingerprints.len--
fingerprints.Cut(i,i+1)
else
src.fingerprints[i] = "1=[L[num2text(1)]]&2=[test_print]"
fingerprints[i] = "1=[L[num2text(1)]]&2=[test_print]"
if(new_prints)
src.fingerprints[new_prints] = text("1=[]&2=[]", md5(H.dna.uni_identity), stringmerge(prints,stars(md5(H.dna.uni_identity), (H.gloves ? rand(10,20) : rand(25,40)))))
else if(new_prints == 0)
if(!src.fingerprints || !src.fingerprints.len)
src.fingerprints = list(text("1=[]&2=[]", md5(H.dna.uni_identity), stars(md5(H.dna.uni_identity), H.gloves ? rand(10,20) : rand(25,40))))
fingerprints[new_prints] = text("1=[]&2=[]", md5(H.dna.uni_identity), stringmerge(prints,stars(md5(H.dna.uni_identity), (H.gloves ? rand(10,20) : rand(25,40)))))
else
if(!fingerprints || !fingerprints.len)
fingerprints = list(text("1=[]&2=[]", md5(H.dna.uni_identity), stars(md5(H.dna.uni_identity), H.gloves ? rand(10,20) : rand(25,40))))
else
src.fingerprints += text("1=[]&2=[]", md5(H.dna.uni_identity), stars(md5(H.dna.uni_identity), H.gloves ? rand(10,20) : rand(25,40)))
for(var/i = 1, i <= src.fingerprints.len, i++)
if(length(src.fingerprints[i]) != 69)
src.fingerprints.Remove(src.fingerprints[i])
fingerprints += text("1=[]&2=[]", md5(H.dna.uni_identity), stars(md5(H.dna.uni_identity), H.gloves ? rand(10,20) : rand(25,40)))
for(var/i = 1, i <= fingerprints.len, i++)
if(length(fingerprints[i]) != 69)
fingerprints.Remove(fingerprints[i])
if(fingerprints && !fingerprints.len) del(fingerprints)
return 1
else
if(src.fingerprintslast != M.key)
src.fingerprintshidden += text("Real name: [], Key: []",M.real_name, M.key)
src.fingerprintslast = M.key
if(fingerprintslast != M.key)
fingerprintshidden += text("Real name: [], Key: []",M.real_name, M.key)
fingerprintslast = M.key
return
//returns 1 if made bloody, returns 0 otherwise
+82 -32
View File
@@ -1,52 +1,85 @@
/proc/GenerateTheft(var/job,var/datum/mind/traitor)
var/list/datum/objective/objectives = list()
var/list/weight = list()
var/index = 1
for(var/o in typesof(/datum/objective/steal))
if(o != /datum/objective/steal) //Make sure not to get a blank steal objective.
var/datum/objective/target = new o(null,job)
objectives += list(target = target.weight)
//objectives += GenerateAssassinate(job,traitor)
return objectives
weight += list("[index]" = target.weight)
objectives += target
index++
world << objectives.len
return list(objectives, weight)
/proc/GenerateAssassinate(var/job,var/datum/mind/traitor)
var/list/datum/objective/assassinate/missions = list()
var/list/weight = list()
var/index = 1
for(var/datum/mind/target in ticker.minds)
if((target != traitor) && istype(target.current, /mob/living/carbon/human))
if(target && target.current)
var/datum/objective/target_obj = new /datum/objective/assassinate(null,job,target)
missions += list(target_obj = target_obj.weight)
return missions
weight += list("[index]" = target_obj.weight)
missions += target_obj
index++
world << missions.len
return list(missions, weight)
/proc/GenerateFrame(var/job,var/datum/mind/traitor)
var/list/datum/objective/frame/missions = list()
var/list/weight = list()
var/index = 1
for(var/datum/mind/target in ticker.minds)
if((target != traitor) && istype(target.current, /mob/living/carbon/human))
if(target && target.current)
var/datum/objective/target_obj = new /datum/objective/frame(null,job,target)
missions += list(target_obj = target_obj.weight)
return missions
weight += list("[index]" = target_obj.weight)
missions += target_obj
index++
world << missions.len
return list(missions, weight)
/proc/GenerateProtection(var/job,var/datum/mind/traitor)
var/list/datum/objective/frame/missions = list()
var/list/weight = list()
var/index = 1
for(var/datum/mind/target in ticker.minds)
if((target != traitor) && istype(target.current, /mob/living/carbon/human))
if(target && target.current)
var/datum/objective/target_obj = new /datum/objective/protection(null,job,target)
missions += list(target_obj = target_obj.weight)
return missions
weight += list("[index]" = target_obj.weight)
missions += target_obj
index++
world << missions.len
return list(missions, weight)
/proc/PickObjectiveFromList(var/list/objectivesArray)
var/list/datum/objectives = objectivesArray[1]
var/pick_index = text2num(pickweight(objectivesArray[2]))
return objectives[pick_index]
/proc/RemoveObjectiveFromList(var/list/objectiveArray, var/datum/objective/objective)
var/list/datum/objective/temp = objectiveArray[1]
var/list/weight = objectiveArray[2]
var/index = temp.Find(objective)
if(index == temp.len)
temp.Cut(index)
weight.Cut(index)
else
temp.Cut(index, index+1)
weight.Cut(index, index+1)
return list(temp,weight)
/proc/SelectObjectives(var/job,var/datum/mind/traitor,var/hijack = 0)
var/list/datum/objective/chosenobjectives = list()
var/list/datum/objective/theftobjectives = GenerateTheft(job,traitor) //Separated all the objective types so they can be picked independantly of each other.
var/list/datum/objective/killobjectives = GenerateAssassinate(job,traitor)
var/list/datum/objective/frameobjectives = GenerateFrame(job,traitor)
var/list/datum/objective/protectobjectives = GenerateProtection(job,traitor)
var/list/chosenobjectives = list()
var/list/theftobjectives = GenerateTheft(job,traitor) //Separated all the objective types so they can be picked independantly of each other.
var/list/killobjectives = GenerateAssassinate(job,traitor)
var/list/frameobjectives = GenerateFrame(job,traitor)
var/list/protectobjectives = GenerateProtection(job,traitor)
//var/points
var/totalweight
var/selectobj
@@ -54,27 +87,30 @@
while(totalweight < 100)
selectobj = rand(1,100) //Randomly determine the type of objective to be given.
if(!length(killobjectives) || !length(protectobjectives)) //If any of these lists are empty, just give them theft objectives.
var/datum/objective/objective = pickweight(theftobjectives)
if(!length(killobjectives[1]) || !length(protectobjectives[1])|| !length(frameobjectives[1])) //If any of these lists are empty, just give them theft objectives.
var/datum/objective/objective = PickObjectiveFromList(theftobjectives)
chosenobjectives += objective
totalweight += objective.points
theftobjectives -= objective
theftobjectives = RemoveObjectiveFromList(theftobjectives, objective)
else switch(selectobj)
if(1 to 55) //Theft Objectives (55% chance)
var/datum/objective/objective = pickweight(theftobjectives)
var/datum/objective/objective = PickObjectiveFromList(theftobjectives)
for(1 to 10)
if(objective.points + totalweight <= 110)
break
objective = pickweight(theftobjectives)
objective = PickObjectiveFromList(theftobjectives)
chosenobjectives += objective
totalweight += objective.points
theftobjectives -= objective
theftobjectives = RemoveObjectiveFromList(theftobjectives, objective)
if(56 to 92) //Assassination Objectives (37% chance)
var/datum/objective/assassinate/objective = pickweight(killobjectives)
var/datum/objective/assassinate/objective = PickObjectiveFromList(killobjectives)
world << objective
for(1 to 10)
if(objective.points + totalweight <= 110)
break
objective = pickweight(killobjectives)
objective = PickObjectiveFromList(killobjectives)
if(!objective)
continue
for(var/datum/objective/protection/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Assassinate somebody they need to Protect.
if(conflicttest.target == objective.target)
conflict = 1
@@ -86,23 +122,37 @@
if(!conflict)
chosenobjectives += objective
totalweight += objective.points
killobjectives -= objective
killobjectives = RemoveObjectiveFromList(killobjectives, objective)
conflict = 0
if(93 to 95) //Framing Objectives (3% chance)
var/datum/objective/objective = pickweight(frameobjectives)
var/datum/objective/objective = PickObjectiveFromList(frameobjectives)
for(1 to 10)
if(objective.points + totalweight <= 110)
break
objective = pickweight(frameobjectives)
chosenobjectives += objective
totalweight += objective.points
frameobjectives -= objective
objective = PickObjectiveFromList(frameobjectives)
if(!objective)
continue
for(var/datum/objective/protection/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Assassinate somebody they need to Protect.
if(conflicttest.target == objective.target)
conflict = 1
break
for(var/datum/objective/assassinate/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Protect somebody they need to Assassinate.
if(conflicttest.target == objective.target)
conflict = 1
break
if(!conflict)
chosenobjectives += objective
totalweight += objective.points
frameobjectives = RemoveObjectiveFromList(frameobjectives, objective)
conflict = 0
if(96 to 100) //Protection Objectives (5% chance)
var/datum/objective/protection/objective = pickweight(protectobjectives)
var/datum/objective/protection/objective = PickObjectiveFromList(protectobjectives)
for(1 to 10)
if(objective.points + totalweight <= 110)
break
objective = pickweight(protectobjectives)
objective = PickObjectiveFromList(protectobjectives)
if(!objective)
continue
for(var/datum/objective/assassinate/conflicttest in chosenobjectives) //Check to make sure we aren't telling them to Protect somebody they need to Assassinate.
if(conflicttest.target == objective.target)
conflict = 1
@@ -114,7 +164,7 @@
if(!conflict)
chosenobjectives += objective
totalweight += objective.points
protectobjectives -= objective
protectobjectives = RemoveObjectiveFromList(protectobjectives, objective)
conflict = 0
var/hasendgame = 0
+4
View File
@@ -185,7 +185,11 @@
if (src.density)
open()
else
var/holdopen_old = holdopen
holdopen = 0
close()
spawn(1)
holdopen = holdopen_old
else if (src.density)
flick("door_deny", src)
return
+22 -22
View File
@@ -195,26 +195,26 @@ FINGERPRINT CARD
return "<B>There are no fingerprints on this card.</B>"
return
/obj/item/weapon/f_card/attack_hand(mob/user as mob)
///obj/item/weapon/f_card/attack_hand(mob/user as mob)
if ((user.r_hand == src || user.l_hand == src))
src.add_fingerprint(user)
var/obj/item/weapon/f_card/F = new /obj/item/weapon/f_card( user )
F.amount = 1
src.amount--
if (user.hand)
user.l_hand = F
else
user.r_hand = F
F.layer = 20
F.add_fingerprint(user)
if (src.amount < 1)
//SN src = null
del(src)
return
else
..()
return
// if ((user.r_hand == src || user.l_hand == src))
// add_fingerprint(user)
// var/obj/item/weapon/f_card/F = new /obj/item/weapon/f_card( user )
// F.amount = 1
// src.amount--
// if (user.hand)
// user.l_hand = F
// else
// user.r_hand = F
// F.layer = 20
// F.add_fingerprint(user)
// if (src.amount < 1)
// //SN src = null
// del(src)
// return
// else
// ..()
// return
/obj/item/weapon/f_card/attackby(obj/item/weapon/W as obj, mob/user as mob)
..()
@@ -253,10 +253,10 @@ FINGERPRINT CARD
..()
if (!istype(usr, /mob/living/silicon))
if (src.fingerprints)
if (fingerprints)
if (src.amount > 1)
var/obj/item/weapon/f_card/F = new /obj/item/weapon/f_card(get_turf(src))
F.amount = --src.amount
src.amount = 1
src.icon_state = "fingerprint1"
amount = 1
icon_state = "fingerprint1"
return