code:
:: Widgets Stalk Actions [widget]

/*Hands */

<<widget "left_pursuit_grab">>
<<if $NPCList[0].state is "pursuit" and $NPCList[0].distance lte 0>>
    <<set _leftaction["Grab"] to "pursuit_grab">>
<</if>>
<</widget>>

<<widget "right_pursuit_grab">>
<<if $NPCList[0].state is "pursuit" and $NPCList[0].distance lte 0>>
    <<set _rightaction["Grab"] to "pursuit_grab">>
<</if>>
<</widget>>

/*Feet */
<<widget "feet_walk">>
<<if $leftleg isnot "bound" and $rightleg isnot "bound" and $dissociation lt 2 and $NPCList[0].state isnot "pursuit" and $feetuse isnot "run" and ($feetskill gte 200 or !$worn.feet.type.includes("heels"))>>
    <<set _feetaction["Walk"] to "walk">>
<</if>>
<</widget>>

<<widget "feet_run">>
<<if $leftleg isnot "bound" and $rightleg isnot "bound" and $dissociation lt 2 and ($feetskill gte 200 or !$worn.feet.type.includes("heels"))>>
    <<if $NPCList[0].state is "pursuit">>
        <<set _feetaction["Chase"] to "run">>
    <<else>>
	    <<set _feetaction["Run"] to "run">>
    <</if>>
<</if>>
<</widget>>

<<widget "feet_stand">>
<<if $dissociation lt 2 and $NPCList[0].state isnot "pursuit" and $feetuse isnot "run">>
    <<set _feetaction["Stand still"] to "stand">>
<</if>>
<</widget>>

<<widget "feet_hobble">>
<<if $dissociation lt 2 and ($leftleg is "bound" or $rightleg is "bound") or ($feetskill lt 200 and $worn.feet.type.includes("heels"))>>
    <<set _feetaction["Hobble"] to "hobble">>
<</if>>
<</widget>>

<<widget "feet_hide">>
<<if $dissociation lt 2 and $panicviolence lte 0>>
    <<set _feetaction["Hide"] to "hide">>
<</if>>
<</widget>>

<<widget "feet_confront">>
<<if $dissociation lt 2 and $panicviolence lte 0 and $NPCList[0].legs isnot "run" and $NPCList[0].state isnot "pursuit">>
    <<set _feetaction["Confront"] to "confront">>
<</if>>
<</widget>>

<<widget "head_turn">>
<<if $dissociation lt 2 and $panicviolence lte 0 and $NPCList[0].legs isnot "run" and $NPCList[0].state isnot "pursuit">>
    <<set _mouthaction["Look behind you"] to "turn">>
<</if>>
<</widget>>

<<widget "head_down">>
<<if $dissociation lt 2 and $panicviolence lte 0 and $NPCList[0].legs isnot "run" and $NPCList[0].state isnot "pursuit">>
    <<set _mouthaction["Look at the ground"] to "down">>
<</if>>
<</widget>>

<<widget "head_up">>
<<if $dissociation lt 2 and $panicviolence lte 0 and $NPCList[0].legs isnot "run" and $NPCList[0].state isnot "pursuit">>
    <<set _mouthaction["Keep your chin up"] to "up">>
<</if>>
<</widget>>


code:
:: Widgets Stalk [widget]
<<widget "man-stalk">>
<<if $stalk_intro is undefined and $NPCList[0].legs isnot "run">>
    <<set $stalk_intro to true>>
    You are being stalked. Bratty actions will discourage people from assaulting you, while meek actions will make them less likely to be violent if they do.

    You could always run or hide, but failing will increase the chance of being assaulted. Looking over your shoulder will give an idea of how hard they are to outrun or deceive.

<</if>>
<<if _n is 0 and $stalk_end isnot "escaped" and $stalk_end isnot "hide">>/*Only triggers on first NPC in a group. */
    <<if $NPCList[_n].legs is "walk">>
        <<set $NPCList[_n].distance -= 1>>
        <<if $NPCList[_n].distance is 3>>
            You hear a pair of footsteps some distance behind you.
        <<elseif $NPCList[_n].distance is 2>>
            You hear a pair of footsteps close behind you.
        <<elseif $NPCList[_n].distance is 1>>
            You hear a pair of footsteps right behind you!
        <</if>>
    <<else>>
        <<set $NPCList[_n].distance -= 1>>
        <<if $NPCList[_n].distance is 3>>
            You hear footsteps running some distance behind you.
        <<elseif $NPCList[_n].distance is 2>>
            You hear footsteps running close behind you.
        <<elseif $NPCList[_n].distance is 1>>
        You hear footsteps running right behind you!
        <</if>>
    <</if>>

    <<if $NPCList[_n].distance lte _n>>
        <<if !$stalk_end>>
            <<if $NPCList[_n].legs is "run" or $NPCList[0].bold gte random(1, 1000)>>
                You are accosted.

                <<events_stalk>>
            <<else>>
                A <<person1>><<person>>
                <<switch $enemyno>>
                <<case 6>>
                    and five others pass by. They don't glance at you.
                <<case 5>>
                    and four others pass by. They don't glance at you.
                <<case 4>>
                    and three others pass by. They don't glance at you.
                <<case 3>>
                    and two others pass by. They don't glance at you.
                <<case 2>>
                    and <<person2>><<person>> pass by. They don't glance at you.
                <<default>>
                    passes by. <<He>> doesn't glance at you.
                <</switch>>
                <<set $stalk_end to "passed">>
            <</if>>
        <</if>>
    <</if>>
<</if>>
<<stalk_img>>
<</widget>>

<<widget "stalk_walk_events">>
<<switch $location>>
    <<case forest>>

    <<case moor>>

    <<case alley>>
        <<set _rng to random(1, 10)>>
        <<switch _rng>>
            <<case 1>>
                Steam rises from a nearby grate.
            <<case 2>>
                <<if $weather is "rain">>
                    You avoid a puddle.
                <<elseif $weather is "snow">>
                    You avoid a patch of ice.
                <<else>>
                    You avoid a pile of rubbish.
                <</if>>
            <<case 3>>
                The buildings tower around the thin alley.
            <<case 4>>
                The path dips and bends.
            <<case 5>>
                You're penned between metal fences.
        <</switch>>
    <<default>>
        <<set _rng to random(1, 10)>>
        <<switch _rng>>
            <<case 1>>
                Steam rises from a nearby grate.
            <<case 2>>
                <<if $weather is "rain">>
                    You avoid a puddle.
                <<elseif $weather is "snow">>
                    You avoid a patch of ice.
                <<else>>
                    You avoid a pile of rubbish.
                <</if>>
            <<case 3>>
                You pass beneath an awning.
            <<case 4>>
                You walk beneath an overpass.
            <<case 5>>
                The pavement is rough and uneven.
        <</switch>>
