code:
:: Widgets Prison [widget]
<<widget "prison_init">>
<<if !$prison>>
    <<set $prison to {}>>
    <<set $prison.guards to 50>>
    <<set $prison.inmates to 0>>
    <<set $prison.hope to 0>>
    <<set $prison.reb to 0>>
    <<set $prison.cell_trouble to 0>>
    <<set $prison.prayer_trouble to 0>>
    <<set $prison.relaxed to 0>>
    <<set $prison.anxious to 0>>
    <<set $prison.veteran to 0>>
    <<set $prison.methodical to 0>>
    <<set $prison.scarred to 0>>
    <<set $prison.tattooed to 0>>
    <<set $prison.shirt to 1>>
    <<set $prison.trousers to 1>>
    <<if $player.gender_appearance is "m">>
        <<set $prison.briefs to 1>>
        <<set $prison.vest to 1>>
    <<else>>
        <<set $prison.panties to 1>>
        <<set $prison.bra to 1>>
    <</if>>
    <<set $prison.punishments to ["free use","nude","blindfold","topless","leash","underwear","cuffs","bottomless","gag","bindings","rut"]>>
    <<set $prison.active_punishments to []>>
    <<set $prison.punishment_intro to 0>>
    <<set $prison.attention to 0>>
    <<set $prison.attention_level to 0>>
    <<set $prison.scarred_level to 0>>
    <<set $prison.tattooed_level to 0>>
    <<set $prison.job to "laundry">>
    <<set $prison.shock to 1>>
    <<set $prison.teeth to 0>>
    <<set $prison.pills to 0>>
    <<set $prison.medical_intro to 0>>
    <<set $prison.spire_intro to 0>>
    <<set $prison.hours_worked to 9>>
    <<set $prison.work_check to 1>>
    <<set $prison.kylar to 0>>

    <<set $prison_wren_intro to 1>>
    <<set $prison_wren_boat_intro to 1>>
	<<set $wardrobe_location to "prison">>
	<<wardrobeSelection true>>
    <<uppersend 86 $wardrobe_location>>
    <<if $malechance gte 100>>
        <<underuppersend 22 $wardrobe_location>>
        <<underuppersend 22 $wardrobe_location>>
        <<underlowersend 4 $wardrobe_location>>
        <<underlowersend 4 $wardrobe_location>>
    <<elseif $malechance lte 0>>
        <<underuppersend 12 $wardrobe_location>>
        <<underuppersend 12 $wardrobe_location>>
        <<underlowersend 1 $wardrobe_location>>
        <<underlowersend 1 $wardrobe_location>>
    <<else>>
        <<underuppersend 22 $wardrobe_location>>
        <<underuppersend 12 $wardrobe_location>>
        <<underlowersend 4 $wardrobe_location>>
        <<underlowersend 1 $wardrobe_location>>
    <</if>>

<</if>>
<<if $NPCName[$NPCNameList.indexOf("Kylar")].state is "prison" and $prison.kylar is 0>>
    <<set $prison_kylar_timer to 2>>
<</if>>
<<set $prison.morning to 1>>
<</widget>>

<<widget "prison_attention">>
<<if $args[0] and ($prison_attention_day isnot true or $prison.schedule is "revolt")>>
    <<set $prison.attention += ($args[0] * 10)>>
<</if>>
<</widget>>

<<widget "prison_end">>
<<set $prison.active_punishments to []>>
<<set $prison.hours_worked to 9>>
<<set $prison.work_check to 1>>
<<set $prison.schedule to "lockdown">>
<<unset $prison_punished_days>>
<</widget>>

<<widget "cell_trouble">>
<<if $args[0]>>
    <<set $prison.cell_trouble += $args[0]>>
    <<set $prison.cell_trouble to Math.clamp($prison.cell_trouble, 0, 10)>>
<</if>>
<</widget>>

<<widget "prison_rep">>
<<if $args[0] and $args[1]>>
    <<set $prison[$args[0]] += $args[1]>>
<</if>>
<</widget>>

<<widget "prison_guards">>
<<if $args[0]>>
    <<set $prison.guards += $args[0]>>
    <<set $prison.guards = Math.clamp($prison.guards, 0, 100)>>
<</if>>
<</widget>>

<<widget "prison_inmates">>
<<if $args[0]>>
    <<set $prison.inmates += $args[0]>>
    <<set $prison.inmates = Math.clamp($prison.inmates, 0, 100)>>
<</if>>
<</widget>>

<<widget "prison_hope">>
<<if $args[0]>>
    <<if $prison.attention_level gte 1>>
        <<set _prison_hope to $prison.attention_level>>
    <<else>>
        <<set _prison_hope to 1>>
    <</if>>
    <<set _prison_hope *= $args[0]>>
    <<set $prison.hope += _prison_hope>>
    <<set $prison.hope = Math.clamp($prison.hope, 0, 100)>>
<</if>>
<</widget>>

<<widget "prison_reb">>
<<if $args[0]>>
    <<if $prison.attention_level gte 1>>
        <<set _prison_reb to $prison.attention_level>>
    <<else>>
        <<set _prison_reb to 1>>
    <</if>>
    <<set _prison_reb *= $args[0]>>
    <<set $prison.reb += _prison_reb>>
    <<set $prison.reb = Math.clamp($prison.reb, 0, 100)>>
<</if>>
<</widget>>

<<widget "effects_prison">>
<<if $prison.work_check isnot 1 and $hour gte 7>>
    <<set $prison.work_check to 1>>
    <<set $prison.hours_worked to 0>>
<</if>>
<<if $prison.schedule is "hunt">>
    You are being hunted.
<<elseif $prison.schedule is "revolt">>
    The inmates are revolting.
<<else>>
    <<switch $hour>>
        <<case 6>>
            <<if $prison.morning is 1>>
                <<set $prison.schedule to "wake">>
                Breakfast is being served in the canteen.
            <<else>>
                <<set $prison.schedule to "hunt">>
            <</if>>
        <<case 7 8 9 10 11>>
            <<set $prison.schedule to "work">>
            <<if $prison.job is "laundry">>
                You are expected in the laundry room.
            <<elseif $prison.job is "spire">>
                You are expected on the spire.
            <<elseif $prison.job is "medical">>
                You are expected in the medical room.
            <</if>>
        <<case 12>>
            <<set $prison.schedule to "lunch">>
            Lunch is being served in the canteen.
        <<case 13>>
            <<set $prison.schedule to "yard">>
            The inmates are being encouraged into the yard.
        <<case 14 15 16 17>>
            <<set $prison.schedule to "work">>
            <<if $prison.job is "laundry">>
                You are expected in the laundry room.
            <<elseif $prison.job is "spire">>
                You are expected on the spire.
            <<elseif $prison.job is "medical">>
                You are expected in the medical room.
            <</if>>
        <<case 18>>
            <<set $prison.schedule to "dinner">>
            Dinner is being served in the canteen.
        <<case 19>>
            <<set $prison.schedule to "free time">>
            Free time.
        <<default>>
            <<set $prison.schedule to "lockdown">>
            Lockdown.
    <</switch>>
<</if>>

<<if $prison.schedule is "revolt">>
    But the warden is coming:
<<else>>
    Attention level:
    <<switch $prison.attention_level>>
        <<case 0>>
            Zero
        <<case 1>>
            One
        <<case 2>>
            Two
        <<case 3>>
            Three
    <</switch>>
    <<if $prison.protection is "scarred">>
        | You are under the scarred inmate's protection.
    <<elseif $prison.protection is "tattooed">>
        | You are under the tattooed inmate's protection.
    <</if>>
    <<if $prison.hours_worked is 8>>
        | The guards expect another hour of work from you today.
    <<elseif $prison.hours_worked gte 9>>
        | You've finished work for the day.
    <<else>>
        | The guards expect <<number `($prison.hours_worked - 9) / -1`>> more hours work from you today.
    <</if>>
