# cikl

!!------------------------------------------------------------------------------------------------------------
!!	Masseuse Job (MUST COME BEFORE DAY CHANGES)
!!------------------------------------------------------------------------------------------------------------
if masseuse['jobtype'] < 1:
	masseuse['<<week>>_shift_1'] = 0
	masseuse['<<week>>_shift_2'] = 0
	masseuse['<<week>>_shift_3'] = 0
end

if (masseuse['<<week>>_shift_1'] ! 0 or masseuse['<<week>>_shift_2'] ! 0 or masseuse['<<week>>_shift_3'] ! 0) and masseuse['last_worked_day'] ! daystart:
	masseuse['missed_shift2'] = 1
end



!!----------------------------------------------------------------------------
!! Time calculations
!! day = day in this month
!! week = day in the week. 1 == Monday
!! hour = Full hour in this day

day += 1
week += 1
hour -= 24

if day > monthsEnd[month]:
	day -= monthsEnd[month]
	month += 1

	!! Changing the year at new year and making sure February have the correct number of days.
	if month > 12: 
		month = 1
		year += 1
		if ((year mod 4 = 0) and (year mod 100 ! 0)) or (year mod 400 = 0): 
			monthsend[2] = 29
		else
			monthsend[2] = 28
		end
	end

	!!MJ: Don''t think that one is needed. But it was in the original loop.
	if month < 1: month = 1

	$month = $monthName[month]

	!! new years party calculation
	temp = func('shortgs','dow',year,12,31)
	if temp < 6:
		nyp_day = 31
	elseif temp = 6:
		nyp_day = 30
	else
		nyp_day = 29
	end

end

!!MJ: Don''t think that one is needed. But it was here already.
if day <= 0:day = 1

ciklNewWeek = 0
if week > 7:
	odd_week = iif(odd_week,0,1)
	ciklNewWeek = 1
	:loopweek
	week -= 7
	husbandrink = 0

	if military = 1:military = 0

	if week > 7:jump 'loopweek'
end

gs 'daystart'

gs 'yearstart'

gs 'emp_functions', 'evt_day_suffix'
$stat_day_suffix = $date_suffix
killvar '$date_suffix'
!!----------------------------------------------------------------------------

!!Fame call to update all the fame variables
gs 'fame'

!!Cycle stats for Contacts
gs 'telefon', 'DailyStatRefresh', ciklNewWeek

!!moving the porn schedule ahead a day, flaffing for missed shootings, if it even matters
if (film > 0 or pornstack = 1) and pfilmNO = 0 and pfilmSTOP = 0:
	if pfilmday[0] > 0: gs 'pornschedule', 'pornmiss'
	gs 'pornschedule', 'schedule'
end

!! set the time when the SMS will be send
gs 'booty_call', 'scheduler'
booty_call_time['daystart'] = daystart


!!------------------------------------------------------------------------------------------------------------
!!	Job Stuff
!!------------------------------------------------------------------------------------------------------------

!! masseuse paycheck
if masseuse['weeks_pay'] > 0 and week = 5:masseuse['paycheck'] = 1

if masseuse['jobtype'] > 0 and week = 5 and masseuse['weeks_pay'] > 0:
	masseuse['payday'] = 1
end

if week = 7 and masseuse['schedule_update'] ! daystart: gs 'masseuse_schedule','schedule_reset'

!!modelling check
if model_week ! (daystart - week) / 7 and model['status'] > 0: model_job_week = 0

!!acting strings to set available jobs
if casting = 1:
	acting_string1 = rand(10000000,199999999)
	acting_string2 = rand(10000000,199999999)
end

!! terminate tour gide job when its off season
if emp_job_status[1] = 1 and month < 6 and month > 8:
	if work = 1: work = 0
	emp_job_status[1]  = 4
end

dynamic $hypnoDaychange

!!phone reset for bf
ringA = 0
ringB = 0
ringC = 0

!!Appearance Age
vidageday -= 1
if vidageday <= 0:
	vidageday = 360
	vidage += 1
end
!!Birthday
age = year - ((pcs_dob - (pcs_dob mod 10000)) / 10000)
if ((month * 100) + day) <= pcs_dob mod 10000: age -= 1
if birthday = day and birthmonth = month and model['age'] > 0:model['age'] += 1

if workDolgDay > 0: workDolgDay -= 1
if QWdogreiqTimer > 0: QWdogreiqTimer -= 1
if husband > 0: husbanday += 1
if husband > 10 and husbanday > 0: husband -= 15
if fingal > 0: fingal -= 1

if husbandMark = 1 and husband <= 10:
	husbizvradd = 0
	husbharmin = 0
	husbandMark = 0
	husband = 0
	divorced += 1

	if KFOnLineReaga > 0:KFOnLineReaga -= 1

	'<b><font color="red">Your husband has filed for a divorce.</font></b>'
end

!! after having surgery you will be in recuperation for a few days

if surgeryday ! '':
	if daystart - 7 <= surgeryday:
		dailyhealthimprov = (daystart - surgeryday) * 50
		pcs_health = dailyhealthimprov
		recuperation = 1
	else
		killvar 'recuperation'
		killvar 'dailyhealthimprov'
	end
end

!!Street events daily reset
streetevent_hour = -2

!!Clothing stock and price randomizers
Clothingstock = rand (0,23)
i = 1
:loopprice
Clothingstock[i] = rand (0,500)
i += 1
if i <= 147:jump 'loopprice'

if dyneval ('RESULT = <<$coatworntype>>_coats_h[<<coatwornnumber>>]') <= 0: $coatworntype = 'none'

!! Abortion and pregnancy recovery resets if finished

if abortionbirthdate ! 0 and daystart - abortionbirthdate > 24: abortionbirthdate = 0
if pregbirthdate ! 0 and daystart - pregbirthdate > 73: pregbirthdate = 0

!!------------------------------------------------------------------------------------------------------------
!!	Nympho
!!------------------------------------------------------------------------------------------------------------

!! Reserved for nympho trait
if nymphosex_flag = 1:
end

nymphosex_flag = 0

!!------------------------------------------------------------------------------------------------------------
!!	Bimbo
!!------------------------------------------------------------------------------------------------------------

