# bed_events
menu_off = 1

!! Bed events trigger after going to lie down on the bed, but before actually lying down in bed (and getting to choose to sleep, get out, read a book, etc)
!!
!! Moved here from bed.
!! When done, move to bed2

	!!=====================================!!
	!!                                     !!
	!!          Event handlers             !!
	!!                                     !!
	!!=====================================!!


if $ARGS[0] = 'start' or $ARGS[0] = '':
	menu_off = 1
	killvar '$sleep_events'
	killvar '$sleep_events_priority'

	if sleepVars['events_active'] = 1:
		sleepVars['events_done'] = 0

		if (hour > 22 or hour < 3) and rand(0, 50) = 0 and houserab = 1 and houserabday ! daystart and pcs_sleep < 50 and $loc = 'nichBedroomServant':
			$sleep_events[] = 'gs ''bed_events'', ''rab'' '
		end
		if (hour > 22 or hour < 3) and rand(0, 200) = 0 and strpos('bedr,bedr2x,korr,korr2x',$loc) > 0 and husband = 0:
			$sleep_events[] = 'gs ''bed_events'', ''vor'' '
		end

		gt 'bed_events', 'mod_sleepevents'
	end

	gt 'bed_events', 'continue'
end

if $ARGS[0] = 'mod_sleepevents':
	!! This location is here to allow mods to hook into the system.
	!! Either check for: if $ARGS[0] = 'bed_events' and $ARGS[1] = 'mod_sleepevents'
	!!
	!! You can add events as: $sleep_events[] = 'gs ''mod_loc'' ''mod_args0'' '
	!! A random event will be chosen from amongst the added ones.
	!! If an event MUST trigger (due to quest timing), add it tp $sleep_events_priority[] = 'gs ''mod_loc'' ''mod_args0'' '
	!!
	!! If the event does not break the sleep cycle (merely interupts it) it needs to end with gs 'bed_events', 'event_end'
	!! If the event removed Sveta from her location (aka her sleep is cut short and/or she leaves her bed), you must call gs 'bed_events', 'exit' before exiting the location
	!!     Example: Act: 'Leave': gs 'bed_events', 'exit' & gt $new_loc, $new_log_arg
	!!
	!! This is to cleanup all necessary variables.
	!!
	!! DO NOT DIRECTLY GOTO/GOSUB OUTOF THIS LOCATION. ALWAYS ADD IT TO THE QUEUEs!!!!
	!! IT WILL ALMOST CERTIANLY END BADLY WHEN MORE THAN 1 MOD IS INVOLVED.

	gs 'LOCA', 'bed_events', 'mod_sleepevents'
	gt 'bed_events', 'event_handler'
end


if $ARGS[0] = 'event_handler':
	if sleepVars['events_done'] < 1:
		if arrsize('$sleep_events_priority') > 0:
			gt 'bed_events', 'event_handler2', 'priority'
		elseif arrsize('$sleep_events') > 0:
			gt 'bed_events', 'event_handler2'
		end
	end

	gt 'bed_events', 'continue'
end

if $ARGS[0] = 'event_handler2':
	sleepVars['events_done'] += 1
	
	if $ARGS[1] = 'priority':
		temp_slev_id = rand(0, arrsize('$sleep_events_priority')-1)
		$temp_sleep_event_chosen = $sleep_events_priority[temp_slev_id]
		killvar '$sleep_events_priority', temp_slev_id
	else
		temp_slev_id = rand(0, arrsize('$sleep_events')-1)
		$temp_sleep_event_chosen = $sleep_events[temp_slev_id]
		killvar '$sleep_events', temp_slev_id
	end

	killvar 'temp_slev_id'
	dynamic $temp_sleep_event_chosen

	gs 'bed_events', 'event_end'
end


if $ARGS[0] = 'event_end':

!!	if arrsize('$sleep_events_priority') > 0:
!!		gt 'bed_events', 'event_handler2', 'priority'
!!	end

	gt 'bed_events', 'event_handler'
end


