%%
%% *CS_GiveEquipment Content
%%
%%  As a reward for something or another, the PC is being given some
%%  upgraded hardware. This will probably be something that can't
%%  be gotten in any other way.
%%
%%  Persona 1 must include a .%id%_GoGiveEquipment script.
%%
%%  This subplot doesn't affect the PlotStatus at all, and in fact
%%  doesn't need its PlotID activated. It's not much more than a
%%  glorified PFrag for handing out an item.
%%
%% Param1: The item-giver
%%

Content
	name <New Mecha>
	requires <*CS_GiveEquipment>

	% E1 is the item-giver

	sub
		Persona 1
		% V%id%01 = Threat Counter
		.%id%_GoGiveEquipment <NewChat Say %id%01 V= %id%01 StoryDL V+ %id%01 d10  RandomMecha .%id%_Factions V%id%01>
		Msg%id%01 <You can never own too many mecha. Here, you can have this one. May it never be shot out from under you.>
		.%id%_Factions <GENERAL \FACTION_DESIG RootSceneFac \FACTION_DESIG ChatNPCFac>
	end

Content
	name <Mecha Gun 1: Grenade Launcher>
	requires <*CS_GiveEquipment !Ne ~1:CRAFT>

	% E1 is the item-giver
	% E2 is the item
	Element2 <Prefab>

	sub
		Persona 1
		.%id%_GoGiveEquipment <NewChat Say %id%01 GiveItem %2%>
		Msg%id%01 <This mecha grenade launcher should come in handy. It's just the thing for taking out swarms of quick enemies.>
	end
	inv
		Gun 9
		name <Grenade Launcher>
		caliber <50mm explosive cannister>
		range 6
		scale 2
		Magazine 30
		sub
			Ammo 9
			caliber <50mm explosive cannister>
			type <BLAST 3 BRUTAL>
		end
	end

Content
	name <Mecha Gun 2: Mech Assault Rifle>
	requires <*CS_GiveEquipment !Lo ~1:CRAFT>

	% E1 is the item-giver
	% E2 is the item
	Element2 <Prefab>

	sub
		Persona 1
		.%id%_GoGiveEquipment <NewChat Say %id%01 GiveItem %2%>
		Msg%id%01 <Here's a mecha assault rifle. It's a versatile weapon that can be used in either fully auto or semiautomatic mode.>
	end
	inv
		Gun 8
		Scale 2
		name <Mech Assault Rifle>
		caliber <30mm caseless>
		Range 6
		Magazine 60
		BV 2
		Speed 3
		Acc 1
		mass -5
		sub
			Ammo 8
			caliber <30mm caseless>
			mass -6
		end
	end


%%
%% *CS_WinFetchItem Content
%%
%%  The PC was sent to fetch an item and has apparently gotten it.
%%  Note that between getting the item and returning to the mission
%%  giver the PC might have lost the item, destroyed the item, sold
%%  the item, eaten the item, abused the item, or otherwise decided
%%  to keep the item. If the PC gives the item to the NPC, a reward
%%  is in order.
%%
%% Param1: The Mission-Giver
%% Param2: The Item
%%

Content
	name <Trade Item For Reward>
	desc <The Mission-Giver will pay the PC for the item.>
	requires <*CS_WinFetchItem>

	% E1 is the NPC
	% E2 is the item

	start <ifNPCDead %1% SMemo 0 WinComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop% ifChatNPCInPlay else .%id%_GoComeHere NewChat Say %id%01 AddChat %id%01 AddCHat %id%02 AddChat %id%03>
		*.%id%_GoComeHere <*NotByPhone>
		result%id%01 <NewChat Say %id%02>
		*result%id%02 <*MissionWasSuccess&Reward .%id%_GoEnd &AllyFac &EnemyFac>
		.%id%_GoEnd <CashPrize Reward StoryDL 500 SMemo 0 DeleteItem %2%  AddReact d10  NTBWinComp 0 .%id%_next>
		.%id%_next <+T-- +F-->
		result%id%03 <NTBLoseComp 0 .%id%_next Goto .%id%_GoLose>
		*.%id%_GoLose <*YouLostItem>
		Msg%id%01 <Have you found the %name2% yet?>
		Msg%id%02 <Then come back here when you've found it!>
		Prompt%id%01 <I'm still working on it.>
		Prompt%id%02 <I have it right here. [Give item]>
		CPrompt%id%02 <ifKeyItem %2% Accept>
		Prompt%id%03 <I sort of lost the %name2%...>
		CPrompt%id%03 <ifItemDestroyed %2% Accept>
	end