<</if>>
<<statbar $prison.attention 100 right>>

<</widget>>

<<widget "prison_work">>
<<if $args[0]>>
    <<set $prison.hours_worked += $args[0]>>
<<else>>
    <<set $prison.hours_worked += 1>>
<</if>>
<</widget>>

<<widget "prison_day">>
<<if $prison>>
    <<if $prison_job_change isnot undefined>>
        <<set $prison.job to $prison_job_change>>
        <<unset $prison_job_change>>
    <</if>>
    <<unset $prison_scarred_done>>
    <<unset $prisonwake>>
    <<unset $prison_relaxed_spoke>>
    <<unset $prison_relaxed_greet>>
    <<unset $prison_anxious_spoke>>
    <<unset $prison_anxious_greet>>
    <<unset $prison_veteran_spoke>>
    <<unset $prison_veteran_greet>>
    <<unset $prison_methodical_spoke>>
    <<set $prison.morning to 0>>
    <<set $prison.evening to 0>>
    <<set $prison_punished_days -= 1>>
    <<set $prison.work_check to 0>>
    <<if $location is "prison">>
        <<cell_trouble -1>>
        <<set $prison.time -= 1>>
        <<set $stat_police.prison += 1>>
    <</if>>
    <<if $prison.kylar is "active">>
        <<npcincr Kylar lust 10>>
        <<unset $prison_kylar_cell>>
    <</if>>
    <<set $prison_kylar_timer -= 1>>
    <<if $prison.kylar is "solitary" and $prison_kylar_timer lte 0>>
        <<unset $prison_kylar_timer>>
        <<set $prison.kylar to "active">>
    <</if>>
    <<unset $prison_attention_day>>
<</if>>
<</widget>>

/*Argument is the NPC slot they fill or should fill. */
<<widget "generate_relaxed_guard">>
<<if $prison_intro is 1>>
    <<loadNPC $args[0] "relaxed_guard">>
<<else>>
    <<generateRole 0 "relaxed" "guard">>
    <<saveNPC 0 "relaxed_guard">>
<</if>>
<</widget>>

<<widget "generate_anxious_guard">>
<<if $prison_intro is 1>>
    <<loadNPC $args[0] "anxious_guard">>
<<else>>
    <<generateRole 1 "anxious" "guard">>
    <<saveNPC 1 "anxious_guard">>
<</if>>
<</widget>>

<<widget "generate_veteran_guard">>
<<if $prison_intro is 1>>
    <<set $_id to $args[0]>>
    <<loadNPC $_id "veteran_guard">>
	<<if $per_npc.veteran_guard and !$per_npc.veteran_guard.description>>

		<<clearsinglenpc $_id>>
		<<generateRole $_id "veteran" "guard">>
		<<if $per_npc.veteran_guard.name_known is 1>>
			<<set $NPCList[$_id].name_known to 1>>
			<<set $NPCList[$_id].fullDescription to $NPCList[0].name>>
		<</if>>
		<<clearNPC "veteran_guard">>
		<<saveNPC $_id "veteran_guard">>
	<</if>>
<<else>>
    <<generateRole 2 "veteran" "guard">>
    <<saveNPC 2 "veteran_guard">>
<</if>>
<</widget>>

<<widget "generate_methodical_guard">>
<<if $prison_intro is 1>>
    <<loadNPC $args[0] "methodical_guard">>
<<else>>
    <<generateRole 3 "methodical" "guard">>
    <<saveNPC 3 "methodical_guard">>
<</if>>
<</widget>>

<<widget "generate_scarred_inmate">>
<<if $prison_intro is 1>>
    <<set $_id to $args[0]>>
    <<loadNPC $_id "scarred_inmate">>
	<<if $per_npc.scarred_inmate and !$per_npc.scarred_inmate.description>>

		<<clearsinglenpc $_id>>
        <<generateRole $_id "scarred" "inmate">>
		<<if $per_npc.scarred_inmate.name_known is 1>>
			<<set $NPCList[$_id].name_known to 1>>
			<<set $NPCList[$_id].fullDescription to $NPCList[0].name>>
		<</if>>
		<<clearNPC "scarred_inmate">>
		<<saveNPC $_id "scarred_inmate">>
	<</if>>
<<else>>
    <<generateRole 4 "scarred" "inmate">>
    <<saveNPC 4 "scarred_inmate">>
<</if>>
<</widget>>

<<widget "generate_tattooed_inmate">>
<<if $prison_intro is 1>>
    <<loadNPC $args[0] "tattooed_inmate">>
<<else>>
    <<generate6>>
    <<set $NPCList[5].description to "tattooed">>
    <<set $NPCList[5].role to "inmate">>
    <<saveNPC 5 "tattooed_inmate">>
<</if>>
<</widget>>

<<widget "save_relaxed_guard">>/*The right NPC fill $NPCList[0] slot */
<<if $NPCList[0].role is "guard">>
    <<set $NPCList[0].fullDescription to $NPCList[0].name>>
    <<clearNPC "relaxed_guard">>
    <<saveNPC 0 "relaxed_guard">>
    <<prison_feat_check>>
<</if>>
<</widget>>

<<widget "save_anxious_guard">>
<<if $NPCList[0].role is "guard">>
    <<set $NPCList[0].fullDescription to $NPCList[0].name>>
    <<clearNPC "anxious_guard">>
    <<saveNPC 0 "anxious_guard">>
    <<prison_feat_check>>
<</if>>
<</widget>>

<<widget "save_veteran_guard">>
<<if $NPCList[0].role is "guard">>
    <<set $NPCList[0].fullDescription to $NPCList[0].name>>
    <<clearNPC "veteran_guard">>
    <<saveNPC 0 "veteran_guard">>
    <<prison_feat_check>>
<</if>>
<</widget>>

<<widget "save_methodical_guard">>
<<if $NPCList[0].role is "guard">>
    <<set $NPCList[0].fullDescription to $NPCList[0].name>>
    <<clearNPC "methodical_guard">>
    <<saveNPC 0 "methodical_guard">>
    <<prison_feat_check>>
<</if>>
<</widget>>

<<widget "save_scarred_inmate">>
<<if $NPCList[0].role is "inmate">>
    <<set $NPCList[0].fullDescription to $NPCList[0].name>>
    <<clearNPC "scarred_inmate">>
    <<saveNPC 0 "scarred_inmate">>
    <<prison_feat_check>>
<</if>>
<</widget>>

<<widget "save_tattooed_inmate">>
<<if $NPCList[0].role is "inmate">>
    <<set $NPCList[0].fullDescription to $NPCList[0].name>>
    <<clearNPC "tattooed_inmate">>
    <<saveNPC 0 "tattooed_inmate">>
    <<prison_feat_check>>
<</if>>
<</widget>>

<<widget "prison_feat_check">>
<<if $per_npc.scarred_inmate.name_known is 1 and $per_npc.relaxed_guard.name_known is 1 and $per_npc.anxious_guard.name_known is 1 and $per_npc.veteran_guard.name_known is 1 and $per_npc.methodical_guard.name_known is 1>>
    <<earnFeat "More than a Number">>
<</if>>
<</widget>>

<<widget "relaxed_guard">>
<<silently>>
<<if $NPCList[$args[0]].name_known is 1>>
    <<set _text_output to  $NPCList[$args[0]].name>>
<<else>>
    <<if $args[1] is "cap" or $args[1] is "capo">>
        <<set _text_output to "the relaxed guard".toUpperFirst()>>
    <<else>>
        <<set _text_output to "the relaxed guard">>
    <</if>>
<</if>>
<<if $args[1] is "apo" or $args[1] is "capo">>
    <<set _text_output += "'s">>
<</if>>
<</silently>>
<<print _text_output>>
<</widget>>

<<widget "anxious_guard">>
<<silently>>
<<if $NPCList[$args[0]].name_known is 1>>
    <<set _text_output to $NPCList[$args[0]].name>>
