diff --git a/code/modules/spells/roguetown/other/grant_title.dm b/code/modules/spells/roguetown/other/grant_title.dm new file mode 100644 index 00000000..03bd7da9 --- /dev/null +++ b/code/modules/spells/roguetown/other/grant_title.dm @@ -0,0 +1,60 @@ +//Grant Title--------------------- + +/obj/effect/proc_holder/spell/self/grant_title + name = "Grant Title" + desc = "Grant someone a title of honor... Or shame." + overlay_state = "recruit" + antimagic_allowed = TRUE + charge_max = 100 + /// Maximum range for title granting + var/title_range = 3 + /// Maximum length for the title + var/title_length = 42 + +/obj/effect/proc_holder/spell/self/grant_title/cast(list/targets, mob/user = usr) + . = ..() + var/granted_title = input(user, "What title do you wish to grant?", "[name]") as null|text + granted_title = reject_bad_text(granted_title, title_length) + if(!granted_title) + return + var/list/recruitment = list() + for(var/mob/living/carbon/human/village_idiot in (get_hearers_in_view(title_range, user) - user)) + //not allowed + if(!can_title(village_idiot)) + continue + recruitment[village_idiot.name] = village_idiot + if(!length(recruitment)) + to_chat(user, span_warning("There are no potential honoraries in range.")) + return + var/inputty = input(user, "Select an honorary!", "[name]") as anything in recruitment + if(inputty) + var/mob/living/carbon/human/recruit = recruitment[inputty] + if(!QDELETED(recruit) && (recruit in get_hearers_in_view(title_range, user))) + INVOKE_ASYNC(src, PROC_REF(village_idiotify), recruit, user, granted_title) + else + to_chat(user, span_warning("Honorific failed!")) + else + to_chat(user, span_warning("Honorific cancelled.")) + +/obj/effect/proc_holder/spell/self/grant_title/proc/can_title(mob/living/carbon/human/recruit) + //wtf + if(QDELETED(recruit)) + return FALSE + //need a mind + if(!recruit.mind) + return FALSE + //need to see their damn face + if(!recruit.get_face_name(null)) + return FALSE + return TRUE + +/obj/effect/proc_holder/spell/self/grant_title/proc/village_idiotify(mob/living/carbon/human/recruit, mob/living/carbon/human/recruiter, granted_title) + if(QDELETED(recruit) || QDELETED(recruiter) || !granted_title) + return FALSE + if(GLOB.lord_titles[recruit.real_name]) + recruiter.say("I HEREBY STRIP YOU, [uppertext(recruit.name)], OF THE TITLE OF [uppertext(GLOB.lord_titles[recruit.real_name])]!") + GLOB.lord_titles -= recruit.real_name + return FALSE + recruiter.say("I HEREBY GRANT YOU, [uppertext(recruit.name)], THE TITLE OF [uppertext(granted_title)]!") + GLOB.lord_titles[recruit.real_name] = granted_title + return TRUE \ No newline at end of file diff --git a/code/modules/spells/roguetown/other/recruiting.dm b/code/modules/spells/roguetown/other/recruiting.dm new file mode 100644 index 00000000..3aab7e8b --- /dev/null +++ b/code/modules/spells/roguetown/other/recruiting.dm @@ -0,0 +1,154 @@ +/obj/effect/proc_holder/spell/self/convertrole + name = "Recruit Beggar" + desc = "Recruit someone to your cause." + overlay_state = "recruit" + antimagic_allowed = TRUE + charge_max = 100 + /// Role given if recruitment is accepted + var/new_role = "Beggar" + /// Faction shown to the user in the recruitment prompt + var/recruitment_faction = "Beggars" + /// Message the recruiter gives + var/recruitment_message = "Serve the beggars, %RECRUIT!" + /// Range to search for potential recruits + var/recruitment_range = 3 + /// Say message when the recruit accepts + var/accept_message = "I will serve!" + /// Say message when the recruit refuses + var/refuse_message = "I refuse." + +/obj/effect/proc_holder/spell/self/convertrole/cast(list/targets,mob/user = usr) + . = ..() + var/list/recruitment = list() + for(var/mob/living/carbon/human/recruit in (get_hearers_in_view(recruitment_range, user) - user)) + //not allowed + if(!can_convert(recruit)) + continue + recruitment[recruit.name] = recruit + if(!length(recruitment)) + to_chat(user, span_warning("There are no potential recruits in range.")) + return + var/inputty = input(user, "Select a potential recruit!", "[name]") as anything in recruitment + if(inputty) + var/mob/living/carbon/human/recruit = recruitment[inputty] + if(!QDELETED(recruit) && (recruit in get_hearers_in_view(recruitment_range, user))) + INVOKE_ASYNC(src, PROC_REF(convert), recruit, user) + else + to_chat(user, span_warning("Recruitment failed!")) + else + to_chat(user, span_warning("Recruitment cancelled.")) + +/obj/effect/proc_holder/spell/self/convertrole/proc/can_convert(mob/living/carbon/human/recruit) + //wtf + if(QDELETED(recruit)) + return FALSE + //need a mind + if(!recruit.mind) + return FALSE + //only migrants and peasants + if(!(recruit.job in GLOB.peasant_positions) && \ + !(recruit.job in GLOB.yeoman_positions) && \ + !(recruit.job in GLOB.allmig_positions) && \ + !(recruit.job in GLOB.mercenary_positions)) + return FALSE + //need to see their damn face + if(!recruit.get_face_name(null)) + return FALSE + return TRUE + +/obj/effect/proc_holder/spell/self/convertrole/proc/convert(mob/living/carbon/human/recruit, mob/living/carbon/human/recruiter) + if(QDELETED(recruit) || QDELETED(recruiter)) + return FALSE + recruiter.say(replacetext(recruitment_message, "%RECRUIT", "[recruit]"), forced = "[name]") + var/prompt = alert(recruit, "Do you wish to become a [new_role]?", "[recruitment_faction] Recruitment", "Yes", "No") + if(QDELETED(recruit) || QDELETED(recruiter) || !(recruiter in get_hearers_in_view(recruitment_range, recruit))) + return FALSE + if(prompt != "Yes") + if(refuse_message) + recruit.say(refuse_message, forced = "[name]") + return FALSE + if(accept_message) + recruit.say(accept_message, forced = "[name]") + if(new_role) + recruit.job = new_role + return TRUE + +//GUARD-------------------------------------- + +/obj/effect/proc_holder/spell/self/convertrole/guard + name = "Recruit Guardsmen" + new_role = "Watchman" + recruitment_faction = "Watchman" + recruitment_message = "Serve the town guard, %RECRUIT!" + accept_message = "FOR THE KING!" + refuse_message = "I refuse." + +/obj/effect/proc_holder/spell/self/convertrole/guard/convert(mob/living/carbon/human/recruit, mob/living/carbon/human/recruiter) + . = ..() + if(!.) + return + recruit.verbs |= /mob/proc/haltyell + +//BOG GUARD-------------------------------------- + +/obj/effect/proc_holder/spell/self/convertrole/bog + name = "Recruit Bogmen" + new_role = "Bog Guard" + recruitment_faction = "Bog Guard" + recruitment_message = "Serve the bog, %RECRUIT!" + accept_message = "FOR THE BOG!" + refuse_message = "I refuse." + +/obj/effect/proc_holder/spell/self/convertrole/bog/convert(mob/living/carbon/human/recruit, mob/living/carbon/human/recruiter) + . = ..() + if(!.) + return + recruit.verbs |= /mob/proc/haltyell + +//SERVANT-------------------------------------- + +/obj/effect/proc_holder/spell/self/convertrole/servant + name = "Recruit Servant" + new_role = "Servant" + recruitment_faction = "Servants" + recruitment_message = "Serve the crown, %RECRUIT!" + accept_message = "FOR THE CROWN!" + refuse_message = "I refuse." + charge_max = 100 + +//TEMPLAR-------------------------------------- + +/obj/effect/proc_holder/spell/self/convertrole/templar + name = "Recruit Templar" + new_role = "Templar" + recruitment_faction = "Templars" + recruitment_message = "Serve the nine, %RECRUIT!" + accept_message = "FOR THE NINE!" + refuse_message = "I refuse." + +//ACOLYTE-------------------------------------- + +/obj/effect/proc_holder/spell/self/convertrole/monk + name = "Recruit Acolyte" + new_role = "Acolyte" + recruitment_faction = "Church" + recruitment_message = "Serve the nine, %RECRUIT!" + accept_message = "FOR THE NINE!" + refuse_message = "I refuse." + +//REBEL-------------------------------------- + +/obj/effect/proc_holder/spell/self/rebelconvert + name = "RECRUIT REBELS" + desc = "!" + antimagic_allowed = TRUE + charge_max = 150 + +/obj/effect/proc_holder/spell/self/rebelconvert/cast(list/targets,mob/user = usr) + ..() + var/inputty = input("Make a speech!", "ROGUETOWN") as text|null + if(inputty) + user.say(inputty, forced = "spell") + var/datum/antagonist/prebel/PR = user.mind.has_antag_datum(/datum/antagonist/prebel) + for(var/mob/living/carbon/human/L in get_hearers_in_view(6, get_turf(user))) + addtimer(CALLBACK(L,TYPE_PROC_REF(/mob/living/carbon/human, rev_ask), user,PR,inputty),1) \ No newline at end of file