%%
%% *CS_WinTask Content
%%	&Protection	The PC protected the NPC from some threat, real or imagined
%%	&NoReward	The PC came into this task knowing there'd be no reward
%%
%%  The PC didn't exactly have a mission, but someone asked him to do something
%%  and he did it. Hooray! Rewards for this subplot are likely to be more
%%  personal than the rewards for a formal mission.
%%
%% Param1: The Task-giver.
%%

Content
	name <If you want a paying job...>
	desc <The NPC will send the PC somewhere to find a paying mission.>
	requires <*CS_WinTask &NoReward>

	% E1 is the NPC.
	% E2 is a scene to search
	Element2 <Scene (Building|Meeting) Public !Near -7 !Okay -3 !XClude -2>

	start <ifNPCDead %1% SMemo 0 WinComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop% NewChat Say %id%01 StoryNote %id%02 AddReact d10  WinComp %2% .%id%_win>
		.%id%_win <+Tgs +Fmi>
		Msg%id%01 <Wow, you're great! If you'd like to get a paying job next time, you should look for work at %name2%... that's what I've heard, anyhow.>
		Msg%id%01_1 <>
		CMsg%id%01_1 <ifNPCSociable Accept>
		Msg%id%01_2 <>
		CMsg%id%01_2 <ifNPCShy Accept>
		Msg%id%01_3 <>
		CMsg%id%01_3 <ifNPCEasygoing Accept>
		Msg%id%01_4 <>
		CMsg%id%01_4 <ifNPCPassionate Accept>
		Msg%id%01_5 <>
		CMsg%id%01_5 <ifNPCCheerful Accept>
		Msg%id%01_6 <>
		CMsg%id%01_6 <ifNPCMelancholy Accept>
		Msg%id%02 <%name1% suggested you look for work at %name2%.>
	end

Content
	name <I'll Help You Out>
	desc <The PC's friend will offer to join him, becoming either an ally or the partner.>
	requires <*CS_WinTask 1:FRIEND ~R:-->

	% E1 is the NPC

	start <ifNPCDead %1% SMemo 0 WinComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop% ifChatNPCInPlay else .%id%_GoComeHere NewChat Say %id%01 AddChat %id%01 AddCHat %id%02 AddChat %id%03>
		.%id%_GoComeHere <NewChat Say %id%07>
		.%id%_GoBecomeAlly <PCAlly %1% NPCLevel %1% StoryDL History %id%05 SMemo 0 NTBWinComp 0 .%id%_win>
		.%id%_win <+T-- +F-->
		result%id%01 <History %id%02 NPCLevel %1% StoryDL &SetPartnerNPC %1% &AddPartnerToLance SMemo 0 AddReact d10  NTBWinComp 0 .%id%_win Goto .%id%_GoJoinLance>
		*.%id%_GoJoinLance <*WelcomeToLance>
		result%id%02 <ifNPCInPlay &PartnerNPC else .%id%_GoEndR2 Monologue &PartnerNPC %id%03 Goto .%id%_GoEndR2>
		.%id%_GoEndR2 <NewChat Say %id%04 Goto .%id%_GoBecomeAlly>
		result%id%03 <NewChat Say %id%06 Goto .%id%_GoBecomeAlly>
		Msg%id%01 <Thanks for helping me out, \PC ! I don't know how I'll ever repay you... say, you don't happen to need a partner, do you?>
		Msg%id%02 <In thanks for your help, %name1% joined your lance.>
		Msg%id%03 <What, am I invisible or something?>
		Msg%id%04 <I see. Well, if you ever need me, you know where you can find me.>
		Msg%id%05 <In thanks for your help, %name1% offered to join your lance.>
		Msg%id%06 <OK. I'll be waiting.>
		Msg%id%07 <Come see me at \SCENE NPCScene %1% .>
		Prompt%id%01 <Sure, I'd love to have you as part of the lance.>
		CPrompt%id%01 <ifNPCDead &PartnerNPC Accept>
		Prompt%id%02 <Sorry, but I've already got a partner.>
		CPrompt%id%02 <ifNPCOK &PartnerNPC Accept>
		Prompt%id%03 <Not right now, but if I need help I'll let you know.>
	end

Content
	name <Here, have some money>
	desc <The NPC will pay the PC for the job.>
	requires <*CS_WinTask -1:FRIEND -&NoReward>

	% E1 is the NPC.

	start <ifNPCDead %1% SMemo 0 WinComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop% NewChat Say %id%01 CashPrize Reward StoryDL 500 SMemo 0 AddReact d10  NTBWinComp 0 .%id%_win>
		.%id%_win <+T-- +F-->
		Msg%id%01 <Thanks for your help. Here, I'd like for you to have this money.>
		Msg%id%01_1 <>
		CMsg%id%01_1 <ifNPCSociable Accept>
		Msg%id%01_2 <>
		CMsg%id%01_2 <ifNPCShy Accept>
		Msg%id%01_3 <>
		CMsg%id%01_3 <ifNPCEasygoing Accept>
		Msg%id%01_4 <>
		CMsg%id%01_4 <ifNPCPassionate Accept>
		Msg%id%01_5 <>
		CMsg%id%01_5 <ifNPCCheerful Accept>
		Msg%id%01_6 <>
		CMsg%id%01_6 <ifNPCMelancholy Accept>
	end

