%%
%% *Skirmishing Plots
%%
%%  Mecha from a foreign power are in town skirmishing with the local security forces,
%%  but it's nothing serious. There will be a lot of mecha missions until everything
%%  calms down.
%%
%% Mood Spec:
%%  E1 = The city itself
%%  E2 = The enemy faction
%%

Plot
	name <Enemy Patrol>
	% desc <Some mecha from the rampaging faction may attack the PC.>
	desc <暴れまわっている勢力のメックが PC を攻撃するかもしれない。>
	requires <*Skirmishing>

	% E1 is an outdoors scene
	% E2 is an encounter to place there
	% E3 is the faction that's rampaging
	% E4 is an ally of that faction
	Element1 <Scene Environs>
	Element2 <Prefab>
	Place2 <1>
	Element3 <Grab 2>
	Element4 <Character HasMecha !Ally 3 !XClude -1 -POLIC !Global>
	Place4 <2 (Enemies)>

	% P1 = Time Limit/Initialization Counter
	% P2 = Mode; if P2=1 then the player joins the battle on E4's side
	start <if# P1 0 ifG ComTime P1 EndPlot>
	update <if= P1 0 P= 1 ComTime P+ 1 21600>

	sub
		MetaScene 2 2
		% L1 = Encounter Over Counter
		% L2 = Initialization Counter
		MapWidth 50
		MapHeight 50

		SetFaction 3

		start <if= L2 0 L= 2 1>
		nu1 <if= T1 0   Return   if= V1 0 V= 1 1    AddRenown -1        EndPlot>
		nu2 <if= T2 0   if= V1 0 V= 1 1   AddRenown 1 Alert 2   XPV 100   SALVAGE   if= P2 0 else GoAltEnding FacXP+ RootSceneFac 1 EndPlot>
		GoAltEnding <FacXP+ %3% 1  FacXP+ NPCFac %4% 1  EndPlot>

		% Msg2 <You have defeated the mecha.>
		Msg2 <敵メックを撃破した。>


		sub
			team 1
			SetEnemy 2
			SetAlly 3
			ParaX 5
			ParaY 5

			team 2
			name <Enemies>
			SetEnemy 1 3
			Deploy <if= P2 0 else GoAltDeploy SetSelfFaction %3% WMecha 2 %threat% 75>
			GoAltDeploy <SetSelfFaction RootSceneFac WMecha 2 %threat% 200>
			ParaX 45
			ParaY 45

			team 3
			name <Allies>
			SetEnemy 2
			SetAlly 3
			Deploy <if= P2 1 SetSelfFaction %3% WMecha 3 %threat% 50>
			ParaX 10
			ParaY 10
		end

		Persona 4
		special <Unlisted NoEscape>
		greeting <if= PlotStatus %plotid% %id% else GoCheckEnemy NewChat SayAnything>
		GoCheckEnemy <SetPlotStatus %plotid% %id% ifFactionEnemy %3% else GoCheckAlly  Goto GoBattleChallenge>
		GoCheckAlly <ifFactionAlly %3% else GoCheckSides P= 2 1 SetNPCTeam %4% 3       Goto GoJoinPatrol>
		GoCheckSides <ifG React d30 else GoBattleChallenge EndChat Say 1 EndPlot>
		*GoBattleChallenge <*BattleChallenge&Avoid GoThemeEnemy GoEnd>
		*GoJoinPatrol <*JoinOurFacPatrol GoThemeAlly GoEnd %3% RootSceneFac>
		*GoThemeEnemy <*THEME_EXPO&Enemy GoStartCombat>
		*GoThemeAlly <*THEME_EXPO&Ally GoStartCombat>
		GoStartCombat <Exit %2%>
		GoEnd <EndPlot>
		% Msg1 <My fight isn't with you, but you better get out of \SCENE RootSceneID while you can.>
		Msg1 <%JS2と戦うつもりはない%JV_F_WA……今のうちに \SCENE RootSceneID から出て行くこと%JV_M_DA%JV_NA。>
	end
	inv
		STC ENCOUNTER-WANDER
		name <%name4%'s Patrol>
		name_I18N <%name4% の哨戒部隊>
		EncounterMove 20
		use <ifG StatVal STAT_MetaVisibility -1  ForceChat %4%>
		ATTACK <ifG StatVal STAT_MetaVisibility -1   ifG PCScale 0   ifUStealth 10 else GoMaybeAttack ifYesNo 3 4 5 else GoAvoidAttack Goto GoAutoAttack>
		GoMaybeAttack <ifFactionEnemy %3% Goto GoAutoAttack>
		GoAutoAttack <ForceChat %4%>
		% Msg3 <You encounter a group of infiltrators led by %name4% of \FACTION NPCFac %4% .>
		% Msg4 <Contact them.>
		% Msg5 <Slip away quietly.>
		Msg3 <\FACTION NPCFac %4% の %name4% に率いられた侵入者の一団と遭遇した。>
		Msg4 <接触する。>
		Msg5 <静かに離脱する。>
	end

