summaryrefslogtreecommitdiff
path: root/npc/items/legacy_heal.txt
diff options
context:
space:
mode:
Diffstat (limited to 'npc/items/legacy_heal.txt')
-rw-r--r--npc/items/legacy_heal.txt36
1 files changed, 26 insertions, 10 deletions
diff --git a/npc/items/legacy_heal.txt b/npc/items/legacy_heal.txt
index 106b92b8d..3157563c5 100644
--- a/npc/items/legacy_heal.txt
+++ b/npc/items/legacy_heal.txt
@@ -14,10 +14,13 @@
// *getequipoption(EQI_HEAD_TOP,1,168); → Heal Bonus (should be first bonus on Chef Hat)
-- script legacy_heal -1,{
+// ItHeal(delay, min, {max=min})
+function script ItHeal {
+ .@delay=getarg(0, @delay);
+ .@min=getarg(1, @min);
+ .@max=getarg(2, (@max ? @max : .@min));
-OnUse:
- if (@delay <= 0) {
+ if (.@delay <= 0) {
Exception("Invalid legacy healing item, deleting without healing effect.");
end;
}
@@ -28,9 +31,10 @@ OnUse:
// minimum between @min and bVit / 2 * BaseLevel / 10
//@min = min(@max, readparam(bVit) * BaseLevel / 20);
- @val1 = rand2(@min, @max);
+ // Vitality no longer applies to these
+ @val1 = rand2(.@min, .@max);
- @delay *= 1000; // Put the delay in ms
+ .@delay *= 1000; // Put the delay in ms
// We now have @val1 (new effect), @delay (new delay)
// But do we have .@v and .@d (old effect and delay)?
@@ -40,21 +44,33 @@ OnUse:
// If there WAS an effect previously, get ponderate average
// Note: never use double-precision ponderate averages
if (.@v > 0) {
- @val1=ponderate_avg(@val1, @delay, .@v, .@d);
+ @val1=ponderate_avg(@val1, .@delay, .@v, .@d);
// Overflow and Underflow protection
- if (@delay+.@d < @delay*5 && .@d > 0)
- @delay=@delay+.@d;
- //@delay=ponderate_avg(@delay, @val1, .@d, .@v);
+ if (.@delay+.@d < .@delay*5 && .@d > 0)
+ .@delay=.@delay+.@d;
+ //.@delay=ponderate_avg(.@delay, @val1, .@d, .@v);
}
// Apply the effect and finish
sc_end .@skill;
- sc_start2 .@skill, @delay, @val1, 1;
+ sc_start2 .@skill, .@delay, @val1, 1;
// @val1 must be preserved for cross-reading
@delay=0;
@min=0;
@max=0;
// @val1=0;
+ return;
+}
+
+- script legacy_heal -1,{
+
+OnUse:
+ if (@delay <= 0) {
+ Exception("Invalid legacy healing item, deleting without healing effect.");
+ end;
+ }
+
+ ItHeal(@delay, @min, @max);
end;
}