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

// Armageddon-like action to be thrown by boss - by Hello=)
// Hurts everyone near boss, throws FX and teleports 'em to crypt!

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 60000, "Magic Timer::OnClear"; // set the new debuff
    sc_start SC_COOLDOWN, 60000, 0, BL_ID;
    misceffect FX_BLUE_MAGIC_CAST, strcharinfo(0);
    set @dist, 25;
    foreach 0, getmap(), (POS_X - @dist), (POS_Y - @dist), (POS_X + @dist), (POS_Y + @dist), strnpcinfo(0) + "::OnHit";
    end;

OnHit:
    if ((get(Hp, @target_id)) < 1) end;         // Do not touch dead
    set Sp, 1, @target_id;                      // Hurt target
    set Hp, min(((Hp/2)), 100), @target_id;     // Hurt target
    sc_start SC_POISON, 1, 10, @target_id;      // Poison target
    message strcharinfo(0, @target_id), "[boss-to-the-crypt] : "+strcharinfo(0, BL_ID)+" ##B PULLS YOU TO THE CRYPT!!";
    misceffect FX_CHANNELLING_RAISE, strcharinfo(0, @target_id);
    addtimer 1000, strnpcinfo(0)+"::OnTeleport", @target_id;
    end;

// Runs attached to player, beware. Dont try access vars from former code!
OnTeleport:
    warp "027-5", 71+rand(3), 51+rand(3);       // warp (under char's RID!)
    addtimer 1500, strnpcinfo(0)+"::OnArrival"; // To play FX after player's arrival -> map
    end;                                        // Done.

// Runs attached to player, beware. Dont try access vars from former code!
OnArrival:
    misceffect 50, strcharinfo(0);              // Unfortunately hell glow lacks const.
    addtimer 15000, strnpcinfo(0)+"::OnClean";  // To cancel former "infinite" FX.
    end;                                        // Done.

// Runs attached to player, beware. Dont try access vars from former code!
OnClean:
    warp getmap(), POS_X, POS_Y;                // Actually to get rid of infinite FX
    end;                                        // Done.

L_Fail_town:
    message strcharinfo(0), "[boss-to-the-crypt] : portal to crypt can't be opened in towns!";
    end;

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