summaryrefslogtreecommitdiff
path: root/npc/items/inc_sc_bonus.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/items/inc_sc_bonus.txt')
-rw-r--r--npc/items/inc_sc_bonus.txt31
1 files changed, 19 insertions, 12 deletions
diff --git a/npc/items/inc_sc_bonus.txt b/npc/items/inc_sc_bonus.txt
index c4187d4d1..ac1dd8d9b 100644
--- a/npc/items/inc_sc_bonus.txt
+++ b/npc/items/inc_sc_bonus.txt
@@ -19,31 +19,38 @@ OnUse:
if (@delay <= 0) close;
// Get the bonus value
- .@bonus=rand(@min, @max);
+ if (@min != @max)
+ .@bonus=rand(@min, @max);
+ else
+ .@bonus=any(@min, @max);
// Remaining time and effect conversion
- @v=getstatus(@type, 1);
- @t=getstatus(@type, 5);
+ .@v=getstatus(@type, 1);
+ .@t=getstatus(@type, 5);
// Convert remaining time to seconds, rounded down
- if (@t > 1000)
- @t=@t/1000;
+ if (.@t > 1000)
+ .@t=.@t/1000;
else
- @t=0;
+ .@t=0;
// If there was effect previously, get ponderate average
- if (@v > 0)
- @v=(.@bonus*@delay+@v*@t)/(@t+@delay);
+ if (.@v > 0)
+ .@v=((.@bonus*@delay)+(.@v*.@t))/(.@t+@delay);
else
- @v=.@bonus;
+ .@v=.@bonus;
// Update time value to ms and to stack
- @t+=@delay;
- @t*=1000;
+ .@t+=@delay;
+ .@t*=1000;
+
+ // Debug print if needed
+ if (debug || $@GM_OVERRIDE)
+ debugmes "Effect %d (+%d percent) for %d ms", @type, .@bonus, .@t;
// Restart the bonus
sc_end @type;
- sc_start @type,@t,@v;
+ sc_start @type,.@t,.@v;
close;
}