!!bimbo flag set in stat_display if bimbo clothing, shoes and makeup are worn at same time
if succubusflag = 0 or CheatBimbo2 = 1: 
	if cheatBimbo = 0 and bimbo_flag = 1: 
		bimbo += 1
	end
end

!!Once bimbolevel is set to 1, must use the withdrawal in stat to return to 0
if bimbo > 0 or bimbolevel > 0:
	if bimbo < 10:
		if bimbo_flag = 0:
			bimbo -= 2
		end
	elseif bimbo < 20:
		bimbolevel = 1
	elseif bimbo < 30:
		bimbolevel = 2
	else
		bimbolevel = 3
	end
end

if bimbo >= 40: bimbo = 40

!!Bimbo levels. They use custom variables so they won''t permanently change character stats
if bimbolevel = 0: supnatvnesh = 0 & bimbostupidity = 0
if  CheatBimbo2 = 0:
	if bimbolevel = 1: supnatvnesh = 2 & bimbostupidity = (pcs_intel / 6)
	if bimbolevel = 2: supnatvnesh = 2 & bimbostupidity = (pcs_intel / 4)
	if bimbolevel = 3: supnatvnesh = 4 & bimbostupidity = (pcs_intel / 3)
elseif CheatBimbo2 = 1:
	if bimbolevel = 1: supnatvnesh = 2 & bimbostupidity = 0
	if bimbolevel = 2: supnatvnesh = 2 & bimbostupidity = 0
	if bimbolevel = 3: supnatvnesh = 4 & bimbostupidity = 0
end

!!A Succubus cannot be a Bimbo
if succubusflag = 1 and CheatBimbo3 = 0:
	if bimbolevel > 0 and bimbo > 0: bimbowithdrawal = 40
elseif bimbolevel >= 1:
!!Checks flag and adds withdrawal if 0
	if bimbo_flag = 0:
		bimbowithdrawal += 1
	else
		bimbowithdrawal = 0
	end
end

if bimbo < 0: bimbo = 0

!! flag reset
bimbo_flag = 0


!!------------------------------------------------------------------------------------------------------------
!!	Butt slut
!!------------------------------------------------------------------------------------------------------------

if orgasm_anal > orgasm_anal[1]:
	if pcs_traits['buttslut_lvl'] > 0: pcs_traits['buttslut_exp'] += orgasm_anal - orgasm_anal[1]
else
	if pcs_traits['buttslut_exp'] > 1: pcs_traits['buttslut_exp'] -= 1
end
orgasm_anal[1] = orgasm_anal
if orgasm_anal > 10 and pcs_traits['buttslut_lvl'] = 0: pcs_traits['buttslut_lvl'] = 1
if pcs_traits['buttslut_exp'] >= 15 and pcs_traits['buttslut_lvl'] = 1: pcs_traits['buttslut_lvl'] = 2 & pcs_traits['buttslut_exp'] = 0
if pcs_traits['buttslut_exp'] >= 50 and pcs_traits['buttslut_lvl'] = 2: pcs_traits['buttslut_lvl'] = 3
if pcs_traits['buttslut_exp'] <= 0 and pcs_traits['buttslut_lvl'] = 3: pcs_traits['buttslut_lvl'] = 2 & pcs_traits['buttslut_exp'] = 0

!!------------------------------------------------------------------------------------------------------------
!!	Exhibitionism
!!------------------------------------------------------------------------------------------------------------

if pcs_exhib > 0 or exhibitionist_lvl > 0:
	if pcs_exhib < 10:
		pcs_exhib -= 1
	elseif pcs_exhib < 50:
		exhibitionist_lvl = 1
	elseif pcs_exhib < 100 or exhibitionQW < 3:
		exhibitionist_lvl = 2
	elseif exhibitionQW > 2:
		exhibitionist_lvl = 3
	end
end

!!Inhibition increases from wearing revealing clothing

if exhibition_outdoors > 0:
	if pcs_inhib > 90:
		exhibition_outdoors = exhibition_outdoors * 3
	elseif pcs_inhib > 75:
		exhibition_outdoors = exhibition_outdoors * 5 / 2
	elseif pcs_inhib > 60:
		exhibition_outdoors = exhibition_outdoors * 2
	elseif pcs_inhib > 30:
		exhibition_outdoors = exhibition_outdoors * 3 / 2
	end

	if exhibition_outdoors <= 5:
		inhib_exp += rand(3,6)
	elseif exhibition_outdoors <= 10:
		inhib_exp += rand(5,9)
	elseif exhibition_outdoors <= 15:
		inhib_exp += rand(7,12)
	elseif exhibition_outdoors <= 20:
		inhib_exp += rand(9,15)
	elseif exhibition_outdoors <= 25:
		inhib_exp += rand(12,20)
	elseif exhibition_outdoors <= 30:
		inhib_exp += rand(16,25)
	elseif exhibition_outdoors <= 35:
		inhib_exp += rand(20,30)
	elseif exhibition_outdoors <= 40:
		inhib_exp += rand(25,40)
	elseif exhibition_outdoors <= 50:
		inhib_exp += rand(35,50)
	elseif exhibition_outdoors <= 65:
		inhib_exp += rand(50,75)
	else
		inhib_exp += rand(70,100)
	end
end

exhibition_outdoors = 0


!!------------------------------------------------------------------------------------------------------------
!!	Everything is new again
!!------------------------------------------------------------------------------------------------------------

!!Trait ''Everything is new again'', gained from the sg_tg start
!! starts at 84 and decreases by 1 every day, when reaches 0 the trait will get disabled
if pcs_traits['new_again'] > 0: pcs_traits['new_again'] -= 1

!!------------------------------------------------------------------------------------------------------------
!!	Succubus Level & hunger calcs
!!------------------------------------------------------------------------------------------------------------
if succubusflag = 1: gs 'succubus','cikl'
!!------------------------------------------------------------------------------------------------------------

if defcurly = 0 and curly > 0:curly -= 1
if defcurly = 1:
	if straight > 0: straight -= 1
	if straight = 0: curly = 2147483647
end

