summaryrefslogtreecommitdiff
path: root/npc/items/inc_sc_bonus.txt
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2019-04-14 22:54:09 -0300
committerJesusaves <cpntb1@ymail.com>2019-04-14 22:55:07 -0300
commita8680c39fbc3aea65a2185b07e3987a8bf1ca102 (patch)
tree5deda6e247120c9099f83dc84edf781cc69c2d18 /npc/items/inc_sc_bonus.txt
parent6c56174d9de8adbbd3ee217f7993589fdc90e380 (diff)
downloadserverdata-a8680c39fbc3aea65a2185b07e3987a8bf1ca102.tar.gz
serverdata-a8680c39fbc3aea65a2185b07e3987a8bf1ca102.tar.bz2
serverdata-a8680c39fbc3aea65a2185b07e3987a8bf1ca102.tar.xz
serverdata-a8680c39fbc3aea65a2185b07e3987a8bf1ca102.zip
Luck Increasing Potions (A, B and C)
Diffstat (limited to 'npc/items/inc_sc_bonus.txt')
-rw-r--r--npc/items/inc_sc_bonus.txt48
1 files changed, 48 insertions, 0 deletions
diff --git a/npc/items/inc_sc_bonus.txt b/npc/items/inc_sc_bonus.txt
new file mode 100644
index 000000000..a4f7cdac5
--- /dev/null
+++ b/npc/items/inc_sc_bonus.txt
@@ -0,0 +1,48 @@
+// TMW-2 Script.
+// Author:
+// Jesusalva
+// Description:
+// Applies effects for INC_* (STR doesn't exist)
+// Valid values: INCAGI INCVIT INCINT INCDEX INCLUK INCHIT
+/// Untested Values: INCHIT INCFLEE INCMHP INCMSP WALKSPEED INVINCIBLE
+//
+// Variables:
+// @delay Second of buffing
+// @min Min amount of type
+// @max Max amount of type
+// @type SC_*
+
+- script inc_sc_bonus -1,{
+OnUse:
+ if (@delay <= 0) close;
+
+ // Get the bonus value
+ .@bonus=rand(@min, @max);
+
+ // Remaining time and effect conversion
+ @v=getstatus(@type, 1);
+ @t=getstatus(@type, 5);
+
+ // Convert remaining time to seconds, rounded down
+ if (@t > 1000)
+ @t=@t/1000;
+ else
+ @t=0;
+
+ // If there was effect previously, get ponderate average
+ if (@v > 0)
+ @v=(.@bonus*@delay+@v*@t)/(@t+@delay);
+ else
+ @v=.@bonus;
+
+ // Update time value to ms and to stack
+ @t+=@delay;
+ @t*=1000;
+
+ // Restart the bonus
+ sc_end @type;
+ sc_start @type,@t,@v;
+
+ close;
+}
+