<</switch>>
<</widget>>

<<widget "stalk_run_events">>

<<if $stalk_event>>
    <<stalk_events_followup>>
<<else>>
    <<if $exposed gte 1 and $daystate isnot "night" and $location is "town">>

    <</if>>
    <<switch $location>>
        <<case forest>>

        <<case moor>>

        <<case alley>>
            <<if $NPCList[0].state is "pursuit">>
                <<set _rng to random(1, 5)>>
                <<switch _rng>>
                    <<case 1>>
                        You run across a metal grate. Warm air blows from the depths below.
                    <<case 2>>
                        <<switch $NPCList[0].size>>
                            <<case large>>
                                <<set $stalk_event to "wall_large">>
                                Your quarry  jumps and hauls <<himself>> over a tall wall. You'll need to do likewise if you mean to follow.
                            <<case normal>>
                                <<set $stalk_event to "wall_normal">>
                                Your quarry  jumps and hauls <<himself>> over a wall. You'll need to do likewise if you mean to follow.
                            <<case small>>
                                <<set $stalk_event to "wall_small">>
                                Your quarry kneels and scrambles through a hole in a wall. You'll need to likewise if you mean to follow.
                            <<case tiny>>
                                <<set $stalk_event to "wall_tiny">>
                                Your quarry kneels and scrambles through a tight hole in the wall. You'll need to likewise if you mean to follow.
                        <</switch>>
                    <<case 3>>
                        <<set $stalk_event to "cat">>
                        Your quarry kicks aside a sleeping cat. It stands upright and hisses in anger.
                    <<case 4>>
                        <<set $stalk_event to "dead-end">>
                        You follow <<him>> around a corner, and see a brick wall up ahead. It looks like a dead-end. <<He>> searches for a way out.
                    <<case 5>>
                        <<set $stalk_event to "employee">>
                        An employee from a nearby establishment leans against the wall up ahead, and regards the <<person>> with mild curiosity.
                <</switch>>
            <<else>>

            <</if>>
        <<default>>
            <<if $NPCList[0].state is "pursuit">>
                <<if $daystate is "night">>
                    <<set _rng to random(1, 5)>>
                    <<switch _rng>>
                        <<case 1>>
                            <<set $stalk_event to "taxi">>
                            A taxi drives around the corner. It's heading this way.
                        <<case 2>>
                            <<set $stalk_event to "crowd">>
                            The <<person>> runs into a drunken crowd.
                        <<case 3>>
                            <<if $hallucinations gte 2>>
                                Something snares your foot in the dark. A tentacle extends from a storm drain, and coils around your ankle.
                            <<else>>
                                Something snares your foot in the dark.
                            <</if>>
                            You shake it free, but your quarry is getting away.
                            <<set $NPCList[0].distance += 1>>
                        <<case 4>>
                            <<set $stalk_event to "night_house">>
                            You hear voices from a building up ahead. Light floods from the windows, bathing the street.
                        <<case 5>>
                            A chill gust makes your hair stand on end.
                    <</switch>>
                <<else>>
                    <<set _rng to random(1, 5)>>
                    <<switch _rng>>
                        <<case 1>>
                            <<set $stalk_event to "bus">>
                            A tourist bus pulls around the corner up ahead. It's heading this way.
                        <<case 2>>
                            <<set $stalk_event to "crowd">>
                            The <<person>> runs into a crowd.
                        <<case 3>>
                            <<set $stalk_event to "restaurant">>
                            The <<person>> runs past a busy restaurant.
                        <<case 4>>
                            <<set $stalk_event to "school">>
                            The <<person>> runs past a gaggle of students you recognise from school.
                        <<case 5>>
                            <<set $stalk_event to "street">>
                            The <<person>> runs across the street.
                    <</switch>>
                <</if>>
            <<else>>

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