gs 'sweat', 'add', 2

if pcs_tan > 0: pcs_tan -= 1

if prezikmsg = 2: prezikmsg = 3


gs 'fertility', 'daily_update'


!!------------------------------------------------------------------------------------------------------------

if pcs_breath = 1:pcs_breath = 0

if cheatNoEat = 1 and dounspell = 1:fat += 15

!!Trauma decay
if mood_trauma > 0: mood_trauma -= 1

!!STD check
if SifacOnce = 1:Sifilis += 1
if GerpesOnce = 1:Gerpes += 1
if TriperOnce = 1:
	if Triper > 0:
		Triper += 1
	end
	if TriperOral > 0:
		TriperOral += 1
	end
	If TriperOral > 14 and TriperNapr = 0:
		if rand(TriperOral,100) > 80:
		TriperOral = 0
		if Triper = 0:TriperOnce = 0
		TriperOralSigns = 0
		end
	end
end
if KandidozOnce = 1:Kandidoz += 1

Venera = 0
if SifacOnce = 1: Venera += 1
if GerpesOnce = 1: Venera += 1
if TriperOnce = 1: Venera += 1

!! Fail safe
if ashrinkdays = 0: ashrinkdays = 6
if vshrinkdays = 0: vshrinkdays = 6

if pcs_ass > 1 and ashrink > 0 and analplugIN = 0:
	if daystart mod(ashrinkdays) = 0: pcs_ass -= ashrink
	if pcs_ass < 0: pcs_ass = 0
end
if pcs_vag > 10 and vshrink > 0:
	if daystart mod(vshrinkdays) = 0: pcs_vag -= vshrink
	if pcs_vag < 0: pcs_vag = 0
end

lipkoef -= rand(0,1)
if lipkoef <= 0: lipkoef = 0

if isprok = 1 or isprokp = 1:
	isprok_lastday = 1
else
	isprok_lastday = 0
end

if Enable_auto_tampons =  0 and isprok = 1: isprok = 0 & 'You threw away your used tampon.'
if Enable_auto_tampons =  0 and isprokp = 1:isprokp = 0 & 'You threw away your used sanitary pad.'

if lactation['nipgrowth'] > 0:
	tmp = rand(0,2)
	pcs_nips -= tmp
	lactation['nipgrowth'] -= tmp
	killvar 'tmp'
elseif lactation['nipgrowth'] < 0:
	lactation['nipgrowth'] = 0
end

if preg = 1:
	pregtime = pregchem / 24

	if pregtimes = 0:pregtimes = 1

	elseif preg = 2 and pregminut < totminut:
	if Enable_nogameover = 0 :
		cla
		*clr
		over = 4
		MSG '<center><b>A horrible pain shoots through your body.</b></center>'
		xgt 'gameover'
		exit
	else
		MSG'<font color=red><B>You should die for giving birth unprepared, but Cheat Mode keeps you Alive.</B></font>'
		pregminut = totminut + 1440
	end
elseif preg = 0:
	gs 'shortgs', 'remove_array_element', 'npc_pregtalk','A14'
	gs 'shortgs', 'remove_array_element', 'npc_pregtalk','A16'
	gs 'shortgs', 'remove_array_element', 'npc_pregtalk','A23'
	gs 'shortgs', 'remove_array_element', 'npc_pregtalk','A28'
	gs 'shortgs', 'remove_array_element', 'npc_pregtalk','A29'
	gs 'shortgs', 'remove_array_element', 'npc_pregtalk','A33'
	gs 'shortgs', 'remove_array_element', 'npc_pregtalk','A34'
	gs 'shortgs', 'remove_array_element', 'npc_pregtalk','A69'
	gs 'shortgs', 'remove_array_element', 'npc_pregtalk','A131'

	!{killvar 'pregTalkFamily' -- Do not kill this (Abortion talk).}

	killvar 'pcs_pregtalk'
	killvar 'pregTalk'
	killvar 'pregtime'
	killvar 'knowpreg'
	killvar 'denypreg'
	killvar '$wombthfath'
end

!!------------------------------------------------------------------------------------------------------------
!!	Arousal
!!------------------------------------------------------------------------------------------------------------

if $start_type[1] ! 'nomagic':
	if pcs_horny < 100:pcs_horny += pcs_vag
else
	if stat['think_virgin'] = 1:
		razeba = 0

		if pcs_horny > 0 and pcs_horny <= 50:pcs_horny -= 10
		if pcs_horny > 50:pcs_horny -= 25
	elseif stat['think_virgin'] = 0:
		if pregtimes = 0:
			if age < 18:
				razeba = 1

				if pcs_horny > 0 and pcs_horny <= 50:pcs_horny -= 5
				if pcs_horny > 50 and pcs_horny < 80:pcs_horny -= 10
				if pcs_horny >= 80:pcs_horny -= 20
			elseif age >= 18 and age < 21:
				razeba = 2

				if pcs_horny > 0 and pcs_horny <= 50:pcs_horny -= 1
				if pcs_horny > 50 and pcs_horny < 80:pcs_horny -= 5
				if pcs_horny >= 80:pcs_horny -= 10
			elseif age >= 21 and age < 25:
				razeba = 3

				if pcs_horny > 0 and pcs_horny <= 50:pcs_horny += 1
				if pcs_horny > 50 and pcs_horny < 80:pcs_horny -= 1
				if pcs_horny >= 80:pcs_horny -= 5
			elseif age >= 25 and age < 30:
				razeba = 4

				if pcs_horny > 0 and pcs_horny <= 50:pcs_horny += 5
				if pcs_horny > 50 and pcs_horny < 80:pcs_horny += 1
				if pcs_horny >= 80:pcs_horny -= 5
			elseif age >= 30:
				razeba = 5

				if pcs_horny > 0 and pcs_horny <= 50:pcs_horny += 10
				if pcs_horny > 50 and pcs_horny < 80:pcs_horny += 5
				if pcs_horny >= 80:pcs_horny += 1
			end
		elseif pregtimes > 0:
			if preg = 0:
				razeba = 5

				if pcs_horny > 0 and pcs_horny <= 50:pcs_horny += 10
				if pcs_horny > 50 and pcs_horny < 80:pcs_horny += 5
				if pcs_horny >= 80:pcs_horny += 1
			elseif preg > 0:
				razeba = 6

				if pcs_horny < 100:pcs_horny += pregchem / 240
			end
		end
	end
