summaryrefslogtreecommitdiff
path: root/npc
diff options
context:
space:
mode:
authorJesusaves <cpntb1@ymail.com>2022-05-12 10:08:38 -0300
committerJesusaves <cpntb1@ymail.com>2022-05-12 10:08:38 -0300
commitc4714d83cb5d7772da8030d575e2eabf0760a664 (patch)
tree1d2ddf55a05530ff295851357c2708ea086c4056 /npc
parent589c80cf0583f2f2106f7073ce11b872b34db70b (diff)
downloadserverdata-c4714d83cb5d7772da8030d575e2eabf0760a664.tar.gz
serverdata-c4714d83cb5d7772da8030d575e2eabf0760a664.tar.bz2
serverdata-c4714d83cb5d7772da8030d575e2eabf0760a664.tar.xz
serverdata-c4714d83cb5d7772da8030d575e2eabf0760a664.zip
Update the code behind variable rate healing items
Diffstat (limited to 'npc')
-rw-r--r--npc/items/rand_sc_heal.txt81
1 files changed, 28 insertions, 53 deletions
diff --git a/npc/items/rand_sc_heal.txt b/npc/items/rand_sc_heal.txt
index b8a797585..fca290644 100644
--- a/npc/items/rand_sc_heal.txt
+++ b/npc/items/rand_sc_heal.txt
@@ -31,69 +31,35 @@
//
// *getequipoption(EQI_HEAD_TOP,1,168); → Heal Bonus (should be first bonus on Chef Hat)
-
-- script rand_sc_heal -1,{
-
- // Add remaning bonus if the last one hasn't finished
- /*
- function remaining_bonus
- {
- if (getstatus(getarg(0)))
- {
- .@old_val1 = getstatus(getarg(0), 1);
- .@old_delay = getstatus(getarg(0), 4) * 1000;
-
- // Penalty to healing item stack: -20% on previous item bonus
- .@old_val1 = (.@old_val1*8/10);
-
- // change the delay to prevent fast healing
- if (.@old_delay > @delay)
- {
- @delay = .@old_delay;
- @val1 += .@old_val1;
- }
- else
- {
- @val1 += (.@old_val1 * .@old_delay) / @delay;
- }
- }
- else
- {
- @val1 = @val3;
- }
- return;
- }
- */
-
-OnUse:
- if (@rarity <= 0) {
- Exception("Invalid healing item, deleting without healing effect.");
- end;
- }
+// ItHeal(type, rarity{, delay=auto})
+function script ItHeal2 {
+ .@type=getarg(0);
+ .@rarity=getarg(1);
+ .@delay=getarg(2, 0);
// Calculate healing value in %
- @min=@rarity * ((@type*1) + 1);
- @max=@rarity * ((@type*1) + 1);
+ .@min=.@rarity * ((.@type*1) + 1);
+ .@max=.@rarity * ((.@type*1) + 1);
// Vitality raises the minimum healing value in 1%, capped at maximum vlaue
// It also raises @max up to double
- @max = min(@max*2, @min+(readparam2(bVit)/50));
- @min = min(@max, @min+(readparam2(bVit)/30));
+ .@max = min(.@max*2, .@min+(readparam2(bVit)/50));
+ .@min = min(.@max, .@min+(readparam2(bVit)/30));
// Make these abstract % in absolute values
- @min=max(1, MaxHp*@min/100);
- @max=max(3, MaxHp*@max/100);
+ .@min=max(1, MaxHp*.@min/100);
+ .@max=max(3, MaxHp*.@max/100);
// Calculate how much you'll heal
- @val1 = rand2(@min, @max);
+ @val1 = rand2(.@min, .@max);
// Calculate delay if it was not given
- if (!@delay || @delay > 60) {
- @delay=1 + ((@type*3)/2);
+ if (.@delay < 0) {
+ .@delay=1 + ((.@type*3)/2);
}
// Update val1
- @val1 = (@val1 / @delay) + 1;
+ @val1 = (@val1 / .@delay) + 1;
// Decide the healing bonus type. We have four types: S, L, G and M
// By default, we use 'S'
@@ -116,19 +82,28 @@ OnUse:
*/
// Put the delay in ms
- @delay *= 1000;
+ .@delay *= 1000;
// Apply the effect and finish
sc_end .@skill;
- sc_start2 .@skill, @delay, @val1, 1;
+ sc_start2 .@skill, .@delay, @val1, 1;
+ return @val1;
+}
+
+- script rand_sc_heal -1,{
+ end;
+OnUse:
+ if (@rarity <= 0) {
+ Exception("Invalid healing item, deleting without healing effect.");
+ end;
+ }
+ ItHeal2(@type, @rarity, @delay);
// Clear stuff
// @val1 must be preserved for cross-reading
@delay=0;
@type=0;
@rarity=0;
- @min=0;
- @max=0;
// @val1=0;
end;
}