summaryrefslogtreecommitdiff
path: root/npc/magic/level2-lay-on-hands.txt
blob: fe9af4cd2f321fdbe83e5bb38be29643e3a0745d (plain) (blame)
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
66
67
68
// The Mana World script
// Author: Jesusalva <jesusalva@themanaworld.org>
//
// Magic Script: SKILL_INMA (Level 1)
// School: Life 2

function	script	SK_Inma	{
    // FIXME: #inma Mouboo
    // In some cases it is... aborted
    if (getunittype(@skillTarget) == UNITTYPE_PC) {
        .@me=getcharid(3);
        .@ok=true;
        attachrid(@skillTarget);
        // TODO: detect if is a bot...
        // FIXME: 099-4 and 099-5 special rules
        // Kill the GM Event
        if (isequipped(MagicGMTopHat))
            .@ok=false;
        // Ailments which prevent inma from working
        if (getstatus(SC_BLOODING))
            .@ok=false;
        if (getstatus(SC_CURSE))
            .@ok=false;
        if (getstatus(SC_POISON) && !getstatus(SC_SLOWPOISON))
            .@ok=false;
        if (getstatus(SC_DPOISON) && !getstatus(SC_SLOWPOISON))
            .@ok=false;
        // Already dead
        if (Hp < 1)
            .@ok=false;
        // Finished
        .@limit=MaxHp-Hp;
        detachrid();
        attachrid(.@me);
        if (!.@ok) return;
    } else {
        if (getunitdata(@skillTarget, UDT_HP) < 1) return;
        .@limit=getunitdata(@skillTarget, UDT_MAXHP)-
                getunitdata(@skillTarget, UDT_HP);
    }
    if (@skillTarget == getcharid(3)) return; // No self casting
    if (isequipped(MagicGMTopHat)) return; // Kill the GM event
    if (.@limit <= 0) return; // No need for healing
    // Apply effects
    .@PW=130+(20*@skillLv);
    .@dmg=AdjustSpellpower(.@PW);

    // Capped to what you need or your own health - the smallest of them
    .@dmg = min(.@dmg, .@limit, Hp);

    // Pay with 20% of your healing total
    heal -(.@dmg/5), 0;

    // Heal the target instantly
    harm(@skillTarget, -(.@dmg), HARM_MISC);

    // Specifics
    if (getskilllv(SKILL_MAGIC_DARK) >= 2)
        SC_Bonus(10, SC_BLOODING, 1); // FIXME SC_REBOUND? SC_MAGICMUSHROOM?
    else
        SC_Bonus(5, SC_BLOODING, 1); // FIXME SC_REBOUND? SC_MAGICMUSHROOM?

    // Gives EXP according to how much you healed
    getexp .@dmg*getskilllv(SKILL_MAGIC_LIFE), .@PW/10;
    GetManaExp(@skillId, 2);
    return;
}