<<widget "stalk_events_followup">>
<<switch $stalk_event>>
    <<case "bus">>
        The bus drives by. A <<personsimple>> spots you. <<His>> mouth moves,
        <<set _rng to random(1, 2)>>
        <<switch _rng>>
            <<case 1>>
                but no one else seems interested in what <<he>> has to say. The bus passes.
            <<case 2>>
                and other heads turn your way. There's a flurry of activity and the tourists grab their cameras, eager to snap the <<nude_text>> <<girl>>.
                <<fameexhibitionism 10 pic>>
        <</switch>>
    <<case "crowd">>
        You run into the crowd. You hope to move fast enough to keep anyone from snatching more than a glimpse.
        <<if $allure gte random(1, 10000) / 2>>
            <<if random(1, 3) is 3>>
                Someone gropes your <<bottom>> as you pass, encouraging others. More hands reach out, fonding and stroking your body.<<gtrauma>><<gstress>><<garousal>>

                You emerge from the other side, and escape around the corner before the bemused pedestrians can reach for their phones.
            <<else>>
                The <<person>> ambushes you! <<He>> grasps your arms and shoves you to the ground.

                <<stalk_attack>>
                <<set $audience_active to true>>
            <</if>>
        <<else>>
            You emerge from the other side, and escape around the corner before the bemused pedestrians can reach for their phones.

        <</if>>
    <<case "restaurant">>
        You rush past the restaurant.
        <<set _rng to random(1, 2)>>
        <<switch _rng>>
        <<case 1>>
            Everyone's too occupied to notice the <<nude_text>> <<girl>> run by.

        <<case 2>>
            Someone shouts. Spoons drop in soup, their owners aghast at the sight of the <<nude_text>> <<girl>> running by. Others chuckle, and reach for their phones.
            <<fameexhibitionism 10 vid>>

        <</switch>>
    <<case "school">>
        The students laugh as you run by.

        <<if $worn.face.type.includes("mask")>>
            <<if random(1, 2) is 2>>
                "Do you recognise <<phim>> from school?" asks one <<persony>>.
            <<else>>
                "<<pShe>> must go to our school," says one <<persony>>.
            <</if>>

            <<if random(1, 2) is 2>>
                "I can't see behind <<pher>> mask," replies another.
            <<else>>
                "Someone grab <<pher>> mask!" replies another.
            <</if>>

        <<elseif $face is "covered">>
            <<if random(1, 2) is 2>>
                "Do you recognise <<phim>> from school?" asks one <<persony>>.
            <<else>>
                "<<pShe>> must go to our school," says one <<persony>>.
            <</if>>

            <<if random(1, 2) is 2>>
                "I can't tell," replies another. "<<pHer>> hands are in the way."
            <<else>>
                "Someone grab them!" replies another.
            <</if>>

        <<else>><<fameexhibitionism 5>>
            <<if (random(1,3) is 1 and $loveInterest.primary is "Robin") or (random(1,3) is 2 and $loveInterest.secondary is "Robin")>>
                "Isn't that Robin's <<girlfriend>>?" asks one <<persony>>.

                "Who'd have thought Robin would be into perverts," says another.

            <<elseif (random(1,3) is 1 and $loveInterest.primary is "Whitney") or (random(1,3) is 2 and $loveInterest.secondary is "Whitney")>>
                "That's the <<girl>> Whitney always bullies," says one <<persony>>.

                "I bet this is Whitney's fault," replies another.

            <<elseif (random(1,3) is 1 and $loveInterest.primary is "Kylar") or (random(1,3) is 2 and $loveInterest.secondary is "Kylar")>>
                "That's the <<girl>> Kylar hangs out with," says one <<persony>>.

                "Figures <<pshe>>'d be a pervert," replies another.

            <<elseif (random(1,3) is 1 and $loveInterest.primary is "Sydney") or (random(1,3) is 2 and $loveInterest.secondary is "Sydney")>>
                "Hold on, that's Sydney's <<girlfriend>>," says one <<persony>>. "What's <<pshe>> doing like that?"

                "Stole one too many books, now <<pshes>> on the run," laughs another.

            <<else>>
                <<if random(1, 2) is 2>>
                    "I recognise <<phim>>!" proclaims one <<persony>>.
                <<else>>
                    "I know <<phim>> from school," says one <<persony>>.
                <</if>>

                <<if random(1, 2) is 2>>
                    "Oh my god," replies another. "I can't wait to tell everyone."
                <<else>>
                    "<<pShe>>'s so perverted," replies another.
                <</if>>

            <</if>>
        <</if>>
        You run around a corner, and escape their prying before they get touchy.<<gtrauma>><<gstress>><<trauma 6>><<stress 6>>

    <<case "street">>
    You cross the street.
    <<set _rng to random(1, 5)>>
    <<if _rng gte 5>>
        A car almost collides with you. It screeches to a halt, but still thuds into you with enough force to knock you to the ground.<<ggstress>><<stress 12>><<gtrauma>><<trauma 6>><<gpain>><<pain 4>>

        You're left lying in the middle of the street, giving everyone time for a good look. <<covered>> The <<personsimple>> behind the offending vehicle steps out, a bewildered look on <<his>> face.

        You struggle to your feet, and rush after the <<person>> before <<he>> escapes, your face bright hot.

        <<set $NPCList[0].distance += 1>>
    <<elseif _rng gte 3>>
        A car almost collides with you, but screeches to a halt instead. The <<personsimple>> behind the wheel's expression softens in bewilderment when <<he>> sees your state of dress. You don't have time to apologise. You make it to the other side, where you're a bit more sheltered.<<gstress>><<stress 6>>
    <<else>>
        You keep focused on your quarry, but you know eyes up and down the street are glimpsing you. You make it to the other side, where you're a bit more sheltered.<<ggstress>><<stress 12>><<gtrauma>><<trauma 6>>
    <</if>>

    <<case "taxi">>
        <<set _rng to random(1, 3)>>
        <<switch _rng>>
            <<case 1>>
                The taxi pulls to a stop as you pass, and the <<personsimple>> in the passenger seat leans. <<lewdcatcall>><<gtrauma>><<gstress>><<trauma 6>><<stress 6>>

            <<case 2>>
                A <<personsimple>> leans out the passenger seat of the taxi as you pass, a large camera pressed against <<his>> face. You hear it click.<<gtrauma>><<gstress>><<trauma 6>><<stress 6>><<fameexhibitionism pic 5>>

            <<case 3>>
                The taxi driver stares at you as you pass, but doesn't stop.<<gstress>><<stress>>

        <</switch>>
    <<case "night_house">>
        <<set _rng to random(1, 3)>>
        <<if _rng gte 3>>
            You run through the light. A cry of mirth erupts from the lit building. You glance over, and see a dozen faces staring back.<<gtrauma>><<gstress>><<trauma 12>><<stress 12>><<fameexhibitionism 12>>

        <<else>>
            You run through the light, sparing a nervous glance at the windows. There are people within, but none are looking this way.

        <</if>>
    <<case "wall_large">>
        <<if $bodysize gte 3 or $bodysize gte 2 and random(1, 2) is 2>>
            You jump and haul yourself over the wall.

        <<else>>
            You jump and try to grasp the top of the wall, but you're too short. You manage to squeeze through a hole at the base instead, but the <<person>> is getting away.
            <<set $NPCList[0].distance += 1>>

        <</if>>
    <<case "wall_normal">>
        <<if $bodysize gte 2 or $bodysize gte 1 and random(1, 2) is 2>>
            You jump and haul yourself over the wall.

        <<else>>
            You jump and try to grasp the top of the wall, but you're too short. You manage to squeeze through a hole at the base instead, but the <<person>> is getting away.
            <<set $NPCList[0].distance += 1>>

        <</if>>
    <<case "wall_small">>
        <<if $bodysize lte 1 or $bodysize lte 2 and random(1, 2) is 2>>
            You drop to your knees and crawl through the hole, emerging on the other side. You continue the chase.

        <<else>>
            You drop to your knees and crawl through the hole. You emerge on the other side, but get stuck.

            The <<person>> returns when <<he>> notices your predicament. <<He>>
            <<if $pronoun is "m">>
                unzips <<his>> fly,
            <<else>>
                lifts <<his>> skirt,
            <</if>>
            <<if $NPCList[0].penis isnot "none">>
                revealing <<his>> <<print $NPCList[0].penisdesc>>
            <<else>>
                revealing <<his>> pussy.
            <</if>>
            <<stalk_attack>>
            <<stuck_in_wall_oral>>

        <</if>>
    <<case "wall_tiny">>
        <<if $bodysize lte 0 or $bodysize lte 1 and random(1, 2) is 2>>
            You drop to your knees and crawl through the hole, emerging on the other side. You continue the chase.

        <<else>>
            You drop to your knees and crawl through the hole. You emerge on the other side, but get stuck.

            The <<person>> returns when <<he>> notices your predicament. <<He>>
            <<if $pronoun is "m">>
                unzips <<his>> fly,
            <<else>>
                lifts <<his>> skirt,
            <</if>>
            <<if $NPCList[0].penis isnot "none">>
                revealing <<his>> <<print $NPCList[0].penisdesc>>
            <<else>>
                revealing <<his>> pussy.
            <</if>>
            <<stuck_in_wall_oral>>

        <</if>>
    <<case "cat">>
        <<if $cat gte 6>>
            You meow at the cat. It meows back, and runs after the <<person>>. It jumps on <<his>> back, its claws ablur. <<He>> drops your $stalk_clothes and reaches for the attacker.

            <<He>> throws the cat away, then turns to face you.

            <<stalk_catch>>
        <<else>>
            The cat hisses as you pass.

        <</if>>
    <<case "dead-end">>
        <<if random(1, 2) is 2>>
            <<He>> spots a thin passage between a building and metal shed, and squeezes through.

        <<else>>
            Finding no way out, the <<person>> turns to face you.

            <<stalk_catch>>
        <</if>>
    <<case "employee">>
        <<set _rng to random(1, 3)>>
        <<switch _rng>>
            <<case 3>>
                The employee reaches into <<his>> pocket when <<he>> spots you, and produces <<his>> phone, pointing it at you as you pass.
                <<fameexhibitionism 5>>

            <<case 2>>
                The employee's mouth opens in shock when <<he>> spots you. <<His>> cigarette falls to the floor.

            <<case 1>>
                The employee's mouth opens in shock when <<he>> spots you.

        <</switch>>