end

if pcs_horny < 0:pcs_horny = 0

!!------------------------------------------------------------------------------------------------------------

!reset Natasha Belova''s clothes
if NatbelQW['seethroughwearing'] = 1: NatbelQW['seethroughwearing'] = 0

!!------------------------------------------------------------------------------------------------------------

!counter for Dimka avoidance
if dimaFilm = 1 and dimaRudeBlock = 0:
	nodimkaK += 1
	DimkaWarnedToday = 0
end

!!------------------------------------------------------------------------------------------------------------

!!Fame degradation
gs 'fame', 'deg'

!!Traits
gs 'traits', 'overnight'


!!------------------------------------------------------------------------------------------------------------

!! Clothing wear and tear
gs 'starenie'


if pregchem > 240:fat += 1

!!------------------------------------------------------------------------------------------------------------
!!	Pain
!!------------------------------------------------------------------------------------------------------------

if painpub = 2:
	if painpubday + 5 < daystart:
		$painpub = 'Your vulva is painfully sore.'
		painpub = 1
		painpubday = daystart
	elseif painpubday + 5 >= daystart:
		$painpub = 'Your vulva is painfully sore.'
	end
elseif painpub = 1:
	if painpubday + 5 < daystart:
		$painpub = ''
		painpub = 0
		painpubday = daystart
	elseif painpubday + 5 >= daystart:
		$painpub = 'Your vulva is a little sore.'
	end
end


prezikProver += 1
if pirs_pain_ton > 0:pirs_pain_ton -= 1
if shorthair = 1:
	shorthairday += 1
	if shorthairday >= 45:shorthairday = 0 & shorthair = 0
end
!!------------------------------------------------------------------------------------------------------------

!!Resetting the counter for relationship modifications that are limited in how many time a day they can be applied.
killvar 'npc_rel_daily'

!!Resetting the counters for npc reactions after certain time periods have passed.
gs 'npc_reactions', 'cikl'

!! Setting the day for nerd game nights
gs 'nerd_game_night', 'cikl'

!!Keeping Christina hating Sveta
gs 'Zvereva_events', 'cikl'

!!Albina hates gopniks while at school
if SchoolAtestat = 0 and grupTipe = 4 and AlbinaQW['Friends'] ! 2 and npc_rel['A23'] > 20:
	gs 'npc_relationship', 'set', 'A23', 20
end

!!if Vitek''s ex he never forgives her
if kotovLoveQW = -1:
	gs 'npc_relationship', 'set', 'A9', 0
end

!!Updating Katja''s variables.
gs 'katja_procedural', 'cikl'

if npc_rel['A69'] > 60 and rand(0,3) = 0:npc_rel['A69'] -= 1

!!Making Sonia''s fall progress if the player do not see the scenes at the disco, by making it such that if at a Sunday her fall have not advanced this weekend it will automatically advance.
gs 'soniadisco', 'cikl'

dmishaevent = 0

if Gspravka <= 0 and GspravkaT = 1:GspravkaT = 0 & Gspravka = 0
if GspravkaT = 1:Gspravka -= 1

if BurgerQW['IlyQW'] = 2 and BurgerQW['IlyQWPoliceDayCount'] > 0 and BurgerQW['IlyQWPoliceDayCount'] < 30: 
	BurgerQW['IlyQWPoliceDayCount'] += 1
elseif BurgerQW['IlyQW'] = 2 and BurgerQW['IlyQWPoliceDayCount'] = 30: 
	BurgerQW['IlyQW']  = 3
end

!!Remove degradation for inhibition
inhib_flr = inhib_lvl

gs 'stat_sklattrib', 'daycall'

!Update body measurements and base appearnce
gs 'body', 'DailyUpdate'


if husband > 0 and husbandrink ! 11:husbandrink = rand(0, 10)

!!Pussy_Kats job settings
inWorkYoungShop = 0
if week = 1 and young_shop_work = 100: young_shop_work = 1
if week = 5 and young_shop_work1 = 100: young_shop_work1 = 1
if week = 1 and young_shop_work2 = 100: young_shop_work2 = 1

husbandsexday = 0
borsexkol = 0
givisexday = 0

if shantsr > 0:
	pay = shantsr * 5000
	karta += pay
	shantsr = 0
end

if shantbog > 0:
	:shantftb
	shantftbgrand = rand(0, 10)
	if shantftbgrand > 2:
		shantpopala += 1
		shantbog -= 1
		if shantbog > 0:jump 'shantftb'
	elseif shantftbgrand <= 2:
		karta += 30000
		shantbog -= 1
		if shantbog > 0:jump 'shantftb'
	end
end

petersexday = 0
if cheatKlisma = 0:
	klismaday = daystart
	klismaday1 = 1
else
	klismaday1 = 0
end

!!ugly duckling start becoming a swan
if uglyduck_flag = 1 and hotcat >= 5:
	killvar 'uglyduck_flag'
	gs 'npc_relationship', 'socialgroup_setting_boys', 10, 10, 10, 10, 0, 0
	grupvalue[1] += 100
	old_grupvalue[1] += 100
end

!! Resetting relationships that go over the max

:toptemprel
if temprel < aarraynumber:
	temprel +=1
	if npc_rel['A'+'<<temprel>>'] > 100:npc_rel['A'+'<<temprel>>'] = 100
	jump 'toptemprel'
end
killvar 'temprel'

gs 'bank', 'cikl'

killvar 'holyday'
killvar 'kanikuli'
killvar 'pcs_ate'
killvar 'pcs_drank'

!! THIS IS THE OLD SYSTEM. Only keeping this in while it''s still in use as reference for the old variables, otherwise THESE VALUES ARE NOT THE CORRECT ONES FOR NEW VARIABLES
!!sisboyparty
!!-1 - don''t go to the party
!!0 - don''t know about parties
!!1 - knows about the parties
!!2 - agreed to go to the party
!!3 - Missed the party

