From 65dc69b9c61a1b3020653296c22ff1d2b08b48f5 Mon Sep 17 00:00:00 2001
From: Jesusaves <cpntb1@ymail.com>
Date: Thu, 16 May 2024 20:00:11 -0300
Subject: Improve Botter Syndrome + Safeguard to division by zero

---
 npc/functions/array.txt   |  1 +
 npc/functions/captcha.txt | 18 +++++++++---------
 2 files changed, 10 insertions(+), 9 deletions(-)

(limited to 'npc/functions')

diff --git a/npc/functions/array.txt b/npc/functions/array.txt
index f29e8500a..48bafff3e 100644
--- a/npc/functions/array.txt
+++ b/npc/functions/array.txt
@@ -220,6 +220,7 @@ function	script	array_difference	{
 
 function	script	array_avg	{
     .@size = getarraysize(getarg(0));
+    if (!.@size) return 0;
     .@suma = array_sum(getarg(0));
     return .@suma / .@size;
 }
diff --git a/npc/functions/captcha.txt b/npc/functions/captcha.txt
index dc4cb8147..b2c9b5a13 100644
--- a/npc/functions/captcha.txt
+++ b/npc/functions/captcha.txt
@@ -150,8 +150,8 @@ OnTimer800000:
     initnpctimer;
     end;
 
-// Pick a random target for captcha checks, which happens every 5 seconds
-OnTimer5000:
+// Pick a random target for captcha checks, which happens every 10 seconds
+OnTimer10000:
     // Script disabled by admins
     if (!$CAPTCHA) {
         initnpctimer;
@@ -258,13 +258,13 @@ OnTimer5000:
                 if (!playerattached())
                     break;
                 /////////////////////////////////////////////////////////////////
-                // The chance of you contracting the Syndrome starts at 70.0%
-                .@chance = 700;
-                // You killed less than 4 monsters, fall to 40.0%
-                if (.@mpk + 4 > MONSTERS_KILLED)
-                    .@chance -= 300;
-                // (If you killed less than 7 monsters, fall to 55.0% instead)
-                else if (.@mpk + 7 > MONSTERS_KILLED)
+                // The chance of you contracting the Syndrome starts at 65.0%
+                .@chance = 650;
+                // You killed less than 7 monsters, fall to 40.0%
+                if (.@mpk + 7 > MONSTERS_KILLED)
+                    .@chance -= 250;
+                // (If you killed less than 12 monsters, fall to 55.0% instead)
+                else if (.@mpk + 12 > MONSTERS_KILLED)
                     .@chance -= 150;
                 // If you interacted with any NPC, it falls to 27.5%
                 if (@npctalk+600 > gettimetick(2))
-- 
cgit v1.2.3-70-g09d2