if $ARGS[0] = 'exit':
	sleepVars['events_done'] = 0
	killvar '$sleep_events'
	killvar '$sleep_events_priority'
	killvar 'temp_slev_id'
	killvar '$temp_sleep_event_chosen'
end

if $ARGS[0] = 'continue':
	sleepVars['events_done'] = 0
	killvar '$sleep_events'
	killvar '$sleep_events_priority'
	killvar 'temp_slev_id'
	killvar '$temp_sleep_event_chosen'

	gt 'bed2', 'start'
end




	!!=====================================!!
	!!                                     !!
	!!              Events                 !!
	!!                                     !!
	!!=====================================!!

if $ARGS[0] = 'rab':
	gt 'bed_events', 'rab2'
end

if $ARGS[0] = 'vor':
	gt 'bed_events', 'vor2'
end

if $ARGS[0] = 'rab2':
	menu_off = 1
	minut += 120
	houserabday = daystart

	'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r0.jpg"></center>'
	'Once you get into bed, your mistress comes into the room. "What, my bitch is going to sleep?" she snaps from the doorway.'
	'"Yes..." you meekly reply.'
	'"Yes, who?" she continues.'
	'"Yes, mistress..." you reply and sit on the bed. She''s drunk and barely able to stand on her feet as she drinks wine from the bottle, spilling quite a bit of it on the floor.'
	'"That''s better, but today you have to be punished." She lifts up her skirt and out pops the strap-on. "Suck it," she commands.'

	act 'Suck it':
		*clr & cla

		if analplugIN = 1: analplugIN = 0 & analplugout = 1
		if pcs_makeup ! 1 and cosmetic_tattoo = 0: pcs_makeup = 0

		'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r1.jpg"></center>'
		'You take the strap-on in your mouth and start sucking her off without much enthusiasm. Mistress, though she''s drunk, notices that you''re not trying and starts to thrust along with your movements, driving it deeper into your mouth and causing you to gag.'
		'"Oh, damn stubborn bitch! Lie down on the bed. Quickly." She forcefully pushes you on the bed.'

		gs 'arousal', 'bj', 5, 'sub', 'lesbian'
		gs 'stat'
		
		act 'Lie down':
			*clr & cla
			'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r2.jpg"></center>'
			'You lay down on the bed and she climbs on top of you and kneels over your face. She makes you open your mouth and forcefully shoves the strap-on in. You try to pull away, but her hands hold your head firmly. She continues to violate your mouth, hardly allowing you to catch a breath of air while she thrust it deeper and deeper, eventually sliding it down your throat, cutting off your breath completely. When you start to lose consciousness, she finally takes it out, allowing you to roll onto your side, wheezing and sniffling.'
			'"And now for the punishment. Get up, bitch!" she demands.'

			gs 'arousal', 'bj', 5, 'sub', 'lesbian', 'rough'
			gs 'stat'
		
			act 'Get up':
				*clr & cla
				'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r3.jpg"></center>'
				'You get up on all fours on the bed. "You''re wet," she says and wipes your saliva on your ass with the strap-on, "You need to be punished, not pleasured. Spread your ass."'
				'You reach back with your hands and try to relax your ass, but you don''t succeed before the pain pierces your body as she forces the strap-on into your anus, not giving your ass the time to get used to it before she starts fucking you at a crazy pace. You grab the blankets with your hands and teeth as tears pour from your eyes and you whine, but she still continues. Growing tired, she lowers the pace. "Well, does it hurt?" she asks.'
				'"Yes mistress, it hurts a lot!" you gasp through your tears.'
				'"Well, let''s see how this feels," she says and starts pouring wine from her bottle onto the strap-on and your ass.'
				'"Thank you, mistress!" you say while she starts gaining momentum again. The wine starts to dry on your skin and hurts so much that you start screaming from the pain. After what feels like an eternity, she tires out, removes the strap-on and leaves the room without saying a word. You collapse on the bed and fall asleep.'

				gs 'arousal', 'anal_strap', 5, 'sub', 'lesbian', 'rough'
				gs 'arousal', 'end'
				gs 'stat'

				act 'Sleep': gs 'bed_events', 'event_end'
			end
		end
	end

	gs 'willpower', 'sex', 'resist', 'medium'
	if pcs_willpwr < will_cost:
		act 'Refuse (<font color="red"><<will_cost>> Willpower</font>)': '<br><font color="red">You don''t have enough willpower to use this action.</font>'
	else
		act 'Refuse (<<will_cost>> Willpower)':
			*clr & cla
			gs 'willpower', 'pay', 'resist'
			gs 'stat'
			lesbian += 1
			orgasm += 1
			houserab = 2
			gs 'stat'

			'<center><img <<$set_imgh>> src="images/characters/city/nicholas/sex/r4.jpg"></center>'
			'"No!" you reply.'
			'"You will suck now or things will get very bad for you!" she asserts.'
			'"No!" you answer again.'
			'"All right, you asked for it!" she screams and swings a fist, trying to hit you. You easily dodge the punch and kick her in the stomach.'
			'"Bitch!" she moans while doubling over. You''ve suffered enough and jump out of bed, grabbing her head in your hands and kneeing her in the face.'
			'She flies into the corner, but you don''t calm down. Remembering the taste of her dirty boots and sneakers, you storm up to her and start pushing a sneaker into her mouth.'
			*nl
			'When you can''t shove it in any further, you throw the sneaker aside, grab her hair and throw her onto the bed.'
			'You jump on the bed, straddle her face and push your pussy against her mouth. "Eat me, bitch!" you yell as she tries to push you away.'
			'You have her head held tight between your thighs, however, and continue yelling. You soon feel her tongue on your pussy and start moving your hips, grinding on her face and increasing the pace.'
			'She doesn''t resist and tries to stick it in your pussy. You start enjoying her submissive nature and get more excited thinking about your dominant actions.'
			'You''ve even thought about something to do with her strap-on and enjoying this thought when you orgasm. You wipe your crotch in her face and finish, leaving her whole face covered in your juices.'
			*nl
			'She quietly gets out of bed, straightens her clothes and leaves the room. "Animal." You should be careful; who knows what she will do to you in return.'

			$orgasm_or = 'yes'
			gs 'arousal', 'cuni', 20, 'dom', 'rough'
			gs 'arousal', 'end'
			gs 'stat'

			act 'Breathe': gs 'bed_events', 'event_end'
		end
	end
