summaryrefslogtreecommitdiff
path: root/npc/magic/level1-lesser-heal.txt
blob: 88cef70fb4f25a52327942bbc1cb78a5713aba73 (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
// The Mana World script
// Author: Jesusalva <jesusalva@themanaworld.org>
//
// Magic Script: SKILL_LUM (Level 1)
// School: Life 1

function	script	SK_Lum	{
    // In some cases it is... aborted
    if (getunittype(@skillTarget) == UNITTYPE_PC) {
        .@me=getcharid(3);
        .@ok=true;
        attachrid(@skillTarget);
        // Kill the GM Event
        if (isequipped(MagicGMTopHat))
            .@ok=false;
        // Ailments cannot be bypassed nor healed until Lv 3 Life Magic
        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);
    }

    // No need for healing? Otherwise, take reagent
    if (.@limit <= 0) return;
    delitem Lifestone, 1;

    // Real healing happens here
    .@PW=90+(10*@skillLv);
    .@dmg=AdjustSpellpower(.@PW);
    sc_start(SC_M_LIFEPOTION, 5000, 1+max(0, .@dmg/5), 10000,
             SCFLAG_NOAVOID|SCFLAG_FIXEDTICK|SCFLAG_FIXEDRATE, @skillTarget);
    specialeffect(FX_MAGIC_WHITE, AREA, @skillTarget);
    if (@skillTarget != getcharid(3))
        specialeffect(FX_MAGIC_WHITE, AREA, getcharid(3));

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

    // Gives EXP according to how much you healed
    if (@skillTarget != getcharid(3))
        setq2(MagicQuest_Healing, getq2(MagicQuest_Healing)+1);
    getexp min(.@dmg, .@limit)*getskilllv(SKILL_MAGIC_LIFE), .@PW/10;
    GetManaExp(@skillId, 1);
    return;
}