<</switch>>
<<unset $stalk_event>>
<</widget>>

<<widget "man-pursuit">>
<<if _n is 0>>
    <<set $NPCList[_n].distance += 1>>
    <<if $NPCList[_n].distance gte 4>>
        You round a corner, but the <<person>> is nowhere to be seen. You've lost <<him>>.
        <<set $stalk_end to "outpaced">>
    <<elseif $NPCList[_n].distance is 3>>
        The <<person>> rounds a corner ahead. You've almost lost <<him>>.
    <<elseif $NPCList[_n].distance is 2>>
        The <<person>> runs, your clothes trailing behind <<him>>. <<Hes>> some distance from you.
    <<elseif $NPCList[_n].distance is 1>>
        The <<person>> runs, and throws the occasional glance over <<his>> shoulder. <<Hes>> not far ahead.
    <<else>>
        <<set $NPCList[_n].distance to 0>>
        The <<person>> runs, your clothes bundled under <<his>> arm. <<Hes>> right in front of you.
    <</if>>
<</if>>
<<stalk_img>>
<</widget>>

<<widget "stalk_catch">>
<<for _i = 0; _i < $NPCList.length; _i++>>
	<<set $NPCList[_i].state to "attack">>
<</for>>
<<if random(1, 2) is 2>>
    <<set $position to "missionary">>
<<else>>
    <<set $position to "doggy">>
<</if>>
<<if $location is "town" and $daystate isnot "night">>
    <<set $audience_active to true>>
<</if>>
<</widget>>

<<widget "stalk_attack">>
<<for _i = 0; _i < $NPCList.length; _i++>>
	<<set $NPCList[_i].state to "attack">>
<</for>>
<<if random(1, 2) is 2>>
    <<set $position to "missionary">>
<<else>>
    <<set $position to "doggy">>
<</if>>
<<if $location is "town" and $daystate isnot "night">>
    <<set $audience_active to true>>
<</if>>
<<set $feetuse to 0>>
<<controlloss>>
<<molested>>
<</widget>>

<<widget "stalk_pursuit">>
<<for _i = 0; _i < $NPCList.length; _i++>>
	<<set $NPCList[_i].state to "pursuit">>
    <<set $NPCList[_i].distance to 2>>
<</for>>
<<set $rescue to 0>>
<<controlloss>>
<<molested>>
<</widget>>

<<widget "stalk_run">>
<<set $feetuse to "run">>
<<for _i = 0; _i < $NPCList.length; _i++>>
    <<set $NPCList[_i].legs to "run">>
<</for>>

<</widget>>

<<widget "stalk_flight">>
<<for _i = 0; _i < $NPCList.length; _i++>>
	<<set $NPCList[_i].state to "pursuit">>
    <<set $NPCList[_i].distance to 2>>
<</for>>
<<set $rescue to 0>>
<<unset $audience_active>>
<</widget>>

<<widget "stalk_init">>
<<for _i = 0; _i < $NPCList.length; _i++>>
	<<set $NPCList[_i].state to "stalk">>
	<<set $NPCList[_i].distance to 4>>
	<<set $NPCList[_i].legs to "walk">>
<</for>>
<<set $position to "stalk">>
<<set $feetuse to "walk">>
<<set $stalk to true>>
<<set $enemyanger to 40>>
<<if $controlled is 0 and ($anxiety gte 2 and random(1, 3) is 3 or $anxiety gte 1 and random(1, 9) is 9)>>
    Your mind races, concocting terrible scenarios of what could befall you.<<llcontrol>><<control -25>>

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

