summaryrefslogtreecommitdiff
path: root/npc/magic/level2-happy-curse.txt
blob: 1e1096a14d66b069c8b4b2a83c8310a86e14b16e (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
// The Mana World script
// Author: Jesusalva <jesusalva@themanaworld.org>
//
// Magic Script: SKILL_JOYPLIM (Level 1)
// School: General 2

function	script	SK_Joyplim	{
    if (getarg(0, true))
        delitem GingerBreadMan, 1;

    .@b=(BL_PC | BL_PET | BL_MER | BL_HOM); // | BL_MOB
    .@r=3+cap_value(getskilllv(SKILL_MAGIC)+(@skillLv/2), 1, 12); // Your radius
    .@s=AdjustSpellpower(100); // Your magical stamina
    .@c=cap_value(11-@skillLv, 1, 10)*2; // MATK stamina cost per char
    .@e=(getskilllv(SKILL_MAGIC_DARK) ? E_EVIL : E_HAPPY); // Emote

    getmapxy(.@m$, .@x, .@y, 0);

    // TODO: Maybe put this loop in a timer, etc? But... Do we want to?
    .@c=getunits(.@b, .@mbs, false, .@m$, .@x-.@r, .@y-.@r, .@x+.@r, .@y+.@r);
    for (.@i = 0; .@i < .@c; .@i++) {
        unitemote(.@mbs[.@i], E_HAPPY);
        // Stamina cost
        .@s-=.@c;
        if (.@s < 0)
            break;
    }
    specialeffect(FX_MAGIC_JOY_CAST, AREA, getcharid(3));
    GetManaExp(@skillId, 2);
    return;
}