From 189d41d88e229a7a1b5572d2dcdd95818703f664 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Sun, 17 Oct 2021 12:25:58 -0300
Subject: Spice up things at Fortress Town Siege - The Five Heroes are immune
 to the stun

---
 npc/025-1/ctrl.c       |  3 ++-
 npc/functions/main.txt | 25 +++++++++++++++++++++++++
 2 files changed, 27 insertions(+), 1 deletion(-)

diff --git a/npc/025-1/ctrl.c b/npc/025-1/ctrl.c
index 1bd138488..1b42e6c7f 100644
--- a/npc/025-1/ctrl.c
+++ b/npc/025-1/ctrl.c
@@ -104,7 +104,8 @@ function	script	FTStatue	{
     if (askyesno() == ASK_YES) {
         if ($@FORTRESS_STATUE & .@id)
             return false;
-        sc_start SC_STUN, 10000, 1;
+        if (!islegendary())
+            sc_start SC_STUN, 10000, 1;
         doevent("Gate#F::OnStatueBreach");
         mapannounce("025-1", strcharinfo(0)+" has broken a statue!", bc_map);
         $@FORTRESS_STATUE=$@FORTRESS_STATUE|.@id;
diff --git a/npc/functions/main.txt b/npc/functions/main.txt
index 787c230a1..2818d1fb7 100644
--- a/npc/functions/main.txt
+++ b/npc/functions/main.txt
@@ -327,6 +327,31 @@ function	script	getmap	{
     return .@mapName$;
 }
 
+// Get unit BL from type
+// ( unittype )
+function	script	getunitbl	{
+    switch (getarg(0)) {
+    case UNITTYPE_PC:
+        return BL_PC;
+    case UNITTYPE_NPC:
+        return BL_NPC;
+    case UNITTYPE_PET:
+        return BL_PET;
+    case UNITTYPE_MOB:
+        return BL_MOB;
+    case UNITTYPE_HOM:
+        return BL_HOM;
+    case UNITTYPE_MER:
+        return BL_MER;
+    case UNITTYPE_ELEM:
+        return BL_ELEM;
+    default:
+        consolewarn("Invalid unit type on getunitbl: %d", getarg(0));
+        return BL_ALL;
+    }
+    return 0;
+}
+
 // isin( map, x1, y1, {[x2, y2][radius]} )
 function	script	isin	{
     if (getmapxy(.@mapName$, .@xpos, .@ypos, 0) != 0)
-- 
cgit v1.2.3-70-g09d2