!!Suspension ends
if suspended['day'] = daystart:	suspended['on'] = 0

if mid($start_type, 1, 2) = 'sg':
!!Party refresh if you didn''t see sis
	if week = 1 and sisboyparty ! 2:
		if sisterQW['party'] = -1: sisterQW['party'] = 0

		if sisboypartyQW >= 2 and sisboyparty > 0:
			sisboyparty_day = daystart + rand(3,5)
		end
	end

	if sisboyparty = 2 and sisboyparty_day + 1 < daystart: sisboyparty = 3


	if SchoolAtestat = 0 and SchoolBlock = 0:
		if month = 12 and day > 25:
			if day < 31:
				$holyday = '<b>Winter Break in <<32-day>> days.</b>'
			else
				$holyday = '<b>Winter Break starts tomorrow.</b>'
			end
		elseif month = 1 and day <= 15:
			kanikuli = 2
			if day < 13:
				$holyday = '<b>Winter Break.</b>'
			elseif day < 15:
				$holyday = '<b>Winter Break ends in <<16-day>> days.</b>'
			else
				$holyday = '<b>Last day of Winter Break.</b>'
			end
		elseif month = 3 and day > 13:
			if day < 19:
				$holyday = '<b>Spring Break starts in <<20-day>> days.</b>'
			elseif day = 19:
				$holyday = '<b>Spring Break starts tomorrow.</b>'
			elseif day >= 20 and day <= 26:
				kanikuli = 3
				if day < 24:
					$holyday = '<b>Spring Break.</b>'
				elseif day < 26:
					$holyday = '<b>Spring Break ends in <<27-day>> days.</b>'
				else
					$holyday = '<b>Last day of Spring Break.</b>'
				end
			end
		elseif month = 5:
			if year = 2017:
				if day = 26:
					kanikuli = 6
					SchoolAtestat = -1
					lernHome = 0
					$holyday = '<b>Your graduation is today. Be there by 8:00.</b>'
				elseif day = 25:
					$holyday = '<b>Your graduation is tomorrow. Be there by 8:00.</b>'
				elseif day >= 19:
					$holyday = '<b>Your graduation is in <<26-day>> days.</b>'
				end
			elseif day >= 25:
				if day = 31:
					$holyday = '<b>Summer Break starts tomorrow.</b>'
				else
					$holyday = '<b>Summer Break starts in <<32-day>> days.</b>'
				end
			end
		elseif month = 6 or month = 7 or month = 8:
			kanikuli = 4
			if month = 8 and day >= 25:
				if day = 31:
					$holyday = '<b>Last day of Summer Break.</b>'
				else
					$holyday = '<b>Summer Break ends in <<32-day>> days.</b>'
				end
			else
				$holyday = '<b>Summer Break.</b>'
			end
!! start inc 'I put it here because I want to reset these variables during the summer, they are related to cheerleading and it is useful just in case that PC will be part of the team for more than one year.'
			killvar 'first_time_outside_in_cold_weather'
			killvar 'first_time_doing_basketball'
			killvar 'first_time_spring_football_match'
!! end inc  
		elseif month = 10 and day >= 29:
			$holyday = '<b>Autumn Break starts in <<35-day>> days.</b>'
		elseif month = 11:
			if day < 3:
				$holyday = '<b>Autumn Break starts in <<4-day>> days.</b>'
			elseif day = 3:
				$holyday = '<b>Autumn Break starts tomorrow.</b>'
			elseif day < 6:
				kanikuli = 1
				$holyday = '<b>Autumn Break.</b>'
			elseif day < 11:
				kanikuli = 1
				$holyday = '<b>Autumn Break ends in <<12-day>> days.</b>'
			elseif day = 11:
				kanikuli = 1
				$holyday = '<b>Last day of Autumn Break.</b>'
			end
		end
		if kanikuli = 0 and week < 6:
			if week = 1:
				!!The start and end values for i have to be changed if more female schoolgirl npcs are added to the game
				i = 11
				
				:hotcat_calc_jump
				i += 1
				
				if hotcat_rating['A<<i>>'] = 0 and i < 145: jump 'hotcat_calc_jump'
				
				switch_rand = rand(1,100)
				
				if hotcat_movement['A<<i>>'] = 0 and switch_rand < 21:
					hotcat_rating['A<<i>>'] -= 1
					hotcat_movement['A<<i>>'] -= 1
				elseif hotcat_movement['A<<i>>'] = 0 and switch_rand > 80:
					hotcat_rating['A<<i>>'] += 1
					hotcat_movement['A<<i>>'] += 1
				elseif hotcat_movement['A<<i>>'] = 1 and switch_rand > 40:
					hotcat_rating['A<<i>>'] -= 1
					hotcat_movement['A<<i>>'] -= 1
				elseif hotcat_movement['A<<i>>'] = -1 and switch_rand > 40:
					hotcat_rating['A<<i>>'] += 1
					hotcat_movement['A<<i>>'] += 1
				end
				if i < 145: jump 'hotcat_calc_jump'
				killvar 'i'
				killvar 'switch_rand'
			end
			
			!! Resetting the late flag
			if late = 1: late = 0
			
		end	
		

		!!Social grup changes
		
		!!Change from relatonship with other students.
		gs 'gschool_socialchg', 'group_student_rel_change'

		!!Decay for the school groups
		if grupvalue[1] > 0:
			grupvalue[1] -= rand(0,1)
		else
			grupvalue[1] = 0
		end
		if grupvalue[2] > 0:
			grupvalue[2] -= rand(0,1)
		else
			grupvalue[2] = 0
		end
		if grupvalue[3] > 0:
			grupvalue[3] -= rand(0,1)
		else
			grupvalue[3] = 0
		end
		if grupvalue[4] > 0:
			grupvalue[4] -= rand(0,1)
		else
			grupvalue[4] = 0
		end
		!!Maximum increase for grupvalues is 10 and max decay is 30
		if oldgrupvalue_set = 0:
			oldgrupvalue_set = 1
			old_grupvalue[1] = grupvalue[1]
			old_grupvalue[2] = grupvalue[2]
			old_grupvalue[3] = grupvalue[3]
			old_grupvalue[4] = grupvalue[4]
		else
			if old_grupvalue[1] + 10 < grupvalue[1]: grupvalue[1] = old_grupvalue[1] + 10
			if old_grupvalue[2] + 10 < grupvalue[2]: grupvalue[2] = old_grupvalue[2] + 10
			if old_grupvalue[3] + 10 < grupvalue[3]: grupvalue[3] = old_grupvalue[3] + 10
			if old_grupvalue[4] + 10 < grupvalue[4]: grupvalue[4] = old_grupvalue[4] + 10
			if old_grupvalue[1] - 30 > grupvalue[1]: grupvalue[1] = old_grupvalue[1] - 30
			if old_grupvalue[2] - 30 > grupvalue[2]: grupvalue[2] = old_grupvalue[2] - 30
			if old_grupvalue[3] - 30 > grupvalue[3]: grupvalue[3] = old_grupvalue[3] - 30
			if old_grupvalue[4] - 30 > grupvalue[4]: grupvalue[4] = old_grupvalue[4] - 30
		end
		!!Limit to max school group values
		if grupvalue[1] > 1000: grupvalue[1] = 1000
		if grupvalue[2] > 1000: grupvalue[2] = 1000
		if grupvalue[3] > 1000: grupvalue[3] = 1000
		if grupvalue[4] > 1000: grupvalue[4] = 1000

		old_grupvalue[1] = grupvalue[1]
		old_grupvalue[2] = grupvalue[2]
		old_grupvalue[3] = grupvalue[3]
		old_grupvalue[4] = grupvalue[4]
		
	elseif SchoolAtestat = -1:
		if func('homes_properties', 'has_access', 'parents_home') = 0:
			$holyday = '<b>You missed your graduation. You could pick up your diploma at the school.</b>'
		else
			$holyday = '<b>You missed your graduation. Maybe your mother picked up your diploma.</b>'
		end
	end
	!!Brother''s dick growth as he gets older
	!Commented out till some future time
	!if kolka_dick_day + 30 < daystart and npc_dick['A34'] < 26:
	!	kolka_dick_day = daystart
	!	npc_dick['A34'] += 1
	!end
	!if npc_dick['A34'] < 20 and npc_dick['A34'] > 16:
	!	$npc_thdick['A34'] = 'well proportioned'
	!elseif npc_dick['A34'] >= 20 and npc_dick['A34'] <= 26:
	!	$npc_thdick['A34'] = 'thick'
	!end

	!! Calcualting the increase/decreas of the grade each week.
	gs 'gschool', 'weekly grade update'

