summaryrefslogtreecommitdiff
path: root/world/map/npc/magic/event-boss-powerup-disarm.txt
blob: 27a199a06355c0bbb4d6ea593e7fdb5646dc73b2 (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
-|script|powerup-disarm|32767
{
    end;

OnCast:
    if(call("boss_powerup_checks")) end;
    if (getmapflag(getmap(), MF_TOWN)) goto L_Fail_town;
    set @_M_BLOCK, 1; // block casting, until the timer clears it
    addtimer 12000, "Magic Timer::OnClear"; // set the new debuff
    sc_start SC_COOLDOWN, 12000, 0, BL_ID;
    misceffect FX_MEDIUM_EXPLOSION, strcharinfo(0);
    set @dist, 12;
    foreach 0, getmap(), (POS_X - @dist), (POS_Y - @dist), (POS_X + @dist), (POS_Y + @dist), strnpcinfo(0) + "::OnHit";
    end;

OnHit:
    if (@target_id == BL_ID) end;               // Do not disarm caster
    if ((get(Hp, @target_id)) < 1) end;           // Do not touch dead
    message strcharinfo(0, @target_id), "[boss-disarm] : "+strcharinfo(0, BL_ID)+" disarms you!";
    addtimer 500, strnpcinfo(0)+"::OnUnequip", @target_id;
    end;

OnUnequip:
    misceffect FX_EMOTE_SURPRISE, strcharinfo(0);
    unequipbyid 8;  // Hand ?1
    unequipbyid 9;  // Hand ?2
    unequipbyid 10; // Ammo
    end;

L_Fail_town:
    message strcharinfo(0), "[boss-disarm] : can't use boss tricks in towns!";
    end;

OnInit:
    set .school, SKILL_MAGIC;
    set .invocation$, chr(MAGIC_SYMBOL) + "mapdisarm"; // used in npcs that refer to this spell
    void call("magic_register", "OnCast");
    set .level, 0;
    set .exp_gain, 0;
    end;
}