<<widget "events_stalk">>
<<switch $enemyno>>
<<case 1>>
    <<set _rng to random(1, 100)>>
    <<if $worn.upper.name is "large towel" and $worn.upper.set is $worn.lower.set>>
        A <<person>> snatches the towel from your body, exposing your <<undertop>> and <<undies>>. <<He>> runs ahead, leaving you exposed in the middle of the <<location_text>>.
        <<set $stalk_clothes to $worn.upper.name>>
        <<upperstrip>>
        <<exposure>>
        <<stalk_pursuit>>

    <<elseif $worn.upper.name is "large towel">>
        A <<person>> snatches the towel from your chest, exposing your <<undertop>>. <<He>> runs ahead, leaving you exposed in the middle of the <<location_text>>.
        <<set $stalk_clothes to $worn.upper.name>>
        <<upperstrip>>
        <<exposure>>
        <<stalk_pursuit>>

    <<elseif $worn.lower.name is "large towel bottom">>
        A <<person>> snatches the towel from your waist, exposing your <<undies>>. <<He>> runs ahead, leaving you exposed in the middle of the <<location_text>>.
        <<set $stalk_clothes to $worn.lower.name>>
        <<lowerstrip>>
        <<exposure>>
        <<stalk_pursuit>>

    <<elseif $worn.upper.name is "towel top">>
        A <<person>> snatches the towel from your chest, exposing your <<undertop>>. <<He>> runs ahead, leaving you exposed in the middle of the <<location_text>>.
        <<set $stalk_clothes to $worn.upper.name>>
        <<upperstrip>>
        <<exposure>>
        <<stalk_pursuit>>

    <<elseif $worn.lower.name is "towel skirt">>
        A <<person>> snatches the towel from your waist, exposing your <<undies>>. <<He>> runs ahead, leaving you exposed in the middle of the <<location_text>>.
        <<set $stalk_clothes to $worn.lower.name>>
        <<lowerstrip>>
        <<exposure>>
        <<stalk_pursuit>>

    <<elseif _rng gte 81 and $exposed lt 2>>
        You hear a <<person>> behind you. <<catcall>> Before you can respond, a pair of intruding hands grasp your clothes!
        <<npcstrip>>
        <<npcidlegenitals>>
        <<stalk_attack>>

    <<elseif $leftarm is "bound" or $rightarm is "bound">>
	    Someone grabs your bound arms from behind. "All wrapped up like a present," says a <<person>> as <<he>> swivels you around. "How could I resist?"
        <<stalk_attack>>

    <<else>>
        You hear a <<person>> behind you. <<catcall>> Before you can respond, a pair of intruding hands grasp you!
        <<stalk_attack>>

    <</if>>
<<case 2>>
    You hear a <<person1>><<person>> behind you. Before you can respond, <<he>> seizes you by the arms and mouth.
    <<if $location is "alley">>
        <<He>> drags you into a shadowed alley, where <<his>> friend awaits.
    <<elseif $location is "town">>
        <<He>> drags you into an alley, where <<his>> friend awaits.
    <<else>>
        <<He>> drags you into the shadows, where <<his>> friend awaits.
    <</if>>
    <<stalk_attack>>
    <<set $leftarm to "grappled">><<set $rightarm to "grappled">><<hand_gag 0 left>><<set $NPCList[0].righthand to "arms">>

<<case 3>>
    <<if $worn.upper.name is "large towel" or $worn.lower.name is "large towel bottom" or $worn.upper.name is "towel top" or $worn.lower.name is "towel skirt">>
        A <<person1>><<person>> steps in front of you, while two other figures move in from behind, penning you between them. "That's an odd thing to walk around in during the night," says the <<person1>><<person>> as <<he>> strokes your towel. "I think I know exactly what you want."

        <<set $combat_end_text to '"Dress like a slut, get treated like one," says the <<person>>. They leave you lying on the pavement.'>>
        <<stalk_attack>>
    <<else>>
        A <<person1>><<person>> steps in front of you, while other figures move in from behind, penning you between them.

        <<stalk_attack>>
    <</if>>
<<case 4>>
    A <<person1>><<person>>'s hand grasps your shoulder and three other figures block your path. "You're going nowhere <<lass>>," the <<person>> says. "Not til we're done."

    <<stalk_attack>>
<<case 5>>
    A <<person1>><<person>> steps in front of you while <<person2>><<person>> rests <<his>> hands on your hips. Three others are with them. They aren't going to let you go.

    <<person1>>
    <<stalk_attack>>
<<default>>
    A <<person1>><<person>> and <<person2>><<person>> step in front of you as several others press in from behind, penning you in.

    <<person1>>
    <<stalk_attack>>
<</switch>>
<</widget>>

<<widget "stalk_athletics_difficulty">>
<<if $stalk_assess or $NPCList[0].state is "pursuit">>
    <<if $worn.feet.type.includes("heels")>>
        <<skill_difficulty feetskill "Feet (heels)" 1 1000>>
    <</if>>
    <<athleticsdifficulty 0 $NPCList[0].skills.athletics>>
<</if>>
<</widget>>

<<widget "stalk_skulduggery_difficulty">>
<<if $stalk_assess or $NPCList[0].state is "pursuit">>
    <<set _difficulty to $NPCList[0].skills.security>>
    <<set _difficulty += ($semencount + $goocount) * 20>>
    <<if ($semencount + $goocount) gte 1>>
        <<skill_difficulty skulduggery "Skulduggery (Slimy)" 0 _difficulty>>
    <<else>>
        <<skill_difficulty skulduggery Skulduggery 0 _difficulty>>
    <</if>>
<</if>>
<</widget>>