end

killvar 'natholi'
if month = 1 and day >= 1 and day <= 8:
	$natholi = 'New Year holidays'
	natholi = 1
	if day = 1:$natholi += ', New Year'
	if day = 7:$natholi += ', Christmas'
end
if month = 2 and day = 23:$natholi = 'Defender of Fatherland Day' & natholi = 1
if month = 3 and day = 8:$natholi = 'Women''s Day' & natholi = 1
if month = 5 and day = 1:$natholi = 'Spring and Labor Day' & natholi = 1
if month = 5 and day = 2:$natholi = 'National holiday' & natholi = 1
if month = 5 and day = 9:$natholi = 'Victory Day' & natholi = 1
if month = 6 and day = 12:$natholi = 'Russia Day' & natholi = 1
if month = 6 and day = 13:$natholi = 'National holiday' & natholi = 1
if month = 11 and day = 4:$natholi = 'Unity Day' & natholi = 1
if natholi = 1:
	if $holyday ! '': $holyday += '<br>'
	$holyday += $natholi
end


!! Anushka''s band is on tour from Thursday 01-06 until Saturday 19-08. Blame Nutluck
if year = 2017 and ( month = 6 or month = 7 or (month = 8 and day < 19) ):
	gopnikbandQW['on_tour'] = 1
else
	gopnikbandQW['on_tour'] = 0
end



!!------------------------------------------------------------------------------------------------------------------------
!!Setting the weeks in the university semester and making sure that the gades are calculated at the right times

gs 'uni_lessons', 'cikl'

!!------------------------------------------------------------------------------------------------------------------------

!!resetting moisturizer so it can be used in the morning regardless
moisturiser_time = totminut
!!same with chaffing cream
mosal_time = totminut

!!resetting last_pee to counteract time cheat
!!also, the first thing you do in the morning is visiting your porcelain friend, no?
killvar 'last_pee'

!!Drugs reduction
gs 'drugs', 'cocaine', 'cikl'
gs 'drugs', 'mentats', 'cikl'
gs 'drugs', 'aphrodisiac', 'cikl'

gs 'gaddvor','cikl'

loc_count = ARRSIZE('$CloLosLoc')
i = loc_count - 1
:loopCloLoc
	$CloLoc = $CloLosLoc[i]
	CloLostOn = CloLosDay[$CloLoc]
	if CloLostOn + RAND(7,14) < daystart :
		gs 'clothing', 'recover_lost_clothes', $CloLoc, 2
	end
	i -=1
if i > -1 :jump 'loopCloLoc'

if vidageday > 1080: vidageday = 1080
if blizoruk < 10: blizoruk -= 1
if blizoruk < 100: blizoruk -= rand(0,1)
if blizoruk < 0: blizoruk = 0


!!------------------------------------------------------------------------------------------------------------------------
!!C and B array cleaning 

if InSleep = 1: gs 'npc','cleanarrays'

!!------------------------------------------------------------------------------------------------------------

!!-------------Therapist Route schedule variables----------------------------------------------------------------------
!! 23 = kitchen
!! 24 = Living room
!! 25 = bathroom
!! 26 = Master''s room
if therapistWantsSlave > 0:
	annaclean1 = rand(23,26)
end
killvar 'therapistFuckedPussyScene'

!!------------------------------------------------------------------------------------------------------------

!!-------------Family Dog----------------------------------------------------------------------

