From 4475fbe47c2ac50706656fc772aae863a6f40932 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Sat, 25 Dec 2021 12:14:54 -0300
Subject: The boss will now summon reinforcements every 60 seconds. I'm afraid
 we'll run out of effects, though

---
 npc/006-7/ctrl.txt | 25 +++++++++++++++++++++++--
 1 file changed, 23 insertions(+), 2 deletions(-)

(limited to 'npc')

diff --git a/npc/006-7/ctrl.txt b/npc/006-7/ctrl.txt
index 1a89b35ca..3217e432e 100644
--- a/npc/006-7/ctrl.txt
+++ b/npc/006-7/ctrl.txt
@@ -18,6 +18,7 @@ OnRw:
 }
 
 006-7,44,50,0	script	Ice Lord	NPC_YETIFLY,{
+    if ($@ICICLE_CHALLENGE) end;
     if (.ticks > gettimetick(2)) {
         mesn;
         mesq l("This challenge will be available in %s. Please wait until then.", FuzzyTime(.ticks));
@@ -44,7 +45,7 @@ OnRw:
     .BOSS = monster("006-7", 44, 36, "Der Schneemann", SnowmanBoss, 1);
     .@mlt = (@menu == 2 ? 10 : 15);
 
-    setunitdata(.BOSS, UDT_MAXHP, 1000000 * .@mlt / 10);
+    setunitdata(.BOSS, UDT_MAXHP, 1000000 * .@mlt / 10); // 1M ~ 1.5M
     setunitdata(.BOSS, UDT_HP,    1000000 * .@mlt / 10);
     // Reconfigure the AI
     .@opt=getunitdata(.BOSS, UDT_MODE);
@@ -68,7 +69,7 @@ OnRw:
     setunitdata(.BOSS, UDT_MODE, .@opt);
 
     // Nerf the damage, but never miss a hit
-    setunitdata(.BOSS, UDT_ATKMIN,   60 * .@mlt / 10);
+    setunitdata(.BOSS, UDT_ATKMIN,   60 * .@mlt / 10); // 60~90 dmg
     setunitdata(.BOSS, UDT_ATKMAX,   60 * .@mlt / 10);
     setunitdata(.BOSS, UDT_ADELAY, 2220 / .@mlt * 10); // 2220 or 1480ms
     setunitdata(.BOSS, UDT_HIT,      2400);
@@ -80,6 +81,7 @@ OnRw:
     // And weak against Fire (snow) and Wind (100% dmg)
     // Otherwise, behave as Ghost element
 
+    $@ICICLE_CHALLENGE = true;
     disablenpc .name$;
     initnpctimer;
     closeclientdialog;
@@ -87,6 +89,7 @@ OnRw:
 
 // Heart
 OnTimer5000:
+    /* Maybe the fight is over */
     if (!mobcount("006-7", "all"))
         maptimer2("006-7", 10, "#OutOf0067::OnRw");
     if (.ticks < gettimetick(2) || !mobcount("006-7", "all") || !getmapusers("006-7")) {
@@ -94,10 +97,28 @@ OnTimer5000:
         enablenpc .name$;
         .ticks = min(.ticks, gettimetick(2) + 1800); // Min. Cooldown: 30 min
         .beats = 0;
+        $@ICICLE_CHALLENGE = false;
         stopnpctimer;
         end;
     }
+
+    /* Prepare some data */
+    .@hp = getunitdata(.BOSS, UDT_HP) * 100 / getunitdata(.BOSS, UDT_MAXHP);
     .beats += 1;
+
+    /* Decide the skill to use based on ~5s beats over 3 minutes */
+    switch (.beats % 18) {
+    // Summon Reinforcements (every 60s)
+    case 0:
+    case 6:
+    case 12:
+        unittalk(.BOSS, "Come forth, snow army, for the Icicle shall live forever!");
+        specialeffect(64, AREA, .BOSS);
+        sleep(500);
+        monster("006-7", 44, 22, strmobinfo(1, Snowman), Snowman, max(1, (11 - .@hp) / 10));
+        break;
+    }
+
     initnpctimer;
     end;
 
-- 
cgit v1.2.3-70-g09d2