summaryrefslogtreecommitdiff
path: root/world/map/npc/magic/level2-toxic-dart.txt
blob: a74ab475a52783e9b51ae3912b6c9d7009f7b841 (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
-|script|toxic-dart|32767
{
    if(call("magic_checks")) end;
    if (Sp < 15) end;
    set .@level, getskilllv(.school);
    if (.@level < .level) end;
    if (OrumQuest <= 37) end;
    if (.@level <= 2 && countitem("Root") >= 2) delitem "Root", 2;
    elif (.@level <= 2) end;
    set @_M_BLOCK, 1; // block casting, until the timer clears it
    addtimer 500, "Magic Timer::OnClear"; // set the new debuff
    sc_start SC_COOLDOWN, 500, 0, BL_ID;
    callfunc "adjust_spellpower";
    set Sp, Sp - 15;
    set CASTS, CASTS + 1;
    if (CASTS < 0) set CASTS, 1; // overflow
    misceffect FX_MAGIC_TDART_CAST, strcharinfo(0);
    setarray @phlexspell[0],
        (sqrt(@spellpower) * 5), // elt damage
        ((BaseLevel/3) + 5), // elt damage bonus
        (((200 - (Agi+Agi2)) * 1200) / 200), // delay
        ((@spellpower/75) + 3), // charges
        (5000+(@spellpower*1200)), // poison duration
        (max(15,@spellpower/15)+5); // poison strength

    callfunc "magic_exp";
    goto L_FreeRecast;

OnAttack:
    if (target(BL_ID, @target_id, 50) != 50) goto L_FreeRecast; // 0x20 | 0x02 | 0x10
    void call("elt_damage", @phlexspell[0], @phlexspell[1], ELT_NEUTRAL, ELT_POISON, FX_NONE);
    if(@target_id != BL_ID && isloggedin(@target_id)) // this is a dirty trick to check if the target is a player
        sc_start SC_POISON, @phlexspell[4], @phlexspell[5], @target_id;
    set @phlexspell[3], @phlexspell[3] - 1;
    goto L_FreeRecast;

L_FreeRecast:
    if (@phlexspell[3] > 0)
        addtimer 0, strnpcinfo(0) + "::OnSetRecast";
    end;

OnDischarge:
    if (@phlexspell[3] < 1) end;
    set @phlexspell[3], 0;
    misceffect FX_MAGIC_DISCHARGE, strcharinfo(0);
    overrideattack;
    end;

OnSetRecast:
    overrideattack @phlexspell[2], 4, ATTACK_ICON_GENERIC, OVERRIDE_TDART, strnpcinfo(0)+"::OnAttack", @phlexspell[3];
    end;

OnInit:
    set .school, SKILL_MAGIC_DARK;
    set .invocation$, chr(MAGIC_SYMBOL) + "phlex"; // used in npcs that refer to this spell
    void call("magic_register");
    set .level, 2;
    set .exp_gain, 3;
    end;
}