if $status['dog'] ! 'blocked' and rex['owned'] = 1:
	rex['timer_day'] = daystart
	
	!!Daily decay
	rex['relationship'] -= 1

	!!Chores
	if cheat['dog_rel'] = 0 and rex['gadukino_day'] ! daystart:
		npc_rel['A29'] -= iif(rex['count_walk'] + rex['count_feed'] = 0, -1, (rex['count_walk'] + rex['count_feed']))
		rex['relationship'] -= iif(rex['count_walk'] + rex['count_feed'] = 0, -1, (rex['count_walk'] + rex['count_feed']))
	end
	rex['count_run'] = 0
	rex['count_walk'] = rex['count_walk_base']
	rex['timer_walk'] = 0
	rex['count_feed'] = rex['count_feed_base']
	rex['timer_feed'] = 0
		
	if week = 1:
		if cheat['dog_rel'] = 0:
			npc_rel['A29'] -= rex['count_bath']
			rex['relationship'] -= (rex['count_bath'] * 5)
		end
		rex['count_bath'] = rex['count_bath_base']
	end
end	

!!------------------------------------------------------------------------------------------------------------

!!---------- School related schedule -------------------------------------------------------------------------
starlets_on     = iif( ( (week = 5 and odd_week = 0) or (week = 1 or week = 3 or week >= 6) ) and natholi = 0,1,0)
cheerleaders_on = iif( ( (week = 5 and odd_week = 1) or (week = 2 or week = 4) ) and (natholi = 0 and (month >9 or month <6)) ,1,0)

if starlets['late_message'] = 1: starlets['late_message'] = 0

!!------------------------------------------------------------------------------------------------------------

!!---------- Starlet Content ---------------------------------------------------------------------------------
if AlbinaQW['StarletsJoined'] > 0 and AlbinaQW['StarletsShutDown'] = 0 and npc_pregtalk['A23'] = 0:
	if starlets_practice = daystart - 1: 
		starlets_missed = 1
		starlets_practice = 0
	end
	if starlets_on = 1: starlets_practice = daystart
end

if month = 9 and day = 16 and AlbinaQW['ParkRally'] = 0: AlbinaQW['ParkRally'] = 1
if month = 10 and day = 16 and AlbinaQW['ParkRally'] = 1: AlbinaQW['ParkRally'] = 2
if month  = 11 and day = 19 and (AlbinaQW['StarletsJoined'] <= 0 or (AlbinaQW['StarletsJoined'] = 1 and npc_pregtalk['A23'] = 1)) and AlbinaQW['StarletsShutDown'] = 0: AlbinaQW['StarletsShutDown'] = 1

!!------------------------------------------------------------------------------------------------------------

!!-------------Music career related variables and calculations------------------------------------------------

!! Setting Del Parco initial variables
if daystart < 2:
	ml_delparcoQW['Stage'] = 0
	ml_delparcoQW['Zariyah Trust'] = 50 
end


!! How many hours a day can Sveta perform. It maxes out at 3.
!! Using the actual skill level, not the one modified by Attributes because that is more realistic for this.
ml_performance['max_perform_minutes'] = pcs_instrmusic + pcs_vokal
ml_performance['performed_minutes'] = 0


!! Checking for missed guitar lesson
if ml_guitarlesson['nextlesson'] < daystart and ml_guitarlesson['lessonday'] ! 8:
	ml_guitarlesson['lessonday'] = 8
end

!! Calculating the fame increase from the uploaded songs and removing ones that do not effect fame anymore to keep the 
!! data at a sane level
if ml_onlinesongcount > 0:
	i = 0
	j = -1
    
	:looponlinesongs        
!!      this so every song counts only every 7 days and only for a limited number of weeks 
		if ml_onlinesong_freshness[i] > 0:		
			j += 1
			ml_tempsong_freshness[j] = ml_onlinesong_freshness[i]
			ml_tempsong_lastcalcday[j] = ml_onlinesong_lastcalcday[i]
			ml_tempsong_hotcat[j] = ml_onlinesong_hotcat[i]
			ml_tempsong_skilllevel[j] = ml_onlinesong_skilllevel[i]
			ml_tempsong_uploaded[j] = ml_onlinesong_uploaded[i]

			if ml_tempsong_lastcalcday[j] <= (daystart - 7) and ml_tempsong_uploaded = 1:
				gs 'fame', 'city', 'music', rand(0, ml_tempsong_freshness[j]/100)
				ml_tempsong_freshness[j] -= 10
				ml_tempsong_lastcalcday[j] = daystart
			end
		end
		i += 1
	if i < ml_onlinesongcount: jump 'looponlinesongs'

	killvar 'ml_onlinesong_freshness'
	killvar 'ml_onlinesong_lastcalcday'
	killvar 'ml_onlinesong_hotcat'
	killvar 'ml_onlinesong_skilllevel'
	killvar 'ml_onlinesong_uploaded'

	i = 0
	
	if j >= 0:
		:looprebuildsongs
			ml_onlinesong_freshness[i] = ml_tempsong_freshness[i]
			ml_onlinesong_hotcat[i] = ml_tempsong_hotcat[i]
			ml_onlinesong_lastcalcday[i] = ml_tempsong_lastcalcday[i]
			ml_onlinesong_skilllevel[i] = ml_tempsong_skilllevel[i]
			ml_onlinesong_uploaded[i] = ml_tempsong_uploaded[i]
			i += 1
		if i <= j: jump 'looprebuildsongs'
	end

	killvar 'ml_tempsong_freshness'
	killvar 'ml_tempsong_lastcalcday'
	killvar 'ml_tempsong_hotcat'
	killvar 'ml_tempsong_skilllevel'
	killvar 'ml_tempsong_uploaded'

end


!! Repertoire quality decay if no practice is done
if ml_performance['set_lastpracticeday'] ! (daystart-1): repertoire_quality -= 2


!!------------- Prostitution - WLife integration related stuff ------------------------------------------------

!! Check if people will start to seek Sveta randomly for services, based on her reputation
gs 'prostitution_functions', 'check_for_wlife'
gs 'prostitution_functions', 'update_prostitution_locations'
prostitute['earnings_day'] = 0
prostitute['customer_day'] = 0

!!------------- Property and Home Related daily, nonfinancial checks ------------------------------------------

