summaryrefslogtreecommitdiff
path: root/npc/magic/level2-lay-on-hands.txt
blob: 1d515324f1de861b90a6595033fd895e68d6e3c3 (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
69
70
71
// 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) ||
            getstatus(SC_HALT_REGENERATION) ||
            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=60+(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);
    specialeffect(FX_MAGIC_WHITE, AREA, @skillTarget);
    specialeffect(FX_MAGIC_WHITE, AREA, getcharid(3));

    // Specifics
    if (getskilllv(SKILL_MAGIC_DARK) >= 2)
        SC_Bonus(10, SC_HALT_REGENERATION, 1);
    else
        SC_Bonus(5, SC_HALT_REGENERATION, 1);

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