1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
|
-|script|lay-on-hands|32767
{
if(call("magic_checks")) end;
if (Sp < 10) end;
if (getskilllv(.school) < .level) end;
if (getskilllv(SKILL_MAGIC) < .level) end;
if (@args$ == "Mouboo" || @args$ == "mouboo") goto L_Mouboo;
set @target_id, getcharid(3, @args$);
if (@target_id < 1 || !(isloggedin(@target_id)) || get(INVISIBLE, @target_id) || BL_ID == @target_id) end;
if (get(GM, @target_id) == 1) end;
if (Hp <= get(MaxHp, @target_id) / 20) end; // hp needs to be > 1/20 * target hp
callfunc "adjust_spellpower";
if (distance(BL_ID, @target_id) >= (((sqrt(@spellpower)*12)+@spellpower)/100)+2) end;
if (sc_check(SC_HALT_REGENERATE,@target_id)) end;
if (getequipid(equip_head, @args$) == 888) end; // magic gm top hat
set @needed, get(MaxHp, @target_id) - get(Hp, @target_id);
goto L_Pay;
L_Pay:
set @_M_BLOCK, 1; // block casting, until the timer clears it
addtimer 500, "Magic Timer::OnClear"; // XXX should this be 0 ?
set Sp, Sp - 10;
misceffect FX_MAGIC_LAY_CAST, strcharinfo(0); // on caster
misceffect FX_MAGIC_LAY_HIT, @args$; // on target
if (get(Hp, @target_id) < 1) end;
set .@fraction, max(80, 200 - (Vit + (@spellpower/10))); // pay at least 40%
set .@payment, (@needed * .@fraction) / 200;
set .@available, Hp - (MaxHp / 20);
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 @mexp, min(.exp_gain, .@payment/100);
void call("gain_heal_xp", @heal_value, 1, 1, 3);
callfunc "magic_exp";
set .@dark, getskilllv(SKILL_MAGIC_DARK) >= 2; // true if dark magic user
set .@bad, (MaxHp/20)*(0-1);
if (.@dark && GM < 20) heal .@bad, 0;
sc_start SC_HALT_REGENERATE, if_then_else(.@dark, 5000, 10000), 0;
set .@thp, get(Hp, @target_id);
if (.@thp < 1) end;
set Hp, .@thp + @heal_value, @target_id;
end;
L_Mouboo:
set @target_id, getnpcid("Mouboo");
callfunc "adjust_spellpower";
if (distance(BL_ID, @target_id) >= (((sqrt(@spellpower) * 12) + @spellpower) / 100) + 2) end;
misceffect FX_MAGIC_LAY_CAST, strcharinfo(0); // on caster
misceffect FX_MAGIC_LAY_HIT, @target_id; // on target
callfunc "QuestMoubooHeal";
end;
OnInit:
set .school, SKILL_MAGIC_LIFE;
set .invocation$, chr(MAGIC_SYMBOL) + "inma"; // used in npcs that refer to this spell
void call("magic_register");
set .level, 2;
set .exp_gain, 1; // this is MAX possible exp
end;
}
|