<<else>>
    <<if $args[1] is "cap" or $args[1] is "capo">>
        <<set _text_output to "the anxious guard".toUpperFirst()>>
    <<else>>
        <<set _text_output to "the anxious guard">>
    <</if>>
<</if>>
<<if $args[1] is "apo" or $args[1] is "capo">>
    <<set _text_output += "'s">>
<</if>>
<</silently>>
<<print _text_output>>
<</widget>>

<<widget "veteran_guard">>
<<silently>>
<<if $NPCList[$args[0]].name_known is 1>>
    <<set _text_output to  $NPCList[$args[0]].name>>
<<else>>
    <<if $args[1] is "cap" or $args[1] is "capo">>
        <<set _text_output to "the veteran guard".toUpperFirst()>>
    <<else>>
        <<set _text_output to "the veteran guard">>
    <</if>>
<</if>>
<<if $args[1] is "apo" or $args[1] is "capo">>
    <<set _text_output += "'s">>
<</if>>
<</silently>>
<<print _text_output>>
<</widget>>

<<widget "methodical_guard">>
<<silently>>
<<if $NPCList[$args[0]].name_known is 1>>
    <<set _text_output to  $NPCList[$args[0]].name>>
<<else>>
    <<if $args[1] is "cap" or $args[1] is "capo">>
        <<set _text_output to "the methodical guard".toUpperFirst()>>
    <<else>>
        <<set _text_output to "the methodical guard">>
    <</if>>
<</if>>
<<if $args[1] is "apo" or $args[1] is "capo">>
    <<set _text_output += "'s">>
<</if>>
<</silently>>
<<print _text_output>>
<</widget>>

<<widget "tattooed_inmate">>
<<silently>>
<<if $NPCList[$args[0]].name_known is 1>>
    <<set _text_output to  $NPCList[$args[0]].name>>
<<else>>
    <<if $args[1] is "cap" or $args[1] is "capo">>
        <<set _text_output to "the tattooed inmate".toUpperFirst()>>
    <<else>>
        <<set _text_output to "the tattooed inmate">>
    <</if>>
<</if>>
<<if $args[1] is "apo" or $args[1] is "capo">>
    <<set _text_output += "'s">>
<</if>>
<</silently>>
<<print _text_output>>
<</widget>>

<<widget "scarred_inmate">>
<<silently>>
<<if $NPCList[$args[0]].name_known is 1>>
    <<set _text_output to  $NPCList[$args[0]].name>>
<<else>>
    <<if $args[1] is "cap" or $args[1] is "capo">>
        <<set _text_output to "the scarred inmate".toUpperFirst()>>
    <<else>>
        <<set _text_output to "the scarred inmate">>
    <</if>>
<</if>>
<<if $args[1] is "apo" or $args[1] is "capo">>
    <<set _text_output += "'s">>
<</if>>
<</silently>>
<<print _text_output>>
<</widget>>

<<widget "prison_sleep_options">>
<<if $sleeptrouble is 1 and $controlled is 0>>
	<<link [[Sleep for 10 hours|Prison Sleep]]>><<set $sleephour to 10>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 10>>)<<ltiredness>>

	<<link [[Sleep for 9 hours|Prison Sleep]]>><<set $sleephour to 9>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 9>>)<<ltiredness>>

<</if>>
<<link [[Sleep for 8 hours|Prison Sleep]]>><<set $sleephour to 8>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 8>>)<<ltiredness>>

<<link [[Sleep for 7 hours|Prison Sleep]]>><<set $sleephour to 7>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 7>>)<<ltiredness>>

<<link [[Sleep for 6 hours|Prison Sleep]]>><<set $sleephour to 6>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 6>>)<<ltiredness>>

<<link [[Sleep for 5 hours|Prison Sleep]]>><<set $sleephour to 5>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 5>>)<<ltiredness>>

<<link [[Sleep for 4 hours|Prison Sleep]]>><<set $sleephour to 4>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 4>>)<<ltiredness>>

<<link [[Sleep for 3 hours|Prison Sleep]]>><<set $sleephour to 3>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 3>>)<<ltiredness>>

<<link [[Sleep for 2 hours|Prison Sleep]]>><<set $sleephour to 2>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 2>>)<<ltiredness>>

<<link [[Sleep for 1 hours|Prison Sleep]]>><<set $sleephour to 1>><<set $saveDetails.auto.count++>><</link>> (<<timeAfterXHours 1>>)<<ltiredness>>

<<link [[Just sleep|Prison Sleep]]>><<set $sleephour to -1>><<set $saveDetails.auto.count++>><</link>> (??:??)<<ltiredness>>

<<link [[Climb out of bed|Prison Cell]]>><<storeon "prison bed">><<set $wardrobe_location to "prison">><<wardrobeSelection>><</link>>

<</widget>>

<<widget "prison_list">>
2. Penance /*free use */

3. Judgement/*nude */

4. See no evil /*blindfold */

5. Devotion /*topless */

6. Discipline /*leash */

7. Atonement /*underwear */

8. Bondage /*cuffs */

9. Chastisement /*bottomless */

10. Speak no evil /*gag */

11. Do no evil /*bindings */

12. Damnation /*rut */

<</widget>>

<<widget "prison_list_dark">>
2. Penance /*free use */

3. Judgement/*nude */

4. See no evil /*blindfold */

5. Devotion /*topless */

6. Discipline /*leash */

7. Atonement /*underwear */

8. Bondage /*cuffs */

9. Chastisement /*bottomless */

10. Speak no evil /*gag */

11. Do no evil /*bindings */

12. Damnation /*rut */

<</widget>>

<<widget "prison_list_result">>
<<switch $prison_punishment_number>>
    <<case 2>>
        Penance<<set $prison_punishment to "free use">>
    <<case 3>>
        Judgement<<set $prison_punishment to "nude">>
    <<case 4>>
        See no evil<<set $prison_punishment to "blindfold">>
    <<case 5>>
        Devotion<<set $prison_punishment to "topless">>
    <<case 6>>
        Discipline<<set $prison_punishment to "leash">>
    <<case 7>>
        Atonement<<set $prison_punishment to "underwear">>
    <<case 8>>
        Bondage<<set $prison_punishment to "cuffs">>
    <<case 9>>
        Chastisement<<set $prison_punishment to "bottomless">>
    <<case 10>>
        Speak no evil<<set $prison_punishment to "gag">>
    <<case 11>>
        Do no evil<<set $prison_punishment to "bindings">>
    <<default>>
        Damnation<<set $prison_punishment to "rut">>
<</switch>>
<</widget>>

<<widget "prison_list_speech">>
<<if $args[0] is "end">>
	<<switch $prison_punishment>>
		<<case "free use">>
			"Penance."
		<<case "nude">>
			"Judgement."
		<<case "blindfold">>
			"See no evil."
		<<case "topless">>
			"Devotion."
		<<case "leash">>
			"Discipline."
		<<case "underwear">>
			"Atonement."
		<<case "cuffs">>
			"Bondage."
		<<case "bottomless">>
			"Chastisement."
		<<case "gag">>
			"Speak no evil."
		<<case "bindings">>
			"Do no evil."
		<<default>>
			"Damnation."
	<</switch>>
<<else>>
	<<switch $prison_punishment>>
		<<case "free use">>
			"Penance,"
		<<case "nude">>
			"Judgement,"
		<<case "blindfold">>
			"See no evil,"
		<<case "topless">>
			"Devotion,"
		<<case "leash">>
			"Discipline,"
		<<case "underwear">>
			"Atonement,"
		<<case "cuffs">>
			"Bondage,"
		<<case "bottomless">>
			"Chastisement,"
		<<case "gag">>
			"Speak no evil,"
		<<case "bindings">>
			"Do no evil,"
		<<default>>
			"Damnation,"
	<</switch>>
<</if>>
<</widget>>

