summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-03-08 23:22:26 +0300
committerAndrei Karas <akaras@inbox.ru>2016-03-08 23:22:26 +0300
commit0b9bffdd4caafd7e9b0d819f1c296ae96dec7629 (patch)
tree325ed00f2d7046d6fbadbdabffdde684c57aac5c
parent24f7099c7a02885bf3ab4b7b9739f9f48d967fe8 (diff)
downloadserverdata-0b9bffdd4caafd7e9b0d819f1c296ae96dec7629.tar.gz
serverdata-0b9bffdd4caafd7e9b0d819f1c296ae96dec7629.tar.bz2
serverdata-0b9bffdd4caafd7e9b0d819f1c296ae96dec7629.tar.xz
serverdata-0b9bffdd4caafd7e9b0d819f1c296ae96dec7629.zip
Refactor a bit item heal functions.
-rw-r--r--npc/items/rand_sc_heal.txt38
1 files changed, 19 insertions, 19 deletions
diff --git a/npc/items/rand_sc_heal.txt b/npc/items/rand_sc_heal.txt
index 90a19f3e..c3aef8c0 100644
--- a/npc/items/rand_sc_heal.txt
+++ b/npc/items/rand_sc_heal.txt
@@ -16,21 +16,22 @@
- script rand_sc_heal -1,{
// Add remaning bonus if the last one hasn't finished
- function remaining_bonus {
+ function remaining_bonus
+ {
if (getstatus (getarg (0)))
{
- @old_val1 = getstatus (SC_S_LIFEPOTION, 1);
- @old_delay = getstatus (SC_S_LIFEPOTION, 4) * 1000;
+ .@old_val1 = getstatus (getarg (0), 1);
+ .@old_delay = getstatus (getarg (0), 4) * 1000;
// change the delay to prevent fast healing
- if (@old_delay > @delay)
+ if (.@old_delay > @delay)
{
- @delay = @old_delay;
- @val1 += @old_val1;
+ @delay = .@old_delay;
+ @val1 += .@old_val1;
}
else
{
- @val1 += (@old_val1 * @old_delay) / @delay;
+ @val1 += (.@old_val1 * .@old_delay) / @delay;
}
}
return;
@@ -47,28 +48,27 @@ OnUse:
switch (@type)
{
case 1:
- remaining_bonus (SC_S_LIFEPOTION);
- sc_end SC_S_LIFEPOTION;
- sc_start2 SC_S_LIFEPOTION, @delay, @val1, 1;
+ .@skill = SC_S_LIFEPOTION;
break;
case 2:
- remaining_bonus (SC_L_LIFEPOTION);
- sc_end SC_L_LIFEPOTION;
- sc_start2 SC_L_LIFEPOTION, @delay, @val1, 1;
+ .@skill = SC_L_LIFEPOTION;
break;
case 3:
- remaining_bonus (SC_G_LIFEPOTION);
- sc_end SC_G_LIFEPOTION;
- sc_start2 SC_G_LIFEPOTION, @delay, @val1, 1;
+ .@skill = SC_G_LIFEPOTION;
break;
case 4:
- remaining_bonus (SC_M_LIFEPOTION);
- sc_end SC_M_LIFEPOTION;
- sc_start2 SC_M_LIFEPOTION, @delay, @val1, 1;
+ .@skill = SC_M_LIFEPOTION;
break;
default :
+ .@skill = 0;
break;
}
+ if (.@skill != 0)
+ {
+ remaining_bonus (.@skill);
+ sc_end .@skill;
+ sc_start2 .@skill, @delay, @val1, 1;
+ }
close;
}