<<widget "run_text">>
<<switch $location>>
    <<case alley>>
        <<set _rng to random(1, 3)>>
        <<switch _rng to random(1, 3)>>
            <<case 1>>
                You leap over a parked car.
            <<case 2>>
                You skirt between tightly-packed dumpsters.
            <<case 3>>
                You avoid a bollard.
        <</switch>>
    <<case park>>
        <<set _rng to random(1, 3)>>
        <<switch _rng to random(1, 3)>>
            <<case 1>>
                You leap over bins and through bushes.
            <<case 2>>
                You duck beneath a tall hedge.
            <<case 3>>
                You bat away obstructing branches.
        <</switch>>
    <<case moor>>
        <<set _rng to random(1, 3)>>
        <<switch _rng to random(1, 3)>>
            <<case 1>>
                You leap over a muddy patch.
            <<case 2>>
                You scramble up a ridge.
            <<case 3>>
                You stomp through a patch of short brambles.
        <</switch>>
    <<case forest>>
        <<set _rng to random(1, 3)>>
        <<switch _rng to random(1, 3)>>
            <<case 1>>
                You leap over a stream.
            <<case 2>>
                You squeeze between dense trees.
            <<case 3>>
                You stomp through a patch of ferns.
        <</switch>>
    <<default>>
        <<set _rng to random(1, 3)>>
        <<switch _rng to random(1, 3)>>
            <<case 1>>
                <<if $weather is "rain">>
                    You leap over a puddle.
                <<elseif $weather is "snow">>
                    You leap over ice.
                <<else>>
                    You leap over a pothole.
                <</if>>
            <<case 2>>
                You avoid colliding with a <<if random(1, 2) is 2>>postbox<<else>>bin<</if>>.
            <<case 3>>
                You weave between parked cars.
        <</switch>>
<</switch>>
<</widget>>

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

    <<for _i to 0; _i lt 8; _i++>>

    <</for>>
    <<if $NPCList[0].distance is 0 and $NPCList[0].state isnot "pursuit" or $stalk_end is "hide">>
        <<if $stalk_end>>

        <<else>>

        <</if>>
    <<else>>
        <<if $NPCList[0].distance lt 4>>
            <<if $NPCList[0].state is "pursuit">>
                <<set _stalk_position to 4 + $NPCList[0].distance>>

            <<elseif $stalk_end is "escaped">>
            <<else>>
                <<set _stalk_position to 4 - $NPCList[0].distance>>

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

    <</if>>

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

repo_name: Area/degrees

license: mit


code:
:: Widgets State Man [widget]
<<widget "stateman">>

		<<if $position isnot "stalk">>
			<<set _looks to ($enemyno is 1? "looks" : "look")>>
			<<set _doesntlook to ($enemyno is 1? "doesn't look" : "don't look")>>
			<<set _is to ($enemyno is 1? "is" : "are")>>
			<<if $enemyno is 1>>
				<<if $enemynomax is 1>>
					<<set _n to 0>>
				<<else>>
					<<for $_i to 0; $_i lt $enemynomax; $_i++>>
						<<if $NPCList[$_i].active is "active" and $NPCList[$_i].stance isnot "defeated">>
							<<set _n to $_i>>
							<<break>>
						<</if>>
					<</for>>
				<</if>>
			<</if>>
			<<if ["m", "f", "i", "n", "t"].includes($NPCList[_n].pronoun)>>
				<<set $pronoun to $NPCList[_n].pronoun>>
			<<elseif $debugdisable is "f">>
				ERROR: Unexpected $$NPCList[0].pronoun: [$NPCList[0].pronoun]
			<</if>>
			<<if $enemytype is "beast" and $monster is 0>>
				<<set $pronoun to "i">>
			<</if>>
			<<if $enemyno gt 1>>
				<<set $pronoun to "t">>
			<</if>>

			<<if $loveDrunk>>
				<<He>> _looks <<print either("love-drunk", "sinful", "crazed", "wild with lust", "rapturous")>>.
			<<elseif $enemyhealth gte $enemyhealthmax>>
				<<He>> _looks eager.
			<<elseif $enemyhealth gte ($enemyhealthmax / 5) * 4>>
				<<He>> _looks uncomfortable.
			<<elseif $enemyhealth gte ($enemyhealthmax / 5) * 3>>
				<<He>> _looks stung.
			<<elseif $enemyhealth gte ($enemyhealthmax / 5) * 2>>
				<<He>> _looks pained.
			<<elseif $enemyhealth gte ($enemyhealthmax / 5) * 1>>
				<<He>> _looks hurt.
			<<elseif $enemyhealth gt 0>>
				<<He>> _doesntlook like <<he>> can take much more pain.
			<<elseif $enemyhealth lte 0>>
				<<He>> _is recoiling in pain.
				<<combatcontrol 15>><<def 10>>
			<</if>>

			<<if $enemyarousal gte $enemyarousalmax>>
				<<if $NPCList[0].penis isnot "none">>
					Ejaculation imminent.
				<<else>>
					Orgasm imminent.
				<</if>>
			<<elseif $enemyarousal gte ($enemyarousalmax / 5) * 4>>
				You think <<he>> _is approaching orgasm.
			<<elseif $enemyarousal gte ($enemyarousalmax / 5) * 3>>
				<<He>> _looks lustful.
			<<elseif $enemyarousal gte ($enemyarousalmax / 5) * 2>>
				<<He>> _looks horny.
			<<elseif $enemyarousal gte ($enemyarousalmax / 5) * 1>>
				<<He>> _looks aroused.
			<<elseif $enemyarousal gt 0>>
				<<He>> _looks stimulated.
			<<elseif $enemyarousal lte 0>>
				<<if $enemyno gt 1>>
					<<He>> _looks unaroused.
				<<else>>
					<<if $npcSub>>
						<<He>> lays still, waiting for you.
					<<else>>
						<<He>> is positively <<if $NPCList[0].penis isnot "none">>flaccid<<else>>dry<</if>>.
					<</if>>
				<</if>>
			<</if>>

			<<if $enemyanger gte $enemyangermax>>
				<<He>> _is furious.
			<<elseif $enemyanger gte ($enemyangermax / 5) * 4>>
				<<He>> _looks incredibly pissed off.
			<<elseif $enemyanger gte ($enemyangermax / 5) * 3>>
				<<He>> _looks angry.
			<<elseif $enemyanger gte ($enemyangermax / 5) * 2>>
				<<He>> _looks frustrated.
			<<elseif $enemyanger gte ($enemyangermax / 5) * 1>>
				<<He>> _looks irritated.
			<<elseif $enemyanger gt 0>>
				<<He>> _looks disappointed.
			<<elseif $enemyanger lte 0>>
				<<He>> _looks calm.
			<</if>>

			<<if $enemytrust lte -100>>
				<<He>> _looks full of suspicion.
			<<elseif $enemytrust lte -60>>
				<<He>> _looks guarded.
			<<elseif $enemytrust lte -20>>
				<<He>> _looks wary.
			<<elseif $enemytrust lte 20>>
				<<He>> _looks cautious.
			<<elseif $enemytrust lte 60>>
				<<He>> _looks alert.
			<<elseif $enemytrust lte 100>>
				<<He>> _looks relaxed.
			<<elseif $enemytrust gt 100>>
				<<He>> _looks confident.
			<</if>>
		<</if>>

		<<if $panicviolence is 0 and $panicparalysis is 0 and $controlled is 0>>
			<<if $panicattacks gte 1 and _panicchecked isnot true and random(1, 100) is 100>>
				<<set $panicparalysis to 5>>
			<</if>>
			<<set _panicchecked to true>>
			<<if $panicattacks gte 2 and _paniccheckedviolence isnot true and random(1, 100) is 100>>
				<<set $panicviolence to 3>>
				<<if $position is "stalk">>
					<<set $feetuse to "run">>
				<</if>>
			<</if>>
			<<set _paniccheckedviolence to true>>
		<</if>>

		<<if $arousal gte $arousalmax and $orgasmdown lte 0>>
			<<orgasm>>
		<</if>>
		<<sexcheck>>