end

if $ARGS[0] = 'vor2':
	menu_off = 1
	if rex['owned'] = 0:
		'You''re lying in bed when you hear sounds from the hallway. You decide to get up and as you get to the door, you see two masked men.'
		act 'Scream': gt 'bed_events', 'vor3'

	else
		if dog_bravery = 0: 
			dog_bravery = rand(1,100)
		end

		if dog_bravery < 50:
			'You''re lying in bed when you hear sounds from the hallway. You decide to get up and as you get to the door you see two masked men. <<$rex[''name'']>> is shivering in the corner.'
			act 'Scream': gt 'bed_events', 'vor3'
		else
			minut += 10
			'You''re lying in bed when you suddenly hear a commotion out in the hallway. You get up to check it out and as you arrive, you see <<$rex[''name'']>> chase two masked men outside. You can hear loud swearing as they run down the stairs.'
			'You call your dog''s name and he comes back from the stairway looking calm.'

			act 'Hug him':
				'You kneel down and hug <<$rex[''name'']>>, your heart pounding at the thought of what could have happened if he wasn''t here.'
				delact 'Hug him'
			end

			act 'Check the lock':
				cla
				'You check the lock on the door and it appears to be intact. You''re not sure if you forgot to lock the door when you came in or if the lock was picked. Maybe you should have a second one installed...'
				act 'Lock the door': 
					gs 'bed_events', 'exit'
					gt 'korr'
				end
			end
		end
	end
end


