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.txt47
1 files changed, 28 insertions, 19 deletions
diff --git a/npc/items/inc_sc_bonus.txt b/npc/items/inc_sc_bonus.txt
index 92a5ae522..32aeec6a0 100644
--- a/npc/items/inc_sc_bonus.txt
+++ b/npc/items/inc_sc_bonus.txt
@@ -5,28 +5,32 @@
// Applies effects for INC_* (STR doesn't exist)
// Valid values: INCAGI INCVIT INCINT INCDEX INCLUK INCHIT INCFLEE
// Doesn't works: SC_STRUP
-// Works if @min == @max: INCMHP INCMHPRATE INCMSP INCMSPRATE
+// Works if .@min == .@max: INCMHP INCMHPRATE INCMSP INCMSPRATE
/// Untested Values: WALKSPEED (reverse logic) INVINCIBLE (broken)
//
// Variables:
-// @delay Second of buffing
-// @min Min amount of type
-// @max Max amount of type
-// @type SC_*
+// .@delay Second of buffing
+// .@type SC_*
+// .@min Min amount of type
+// .@max Max amount of type (optional)
-- script inc_sc_bonus -1,{
-OnUse:
- if (@delay <= 0) close;
+function script SC_Bonus {
+ .@delay=getarg(0);
+ .@type=getarg(1);
+ .@min=getarg(2);
+ .@max=getarg(3, .@min);
+ if (.@delay <= 0)
+ return false;
// Get the bonus value
- if (@min != @max)
- .@bonus=rand(@min, @max);
+ if (.@min != .@max)
+ .@bonus=rand2(.@min, .@max);
else
- .@bonus=any(@min, @max);
+ .@bonus=.@min;
// 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)
@@ -36,22 +40,27 @@ OnUse:
// If there was effect previously, get ponderate average
if (.@v > 0)
- .@v=ponderate_avg(.@bonus, @delay, .@v, .@t);
+ .@v=ponderate_avg(.@bonus, .@delay, .@v, .@t);
else
.@v=.@bonus;
// Update time value to ms and to stack
- .@t+=@delay;
+ .@t+=.@delay;
.@t*=1000;
// Debug print if needed
if (debug || $@GM_OVERRIDE)
- debugmes "Effect %d (+%d percent) for %d ms", @type, .@bonus, .@t;
+ debugmes "Effect %d (+%d percent) for %d ms", .@type, .@bonus, .@t;
// Restart the bonus
- sc_end @type;
- sc_start @type,.@t,.@v;
+ sc_end .@type;
+ sc_start .@type,.@t,.@v;
+ return true;
+}
- close;
+- script inc_sc_bonus -1,{
+OnUse:
+ SC_Bonus(@delay, @type, @min, @max);
+ end;
}