From 62e2f7afb625ee54512fab96e9523159b1696e59 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Sun, 1 Sep 2019 15:14:24 -0300
Subject: Prepare the battle functions (not the internal warp system) from
 Forgotten Shrine (missing file)

---
 npc/018-6-3/main.txt | 81 ++++++++++++++++++++++++++++++++++++++++++++++++++++
 1 file changed, 81 insertions(+)
 create mode 100644 npc/018-6-3/main.txt

(limited to 'npc')

diff --git a/npc/018-6-3/main.txt b/npc/018-6-3/main.txt
new file mode 100644
index 000000000..e0c8ffdc4
--- /dev/null
+++ b/npc/018-6-3/main.txt
@@ -0,0 +1,81 @@
+// TMW2 Scripts
+// Author:
+//    Jesusalva
+// Description:
+//    Controls Forgotten Shrine
+
+// 01863_RelevanceCheck ( Room ID )
+function	script	01863_RelevanceCheck	{
+    .@id=getarg(0);
+    .@q=getq(LoFQuest_Barbara);
+    .@q2=getq2(LoFQuest_Barbara);
+    .@q3=getq3(LoFQuest_Barbara);
+    if (.@q < 3)
+        Exception("INVALID QUEST STATE, REVCHECK", RB_DEFAULT|RB_ISFATAL);
+    if (.@q != 3)
+        return false;
+    if (.@q3 & .@id)
+        return false;
+    return true;
+}
+
+// Main Controller for Instanced maps
+018-6-3,0,0,0	script	#01863_InstCtrl	NPC_HIDDEN,{
+    end;
+
+// Map, x1, y1, x2, y2, mob, amount
+function AreaMonsterB {
+    .@m$=getarg(0);
+    .@x1=getarg(1);
+    .@x2=getarg(3);
+    .@y1=getarg(2);
+    .@y2=getarg(4);
+    .@mi=getarg(5);
+    .@am=getarg(6);
+    if (!.@am)
+        return;
+    areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mi), .@mi, .@am);
+    //, instance_npcname(.name$)+"::OnKill"+.@mi);
+    return;
+}
+
+// Map, x1, y1, x2, y2, mob, amount, bossID
+function AreaMonsterBoss {
+    .@m$=getarg(0);
+    .@x1=getarg(1);
+    .@x2=getarg(3);
+    .@y1=getarg(2);
+    .@y2=getarg(4);
+    .@mi=getarg(5);
+    .@am=getarg(6);
+    .@id=getarg(7);
+    areamonster(.@m$, .@x1, .@y1, .@x2, .@y2, strmobinfo(1, .@mi), .@mi, .@am, instance_npcname(.name$)+"::OnKill"+.@id);
+    return;
+}
+
+OnRoomA:
+    // True: Must spawn boss, False: Allow to use warps
+    if (01863_RelevanceCheck(1)) {
+        mapannounce getmap(), l("BOSS FIGHT!"), bc_map|bc_pc;
+        AreaMonsterBoss(getmap(), 62, 41, 121, 58, any(HolyPixie, NulityPixie, VanityPixie, TerraniteProtector, GoboBear, Centaur), 1, 1); // Aggressive: 33%
+        // 6~12 support units
+        AreaMonsterB(getmap(), 62, 41, 121, 58, BlackSlime, rand2(3,5));
+        AreaMonsterB(getmap(), 62, 41, 121, 58, DarkLizard, rand2(2,3));
+        AreaMonsterB(getmap(), 62, 41, 121, 58, BlackScorpion, rand2(1,2));
+        // 620ms, AD18, tk710 hp 8.7
+        AreaMonsterB(getmap(), 62, 41, 121, 58, Archant, rand2(0,1));
+        // 200ms, AD21, tk630 hp 6.4
+        AreaMonsterB(getmap(), 62, 41, 121, 58, HoodedNinja, any(0,0,1));
+    }
+    end;
+
+// Kill boss will use setq3 and also erase any remaining monster
+OnKill1:
+    .@q3=getq3(LoFQuest_Barbara);
+    setq3 LoFQuest_Barbara, .@q3|1;
+    killmonsterall(getmap());
+    end;
+
+}
+
+
-- 
cgit v1.2.3-70-g09d2