if $ARGS[0] = 'vor3':
	menu_off = 1
	minut += 60
	'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sex/g0.jpg"></center>'
	'You don''t even have time to open your mouth to scream when a knife is at your throat. "Scream and I''ll cut you, bitch!" one of them croaks.'
	'They tie your hands and one goes to search your apartment while the second guards you. He sits down and studies you, then starts running his knife across your body.'
	'"You scared?" he asks. Thinking that it''s better to keep silent, you say nothing and look at the floor. "So you <i>are</i> scared..."'
	'He starts feeling you up and you try to pull away, but the knife is back at your throat. "Sit still or the knife might slip. Fatally..." he croaks and continues feeling you up.'
	'The other intruder finally returns. "Time we got out of here," he says. "Unless we give this juicy little morsel a treat," he adds as he sits next to you.'

	if pcs_apprnc < 120:
		'"Gag her," one of them orders and the second one doesn''t argue as he takes some of your clothes and stuffs them in your mouth. "If you try to leave in the next half hour, you''re dead," he says and they leave.'
		'You don''t wait half an hour before you start trying to break free. Fortunately, they really didn''t know how to tie a knot and you''re soon free.'

		act 'Assess the damage': gt 'bed_events', 'vorend'

	else
		guy += 2
		rape += 1
		'"Hey, sweet cheeks. Something tells me you like to fuck," the first one says.'

		act 'Plead':
			*clr & cla
			'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sex/g1.jpg"></center>'
			'You''re struck with fear. "Kneel down and open your mouth, whore. If we so much as feel a tooth, I''ll cut your throat from ear to ear!" the second one says while pulling his cock out.'
			'You start pleading with them, but they just push you to your knees and he jabs his dick against your lips. You reluctantly open your mouth and his cock slides into your mouth.'
			'His hands clench your head and he starts fucking your face before they start taking turns with you.'
			'"Get her on all fours," one of them eventually commands.'

			gs 'arousal', 'bj', 15, 'rough', 'sub', 'group', 'bound'
			gs 'stat'
			
			act 'Get up':
				*clr & cla
				orgasm += 1
				gs 'npcgeneratec', 0, 'Rapist', rand(18,40)
				$boy[0] = $npclastgenerated
				$boydesc[0] = $npc_usedname[$npclastgenerated]

				gs 'npcgeneratec', 0, 'Rapist', rand(18,40)
				$boy[1] = $npclastgenerated
				$boydesc[1] = $npc_usedname[$npclastgenerated]

				'<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sex/g2.jpg"></center>'
				'You stand up and bend over as one of them stands behind you and stuffs his dick into your pussy.'
				'"Open your mouth!" the second guy growls and he inserts his dick into your mouth. They proceed to rape you from both sides before they untie your hands and get off you. "Let''s see what she can do with her hands free," one of them says.'

				$orgasm_or = 'yes'
				gs 'arousal', 'bj', 15, 'rough', 'sub', 'group', 'bound'
				gs 'arousal', 'vaginal', 15, 'rough', 'sub', 'group', 'bound'
				minut -= 15
				gs 'stat'
			
				act 'Continue': 
					picrand = 38
					gs 'bed_events', 'exit'
					xgt 'sexdvoe', 'var'
				end
			end
		end
	end
end


if $ARGS[0] = 'vorend':
	*clr & cla
	menu_off = 1
	if remsitr = 0: '<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sitr.jpg"></center>'
	if remsitr = 1: '<center><img <<$set_imgh>> src="images/locations/city/residential/apartment/sitr2.jpg"></center>'

	'Relieved that it''s over, you check your apartment to see what''s missing.'

	if stolmoney > 0:
		'They took <<stolmoney>> <b>₽</b> from your living room table.'
		stolmoney = 0
	end

	if money > 0:
		'They took the <<money>> <b>₽</b> that you had on you.'
		money = 0
	end

	if mc_inventory['tech_computer'] = 1:
		'They took your computer.'
		mc_inventory['tech_computer'] = 0
	end

	gs 'stat'
	act 'Finish': gs 'bed_events', 'event_end'
end


