# pushkin_ballet_init

!! Date Created: 17th Sept, 2022
!! Modified date: 
!! Version: .01 - initial release
!! Author: Hooded Silence
!!
!! Ballet Summer School 
!!
!! This is the initiator for the ballet story arc. Triggers in June, 2016 on start, and is open to the Dancer at the start of July or by seeing a post in the community hall if modern dance skill is above 60.
!! For the non-dancer start there''s one time fee of 15,000 rubles for the weeks course which takes places in August (future content).
!! 
!! Variables
!! 
!! mod_ballet[blocker]- quest line initiator to start/stop the quests.
!! mod_ballet[letter]- temp blocker to prevent the letter being read multiple times.
!! ballet[hypno] = 1  - hypno content trapdoor
!! school_prep, school_running tally and final_score - preparation work, will be added to final school score to determine pass, almost pass (favour) or fail (no favour) converts to balletqw[school]
!! balletqw[school] - Holding variable for final score 2 - passed, 3 - passed with Rudolph''s help, 4 - passed with Maya's help, 5 = Merit, 1 - failed
!! balletqw[rank] - What stage of her career, 1 apprenticeship, 2 part of Corp de ballet, 3 full member of the Theatre.
!! Ranks
!! Corps De Ballet, coryphée, demi-soloist, soloist, principle dancer.
!! balletqw[performances] - How many shows perfomed
!! mayaqw[grave] - Did you attend Anitchka's grave with Maya, 3 means you talked to Maya, 4 means you was empathic. Has impact later on Maya''s actions towards the player.
!! mayaqw[trust] - How much Maya trusts you and works in conjunction with npc_rel
!! Rudolph quest is broken into two variables the main tracker being rudolphqw[stage] and rudolphqw[corruption], the latter reflects his slow insidious undermining of Sveta''s confidence and the former is how
!! much she has submitted to his authority and demands. Corruption opens dialogue options.
!!
!! AlbinaQW[StarletsJoined] - Set -1 to prevent rejoining.
!!



if $ARGS[0] = 'init':
	
	!! Start the School
	if $start_type['cat'] = 'dancer' or ($start_type['cat'] = 'custom' and danc_lvl >= 50):
		
		!! School week
		
		!! Pushkin residential block
		
		if $loc = 'pushkin_sq':
			*nl
			'Just off Okhlopkov Square you see the road that leads to the ballet schools <a href="exec:gt ''pushkin_ballet_center'',''start''">residential block</a>.'
			act 'Walk to the residential block': gt 'pushkin_ballet_center', 'start'
		end
		
		if $loc = 'pushkin_ballet_res' and (hour = 7 and minut >= 30):
			!! trigger late event for Maya wtih fall back
			$balletEv['trigger'] = 'late'
			gs 'npc_3501_init', 'summer_school'
		elseif $loc = 'pushkin_ballet_res' and $loc_arg = 'hallway' and (hour >= 6 and hour < 8) and (day >=  1 or day <= 6):
				act 'Go to School (07:30 start)': gt 'pushkin_ballet_class', 'start'	
		end
		
		if daystart > 33 and $loc = 'bedrPar' and mod_ballet['letter'] = 1:
			gs 'shortgs', 'remove_array_element', 'mod_ballet', 'blocker'
			gs 'shortgs', 'remove_array_element', 'mod_ballet', 'letter'
		
			msg 'You''ve missed your ballet school start date, maybe there will be other opportunities in future.'
		end
		
		if $loc = 'bedrPar':
			
		end
	end
	!! Initiate the ballet events.
	If mod_ballet['blocker'] = 1:   
		mod_ballet['blocker'] = 2
		gs 'fame', 'pushkin', 'ballet', 30, 'local'
		gs 'ballet_npc'
		i_npc = 1
		:mod_ballet_rel_set
			if i_npc < 10:
				$npc_idx = 'A350<<i_npc>>'
			else
				$npc_idx = 'A35<<i_npc>>'
			end		   
			gs 'npc_relationship', 'set', '<<$npc_idx>>', 'unknown'
			npc_trust[$npc_idx] = 0 
			i_npc += 1
		if i_npc <=  17: jump 'mod_ballet_rel_set'
		!! Set local fame to fit narrative of up and coming ballet dancer	
	end
end

if $ARGS[0] = 'start':
	! Initial acceptance

	if $loc = 'kuhrPar' and $start_type['cat'] = 'dancer':
	
		if locat['Mother'] = 4 and mod_ballet['letter'] < 1 and daystart <= 14 :
			! Trigger first act
			gs 'ballet_npc'
			act 'Read the letter': gt 'pushkin_ballet_evt', 'letter'			
		end
		if locat['Mother'] = 4 and mod_ballet['letter'] < 1 and daystart >=45:
			! Trigger second act
			act 'Read the letter': gt 'pushkin_ballet_evt', 'letter'
		end
	end
end