%%
%% *CS_LoseTask Content
%%
%% The PC didn't exactly have a mission, but someone asked him to do something
%% and he failed. Bummer.
%%
%% Param1: The Task-giver.
%%

Content
	name <Default Lose Task>
	desc <The NPC will debrief the PC on the loss.>
	requires <*CS_LoseTask>

	% E1 is the NPC.

	start <ifNPCDead %1% LoseComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop% NewChat Say %id%01 SMemo 0 AddReact -d4  NTBLoseComp 0 .%id%_loss>
		.%id%_loss <+T-- +F-->
		Msg%id%01 <That didn't go so well.>
		Msg%id%01_1 <>
		CMsg%id%01_1 <ifNPCSociable Accept>
		Msg%id%01_2 <You failed.>
		CMsg%id%01_2 <ifNPCShy Accept>
		Msg%id%01_3 <>
		CMsg%id%01_3 <ifNPCEasygoing Accept>
		Msg%id%01_4 <>
		CMsg%id%01_4 <ifNPCPassionate Accept>
		Msg%id%01_5 <That didn't go so well... but, at least you did your best.>
		CMsg%id%01_5 <ifNPCCheerful Accept>
		Msg%id%01_6 <You failed. What am I going to do now...?>
		CMsg%id%01_6 <ifNPCMelancholy Accept>
	end

%%
%% *CS_MootMission Content
%%
%% The mission has become unwinnable, somehow. This counts as a loss, but at least
%% the NPC involved will be kind enough to explain what's happening.
%%
%% Param1: The Mission-giver
%%

Content
	name <Default Moot>
	desc <The NPC will debrief the PC on the loss.>
	requires <*CS_MootMission>

	% E1 is the NPC.

	% p%id%01 = Email Counter
	start <ifNPCDead %1% SMemo 0 LoseComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->
	update <if= p%id%01 0 P= %id%01 1 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 SMemo 0 NTBLoseComp 0 .%id%_loss>
		.%id%_loss <+T-- +F-->
		Msg%id%01 <I'm afraid that you took too long on that mission. It's over now.>
	end


%%
%% *CS_CAWinMission Content
%%	&RevealEF	The enemy faction has been revealed
%%
%% Catch-all win mission component.
%% The PC has won a mission provided by the NPC. Note that the mission should not
%% have altered the state of the story; therefore, this reward is free to do so
%% itself.
%%
%% The parent plot sets the plot status to this layer's ID when ready.
%%
%% Param1: The Mission-giver
%%

Content
	name <Here, have some money>
	desc <The NPC will pay the PC for the job.>
	requires <*CS_CAWinMission>

	% E1 is the NPC.

	start <ifNPCDead %1% SMemo 0 WinComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop% gOTO .%id%_GoReportSuccess>
		*.%id%_GoReportSuccess <*MissionWasSuccess&Reward .%id%_GoEnd &AllyFac &EnemyFac>
		.%id%_GoEnd <CashPrize Reward StoryDL 500 SMemo 0  AddReact d10  NTBWinComp 0 .%id%_win>
		.%id%_win <+T-- +F-->
	end

Content
	name <You Have Another Mission>
	desc <The NPC will pay the PC, then direct him to another mission.>
	requires <*CS_CAWinMission 1:PCFAC>

	% E1 is the NPC.
	% E2 is another NPC the PC can speak with
	% E3 is a scene for the meeting
	Element2 <Character !Near -7 !Comrade 1>
	Element3 <Scene Building Public !Near -7 !Okay 2>

	start <ifNPCDead %1% SMemo 0 WinComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop% ifNPCOK %2% else .%id%_GoReportSuccess  NewChat Say %id%01 SMemo %id%02 History %id%03 Goto .%id%_GoEnd>
		*.%id%_GoReportSuccess <*MissionWasSuccess&Reward .%id%_GoMeh &AllyFac &EnemyFac>
		.%id%_GoEnd <CashPrize Reward StoryDL 500 &SetTargetNPC %2%  AddReact d10  WinComp %3% .%id%_win>
		.%id%_win <+Tgt +Fmi>
		.%id%_GoMeh <CashPrize Reward StoryDL 500  AddReact d10  NTBWinComp 0 .%id%_meh>
		.%id%_meh <+T-- +F-->
		Msg%id%01 <Good job on that mission. I think %name2% has some more work for you; you should go meet \OPR %2% at %name3%.>
		Msg%id%01_1 <>
		CMsg%id%01_1 <ifNPCSociable Accept>
		Msg%id%01_2 <>
		CMsg%id%01_2 <ifNPCShy Accept>
		Msg%id%01_3 <>
		CMsg%id%01_3 <ifNPCEasygoing Accept>
		Msg%id%01_4 <>
		CMsg%id%01_4 <ifNPCPassionate Accept>
		Msg%id%01_5 <>
		CMsg%id%01_5 <ifNPCCheerful Accept>
		Msg%id%01_6 <>
		CMsg%id%01_6 <ifNPCMelancholy Accept>
		Msg%id%02 <%name1% sent you to %name2% at %name3% for another mission.>
		Msg%id%03 <%name1% sent you to %name2% for another mission.>
	end