if $ARGS[0] = 'mast':
	menu_off = 1
	if pcs_inhib < 30: inhib_exp += rand(1,3)
	pcs_mood += 15
	pcs_vag += 1

	if husband = 0 or strpos('bedr,bedr2x,korr,korr2x',$loc) <= 0 or husbandrink = 10:
		gs 'bed_events', 'exit'
		gt 'selfplay', 'start'
	else
		if mc_inventory['dildo_small'] = 0:
			if week > 5 or week < 6 and hour > 16:
				'You feel the need for something inside you and think that your husband would be a better option.'
			else
				gs 'bed_events', 'exit'
				gt 'selfplay', 'start'
			end
		else
			if week <= 5 and hour <= 15:
				'<center><video autoplay loop src="images/shared/sex/mast/mastr.mp4"></video></center>'
				'Unable to control yourself anymore, you immediately reach for your dildo so you can finally take care of your lustful desires. You waste no time and attach the suction base of the dildo onto the floor before slowly lowering yourself.'
				'Shivers run down your spine as you feel the thick head spreading your pussy lips and soon the whole length starts to slide deep inside your hole. A throaty moan overwhelms the room when it finally bottoms out inside you, sending you to the heavens and back.'
				'After shifting your legs and getting more comfortable, you start to rock your hips and bounce on it, moaning louder and louder as you keep increasing the power and pace of your thrusts. You''re soon hammering your ass against the cold floor time and it takes you just a few minutes to reach orgasm, your toes curling tightly as a wonderful feeling run through your entire body.'
				'You''re soon twitching on the dildo and juices drip down its length, soaking the floor beneath you. You take a few deep breaths and a smile grows along your face. That was just what you needed!'
				$orgasm_or = 'custom'
				gs 'arousal', 'vaginal_dildo', 10, 'masturbate'
				gs 'arousal', 'end'
				
				act 'Breathe': gs 'bed_events', 'event_end'

			else
				'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m21.jpg"></center>'
				'You bend over and start fucking your pussy with your dildo.'
				gs 'arousal', 'vaginal_dildo', 15
				gs 'stat'

				if hour > 22 or hour < 7:'<<$husName>> looks at you, a little dumbfounded.'
				if hour >= 7 and hour <= 22:'Once you get into it, <<$husName>> enters the room.'
				if harakHusb = 0:
					'"What are you doing?" he asks.'
					'"I''m sorry dear, but I really need it, and you''ve been busy," you reply without stopping.'
					'"How often do you do this?" he asks.'
					'"Quite often, sometimes in my ass. you want to see?" you ask.'
					if izvratH = 0:
						husband -= 1
						'"I''ll wait outside the door until you''re done," he says and leaves. You continue to satisfy yourself rapidly, and soon finish.'
						$orgasm_or = 'yes'
						gs 'arousal', 'clit_finger', 5, 'masturbate'
						gs 'arousal', 'end'
						gs 'stat'

						act 'Finish': gs 'bed_events', 'event_end'

					elseif izvratH = 1:
						'"Oh. I don''t know..." he stammers.'
						'"Come on," you encourage him.'

						act 'Show him':
							*clr & cla
							'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m22.jpg"></center>'
							'You pull the dildo out of your pussy and, winking at your husband, insert it into your ass. <<$husName>> watches closely as the dildo disappears into your ass.'
							'You see how his pants swell. "Anything else you want, dear?" you ask while smiling.'
							'"Can I join?" he asks, a little embarrassed.'
							gs 'arousal', 'anal_dildo', 5, 'masturbate'
							gs 'stat'

							act 'Invite':
								*clr & cla
								'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m23.jpg"></center>'
								'<<$husName>> gets his dick out and starts masturbating. It''s not what you expected and you feel a little sad that he isn''t fucking you as you start to masturbate.'
								'You watch your husband masturbate as he watches you, his face covered in pleasure, before you scream and fall on the table, having experienced an orgasm.'
								'<<$husName>> is still masturbating, looking at you stretched out on the table before you take the dildo out of your ass and start lick it while looking into his eyes.'
								'The spectacle has him immediately cum all over the floor before you walk over to him and kiss him on the lips. He passionately kisses you back.'
								gs 'arousal', 'anal_dildo', 5, 'masturbate'
								$orgasm_or = 'custom'
								gs 'arousal', 'end'
								gs 'stat'
						
								act 'Finish': gs 'bed_events', 'event_end'
							end
						end
					end

				elseif harakHusb = 1:
					'"Are you trying to tell me that I''m not enough to satisfy you?" He asks.'
					'"I''m sorry dear, but I really need this, and you''ve been busy," you reply without stopping.'
					'"Well then, show me everything now that you know I''ll watch," he says.'
					'"Want to see me do it in the ass too?" you offer.'

					if izvratH = 0:
						husband += 1
						husbizvradd += 1
						'"No, I think this is enough," he says as he sits on a chair and starts watching you. You continue to satisfy yourself rapidly and soon finish in front of him.'
						$orgasm_or = 'yes'
						gs 'arousal', 'clit_finger', 5, 'masturbate'
						gs 'arousal', 'end'
						gs 'stat'
						'<<$husName>> stands up and playfully claps. "Bravo! Encore?" he laughs.'
						'"Anything for such a lovely audience, but first an intermission," you laugh and <<$husName>> helps you down from the table.'

						act 'Finish': gs 'bed_events', 'event_end'

					elseif izvratH = 1:
						husband += 1
						'"Well then, I think you better show me," he says.'
						'"As you wish," you reply.'

						act 'Show':
							*clr & cla
							'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m22.jpg"></center>'
							'You pull the dildo out of your pussy and, winking at your husband, insert it into your ass. <<$husName>> watches closely as you slide the dildo in and out of your ass.'
							'You see how his pants swell. "Anything else you want, dear?" you ask while smiling.'
							'"I don''t just want something, I''ll do something!" he replies, unbuttoning his pants and brings his cock to your mouth.'
							gs 'arousal', 'anal_dildo', 5
							gs 'stat'

							act 'Suck him':
								*clr & cla
								'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m24.jpg"></center>'
								'You take his flaccid penis in your mouth and start sucking while continuing to drive the dildo into your ass.'
								'When his cock has finally hardened, <<$husName>> stops you. "Now I''ll take this hole."'
								gs 'arousal', 'clit_finger', 5
								gs 'arousal', 'bj', -5
								gs 'stat'

								act 'Get fucked in the ass':
									picrand = 89
									gs 'bed_events', 'exit'
									gt 'sex', 'anal'
								end
							end
						end

					else
						'"Itchy hole?" he asks.'
						'"I''m sorry dear, but I really need it, and you''ve been busy," you reply without stopping.'

						if izvratH = 0:
							husband += 1
							husbizvradd += 1
							'"You should have said something. Now open your mouth," he says while pulling out his cock and forcefully pushing it into your mouth.'
							'He holds you by the hair and fucks your mouth, telling you not to stop masturbating before he tires of your mouth. "Enough of this rubber shit! I''m going to fuck you."'
							gs 'arousal', 'vaginal_dildo', 10
							gs 'arousal', 'bj', -10
							gs 'stat'
						
							act 'Spread your legs ':
								picrand = 89
								gs 'bed_events', 'exit'
								gt 'sex', 'vag'
							end

						else
							husband += 1
							'"You''re going to insert this stupid toy into your pussy, ass and mouth. You''ll pulverize them for as long as I like," he says while sitting down to watch.'
							'You quickly and submissively do as you''re told.'
							gs 'arousal', 'vaginal_dildo', 5
							gs 'arousal', 'anal_dildo', -5
							gs 'stat'

							act 'Offer your mouth':
								*clr & cla
								'<center><img <<$set_imgh>> src="images/characters/city/husband/sex/m24.jpg"></center>'
								'Still using the dildo on your pussy and ass, you offer <<$husName>> your mouth. He gets up and walks over to you.'
								'You take his flaccid penis and start sucking until his cock is finally hard and he stops you. "Now I''ll fuck your ass."'
								gs 'arousal', 'vaginal_dildo', 5
								gs 'arousal', 'anal_dildo', 5
								gs 'arousal', 'bj', -10
								gs 'stat'
								
								act 'Offer your ass':
									picrand = 89
									gs 'bed_events', 'exit'
									gt 'sex', 'anal'
								end
							end
						end
					end
				end
			end
		end
	end
end

--- bed_events ---------------------------------
