diff options
author | Reid <reidyaro@gmail.com> | 2016-03-08 03:01:19 +0100 |
---|---|---|
committer | Reid <reidyaro@gmail.com> | 2016-03-08 03:01:19 +0100 |
commit | 24f7099c7a02885bf3ab4b7b9739f9f48d967fe8 (patch) | |
tree | eac6db3882d289b3b9b12781a5ef5bde60890e35 /npc/items | |
parent | 164d26feafde911eafaed36f6f53a769f6bbdbe5 (diff) | |
download | serverdata-24f7099c7a02885bf3ab4b7b9739f9f48d967fe8.tar.gz serverdata-24f7099c7a02885bf3ab4b7b9739f9f48d967fe8.tar.bz2 serverdata-24f7099c7a02885bf3ab4b7b9739f9f48d967fe8.tar.xz serverdata-24f7099c7a02885bf3ab4b7b9739f9f48d967fe8.zip |
Merge healing status effects.
Diffstat (limited to 'npc/items')
-rw-r--r-- | npc/items/rand_sc_heal.txt | 40 |
1 files changed, 33 insertions, 7 deletions
diff --git a/npc/items/rand_sc_heal.txt b/npc/items/rand_sc_heal.txt index 1bdcf0ee..90a19f3e 100644 --- a/npc/items/rand_sc_heal.txt +++ b/npc/items/rand_sc_heal.txt @@ -14,31 +14,57 @@ // 4 Special 2 - script rand_sc_heal -1,{ - close; + + // Add remaning bonus if the last one hasn't finished + function remaining_bonus { + if (getstatus (getarg (0))) + { + @old_val1 = getstatus (SC_S_LIFEPOTION, 1); + @old_delay = getstatus (SC_S_LIFEPOTION, 4) * 1000; + + // change the delay to prevent fast healing + if (@old_delay > @delay) + { + @delay = @old_delay; + @val1 += @old_val1; + } + else + { + @val1 += (@old_val1 * @old_delay) / @delay; + } + } + return; + } OnUse: if (@delay <= 0) close; - .@rand = rand (@min, @max) / @delay; - if (.@rand <= 0) close; + @val1 = rand (@min, @max) / @delay; + if (@val1 <= 0) close; + + @delay *= 1000; // Put the delay in ms switch (@type) { case 1: + remaining_bonus (SC_S_LIFEPOTION); sc_end SC_S_LIFEPOTION; - sc_start2 SC_S_LIFEPOTION, @delay * 1000, .@rand, 1; + sc_start2 SC_S_LIFEPOTION, @delay, @val1, 1; break; case 2: + remaining_bonus (SC_L_LIFEPOTION); sc_end SC_L_LIFEPOTION; - sc_start2 SC_L_LIFEPOTION, @delay * 1000, .@rand, 1; + sc_start2 SC_L_LIFEPOTION, @delay, @val1, 1; break; case 3: + remaining_bonus (SC_G_LIFEPOTION); sc_end SC_G_LIFEPOTION; - sc_start2 SC_G_LIFEPOTION, @delay * 1000, .@rand, 1; + sc_start2 SC_G_LIFEPOTION, @delay, @val1, 1; break; case 4: + remaining_bonus (SC_M_LIFEPOTION); sc_end SC_M_LIFEPOTION; - sc_start2 SC_M_LIFEPOTION, @delay * 1000, .@rand, 1; + sc_start2 SC_M_LIFEPOTION, @delay, @val1, 1; break; default : break; |