diff options
author | Jesusaves <cpntb1@ymail.com> | 2021-04-18 03:46:14 -0300 |
---|---|---|
committer | Jesusaves <cpntb1@ymail.com> | 2021-04-18 03:46:14 -0300 |
commit | 487fe31613270893a6cec38673ecc15b3814fb22 (patch) | |
tree | 2e6689e41c2a34e950363207db105fa66269f28a /npc | |
parent | d7a2a280d933a82704d8e33c3ec5ecadf3699d77 (diff) | |
download | serverdata-487fe31613270893a6cec38673ecc15b3814fb22.tar.gz serverdata-487fe31613270893a6cec38673ecc15b3814fb22.tar.bz2 serverdata-487fe31613270893a6cec38673ecc15b3814fb22.tar.xz serverdata-487fe31613270893a6cec38673ecc15b3814fb22.zip |
Remove deprecated event script, and add SCBonus2 (unused, but cool to have)
Diffstat (limited to 'npc')
-rw-r--r-- | npc/functions/inc_sc_bonus.txt | 49 |
1 files changed, 41 insertions, 8 deletions
diff --git a/npc/functions/inc_sc_bonus.txt b/npc/functions/inc_sc_bonus.txt index 8e6b6e5b..7bd24331 100644 --- a/npc/functions/inc_sc_bonus.txt +++ b/npc/functions/inc_sc_bonus.txt @@ -60,13 +60,46 @@ function script SC_Bonus { return true; } -- script inc_sc_bonus -1,{ -OnUse: - SC_Bonus(@delay, @type, @min, @max); - @delay=0; - @type=0; - @min=0; - @max=0; - end; +// SC_Bonus2(delay, SC1, val1, val2) +function script SC_Bonus2 { + .@delay=getarg(0); + .@type=getarg(1); + .@val1=getarg(2); + .@val2=getarg(3); + if (.@delay <= 0) + return false; + + // Remaining time and effect conversion + .@v1=getstatus(.@type, 1); + .@v2=getstatus(.@type, 2); + .@ts=getstatus(.@type, 5); + + // Convert remaining time to seconds, rounded down + .@ts=.@ts/1000; + + // If there was effect previously, get ponderate average (val1) + if (.@v1 > 0) + .@v1=ponderate_avg(.@val1, .@delay, .@v1, .@ts); + else + .@v1=.@val1; + + // If there was effect previously, get ponderate average (val2) + if (.@v2 > 0) + .@v2=ponderate_avg(.@val2, .@delay, .@v2, .@ts); + else + .@v2=.@val2; + + // Update time value to ms and to stack + .@t+=.@delay; + .@t*=1000; + + // Debug print if needed + if (debug || $@GM_OVERRIDE) + debugmes "Effect %d (%d/%d bonus) for %d ms", .@type, .@v1, .@v2, .@ts; + + // Restart the bonus + sc_end .@type; + sc_start2 .@type, .@ts, .@v1, .@v2; + return true; } |