<</widget>>

<<widget "pass10sec">>
<<if !$prayerRoom>>
	<<set $seconds += 10>>
	<<if $seconds gte 60>>
		<<set $seconds to 0>>
		<<pass 1>>
	<</if>>
<</if>>
<</widget>>

:: Widgets Combat State [widget]
<<widget "combatstate">>
<<if _statechecked isnot true>>
	<<if $gamemode is "soft">>
		<<set $pain to 0>>
	<</if>>
	<<wetnessCalculate>>
	<<if $orgasmdown gte 1>>
		<<set $enemyarousal += 10>>
		Your body pulses and spasms with orgasmic waves, preventing you from acting normally.

		<<disable>>
		<<if $combatControls is "disabled" and $panicviolence lte 0 and $panicparalysis lte 0 and $trance lte 0>>
			<<actionsorgasm>>
		<</if>>
	<</if>>

	<<if $pain gte 100 and $willpowerpain is 0>>
		<<set $enemyarousal += 10>>
		<<if $possessed is true>>
			<<if $orgasmdown lte 0>>
				You can't take any more pain, but your body continues to fight.
				<<trauma 12>><<ggtrauma>>

			<</if>>
		<<else>>
			You are in too much pain to act normally.

			<<disable>>
			<<if $combatControls is "disabled" and $orgasmdown lte 0 and $panicviolence lte 0 and $panicparalysis lte 0 and $trance lte 0>>
				<<actionspain>>
			<</if>>
		<</if>>
	<</if>>

	<<if $panicviolence gte 1 and !$possessed>>
		<<set $enemyarousal += 10>>
		<<if $position is "stalk">>
			You are overcome by panic. You run, needing to be anywhere but here.
		<<else>>
			You are stricken with panic, and flail wildly at anything invading your personal space.
		<</if>>

		<<defiance 10>><<set $panicviolence to $panicviolence - 1>><<disable>>
	<</if>>

	<<if $panicparalysis gte 1 and !$possessed>>
		<<set $enemyarousal += 10>>
		<<if $position is "stalk">>
			You are stricken with panic. Your muscles seize up, leaving you motionless.
		<<else>>
			You are stricken with panic. Your muscles seize up, leaving you helpless.
		<</if>>

		<<set $panicparalysis -= 1>><<disable>>
	<</if>>

	<<if $dissociation gte 2 and !$possessed>>
		<<set $enemyarousal += 10>>
		You feel disconnected from yourself, as if in a dream.

		<<disable>>
		<<if $combatControls is "disabled" and $orgasmdown lte 0 and $panicviolence lte 0 and $panicparalysis lte 0 and $trance lte 0>>
			<<if $pain lt 100 or $willpowerpain is undefined>>
				<<actionsdissociation>>
			<</if>>
		<</if>>
	<</if>>

	<<if $trance gte 1>>
		<<set $enemyarousal += 10>>
		You are entranced.

		<<disable>>
	<</if>>

	<<if $possessed is true>>
		Your body is not your own. <<if $rng gte 96>>It never was.<</if>>

		<<disable>>
		<<if $dissociation lte 1 and $orgasmdown lte 0 and $panicviolence lte 0 and $panicparalysis lte 0 and $trance lte 0>>
			<<actionspossessed>>
		<</if>>
		/* Updates the control caption at the top of the screen to include any control gained through the rest of the passage */
		<<run $(()=>{
			Dynamic.render("control-caption")
		})>>
		/* Adds the condition for ending an encounter. */
		<<if $control gte $controlmax>>
			<<set _controlRegain to 1>>
		<</if>>
	<</if>>
	<<set _statechecked to true>>
<</if>>
<</widget>>

<<widget "carryblock">>
	<<if $orgasmdown gte 1>>
		<<set $carryblock to "orgasm">>
	<<elseif $pain gte 100 and $willpowerpain is 0>>
		<<set $carryblock to "pain">>
	<<elseif $dissociation gte 2>>
		<<set $carryblock to "dissociation">>
	<<elseif $panicviolence gte 1>>
		<<set $carryblock to 1>>
	<<elseif $panicparalysis gte 1>>
		<<set $carryblock to 1>>
	<<elseif $trance gte 1>>
		<<set $carryblock to 1>>
	<<else>>
		<<set $carryblock to 0>>
	<</if>>
<</widget>>

