%%
%% UTILITY SUBPLOTS
%%
%%  This unit holds utility subplots. These are usually very short subplots which are used for
%%  handling common situations- running out of time on a mission, earning a cash reward, and
%%  so on.
%%

%%
%% *UTIL_BlankState
%%
%%  For when you need a PlotState, but don't need anything to happen.
%%

Content
	name <Blank State>
	requires <*UTIL_BlankState>


%%
%% *UTIL_WinMission
%%
%%  The player has won this mission, and will be paid by the NPC according to the agreed upon
%%  pay rate. There may be an additional bonus, depending on the situation.
%%
%% The master plot must have a PayRate set.
%%
%%  PARAM1: The mission-giving NPC

Content
	name <Friend/Lover Win Mission>
	requires <*UTIL_WinMission (1:FRIEND|1:LOVER)>

	% E1 is the mission-giving NPC.

	start <ifNPCDead %1% EndPlot>

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop%  NewChat Say %id%01 CashPrize Reward %threat% PayRate    FacXP+ ChatNPCFac 1    RandomMecha .%id%_meks %threat%   EndPlot>
		.%id%_meks <GENERAL \FACTION_DESIG RootSceneID \FACTION_DESIG ChatNPCFac>
		Msg%id%01 <Here's your reward for that last mission, \PC . I decided to throw in a little something extra as well.>
		Msg%id%01_1 <Your mission was a complete success. You're impressing a lot of people with your performance, \PC . In addition to the mission pay you've also been awarded this special gift.>
		CMsg%id%01_1 <ifNPCSociable Accept>
		Msg%id%01_2 <Good work, \PC . You've been awarded this new mecha.>
		CMsg%id%01_2 <ifNPCShy Accept>
		Msg%id%01_3 <Hey \PC . I hope the mission wasn't too hard... Anyhow, because of your success, I've been asked to give you this new mecha in addition to your regular pay.>
		CMsg%id%01_3 <ifNPCEasygoing Accept>
		Msg%id%01_4 <You did it! Wow, you really are a powerful fighter... In recognition of your success, I'm pleased to give you this brand new mecha in addition to your pay. Pilot it well!>
		CMsg%id%01_4 <ifNPCPassionate Accept>
		Msg%id%01_5 <Good job, \PC ! You'll be pleased to know that the higher-ups are just as impressed with you as I am. In addition to the regular mission pay, they've authorized me to give you this brand new mecha.>
		CMsg%id%01_5 <ifNPCCheerful Accept>
		Msg%id%01_6 <I'm glad to see that you made it back in one piece. Here, this new mecha is for you. You're probably going to need a backup one of these days.>
		CMsg%id%01_6 <ifNPCMelancholy Accept>
	end

Content
	name <Basic Win Mission>
	requires <*UTIL_WinMission Common>

	% E1 is the mission-giving NPC.

	start <ifNPCDead %1% EndPlot>

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop%  Goto .%id%_GoWinMission>
		*.%id%_GoWinMission <*MissionWasSuccess&Reward .%id%_GoEnd ChatNPCFac na>
		.%id%_GoEnd <CashPrize Reward %threat% PayRate    FacXP+ ChatNPCFac 1    AddReact d6   EndPlot>
	end

Content
	name <Basic Win Mission>
	requires <*UTIL_WinMission &Mecha Common>

	% E1 is the mission-giving NPC.

	start <ifNPCDead %1% EndPlot>

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop%  Goto .%id%_GoWinMission>
		*.%id%_GoWinMission <*MissionWasSuccess&Reward&Mecha .%id%_GoEnd ChatNPCFac na>
		.%id%_GoEnd <CashPrize Reward %threat% PayRate    FacXP+ ChatNPCFac 1   AddReact d6   EndPlot>
	end

%%
%% *UTIL_LoseMission
%%
%%  The player has lost this mission.
%%
%%  PARAM1: The mission-giving NPC

Content
	name <Basic Lose Mission>
	requires <*UTIL_LoseMission>

	% E1 is the mission-giving NPC.

	% P%id%01 = Time Limit
	start <ifNPCOK %1% else .%id%_GoEnd ifG ComTime P%id%01 EndPlot>
	.%id%_GoEnd <EndPlot>
	update <if= p%id%01 0 P= %id%01 ComTime P+ %id%01 43200>

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop%  Goto .%id%_GoLostMission>
		*.%id%_GoLostMission <*MissionWasFailure .%id%_GoEnd ChatNPCFac na>
		.%id%_GoEnd <AddReact -d6   EndPlot>
	end

Content
	name <Basic Lose Mission>
	requires <*UTIL_LoseMission &Mecha>

	% E1 is the mission-giving NPC.

	% P%id%01 = Time Limit
	start <ifNPCOK %1% else .%id%_GoEnd ifG ComTime P%id%01 EndPlot>
	.%id%_GoEnd <EndPlot>
	update <if= p%id%01 0 P= %id%01 ComTime P+ %id%01 43200>

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop%  Goto .%id%_GoLostMission>
		*.%id%_GoLostMission <*MissionWasFailure&Mecha .%id%_GoEnd ChatNPCFac na>
		.%id%_GoEnd <AddReact -d6   EndPlot>
	end

%%
%% *UTIL_TimeOver
%%
%%  The player was given a mission, but didn't complete it in time.
%%
%%  PARAM1: The mission-giving NPC

Content
	name <Basic Time Over>
	requires <*UTIL_TimeOver>

	% E1 is the mission-giving NPC.

	% P%id%01 = Time Limit
	start <if= PlotStatus %plotid% %id% else %pop% ifNPCOK %1% else .%id%_GoEnd ifG ComTime P%id%01 EndPlot>
	.%id%_GoEnd <EndPlot>
	update <if= PlotStatus %plotid% %id% else %pop% if= p%id%01 0 P= %id%01 ComTime P+ %id%01 21600 EMail %id%01>

	Msg%id%01_1 <%name1% @ \SCENE NPCScene %1% :// Your mission has been cancelled.>
	Msg%id%01_2 <%name1% @ \SCENE NPCScene %1% :// Your mission has been aborted.>

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop%  NewChat Say %id%01 AddReact -d3 EndPlot>
		Msg%id%01 <I'm afraid that you took too long on that mission. It's over now.>
	end