Content
	name <Pass the Buck>
	desc <The NPC will send the PC to talk with someone else.>
	requires <*CS_CAWinMission>

	% E1 is the NPC.
	% E2 is another NPC the PC can speak with
	% E3 is a scene for the meeting
	Element2 <Character !Near -7 !Ally 1 !Okay -3>
	Element3 <Scene Building Public !Near -7 !Okay 2>

	start <ifNPCDead %1% SMemo 0 WinComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop% SMemo 0  ifNPCOK %2% else .%id%_GoReportSuccess  if# ChatNPCFac 0 else .%id%_GoReportSuccess NewChat Say %id%01 SMemo %id%02 History %id%03 Goto .%id%_GoEnd>
		*.%id%_GoReportSuccess <*MissionWasSuccess&Reward .%id%_GoMeh &AllyFac &EnemyFac>
		.%id%_GoEnd <CashPrize Reward StoryDL 500 &SetTargetNPC %2%  AddReact d10  WinComp %3% .%id%_win>
		.%id%_win <+Tgt +Fmi>
		.%id%_GoMeh <CashPrize Reward StoryDL 500  AddReact d10  NTBWinComp 0 .%id%_meh>
		.%id%_meh <+T-- +F-->
		Msg%id%01 <Good work, \PC . If you want to see this through, I believe %name2% at %name3% has another mission you could help with.>
		Msg%id%01_1 <Thanks \PC . We're going to need a lot of help to fight this problem... I believe %name2% at %name3% is looking for someone to run another mission, if you're interested.>
		CMsg%id%01_1 <ifNPCSociable Accept>
		Msg%id%01_2 <Good job. %name2% at %name3% has another mission for you, if you're interested.>
		CMsg%id%01_2 <ifNPCShy Accept>
		Msg%id%01_3 <Back for your pay, I see. I believe %name2% at %name3% has another mission if you're planning to continue this.>
		CMsg%id%01_3 <ifNPCEasygoing Accept>
		Msg%id%01_4 <One battle's over, but we're a long way from the end yet... %name2% could use some help over at %name3% , if you're up for another mission.>
		CMsg%id%01_4 <ifNPCPassionate Accept>
		Msg%id%01_5 <>
		CMsg%id%01_5 <ifNPCCheerful Accept>
		Msg%id%01_6 <>
		CMsg%id%01_6 <ifNPCMelancholy Accept>
		Msg%id%02 <%name1% sent you to %name2% at %name3% for another mission.>
		Msg%id%03 <%name1% sent you to %name2% for another mission.>
	end


%%
%% *CS_CALoseMission Content
%%	&RevealEF	The enemy faction has been revealed
%%
%% Catch-all lose mission component.
%% The PC has lost a mission provided by the NPC. Note that the mission should not
%% have altered the state of the story; therefore, this reward is free to do so
%% itself.
%%
%% The parent plot sets the plot status to this layer's ID when ready.
%%
%% Param1: The Mission-giver
%%

Content
	name <Default Loss>
	desc <The NPC will debrief the PC on the loss.>
	requires <*CS_CALoseMission>

	% E1 is the NPC.

	start <ifNPCDead %1% LoseComp 0 .%id%_loss>
	.%id%_loss <+T-- +F-->

	sub
		Persona 1
		greeting <if= PlotStatus %plotid% %id% else %pop% gOTO .%id%_GoReportLoss>
		*.%id%_GoReportLoss <*MissionWasFailure .%id%_GoEnd &AllyFac &EnemyFac>
		.%id%_GoEnd <SMemo 0  AddReact -d6  NTBLoseComp 0 .%id%_loss>
		.%id%_loss <+T-- +F-->
	end