<<widget "destination_prison">>
<<switch $bus>>
    <<case "walkway">>
        <<link [[Next|Prison Walkway]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<case "cell_block">>
        <<link [[Next|Prison Block]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<case "medical">>
        <<link [[Next|Prison Medical]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<case "shower">>
        <<link [[Next|Prison Shower]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<case "canteen">>
        <<link [[Next|Prison Canteen]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<case "laundry">>
        <<link [[Next|Prison Laundry]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<case "spire">>
        <<link [[Next|Prison Spire]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<case "library">>
        <<link [[Next|Prison Library]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<case "chapel">>
        <<link [[Next|Prison Chapel]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<case "yard">>
        <<link [[Next|Prison Yard]]>><<endevent>><<set $eventskip to 1>><</link>>

    <<default>>
        <<link [[Next|Prison Cell]]>><<endevent>><<set $eventskip to 1>><</link>>

<</switch>>
<</widget>>

<<widget "destination_prison_walkway">>
<<if $prison.schedule is "lockdown" or $prison.schedule is "wake" or $hour is 6>>
    You are escorted back to your cell.

    <<link [[Next|Prison Cell]]>><<endevent>><</link>>

<<else>>
    <<link [[Next|Prison Walkway]]>><<endevent>><</link>>

<</if>>
<</widget>>

<<widget "prison_punishment_end">>
<<if $prison.schedule is "lockdown">>
    You return to the walkway. A few prisoners look up. <<relaxed_guard 1 cap>><<person2>> blows on a whistle, alerting others.
<<else>>
    You return to the walkway. You hear movement in the cells, and a groan of metal as inmates lean against the bars, peering into the gloom. <<relaxed_guard 1 cap>><<person2>> blows on a whistle as <<he>> slams on the lights, waking the others.
<</if>>

<</widget>>

<<widget "prison_guard_watch">>
<<switch $args[0]>>
    <<case "relaxed">>
        <<generate_relaxed_guard 0>><<person1>><<relaxed_guard 0 cap>> glances at you.
    <<case "anxious">>
        <<generate_anxious_guard 0>><<person1>><<anxious_guard 0 cap>>'s eyes flick over you.
    <<case "veteran">>
        <<generate_veteran_guard 0>><<person1>><<veteran_guard 0 cap>> watches you.
    <<default>>
        <<generate_methodical_guard 0>><<person1>><<methodical_guard 0 cap>> scrutinises you.
<</switch>>

<<if $prison.active_punishments.includes("free use") and $worn.neck.name isnot "free use collar" and $worn.neck.name isnot "free use collar with leash">>
    "Where's your collar?" <<he>> asks. "Best come with me."
    <<set $phase to 1>>
<<elseif $prison.active_punishments.includes("nude") and ($worn.upper.name isnot "naked" or $worn.lower.name isnot "naked" or $worn.under_upper.name isnot "naked" or $worn.under_lower.name isnot "naked")>>
    "Aren't you supposed to be naked?" <<he>> asks. "Come with me."
    <<set $phase to 1>>
<<elseif $prison.active_punishments.includes("blindfold") and !$worn.face.type.includes("blindfold")>>
    "Where's your blindfold?" <<he>> asks. "Best come with me."
    <<set $phase to 1>>
<<elseif $prison.active_punishments.includes("topless") and ($worn.upper.name isnot "naked" or $worn.under_upper.name isnot "naked")>>
    "You're supposed to be topless," <<he>> says. "Come with me."
    <<set $phase to 1>>
<<elseif $prison.active_punishments.includes("bottomless") and ($worn.lower.name isnot "naked" or $worn.under_lower.name isnot "naked")>>
    "You're supposed to be bottomless," <<he>> says. "Come with me."
    <<set $phase to 1>>
<<elseif $prison.active_punishments.includes("leash") and $worn.neck.collared isnot 1>>
    "Where's your leash?" <<he>> asks. "Come with me."
    <<set $phase to 1>>
<<elseif $prison.active_punishments.includes("underwear") and ($worn.upper.name isnot "naked" or $worn.lower.name isnot "naked")>>
    "That doesn't look like underwear," <<he>> says. "Come with me."
    <<set $phase to 1>>
<<elseif $prison.active_punishments.includes("cuffs") and !$worn.feet.type.includes("shackle")>>
    "Where is your shackle?" <<he>> asks. "Come with me."
    <<set $phase to 1>>
<<elseif $prison.active_punishments.includes("gag") and !$worn.face.type.includes("gag")>>
    "Where's your gag?" <<he>> asks. "Come with me."
    <<set $phase to 1>>
<<elseif $prison.active_punishments.includes("bindings") and ($leftarm isnot "bound" or $rightarm isnot "bound")>>
    "Your arms aren't supposed to be free," <<he>> says. "Come with me."
    <<set $phase to 1>>
<<elseif $worn.feet.type.includes("shackle") and !$prison.active_punishments.includes("cuffs")>>
    "Where'd you get that?" <<he>> asks, looking at your shackle. <<He>> pulls a key from <<his>> pocket.
    <<set $phase to 2>>
<<elseif $worn.neck.type.includes("leash") and !$prison.active_punishments.includes("leash")>>
    "You're not supposed to be leashed," <<he>> says, pulling a pair of pliers from <<his>> pocket.
    <<set $phase to 3>>
<<elseif !$prison.active_punishments.includes("blindfold") and $worn.face.type.includes("blindfold")>>
    "Time to remove that blindfold," <<he>> says. You hear <<him>> walk closer.
    <<set $phase to 4>>
<<elseif !$prison.active_punishments.includes("gag") and $worn.face.type.includes("gag")>>
    "Time to remove that gag," <<he>> says, walking closer.
    <<set $phase to 5>>
<<else>>
	<<switch $args[0]>>
		<<case "relaxed">>
			<<He>> shrugs and shifts <<his>> focus back to <<his>> game.
		<<case "anxious">>
			<<He>> looks down and mutters something under <<his>> breath, nodding.
		<<case "veteran">>
			<<He>> sneers and turns <<his>> nose up at you, but otherwise leaves you be.
		<<default>>
			<<He>> looks away, seeming satisfied.
	<</switch>>
    <<set $phase to 0>>
<</if>>

<<if $phase is 5>>
    <<link [["Let " + $NPCList[0].pronouns.him + " remove the gag"|Prison Remove Gag]]>><</link>>

<<elseif $phase is 4>>
    <<link [["Let " + $NPCList[0].pronouns.him + " remove the blindfold"|Prison Remove Blindfold]]>><</link>>

<<elseif $phase is 3>>
    <<link [["Let " + $NPCList[0].pronouns.him + " remove the leash"|Prison Remove Leash]]>><</link>>

<<elseif $phase is 2>>
    <<link [["Let " + $NPCList[0].pronouns.him + " remove the ball and chain"|Prison Remove Cuffs]]>><</link>>

<<elseif $phase is 1>>
    <<prison_repunishment_options>>
<<else>>
    <<destination_prison>>
<</if>>

<</widget>>

<<widget "prison_guard_greet">>
	<<switch $args[0]>>
		<<case "relaxed">>
			<<set $prison_relaxed_greet to 1>>
			<<generate_relaxed_guard 0>><<person1>><<relaxed_guard 0 cap>> glances up as you approach.
			<<if $prison.relaxed gte 45>>
				<<He>> grins. "My favourite <<girl>>. Feeling lucky today?"

				<<He>> looks between you and the dice in <<his>> hand expectantly, still smiling.
			<<elseif $prison.relaxed gte 30>>
				<<He>> grins. "I was starting to get bored." <<He>> chuckles and leans back, rolling <<his>> dice in <<his>> palm.
			<<else>>
				"You're looking miserable as ever," <<he>> chuckles, tossing <<his>> dice in the air.
				<<if random(1, 20) is 1>>
					<<He>> fails to catch them. You watch one plink off <<his>> head and onto the floor.

					"I deserved that," <<he>> admits, rubbing <<his>> forehead.<<trauma -2>><<ltrauma>>
				<</if>>
			<</if>>
		<<case "anxious">>
			<<set $prison_anxious_greet to 1>>
			<<generate_anxious_guard 0>><<person1>><<anxious_guard 0 cap>> startles at the sound of your footsteps.
			<<if $prison.anxious gte 45>>
				<<He>> calms down when <<he>> sees you. A smile flashes on <<his>> face briefly, before <<he>> straightens it into a stern look.

				"Don't do anything stupid," <<he>> says.
				<<switch random(0, 2)>>
					<<case 2>>
						"Dunno what I'd do if specs had you pulled."
					<<case 1>>
						"Or else the warden will have both our asses."
					<<default>>
						"It's dangerous up here. No screwing around."
				<</switch>>
			<<elseif $prison.anxious gte 30>>
				<<He>> sighs when <<he>> sees you. "Oh, good.
				<<if random(0, 1) is 1>>
					This job's a bitch alone."
				<<else>>
					The birds are all ornery today. At least I won't have to deal with 'em."<<stress 1>><<gstress>>
				<</if>>
			<<else>>
				<<He>> looks surprised when <<he>> sees you.
				<<switch random(0, 1)>>
					<<case 1>>
						"Huh, they don't usually last so long."<<stress 1>><<gstress>>
					<<default>>
						"I thought you would've transferred by now." <<He>> furrows <<his>> brow and mumbles, "I would have, anyway."
				<</switch>>
			<</if>>
		<<case "veteran">>
			<<set $prison_veteran_greet to 1>>
			<<generate_veteran_guard 0>><<person1>>
			<<if $prison.veteran gte 45>>
				Someone claps you on the shoulder. It's <<veteran_guard 0>>. <<He>> passes without looking at you.
			<<elseif $prison.veteran gte 30>>
				Something smacks your <<bottom>>. You look over your shoulder to see <<veteran_guard 0>> turned away, a barely concealed smile on <<his>> lips.
			<<else>>
				<<veteran_guard 0 cap>> regards you with a smirk. "Still kicking?
				<<switch random(0, 2)>>
					<<case 2>>
						You lost me a bet, <<girl>>."
					<<case 1>>
						Tougher than you look."
					<<default>>
						We'll see if it sticks."<<stress 1>><<gstress>>
				<</switch>>
			<</if>>
		<<default>>
			<<generate_methodical_guard 0>><<person1>><<methodical_guard 0 cap>> gives you a passing glance.
	<</switch>>

	<<destination_prison>>
<</widget>>

<<widget "prison_repunishment_options">>
<<link [[Go quietly|Prison Repunishment]]>><<set $prison.hours_worked to 0>><</link>>

<<if $prison.shock is 1>>
<<link [[Fight|Prison Punishment Shock]]>><<set $prison.hours_worked to 0>><</link>>

<<else>>
<<link [[Fight|Prison Punishment Fight]]>><<set $fightstart to 1>><<set $prison.hours_worked to 0>><</link>>

<</if>>
<</widget>>

<<widget "prison_punishment_init">>
<<set $prison_punished_days to 2>>
<<set $prison.active_punishments.push($prison_punishment)>>
<<unset $prison_punishment>>
<<unset $prison_punishment_number>>
<<if $prison.active_punishments.includes("nude")>>
    <<if !$prison.active_punishments.includes("topless")>>
        <<set $prison.active_punishments.push("topless")>>
    <</if>>
    <<if !$prison.active_punishments.includes("bottomless")>>
        <<set $prison.active_punishments.push("bottomless")>>
    <</if>>
    <<if !$prison.active_punishments.includes("underwear")>>
        <<set $prison.active_punishments.push("underwear")>>
    <</if>>
<<elseif $prison.active_punishments.includes("topless") and $prison.active_punishments.includes("bottomless")>>
    <<if !$prison.active_punishments.includes("nude")>>
        <<set $prison.active_punishments.push("nude")>>
    <</if>>
    <<if !$prison.active_punishments.includes("underwear")>>
        <<set $prison.active_punishments.push("underwear")>>
    <</if>>
<</if>>
<</widget>>

<<widget "events_prison_triggered">>
<<if $prison_event_trigger is "one">>
    <<if $leftarm is "bound" and $rightarm is "bound">>
        It's hard to defend yourself with your arms bound.

    <<else>>
        <<link [[Shove|Prison Shove]]>><</link>><<physiquedifficulty 1 16000>>

    <</if>>
    <<link [[Stay still|Prison Still]]>><</link>><<difficulty 50>>

<<elseif $prison_event_trigger is "two">>
    <<if $worn.feet.type.includes("shackle")>>
        It's hard to defend yourself with your ankle cuffed.

    <<else>>
        <<link [[Kick|Prison Kick]]>><</link>><<athleticsdifficulty 1 1000>>

    <</if>>
    <<link [[Endure|Prison Endure]]>><<trauma 6>><<stress 6>><<arousal 600>><</link>><<difficulty 70>><<gtrauma>><<gstress>><<garousal>>

<<elseif $prison_event_trigger is "three">>
    <<set $skulduggerydifficulty to random(500, 1000)>>
    <<link [[Hide|Prison Hide]]>><</link>><<skulduggerydifficulty>>

    <<link [[Confront|Prison Confront]]>><<pain -8>><</link>><<llpain>>

<<elseif $prison_event_trigger is "hunt">>
    <<link [[Go quietly|Prison Punishment]]>><</link>>

    <<if $prison.shock is 1>>
        <<link [[Fight|Prison Punishment Shock]]>><</link>>

    <<else>>
        <<link [[Fight|Prison Punishment Fight]]>><<set $fightstart to 1>><</link>>

    <</if>>
<<else>>
    <<link [[Next|Prison Rape]]>><<set $molestationstart to 1>><</link>>

<</if>>
<<unset $prison_event_trigger>>
<</widget>>

<<widget "events_prison">>
<<if $prison.schedule is "hunt">>
    <<set $prison.schedule to "free time">>
    <<generate_anxious_guard 0>>
    <<person1>>
    "I've found <<phim>>," shouts <<anxious_guard 0>> from behind. You turn, and see the guard marching towards you.

    <<set $prison.hours_worked to 0>>
    <<set $prison_event_trigger to "hunt">>
    <<set $prison.morning to 1>>
<<elseif $prison.schedule is "revolt">>
    <<prison_attention 1>>
    Anarchy reigns throughout the prison.

<<elseif ($worn.neck.name is "free use collar" or $worn.neck.name is "free use collar with leash") and random(1, 2) is 2>>
    <<set _rng to random(1, 5)>>
    <<switch _rng>>
        <<case 1>>
            <<generate1>><<person1>>
            A <<person>> wearing a torn inmate's uniform grasps your collar, and leans forward to read it.

            <<set $prison_event_trigger to "one">>
        <<case 2>>
            <<generate1>><<generate2>><<person1>>
            <<if $leftarm is "bound" and $rightarm is "bound">>
                A <<person2>><<person>> steps in front of you, while a <<person1>><<person>> grasps your hair from behind.
            <<else>>
                A <<person2>><<person>>, steps in front of you, while a <<person1>><<person>> grasps your arms from behind.
            <</if>>
            "It's our turn, slut."

            <<set $prison_event_trigger to "two">>
        <<case 3>>
            <<generate1>><<generate2>><<generate3>><<person1>>
            You hear approaching voices.
            <<if random(1, 2) is 2>>
                "Let's find that free use slut," says one.
            <<else>>
                "Let's find that whore the guards marked for us," says one.
            <</if>>

            <<if random(1, 2) is 2>>
                "Good plan," says another.
            <<else>>
                "Almost makes being locked up worth it," says another.
            <</if>>

            <<if random(1, 2) is 2>>
                <<if $NPCList[2].penis isnot "none">>
                    "I'm itching to empty my cum in something," says a third.
                <<else>>
                    "Can't wait. My pussy's aching," says a third.
                <</if>>
            <<else>>
                "I'd make that one my bitch, but it's too much hassle," says a third.
            <</if>>

            <<set $prison_event_trigger to "three">>
        <<case 4>>
            Eyes are drawn to the "free use" sign hanging around your neck. No one acts, but you know they want to.<<ggattention>><<prison_attention 2>>

        <<default>>
            A rowdy group of inmates approach.
            <<if $leftarm is "bound" and $rightarm is "bound">>
                You want to cover the "free use" sign with your hand, but they're bound too tight. Their hungry eyes take in your collar, then swarm over your body.<<gggattention>><<prison_attention 3>><<gstress>><<stress 6>>
            <<else>>
                You cover the "free use" sign with your hand.
            <</if>>

    <</switch>>
<<elseif $worn.face.type.includes("blindfold")>>
    <<set _rng to random(1, 5)>>
    You can't see where you're going.
    <<switch _rng>>
        <<case 1>>
            You walk right into something, and fall back on your <<bottom>>. Laughter surrounds you.<<gattention>><<prison_attention 1>><<gtrauma>><<gstress>><<trauma 6>><<stress 6>>

        <<case 2>>
            <<generate1>><<person1>>
            <<if $skulduggery gte random(1, 1000)>>
                <<if $leftarm is "bound" and $rightarm is "bound">>
                    <<if $worn.feet.type.includes("shackle")>>
                        You hear light footsteps behind. You can't defend yourself with your arms bound. You try to hasten away, but your shackle slows you. You're helpless to resist as <<he>> grasps your <<breasts>>.
                        <<set $prison_event_trigger to "rape">>
                    <<else>>
                        You hear light footsteps behind. Someone's trying to sneak up on you. You hasten away before <<he>> accomplishes any devilry.
                        <<endevent>>
                    <</if>>
                <<else>>
                    You hear light footsteps behind. Someone's trying to sneak up on you. You turn and smack <<him>> before <<he>> accomplishes any devilry.
                    <<endevent>>
                <</if>>
            <<else>>
                Someone sneaks up on you, and grasps your <<breasts>>. You twist and bat <<him>> away.<<ggattention>><<prison_attention 2>><<gtrauma>><<trauma 6>><<gstress>><<stress 6>><<garousal>><<arousal 600>>
                <<endevent>>
            <</if>>

        <<case 3>>
            You trip, and land with your <<bottom>> stuck in the air.<<gpain>><<gattention>><<pain 4>><<prison_attention 4>>

        <<case 4>>
            You walk deliberately, careful not to trip.

        <<default>>
            You stumble, but manage to stay on your feet.

    <</switch>>
<<elseif $exposed gte 2 and random(1, 2) is 2>>
    <<set _rng to random(1, 5)>>
    <<switch _rng>>
        <<case 1>>
            A mass of rowdy inmates are coming your way, and there's nowhere to hide. <<covered>><<gggattention>><<prison_attention 3>><<gstress>><<stress 6>>

        <<case 2>>
            <<generate1>><<generate2>><<person1>>
            You hide around a corner for a <<person>> and <<person2>><<person>> to pass.
            <<endevent>>

        <<case 3>>
            Eyes are drawn to your nudity. <<covered>><<ggattention>><<prison_attention 2>><<gstress>><<stress 6>>

        <<case 4>>
            <<generate1>><<generate2>><<person1>>
            You hide around a corner for a <<person>> and <<person2>><<person>> to pass, but they turn your way instead. <<covered>> You endure their leers.<<gattention>><<prison_attention 1>><<gstress>><<stress 6>>
            <<endevent>>

        <<default>>
            A mass of rowdy inmates are coming your way. You turn and escape in the other direction.<<gattention>><<prison_attention 1>><<gstress>><<stress 6>>

    <</switch>>
<<elseif $exposed is 1 and random(1, 4) is 4>>
    <<set _rng to random(1, 5)>>
    <<switch _rng>>
        <<case 1>>
            You're self-conscious about your state of dress, being the only one attired so.<<gstress>><<stress 6>>

        <<case 2>>
            Inmates keep leering at your bare skin. <<covered>><<gattention>><<prison_attention 1>><<gstress>><<stress 6>>

        <<case 3>>
            <<generate1>><<person1>>
            <<if $worn.lower.name isnot "naked">>
                A <<person>> seizes the hem of your $worn.lower.name, and tugs, pulling it taut against your crotch.
            <<elseif $worn.under_lower.name isnot "naked">>
                A <<person>> seizes the hem of your $worn.under_lower.name, and tugs, pulling it taut against your crotch.
            <<else>>
                A <<person>> gropes your <<bottom>> as <<he>> passes.
            <</if>>
            <<if $physique gte random(1, $physiquemax)>>
                You swat <<him>> away from you, and your hand connects with <<his>> face. <<He>> staggers away.
            <<else>>
                You swat <<him>> away from you, but <<he>> dodges your blow. At least you got <<his>> mitts off.<<gattention>><<prison_attention>><<gstress>><<stress 6>>
            <</if>>
            <<endevent>>

        <<case 4>>
            <<generate1>><<person1>>A <<person>> looks you over and calls you a whore as <<he>> passes.<<gattention>><<prison_attention 1>><<gstress>><<stress 6>>
            <<endevent>>

        <<default>>
            <<generate1>><<person1>>
            A <<person>> points at you from some distance away, and the inmates around <<him>> laugh. <<covered>> <<gattention>><<prison_attention 1>><<gstress>><<stress 6>>
            <<endevent>>

    <</switch>>
<<else>>
    <<set _rng to random(1, 10)>>
    <<switch _rng>>
        <<case 1>>
            <<generate1>><<generate2>><<person1>>
            <<if $beauty gte random(1, $beautymax)>>
                A <<person>> and <<person2>><<person>> openly leer as they walk by.<<gattention>><<prison_attention 1>>
            <<else>>
                A <<person>> and <<person2>><<person>> walk by, but pay you no mind.
            <</if>>
            <<endevent>>

        <<case 2>>
            <<generate1>><<person1>>
            <<if $worn.neck.type.includes("leash")>>
                A <<person>> grasps your leash and tugs, pulling you forward before you tug the length away from <<him>>.<<ggattention>><<prison_attention 2>>
            <<else>>
                A <<person>> grins. "The collar suits you," <<he>> says as <<he>> passes. "Bet you wore one on the outside."<<gattention>><<prison_attention 1>>
            <</if>>
            <<endevent>>

        <<case 3>>
            <<if $worn.feet.type.includes("shackle")>>
                You trip over broken stonework. You can't control your feet very well in the $worn.feet.name, and fall to the ground with your <<bottom>> in the air.<<gpain>><<gattention>><<pain 4>><<prison_attention 6>>
            <<else>>
                You trip over broken stonework, but manage to right yourself.
            <</if>>

        <<case 4>>
            <<if $worn.face.type.includes("gag")>>
                <<generate1>><<person1>>A <<person>> leers at your <<bottom>>. "You wouldn't mind if I had a feel, would you?" <<he>> asks. You can't respond with the $worn.face.name in your mouth. "Didn't think so."

                <<He>> reaches around your waist, and gropes your rear.
                <<if $leftarm is "bound" and $rightarm is "bound">>
                    With your arms bound, all you can do is try to twist away, but <<he>> holds you firm.<<ggattention>><<prison_attention 2>><<gtrauma>><<trauma 6>><<gstress>><<stress 6>><<garousal>><<arousal 600>>

                    <<He>> gives you a parting smack, and walks away.
                <<else>>
                    <<gattention>><<prison_attention 1>><<gstress>><<stress 6>><<garousal>><<arousal 600>>

                <</if>>
            <<else>>
                <<generate1>><<person1>>
                A <<person>> leers at your <<bottom>> as <<he>> walks by.<<gstress>><<stress 6>>
            <</if>>

            <<endevent>>
        <<case 5>>
            You feel a tremor underfoot.

        <<case 6>>
            <<generate1>><<person1>>A <<person>> stares at you from a distance. <<He>> doesn't look away when you make eye contact.<<gattention>><<prison_attention 1>>
            <<endevent>>

        <<case 7>>
            Inmates cluster in groups of three or four, lost in furtive discussions.
            <<if $skulduggery lt 400>>
                You catch snippets of intrigue.<<gskulduggery>><<skulduggery 1>>
            <<else>>
                You catch snippets of intrigue. Amateur stuff.
            <</if>>

        <<case 8>>
            <<if $hallucinations gte 2>>
                The shadows have a life of their own.<<gstress>><<stress 6>>
            <<else>>
                The weak electric lights flicker.
            <</if>>

        <<case 9>>
            You hear a screech far above.

        <<default>>
            <<if $beauty gte random(1, $beautymax)>>
                Your looks draw attention.<<gattention>><<prison_attention 1>>
            <<else>>
                No one pays you any attention.
            <</if>>

    <</switch>>
<</if>>
<</widget>>

<<widget "events_prison_attention">>
<<set $prison.attention to 0>>
<<set $prison_attention_day to true>>
<<if $prison.schedule is "revolt">>
    The riotous noise quells. An inmate staggers by, and collapses. You find it hard to remain on your feet yourself. Something is wrong.

    <<link [[Next|Prison Warden]]>><</link>>

<<elseif $prison.attention_level is 0>>
    <<generate_scarred_inmate 0>>
    <<generate_tattooed_inmate 1>>
    <<generate3>><<generate4>><<generate5>><<generate6>><<person3>>
    "I see <<phim>> boss," says a <<personsimple>>'s voice. You turn. <<tattooed_inmate 0 cap>> walks towards you, flanked by a <<person3>><<person>> and <<person4>><<person>>.

    <<person2>><<He>> stops several feet away, and examines you from head to toe. "I need a new <<bitch>>," <<he>> says. There's not an inch of space free of the ink covering <<his>> visible body. "The old's all used up."

    "You heard the boss," the <<person3>><<person>> says. <<He>> also wears tattoos, though far less than <<his>> boss. <<if $awareness gte 300>><<He>> speaks in an odd monotone, as if <<his>> mind were elsewhere.<</if>> "Come 'ere."

    <<link [[Go quietly|Prison Attention Quiet]]>><<set $prison.attention_level to 1>><<set $prison.attention to 0>><</link>>

    <<link [[Refuse|Prison Attention Refuse]]>><<set $prison.attention_level to 1>><<set $prison.attention to 0>><</link>>

<<elseif $prison.protection is "scarred">>
    <<generate_veteran_guard 0>><<generate_scarred_inmate 1>><<person1>><<generate3>><<generate4>>
    <<set $prison.protection to 0>>
    <<if $leftarm is "bound" and $rightarm is "bound">>
        A harsh voice rings out. "Prisoner," <<veteran_guard 0>> says. "Lean against the wall!"
    <<else>>
        A harsh voice rings out. "Prisoner," <<veteran_guard 0>> says. "Hands against the wall!"
    <</if>>
    <<He>> marches closer, baton at the ready. Then <<he>> pauses, and looks over your shoulder.

    <<scarred_inmate 1 cap>> arrives at your side. <<person3>>A <<person>> and <<person4>><<person>> flank <<person2>><<him>>. "Just the <<bitch>> I wanted to see," <<he>> says, giving your <<bottom>> a slap. <<He>> looks at <<veteran_guard 0>>. "What you want with <<phim>> anyway? Should I let the other guards know?"

    <<veteran_guard 0 cap>> sneers, and walks away.

    "See you later, slut," <<scarred_inmate 1>> says. You've lost the scarred inmate's protection.

    <<destination_prison>>

<<elseif $prison.attention_level gte 1>>
    <<generate_veteran_guard 0>><<person1>>
    <<set $prison.protection to 0>>
    <<if $leftarm is "bound" and $rightarm is "bound">>
        A harsh voice rings out. "Prisoner," <<veteran_guard 0>> says. "Lean against the wall!"
    <<else>>
        A harsh voice rings out. "Prisoner," <<veteran_guard 0>> says. "Hands against the wall!"
    <</if>>
    <<He>> marches closer, baton at the ready. <<He>> has something devious in mind.

    <<link [[Do as instructed|Prison Attention]]>><</link>>

    <<link [[Fight|Prison Attention Fight Refuse]]>><</link>>

    <<if $prison.kylar is "active">>
        <<if $worn.face.type.includes("gag")>>
            Kylar would rescue you, but you can't call them with your mouth gagged.

        <<else>>
            <<link [[Call Kylar|Prison Attention Kylar]]>><<set $prison.attention_level to 1>><<set $prison.attention to 0>><<set $prison.kylar to "solitary">><<set $prison_kylar_timer to 3>><</link>>

        <</if>>
    <<elseif $prison.kylar is "solitary">>
        Kylar can't help you from solitary.

    <</if>>
<</if>>
<</widget>>

<<widget "prison_laundry_options">>
<<endevent>>
<<if $hour is 12>>
    <<generate_relaxed_guard 0>><<person1>>"Shift over," <<relaxed_guard 0>> shouts. "Lunch time."

    You shuffle from the room with the other inmates.

    <<link [[Next|Prison Block]]>><<endevent>><</link>>

<<elseif $hour is 18>>
    <<generate_relaxed_guard 0>><<person1>>"Shift over," <<relaxed_guard 0>> shouts. "Dinner time."

    You shuffle from the room with the other inmates.

    <<link [[Next|Prison Block]]>><<endevent>><</link>>

<<else>>
    <<link [[Work hard (1:00)|Prison Laundry Work Hard]]>><<prison_work 1>><<pass 1>><<advancetohour>><</link>> | Will give opportunities to reduce suspicion.

    <<link [[Socialise with inmates (1:00)|Prison Laundry Work Socialise]]>><<prison_work 1>><<pass 1>><<advancetohour>><</link>> | Will give opportunities to raise respect.

    <<if $prison_relaxed_spoke isnot 1>>
        <<link [[Speak with guard (1:00)|Prison Laundry Work Chat]]>><</link>> | Will give opportunities to raise love.

    <</if>>
    <<link [[Stop|Prison Laundry]]>><</link>>

<</if>>
<</widget>>

<<widget "prison_medical_options">>
<<endevent>>
<<if $hour is 12>>
    <<generate_methodical_guard 0>><<person1>>"Lunch time," <<methodical_guard 0>> says. <<He>> pulls a prayer book from <<his>> pocket, and walks towards the door.

    <<link [[Next|Prison Medical]]>><<endevent>><</link>>

<<elseif $hour is 18>>
    <<generate_methodical_guard 0>><<person1>>"Dinner time," <<methodical_guard 0>> says. <<He>> pulls a prayer book from <<his>> pocket, and walks towards the door.

    <<link [[Next|Prison Medical]]>><<endevent>><</link>>

<<else>>
    <<link [[Assist (1:00)|Prison Medical Work Hard]]>><<prison_work 1>><<pass 1>><<advancetohour>><</link>>

    <<if $prison_methodical_spoke isnot 1>>
        <<link [[Speak with guard|Prison Medical Work Chat]]>><</link>>

    <</if>>
    <<link [[Stop|Prison Medical]]>><</link>>

<</if>>
<</widget>>

<<widget "prison_spire_options">>
<<endevent>>
<<if $hour is 12>>
    <<generate_anxious_guard 0>><<person1>>"Lunch," <<anxious_guard 0>> says. <<He>> takes a deep breath, and runs for the staircase down.

    <<link [[Next|Prison Spire]]>><<endevent>><</link>>

<<elseif $hour gte 18>>
    <<generate_anxious_guard 0>><<person1>>"Dinner," <<anxious_guard 0>> says. <<He>> takes a deep breath, and runs for the staircase down.

    <<link [[Next|Prison Spire]]>><<endevent>><</link>>

<<elseif $prison.anxious gte 60 and $per_npc.anxious_guard.name_known isnot 1>>
    <<beastNEWinit 2 "hawk">><<person1>>
    You hear a cry. A scrap between two <<beastsplural>> has turned sour. One holds the other down, and looks to be trying to throttle <<bhim>> with <<person2>><<bhis>> talons.
    <<endevent>>

    <<generate_anxious_guard 0>><<person1>>
    "No no no," <<anxious_guard 0>> says. <<He>> takes a deep breath, and leaves the safety of the cabin. "Br-break it up you two," <<he>> says. "I said break it up."

    The endangered creature struggles free, but the other turns its eyes on <<anxious_guard 0>>. <<He>> turns at once, but isn't fast enough. Wings flap, and the creature lifts <<him>> from the ground.

    <<link [[Next|Prison Spire Precipice]]>><</link>>

<<else>>
    <<link [[Work (1:00)|Prison Spire Work Hard]]>><<prison_work 1>><<pass 1>><<advancetohour>><</link>>

    <<if $prison_anxious_spoke isnot 1>>
        <<link [[Speak with guard|Prison Spire Work Chat]]>><</link>>

    <</if>>
    <<link [[Stop|Prison Spire]]>><</link>>

<</if>>
<</widget>>

<<widget "prison_teeth">>
<<if $args[0]>>
    <<set $prison.teeth += $args[0]>>
<</if>>
<</widget>>

<<widget "prison_teeth_text">>
<<if $args[0]>>
     | You've gained <<number $args[0]>> shark's teeth.
<</if>>
<</widget>>

<<widget "prison_birds">>
<<if $args[0]>>
    <<set $prison.birds += $args[0]>>
<</if>>
<</widget>>

<<widget "prison_birds_text">>
 | + Watchers
<</widget>>

<<widget "prison_unbind">>
<<if !$prison.active_punishments.includes("bindings")>>
	<<set $rightboundcarry to 0>>
	<<set $leftboundcarry to 0>>
	<<set $leftarm to 0>>
	<<set $rightarm to 0>>
<</if>>
<<if !$prison.active_punishments.includes("cuffs")>>
	<<remove_shackle>>
<</if>>
<</widget>>

<<widget "prison_detach_leash">>
<<if !$prison.active_punishments.includes("leash")>>
    <<detach_leash>>
<</if>>
<</widget>>

<<widget "prison_bondage_removal">>
<<if $worn.face.type.includes("gag") or $worn.face.type.includes("blindfold")>><<set _punishments_removed to true>>
    <<set $worn.face.type.push("broken")>>
    <<faceruined>>
<</if>>
<<if $worn.feet.type.includes("shackle")>><<set _punishments_removed to true>>
    <<set $worn.face.type.push("broken")>>
    <<feetruined>>
<</if>>
<<if $worn.neck.cursed is 1>><<set _punishments_removed to true>>
    <<set $worn.neck.type.push("broken")>>
    <<neckruined>>
<</if>>
<<if $leftarm is "bound" or $rightarm is "bound">>
    <<set _punishments_removed to true>>
<</if>>
<<unbind>>
<</widget>>

<<widget "gagged_speech">><<silently>>
<<set _text_output to '"'>>
<<if $args[0]>>
    <<if $worn.face.type.includes("gag")>>
        <<if $submissive gte 1150>>
            <<set _text_output += "Mmmmmmhr">>
        <<elseif $submissive lte 850>>
            <<set _text_output += "Mmhhrrr">>
        <<else>>
            <<set _text_output += "Mmmmhhrr">>
        <</if>>
    <<else>>
        <<set _text_output += $args[0]>>
    <</if>>
<</if>>
<<if $args[1]>>
    <<set _text_output += $args[1]>>
<</if>>
<<set _text_output += '"'>>
<</silently>><<print _text_output>>
<</widget>>

<<widget "passout_prison">>
/*ToDo: Pregnancy, remove $pregnancyTesting to properly enable*/
<<if $sexStats.vagina.pregnancy.waterBreaking is true and $pregnancyTesting>>
	<<pregnancyWatersBrokenPassout "prison">>
<<else>>
	[[Everything fades to black...->Passout Prison]]
<</if>>
<</widget>>

<<widget "passout_rut">>
<<if $rut_entry is "rope">>
    <<set $bus to "cell_block">>
    <<passout_prison>>
<<else>>
    [[Everything fades to black...->Passout Rut]]
<</if>>
<</widget>>

<<widget "prison_revolt_options">>
You have the inmates' attention. A thought flashes through your mind. A desire for insurrection.

<<if $prison.shock is 1>>
    <<if $prison.hope lt 80>>
        <<if $prison.reb lt 80>>
            The inmates don't feel it at all. They're so hopeless and downtrodden the shock collars aren't needed.

        <<else>>
            The inmates feel it as well, but don't believe they can actually change things. They're probably right, due to the shock collars.

        <</if>>
    <<else>>
        <<if $prison.reb lt 80>>
            The inmates are optimistic, but don't feel their chains tightly enough to revolt. It doesn't matter anyway due to the shock collars.

        <<else>>
            The inmates are feverish with the same desire, but the shock collars render this pointless.

        <</if>>
    <</if>>
<<else>>
    <<if $prison.hope lt 80>>
        <<if $prison.reb lt 80>>
            The shock collars are non-functioning, but the inmates are too hopeless and downtrodden to revolt.

        <<else>>
            The shock collars are non-functioning, and the inmates rebellious, but they're too pessimistic for any major revolt.

        <</if>>
    <<else>>
        <<if $prison.reb lt 80>>
            The shock collars are non-functioning, and the inmates optimistic, but they don't feel their chains tightly enough to revolt.

        <<else>>
            The stage is set. However, be sure you know what you're doing. A revolt without a plan will never end well.

            <<link [[Incite revolt|Prison Revolt]]>><</link>>

        <</if>>
    <</if>>
<</if>>
<<link [[Not right now|Prison Revolt Refuse]]>><<pain -4>><<trauma -6>><<stress -6>><</link>><<lpain>><<ltrauma>><<lstress>>

<</widget>>

<<widget "rut_end">>
<<unset $rut>>
<<unset $rut_entry>>
<</widget>>

<<widget "remove_punishments">>
<<if $worn.neck.name is "collar with leash" or $worn.neck.name is "free use collar with leash">>
    <<set _punishments_removed to true>>
<</if>>
<<detach_leash>>
<<if $worn.feet.type.includes("shackle")>><<set _punishments_removed to true>>
    <<set $worn.feet.type.push("broken")>>
    <<feetruined>>
<</if>>
<<if $worn.face.type.includes("blindfold") or $worn.face.type.includes("gag")>><<set _punishments_removed to true>>
    <<set $worn.face.type.push("broken")>>
    <<faceruined>>
<</if>>
<<if $worn.neck.name is "free use collar">><<set _punishments_removed to true>>
    <<set $worn.neck.type.push("broken")>>
    <<neckruined>>
    <<neckwear 1>>
<</if>>
<<if $leftarm is "bound" or $rightarm is "bound">>
    <<set _punishments_removed to true>>
<</if>>
<<unbind>>
<</widget>>

<<widget "prison_map">>
<<if $images is 1>>

        <<if $rut isnot undefined>>

            <<if random(1, 1000) is 1000>>

                    <<timed 1s>>
                        <<replace #prison_map_hide>>
                        <</replace>>
                    <</timed>>

            <</if>>
        <</if>>
        <<if $args[0] and $args[0] isnot "rut">>

        <<elseif $args[0] is "rut">>

        <</if>>

<</if>>
<</widget>>