!! Moves time for the rented properties
gs 'homes_properties', 'progress_property_rent_time'

!!------------- Check for Daily Events for event generator, sets evt_chk variable  ------------------------------------------
gs 'emp_functions', 'evt_day_chk'



!!----------------------------------------------------------------------
!!---------------------------- WEEKLY RESET ----------------------------
!!----------------------------------------------------------------------
if week = 1:
	!! Reset used car dealership offers 
	killvar 'used_car'

	!! Reset therapist schedule
	killvar 'therapist_weekly_block'
end

!!------------- Advance book loan debt  ------------------------------------------
if $lib_book_loaned ! '': lib_debt += 50


!!------------- Preliminary npc_uni_eduTipe  ------------------------------------------
!! 
!!npc_uni_eduType = '', 'professor', 'teaching_studies', 'business_studies', 'science_studies', 'fashion_studies'
!!                  'nursing_studies', 'psychology_studies', 'programming_studies', 'other_studies'
!!
!!Will eventually need to be moved to the npcstatic and npcstaticdefault files for eternal uni npcs
!!To specific event checks for pav_uni npcs
!!And to the various starts.

!!This should be migrated to npcstaticx and eventually schedule
if set_npc_uni_eduType = 0:
	set_npc_uni_eduType = 1

	npc_uni_active['A77']  = 1
	npc_uni_active['A82']  = 1
	npc_uni_active['A83']  = 1
	npc_uni_active['A84']  = 1
	npc_uni_active['A209'] = 1
	npc_uni_active['A220'] = 1
	npc_uni_active['A242'] = 1
	npc_uni_active['A243'] = 1
	npc_uni_active['A244'] = 1
	npc_uni_active['A245'] = 1
	npc_uni_active['A246'] = 1
	npc_uni_active['A247'] = 1
end


!! This should eventually be migrated to schedule
if set_pav_npc_uni_active = 0 and yearstart = 2 and month >= 8 and day >= 28:
	set_pav_npc_uni_active = 1

	npc_uni_active['A1']   = 1
	npc_uni_active['A2']   = 1
	npc_uni_active['A4']   = 1
	npc_uni_active['A7']   = 1

	npc_uni_active['A12']  = 1
	npc_uni_active['A13']  = 1
	npc_uni_active['A14']  = 1
	npc_uni_active['A15']  = 1
	npc_uni_active['A16']  = 1
	npc_uni_active['A17']  = 1
	npc_uni_active['A18']  = 1
	npc_uni_active['A19']  = 1
	npc_uni_active['A22']  = 1
	npc_uni_active['A23']  = 1
	npc_uni_active['A25']  = 1

	npc_uni_active['A139'] = 1
	npc_uni_active['A140'] = 1
	npc_uni_active['A142'] = 1
	npc_uni_active['A144'] = 1
	npc_uni_active['A146'] = 1
	npc_uni_active['A147'] = 1
	npc_uni_active['A149'] = 1
	npc_uni_active['A152'] = 1
	npc_uni_active['A153'] = 1
	npc_uni_active['A155'] = 1
	npc_uni_active['A159'] = 1
	npc_uni_active['A165'] = 1

end

!!------------- Advance will counter  ------------------------------------------
if will_counter >= 20: will_counter -= 20 & willpowermax += 1


!!-----------------webcam follower loss due to inactivity ------------------------------------------
if camwhore = 1:
    if cam_daystart < daystart:
        engagementFactor = 1 + (CamBonus / 100)
        popularityFactor = webpopular / 1000

        if regviewReset < 3:
            if regview >= 500:
                FollowersLost = rand(regview / (100 * engagementFactor), regview / (50 * engagementFactor)) + popularityFactor
            else
                FollowersLost = rand(1, 3) + popularityFactor
            end
            cam_daystart = daystart + max(1, 3 - (CamBonus / 50))
        else
            if regview >= 300:
                FollowersLost = rand(regview / (80 * engagementFactor), regview / (40 * engagementFactor)) + popularityFactor
            else
                FollowersLost = rand(2, 6) + popularityFactor
            end
            cam_daystart = daystart + max(1, 2 - (CamBonus / 50))
        end
        regviewReset += 1
        FollowersLost = func('shortgs', 'clamp', FollowersLost, 0, regview)
        totFollowersLost += FollowersLost
        regview -= FollowersLost
        killvar 'FollowersLost'
    end
end



!!---------------Keeping track of missing court appearances-----------------------------
if arrsize('policeQW_courthearing_dates') > 0 and daystart > policeQW_courthearing_dates[0]:
	policeQW['missed_court_dates'] += 1
	policeQW['tot_court_dates_missed'] += 1
	
	!! Might need code to throw a message with 'You''ve missed your court hearing or something'

	policeQW_courtletter_dates[] = daystart + rand(3, 6)
	$policeQW_courtletter_subjects[] = 'missed_court_<<$policeQW_courthearing_subjects[0]>>'

	killvar 'policeQW_courthearing_dates', 0
	killvar 'policeQW_courthearing_subjects', 0
end

if policeQW['fine_deadline'] > 0:
	if daystart > policeQW['fine_deadline'] - 8:
		policeQW_courtletter_dates[] = daystart
		$policeQW_courtletter_subjects[] = 'fine'

	elseif daystart > policeQW['fine_deadline']:
		policeQW['missed_fine_deadlines'] += 1
		policeQW['tot_fines_deadlines_missed'] += 1

		!! Might need code to throw a message with 'you''ve failed to pay your fine on time.'

		policeQW_courtletter_dates[] = daystart + rand(3, 6)
		$policeQW_courtletter_subjects[] = 'missed_fine'
	end
end


if arrsize('policeQW_courtletter_dates') > 1:
	gs 'shortgs', 'coupled_array_sort', 'policeQW_courtletter_dates', '$policeQW_courtletter_subjects'
end
if arrsize('policeQW_courthearing_dates') > 1:
	gs 'shortgs', 'coupled_array_sort', 'policeQW_courthearing_dates', '$policeQW_courthearing_subjects'
end

if blackmailQW['stage'] > 0: gs 'blackmailer', 'cikl'


--- cikl ---------------------------------

