summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorwushin <pasekei@gmail.com>2016-03-08 18:27:49 -0600
committermekolat <mekolat@users.noreply.github.com>2016-03-30 11:22:50 -0400
commit502bb1adfbe060d81b8bbcd6d41153170f43031c (patch)
tree8f3f9c992a07d83e0063e67974442190ff747a7a
parentafb8f6982d9a6458197faeb9c035b0a882b5b7fa (diff)
downloadserverdata-502bb1adfbe060d81b8bbcd6d41153170f43031c.tar.gz
serverdata-502bb1adfbe060d81b8bbcd6d41153170f43031c.tar.bz2
serverdata-502bb1adfbe060d81b8bbcd6d41153170f43031c.tar.xz
serverdata-502bb1adfbe060d81b8bbcd6d41153170f43031c.zip
Add heal_gain_xp
-rw-r--r--world/map/npc/magic/_procedures.txt28
-rw-r--r--world/map/npc/magic/level1-lesser-heal.txt20
-rw-r--r--world/map/npc/magic/level2-lay-on-hands.txt12
3 files changed, 49 insertions, 11 deletions
diff --git a/world/map/npc/magic/_procedures.txt b/world/map/npc/magic/_procedures.txt
index b2a734c2..3fe0ed34 100644
--- a/world/map/npc/magic/_procedures.txt
+++ b/world/map/npc/magic/_procedures.txt
@@ -126,3 +126,31 @@ function|script|adjust_spellpower
L_Return:
return;
}
+
+function|script|gain_heal_xp
+{
+ set @last_heal_xp, ((SCRIPT_XP & SCRIPT_HEALSPELL_MASK) >> SCRIPT_HEALSPELL_SHIFT);
+ if ((@target_id != BL_ID) && ((.@heal_value / .heal_xp_value_divisor) > (((10 + @last_heal_xp) + rand(@last_heal_xp + 1)) + rand(@last_heal_xp + 1))))
+ goto L_Block;
+ goto L_Return;
+
+L_Block:
+ set @heal_xp, (@last_heal_xp + @mexp);
+ if (@heal_xp > SCRIPT_HEALSPELL_MASK)
+ set @heal_xp, SCRIPT_HEALSPELL_MASK;
+ set XMASTIME, (XMASTIME & ~(NIBBLE_0_MASK) | (@xmas_state << NIBBLE_0_SHIFT));
+ set SCRIPT_XP, (SCRIPT_XP & ~(SCRIPT_HEALSPELL_MASK) | (@heal_xp << SCRIPT_HEALSPELL_SHIFT));
+ goto L_Gain_Xp;
+
+L_Gain_Xp:
+ set @target_heal_xp, (get(MaxHp, @target_id) - get(HEALXP, @target_id));
+ set @heal_exp, .@heal_value;
+ if (@target_heal_xp < .@heal_value)
+ set @heal_exp, @target_heal_xp;
+ getexp (.base_exp_factor * @heal_exp), 0;
+ set HEALXP, (get(HEALXP, @target_id) + @heal_exp), @target_id;
+ goto L_Return;
+
+L_Return:
+ return;
+}
diff --git a/world/map/npc/magic/level1-lesser-heal.txt b/world/map/npc/magic/level1-lesser-heal.txt
index 6b728e81..22aec370 100644
--- a/world/map/npc/magic/level1-lesser-heal.txt
+++ b/world/map/npc/magic/level1-lesser-heal.txt
@@ -15,16 +15,23 @@
callfunc "adjust_spellpower";
set Sp, Sp - 6;
misceffect FX_MAGIC_WHITE, strcharinfo(0);
- if (@target_id != BL_ID) misceffect FX_MAGIC_WHITE, @target_id;
- // TODO gain_heal_exp
- // TODO magic_exp
+ set .@heal_value, (get(MaxHp, @target_id) - get(Hp, @target_id));
+ set @mexp, .exp_gain;
+ if (.@heal_value < 200)
+ set .@heal_value, 200;
if (@args$ == "Mouboo" || @args$ == "mouboo") goto L_Mouboo;
+ if (@target_id != BL_ID) goto L_NotMe;
+ goto L_Continue;
- if (getskilllv(SKILL_MAGIC_DARK) >= 1) sc_start SC_HALT_REGENERATE, 2000, 0;
+L_NotMe:
+ misceffect FX_MAGIC_WHITE, @target_id;
+ callfunc "gain_heal_xp";
+ goto L_Continue;
- set @heal_amount, 200, @target_id;
+L_Continue:
+ if (getskilllv(SKILL_MAGIC_DARK) >= 1) sc_start SC_HALT_REGENERATE, 2000, 0;
if (attachrid(@target_id) != 1) end; // XXX: to avoid the ugly attachrid method we would need some kind of `run_as` builtin
- if (!(isdead())) heal @heal_amount, 0, 1;
+ if (!(isdead())) heal .@heal_value, 1, 1;
end;
L_Mouboo:
@@ -37,5 +44,6 @@ OnInit:
void call("magic_register");
set .level, 1;
set .exp_gain, 1;
+ set .heal_xp_value_divisor, 2;
end;
}
diff --git a/world/map/npc/magic/level2-lay-on-hands.txt b/world/map/npc/magic/level2-lay-on-hands.txt
index 7d006ea9..8fb7f6ce 100644
--- a/world/map/npc/magic/level2-lay-on-hands.txt
+++ b/world/map/npc/magic/level2-lay-on-hands.txt
@@ -24,13 +24,13 @@ L_Pay:
set .@fraction, max(80, 200 - (Vit + (@spellpower/10))); // pay at least 40%
set .@payment, (.@needed * .@fraction) / 200;
set .@available, Hp - (MaxHp / 20);
- set .@power, if_then_else(.@payment < .@available, .@needed+1-1, (.@available * 200) / .@fraction); // FIXME / XXX why the f do I need to do +1-1 ?
+ set .@heal_value, if_then_else(.@payment < .@available, .@needed+1-1, (.@available * 200) / .@fraction); // FIXME / XXX why the f do I need to do +1-1 ?
if (.@payment > .@available) set .@payment, .@available;
- set @inma_power, .@power, @target_id;
+ set @inma_power, .@heal_value, @target_id;
- set @mexp, min(.exp_gain, .@payment/100); // TODO pass this to gain_heal_exp so it can be passed to gain_exp
- // TODO gain_heal_exp(.@power, 1, 1, 3) => gain_exp
+ set @mexp, min(.exp_gain, .@payment/100);
+ callfunc "gain_heal_xp";
set .@dark, getskilllv(SKILL_MAGIC_DARK) >= 2; // true if dark magic user
set .@bad, (MaxHp/20)*(0-1);
@@ -52,6 +52,8 @@ OnInit:
set .invocation$, chr(MAGIC_SYMBOL) + "inma"; // used in npcs that refer to this spell
void call("magic_register");
set .level, 2;
- set .exp_gain, 4; // this is MAX possible exp
+ set .exp_gain, 1; // this is MAX possible exp
+ set .heal_xp_value_divisor, 1;
+ set .base_exp_factor, 3;
end;
}