// uses base.df
// uses events.df
// uses loot.df
// uses cyoa.df
// uses charstats.df
// uses carstats.df

road{ 

: car-lost
	0 vehicle.which!
	car-update-display
	badfx
	walk-day-pick
;

0 value anime-countdown 
0 value kills-this-game

}

cyoa{ voc{ mission

: cyoachar player .character@ ; // Char for CYOA

: leave-car me .leave ;

cyoa: anime-boom
	65 stpick if choosechar cicon else "The Anime Girl was going to explode, but got prevented from doing so at the last possible moment." text! morale++all exit then
	"Anime Overdose" cyoa-title!
	($ cname .. " suddenly explodes while on the road. Everything is heavily damaged by flying shards of anime." $) text!
		($ "ANIME GIRL GETS OBLITERATED!" fbold $) +crtext
		sfx{ ruffle 1000 fx .d! 0.25 fx .s! 2000 fx .r! 0.925 fx .q! 1250 fx .filt! 1 fx .scale! 3 fx .freq2! }
		10 0.9 rumble-gui
		TEAM_STATUS_DIED cchar .decruit sfx{ creepy }
		ouch--all sting--all
;

cyoa: knight-oneuse
	53 stpick if choosechar cicon then
	"End of the Battle" cyoa-title!
	($ "The knight" pbold .. " thanks you for the experience, but says she should probably go on her own from here. She starts slowly clanking away!" $) text! TEAM_STATUS_GOOD_LEFT cchar .decruit goodfx
;

: anime-timeup

//	sfx{ fm }

	62 stpick if
		choosechar 63 cchar .specialtype!
		0.2 cchar .speed_bonus!
		road{ 2 to anime-countdown }
		PRINTSTACK
	then;
	63 stpick if
		choosechar 64 cchar .specialtype!
		road{ 2 to anime-countdown }
		0.3 cchar .speed_bonus!
		PRINTSTACK
	then;
	64 stpick if
		choosechar 65 cchar .specialtype!
		road{ 2 to anime-countdown }
		0.5 cchar .speed_bonus!
		PRINTSTACK
	then;

	' anime-boom stack-road-action
;

0 value DEMO
0 value skipsummary
0 value kills-this-game

: mission-summary-cyoa
	skipsummary 0 > if 
		0 to skipsummary to-road 
	else
		cyoa-new
			cyoa-leftjust
			"MISSION SUMMARY" cyoa-title!
			mission-total-loot if
				"Found:" cyoa-text-append cyoa-text-cr
				cyoa-loot-text cyoa-text-cr
			then
			mission-kills cyoa-text-append
			" zombies destroyed." cyoa-text-append
			cyoa-text-cr

			mission-kills gstats{ ' total-kills +! }
			mission-kills road{ ' kills-this-game +! }
	
			absentees if
				"LEFT BEHIND: " swap $cat cyoa-text-append
			else drop then
	
			mission>road-car-chassis
	
			cyoa-add-choice
			DEMO if
				"END of DEMO" cyoa-choice-text!
				' quit-to-title cyoa-choice-handler! // end of demo
			else
				' to-road cyoa-choice-handler! // go to driving mode
			then
	 then

	post-mission-cyoa if
		post-mission-cyoa stack-road-action
		0 to post-mission-cyoa
	then

	// Anime girl mutation cascade
	// 65 stpick-mission if drop road{ anime-timeup } then	
	64 stpick-mission if drop anime-timeup then	
	63 stpick-mission if drop anime-timeup then
	62 stpick-mission if drop anime-timeup then 

	// Knight leaving after one use
	
	53 stpick-mission if drop ' knight-oneuse stack-road-action then
	
;

last to main-event-mission-end

} }