Plot
	name <Skirmishing Job>
	% This job gives salvage.
	requires <*Skirmishing>
	PayRate 125

	% E1 is the faction to be fought
	% E2 is a character who will offer the mission
	% E3 is a scene where the encounter will take place
	Element1 <Faction !Ally -2 !Xclude -1>
	Element2 <Character (HasMecha|POLIT) -POLIC !Ally -1 !Xclude 1>
	Element3 <Scene Environs>

	% SubPlot1 is the combat encounter
	SubPlot1 <*MECHAMISSION_Versus 2 3 1>

	% P1 = Time Limit
	% P2 = Email Indicator
	start <if= PlotStatus %plotid% 0 ifNPCOK %2% else GoDelete ifG ComTime P1 EndPlot>
	GoDelete <EndPlot>
	update <if= PlotStatus %plotid% 0 if= P1 0 P= 1 ComTime P+ 1 86400>

	% Insert email here
	5min <if= PlotStatus %plotid% 0 if= RootSceneID %1% if= P2 0  if= PCFac NPCFac %2%    ifG PCCharm d30  SetNPC %2% Email 1 P= 2 1>
	% Msg1   <%name2%@ \SCENE NPCSCene %2% :// \RANK \PC , report to \SCENE EScene 2 for a mission.>
	% Msg1_1 <%name2%@ \SCENE NPCSCene %2% :// I have a job for you at \SCENE EScene 2 .>
	% Msg1_2 <%name2%@ \SCENE NPCSCene %2% :// %name1% needs your help. Come see me at \SCENE EScene 2 .>
	% Msg1_3 <%name2%@ \SCENE NPCSCene %2% :// Call when you can; I've got a mission for you.>
	Msg1   <%name2%@ \SCENE NPCSCene %2% :// \PC、任務のために \SCENE EScene 2 へ出頭するように。>
	Msg1_1 <%name2%@ \SCENE NPCSCene %2% :// \SCENE EScene 2 で%JS2に仕事がある%JV_ZO。>
	Msg1_2 <%name2%@ \SCENE NPCSCene %2% :// %JF2%JF_TACHIは%JS2の助けを必要としている%JV_F_WA。%JF2に会いに \SCENE EScene 2 に来るように。>
	Msg1_3 <%name2%@ \SCENE NPCSCene %2% :// すぐに連絡を。%JS2に任務がある%JV_F_WA。>

	sub
		Persona 2
		% rumor0 <%name2% needs a pilot to fight the infiltrators from %name1%.>
		rumor0 <%name2% は %name1% からの侵入者と戦うパイロットを探している>
		greeting <if= PlotStatus %plotid% %id1% else GoCheckOffer Goto GoRemind>
		*GoRemind <*MechaMissionReminder %3%>
		GoCheckOffer <if# PlotStatus %plotid% 0 else GoCheckEnemy NewChat SayAnything>
		*GoCheckEnemy <*ENEMY_CHECK GoCheckEmail ChatNPCFac GoEnd>
		GoCheckEmail <if= P2 1 else GoCheckMember Goto GoGotEmail>
		*GoGotEmail <*DidYouGetEmail GoMissionBriefing>
		GoCheckMember <if= PCFac ChatNPCFac else GoCheckAuto  Goto GoIsMember>
		*GoIsMember <*IHaveAJobForYou GoMissionBriefing>
		*GoCheckAuto <*AutoMissionTest&Mecha GoMissionBriefing GoRejectMission GoCheckSkill ChatNPCFac na>
		*GoCheckSkill <*CivilDefenseTest&Mecha  GoMissionBriefing GoEnd GoRejectMission GoReducePay ChatNPCFac %1% %threat%>
		GoReducePay <SetPayRate 75  Goto GoMissionBriefing>
		*GoRejectMission <*RejectMission GoEnd>
		GoEnd <EndPlot>
		GoMissionBriefing <NewChat Say 1  AddChat 1 AddChat 2>
		*result1 <*GoodLuckOnMission&NoEnemyFac GoR1Final ChatNPCFac na>
		GoR1Final <Memo 2 SetPlotStatus %plotid% %id1%>
		result2 <Goto GoRejectMission>
		% Msg1 <Infiltrators sent by %name1% have been spotted in %name3%. I want you to go defeat them; do this, and you'll earn $ \VAL Reward %threat% PayRate plus salvage.>
		% Msg1_1 <No doubt you've heard about the infiltrators from %name1%. They've been seen in %name3%; your mission, if you choose to accept it, is to engage and defeat them. For this you'll earn $ \VAL Reward %threat% PayRate plus salvage.>
		% CMsg1_1 <ifNPCSociable Accept>
		% Msg1_2 <Infiltrators from %name1% have been tracked to %name3%. Defeat them and you'll earn $ \VAL Reward %threat% PayRate plus salvage rights.>
		% CMsg1_2 <ifNPCShy Accept>
		% Msg1_3 <>
		% CMsg1_3 <ifNPCEasygoing Accept>
		% Msg1_4 <>
		% CMsg1_4 <ifNPCPassionate Accept>
		% Msg1_5 <>
		% CMsg1_5 <ifNPCCheerful Accept>
		% Msg1_6 <>
		% CMsg1_6 <ifNPCMelancholy Accept>
		% Msg2 <\ELEMENT 2 in \SCENE NPCScene %2% hired you to fight %name1% in %name3%.>
		% Prompt1 <No problem. I'll be back when I'm done.>
		% Prompt1_1 <I can do that.>
		% Prompt1_2 <Alright, I'll do it.>
		% Prompt2 <Sorry, but I'd rather not make any more enemies.>
		% CPrompt2 <if# PCFac ChatNPCFac Accept>
		% Prompt2_1 <Sorry, but I don't want this job.>
		% Prompt2_2 <Wait, I've changed my mind about this job.>
		Msg1 <%name1% の送り込んだ侵入者が %name3% にいることが確認された%JV_F_WA。%JS2にはこれを撃破してほしい%JV_F_NO。この任務の報酬は、$ \VAL Reward %threat% PayRate とサルベージ権%JG_DA。>
		Msg1_1 <%name1% から侵入者が来ている話はもう聞いてると思う。現在地は %name3% であることが目撃されている%JV_F_WA。%JS2の任務は──もし受けてもらえるならだ%JG_GA、彼らと交戦して撃破すること%JG_DA。報酬には $ \VAL Reward %threat% PayRate とサルベージ権が用意してある%JG_YO。>
		CMsg1_1 <ifNPCSociable Accept>
		Msg1_2 <%name1% からの侵入者が %name3% にいる%JV_F_NO%JV_SIL。撃破すれば $ \VAL Reward %threat% PayRate の報酬とサルベージ権を渡す%JG_YO。>
		CMsg1_2 <ifNPCShy Accept>
		Msg1_3 <>
		CMsg1_3 <ifNPCEasygoing Accept>
		Msg1_4 <>
		CMsg1_4 <ifNPCPassionate Accept>
		Msg1_5 <>
		CMsg1_5 <ifNPCCheerful Accept>
		Msg1_6 <>
		CMsg1_6 <ifNPCMelancholy Accept>
		Msg2 <\SCENE NPCScene %2% の \ELEMENT 2 は、%name3% にいる %name1% と戦うためにあなたを雇った。>
		Prompt1 <問題ない%JV_F_WA。片付けて戻ってくる。>
		Prompt1_1 <引き受け%JV_YOU。>
		Prompt1_2 <分かった、引き受ける%JG_YO。>
		Prompt2 <悪い%JG_GA、余計な敵は増やしたくない%JV_N%JV_M_DA。>
		CPrompt2 <if# PCFac ChatNPCFac Accept>
		Prompt2_1 <悪い%JG_GA、この仕事はやりたくない%JV_F_WA。>
		Prompt2_2 <ちょっとやる気が起きない%JV_F_WA%JV_NA。>
	end