<<widget "actioncarry">>
	<<if $carryblock is 0>>
		<<set $leftactioncarry to $leftactiondefault>>
		<<set $rightactioncarry to $rightactiondefault>>
		<<set $feetactioncarry to $feetactiondefault>>
		<<set $mouthactioncarry to $mouthactiondefault>>
		<<set $vaginaactioncarry to $vaginaactiondefault>>
		<<set $penisactioncarry to $penisactiondefault>>
		<<set $anusactioncarry to $anusactiondefault>>
		<<set $thighactioncarry to $thighactiondefault>>
		<<set $cheekactioncarry to $cheekactiondefault>>
		<<set $chestactioncarry to $chestactiondefault>>
	<<elseif $carryblock is "pain">>
		<<set $leftactioncarrypain to $leftactiondefault>>
		<<set $rightactioncarrypain to $rightactiondefault>>
		<<set $feetactioncarrypain to $feetactiondefault>>
		<<set $mouthactioncarrypain to $mouthactiondefault>>
		<<set $vaginaactioncarrypain to $vaginaactiondefault>>
		<<set $penisactioncarrypain to $penisactiondefault>>
		<<set $anusactioncarrypain to $anusactiondefault>>
		<<set $thighactioncarrypain to $thighactiondefault>>
		<<set $cheekactioncarrypain to $cheekactiondefault>>
		<<set $chestactioncarrypain to $chestactiondefault>>
	<<elseif $carryblock is "orgasm">>
		<<set $leftactioncarryorgasm to $leftactiondefault>>
		<<set $rightactioncarryorgasm to $rightactiondefault>>
		<<set $feetactioncarryorgasm to $feetactiondefault>>
		<<set $mouthactioncarryorgasm to $mouthactiondefault>>
		<<set $vaginaactioncarryorgasm to $vaginaactiondefault>>
		<<set $penisactioncarryorgasm to $penisactiondefault>>
		<<set $anusactioncarryorgasm to $anusactiondefault>>
		<<set $thighactioncarryorgasm to $thighactiondefault>>
		<<set $cheekactioncarryorgasm to $cheekactiondefault>>
		<<set $chestactioncarryorgasm to $chestactiondefault>>
	<<elseif $carryblock is "dissociation">>
		<<set $leftactioncarrydissociation to $leftactiondefault>>
		<<set $rightactioncarrydissociation to $rightactiondefault>>
		<<set $feetactioncarrydissociation to $feetactiondefault>>
		<<set $mouthactioncarrydissociation to $mouthactiondefault>>
		<<set $vaginaactioncarrydissociation to $vaginaactiondefault>>
		<<set $penisactioncarrydissociation to $penisactiondefault>>
		<<set $anusactioncarrydissociation to $anusactiondefault>>
		<<set $thighactioncarrydissociation to $thighactiondefault>>
		<<set $cheekactioncarrydissociation to $cheekactiondefault>>
		<<set $chestactioncarrydissociation to $chestactiondefault>>
	<</if>>
	<<set $carryblock to 0>>
<</widget>>

<<widget "actioncarrydrop">>
	<<if $orgasmdown gte 1>>
		<<set $leftactiondefault to $leftactioncarryorgasm>>
		<<set $rightactiondefault to $rightactioncarryorgasm>>
		<<set $feetactiondefault to $feetactioncarryorgasm>>
		<<set $mouthactiondefault to $mouthactioncarryorgasm>>
		<<set $vaginaactiondefault to $vaginaactioncarryorgasm>>
		<<set $penisactiondefault to $penisactioncarryorgasm>>
		<<set $anusactiondefault to $anusactioncarryorgasm>>
		<<set $thighactiondefault to $thighactioncarryorgasm>>
		<<set $cheekactiondefault to $cheekactioncarryorgasm>>
		<<set $chestactiondefault to $chestactioncarryorgasm>>
	<<elseif $pain gte 100 and $willpowerpain is 0>>
		<<set $leftactiondefault to $leftactioncarrypain>>
		<<set $rightactiondefault to $rightactioncarrypain>>
		<<set $feetactiondefault to $feetactioncarrypain>>
		<<set $mouthactiondefault to $mouthactioncarrypain>>
		<<set $vaginaactiondefault to $vaginaactioncarrypain>>
		<<set $penisactiondefault to $penisactioncarrypain>>
		<<set $anusactiondefault to $anusactioncarrypain>>
		<<set $thighactiondefault to $thighactioncarrypain>>
		<<set $cheekactiondefault to $cheekactioncarrypain>>
		<<set $chestactiondefault to $chestactioncarrypain>>
	<<elseif $dissociation gte 2>>
		<<set $leftactiondefault to $leftactioncarrydissociation>>
		<<set $rightactiondefault to $rightactioncarrydissociation>>
		<<set $feetactiondefault to $feetactioncarrydissociation>>
		<<set $mouthactiondefault to $mouthactioncarrydissociation>>
		<<set $vaginaactiondefault to $vaginaactioncarrydissociation>>
		<<set $penisactiondefault to $penisactioncarrydissociation>>
		<<set $anusactiondefault to $anusactioncarrydissociation>>
		<<set $thighactiondefault to $thighactioncarrydissociation>>
		<<set $cheekactiondefault to $cheekactioncarrydissociation>>
		<<set $chestactiondefault to $chestactioncarrydissociation>>
	<<else>>
		<<set $leftactiondefault to $leftactioncarry>>
		<<set $rightactiondefault to $rightactioncarry>>
		<<set $feetactiondefault to $feetactioncarry>>
		<<set $mouthactiondefault to $mouthactioncarry>>
		<<set $vaginaactiondefault to $vaginaactioncarry>>
		<<set $penisactiondefault to $penisactioncarry>>
		<<set $anusactiondefault to $anusactioncarry>>
		<<set $thighactiondefault to $thighactioncarry>>
		<<set $cheekactiondefault to $cheekactioncarry>>
		<<set $chestactiondefault to $chestactioncarry>>
	<</if>>
<</widget>>
:: Widgets Combat Effects [widget]
<<widget "combateffects">>
	<<if $dev is 1>>
		<<if $consensual is 1>>
			<<if $trauma gte $traumasaved>>
				<<set $trauma to ($trauma - (($trauma - $traumasaved) * (($devlevel - 6) * 0.1)))>>
			<</if>>
		<</if>>
	<</if>>
	<<if $trauma gte $traumasaved>>
		<<set $traumagain += ($trauma - $traumasaved)>>
	<</if>>
	<<if $trauma lte 0>>
		<<set $traumasaved to 0>>
	<<else>>
		<<set $traumasaved to $trauma>>
	<</if>>
	<<set $painsaved to $pain>>
	<<if $stress gte $stresssaved>>
		<<set $stressgain += ($stress - $stresssaved)>>
	<</if>>
	<<if $stress lte 0>>
		<<set $stresssaved to 0>>
	<<else>>
		<<set $stresssaved to $stress>>
	<</if>>
<</widget>>