%%
%% *:StopNPC Content
%%
%% The NPC is doing some kind of mission. It's the PC's job to stop
%% them... maybe.
%%
%% The parent plot sets the plot status to this layer's ID when ready.
%%
%% When this subplot concludes, it sets one of the following triggers:
%%  .%id%_%plotid%_GoWin
%%  .%id%_%plotid%_GoLoss
%%
%%  Param1: The NPC on the mission.
%%

Content
	name <SN: Basic Fight>
	requires <*:StopNPC>
	desc <The NPC is doing something. Let's have a mecha battle and be done with it.>

	% E1 is the NPC to stop
	% E2 is the outdoors scene for the fight
	% E3 is the combat encounter
	Element2 <Scene Outdoors>
	Element3 <Prefab>
	Place3 <2>

	% P%id%01 = Timer
	% P%id%02 = Have entered combat

	% At initialization set the timer, move the NPC, and level them up if
	%  appropriate.
	update <if= p%id%01 0 P= %id%01 ComTime P+ %id%01 86400 MoveNPC %1% %3% SetNPCTeam %1% 2 ifG %threat% NPCRenown %1% NPCLevel %1% %threat%>
	end <if# P%id%01 0 if= P%id%02 0 ifG ComTime P%id%01  Trigger0 .%id%_%plotid%_GoLoss  CancelSubPlot %plotid%>

	sub
		Persona 1
		special <UNLISTED>
		*greeting <*BattleChallenge&CharDev GoThemeExpo na>
		*GoThemeExpo <*THEME_EXPO&Enemy na>

		MetaScene 3 2
		rumor%id% <%name1%'s mecha has been seen in %name2%.>
		% L1 = Encounter Over Counter
		% L2 = Initialization Counter
		MapWidth 50
		MapHeight 50
		special <ARENA>

		Start <if= L2 0 L= 2 1   Alert 1 ForceChat %1% P= %id%02 1>
		nu1 <if= T1 0   Return   if= V1 0 V= 1 1                                     Trigger0 .%id%_%plotid%_GoLoss  LoseSubPlot %plotid%>
		nu2 <if= T2 0   if= V1 0 V= 1 1   XPV 100  AddRenown 1   SALVAGE   Alert 2   Trigger0 .%id%_%plotid%_GoWin   WinSubPlot  %plotid%>

		Msg1 <You face %name1% and \PPR %1% lance.>
		Msg2 <You have defeated %name1%.>

		sub
			team 1
			SetEnemy 2
			ParaX 5
			ParaY 5

			team 2
			name <Enemies>
			SetEnemy 1
			Deploy <if= PlotStatus %plotid% %id%  SetSelfFaction NPCFac %1%  WMecha 2 %threat% 70>
			ParaX 45
			ParaY 45
		end
	end
	inv
		STC CORE-INVISIBLEENCOUNTER
		name <%name1%'s Lance>
	end