if $ARGS[0] = 'daily_assessment':

	!! Grade appearance, behaviour and other factors.

	!! Daily Appearance
	if school_daily_check ! daystart and (hour >= 8 and hour <= 17):
	
		!! Positive additions:
		mod_grade_attendance[week] += 1
		if pcs_makeup > 1: mod_grade_mua[week] += 1  
		if hBraids > 0  or hpingripw > 0: mod_grade_appearance[week] +=1
		
		!! Negative deductions: 
		if pcs_hairbsh = 0: mod_grade_appearance[week] -=1
		if pcs_missing_teeth > 0 or pcs_teeth ! -1: mod_grade_appearance[week] -=1
		if school_curfew > 0: mod_grade_disciplne[week] -= 1
		if pcs_leghair > 3 : mod_grade_appearance[week] -= 1
		if pubestyle = 10: mod_grade_appearance[week] -= 1
		if alko > 1: mod_grade_discipline[week] -= 1 
		!!mod_daily_score[week] = mod_grade_mua[week] + mod_grade_attendance[week] + mod_grade_appearance[week] - mod_grade_discipline[week] 
		!! msg 'Attend: <<mod_grade_attendance[week]>>, MUA:<<mod_grade_mua[week]>>, Appear: <<mod_grade_appearance[week]>>, Discipline <<mod_grade_disciple[week]>>, <<pcs_hairbsh>>'
	end
	if nclass = 5 and  school_daily_check ! daystart:
		mod_daily_score[week] = mod_grade_attendance[week] + mod_grade_mua[week] + mod_grade_appearance[week] + mod_homework[week] - mod_grade_discipline[week] 
	end


	if $ARGS[1]= 'grade':
		final_score = (pcs_apprnc / 10) + ((pcs_stren + pcs_agil + pcs_danc) / 10 ) + school_running_tally + study_tally

		!! Three score levels, fail, pass and merit. Fail is one route for corruption path, pass is either low or no pay, merit is low to low +10%. 
		if final_score <= 40:
			balletqw[school] = 5
		elseif final_score >=41 and final_score < 60:
			!! Interim pass until quest lines are created for Maya/Rudolph
			balletqw[school] = 1
			balletqw[rank] = 1
		elseif final_score >= 61 and final_score <= 90:
			balletqw[school] = 1
			balletqw[rank] = 1
		elseif final_score >= 91:
			balletqw[school] = 4
			balletqw[rank] = 1
		end

		if final_score > 60: gs 'pushkin_ballet_init', 'famemodifier', final_Score
	end

end

if $ARGS[0] = 'famemodifier':

	! Set upper value for seed. 
	rank = ARGS[1] 

	hc_restrict = rand(2, (rank/4))
	ballet_fame = ( (rank + pcs_danc ) / hc_restrict )  

	if ballet_fame < 1: ballet_fame = 5 

	gs 'fame', 'pushkin', 'ballet', rand(0, ballet_fame), 'local'
	!! Diags 
		ballet_temp['score'] = final_score
		ballet_temp['rank'] = rank
		ballet_temp['fame'] = fame
	!! End Diags
	killvar 'final_score'
	killvar 'rank'
	killvar 'hc_restrict'
	killvar 'ballet_fame'
end

if $ARGS[0] = 'cleanup_var':
	!! Clean up school variables upon completion.
	!! Debug - remove all variables associated with mod

	if $ARGS[]= 'debug':
	! Maya 
		gs 'shortgs', 'remove_array_element', 'mayaqw','trust'
		gs 'shortgs', 'remove_array_element', 'mayaqw','grave'
	! Rudolph
		gs 'shortgs', 'remove_array_element', 'rudolphqw','corruption'
		gs 'shortgs', 'remove_array_element', 'rudolphqw','stage'
	! School events
		gs 'shortgs', 'remove_array_element', 'balletqw','school'
		gs 'shortgs', 'remove_array_element', 'balletqw','performances'
		gs 'shortgs', 'remove_array_element', 'balletqw','rank'
	end
	!! Diags
		ballet_temp['srt'] =  school_running_tally
		ballet_temp['school_prep'] = school_prep
	!! End diags
	killvar 'ballet_awol'
	killvar 'school_running_tally'
	killvar 'sharedmeal'
	killvar 'study_tally'
	killvar 'school_prep'
	killvar 'ballet_day'	
	killvar 'ballet_first_bedroom'
	killvar 'feet_track'	
	gs 'shortgs', 'remove_array_element', 'mod_ballet', 'letter'
	gs 'shortgs', 'remove_array_element', 'mod_ballet', 'res_mg'

end

if $ARGS[0] = 'score_debug':   
	debug_day = 1
	:jmp_debug_score
		'Day: <<debug_day>>' 
		'Make-up Score: <<mod_grade_mua[debug_day]>>'
		'Appearance: <<mod_grade_appearance[debug_day]>>'
		'Rules and Discipline: <<mod_grade_disciple[debug_day]>>'
		'Homework: <<mod_homework[debug_day]>>'
		'Attendance: <<mod_grade_attendance[debug_day]>>'
		'Total Day Score:  <<mod_daily_score[debug_day]>>'
		' - - - '
		debug_day += 1
	if debug_day <=  5: jump 'jmp_debug_score'
end
--- pushkin_ballet_init ---------------------------------