summaryrefslogtreecommitdiff
path: root/npc/034-4/lobby.txt
blob: 1c634d1f42a606fd8b155046890a5e3a879c2ebd (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
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
// TMW2 scripts.
// Authors:
//    Jesusalva
// Description:
//    Gemini Sisters Quest - Part C: Showdown

034-4,98,22,0	script	#GeminiPartD	NPC_HIDDEN,0,0,{
    end;
OnTouch:
    if (instance_id() < 0 || getcharid(1) < 1) end;
    GeminiCheck(13);
    .@p=getcharid(1);
    if ($@VALIA_STATUS[.@p] < 14 || mobcount(getmap(), "#GeminiShowdown::OnABC")) {
        dispbottom l("Luvia is too dangerous to be left alone.");
        end;
    }
    if (mobcount(getmap(), "all") > 0) {
        dispbottom l("I cannot leave until Luvia and her allies are dead.");
        end;
    }
    if (mobcount(getmap(), "all") <= 0 && $@VALIA_STATUS[.@p] == 14) {
        $@VALIA_STATUS[.@p]=15;
    }
    if ($@VALIA_STATUS[.@p] >= 15) {
        slide 143, 96;
    }
    end;
}

// 98 36 with radius 12?
034-4,98,28,0	script	#GeminiShowdown	NPC_HIDDEN,2,1,{
    end;
OnTouch:
    if (instance_id() < 0 || getcharid(1) < 1) end;
    GeminiCheck(13);
    .@p=getcharid(1);
    if (strcharinfo(0) != getpartyleader(.@p)) end;

    if (!.state) {
        .mp$ = getmap();
        .beats = 0;
        .pid = getcharid(1);
        .state = true;
        initnpctimer;
        killmonsterall(.mp$); // Cancel everything done thus far, incl. showdown
    }
    end;

OnABC:
    end;

OnTimer1000:
    .luvia = monster(.mp$, 98, 32, "Luvia Gemini", Luvia, 1);
    immortal(.luvia);
    setunitdata(.luvia, UDT_MODE, MD_BOSS|MD_PLANT|MD_NOKNOCKBACK);
    end;

OnTimer2500:
    unittalk(.luvia, "Ara! Look at who is trying to sneak past me!");
    end;

OnTimer6000:
    unittalk(.luvia, "How silly. I prepared this party for ya, you know.");
    end;

OnTimer9500:
    unittalk(.luvia, "Isbamuth wants all of you dead ─ And I'll carry out his orders.");
    end;

OnTimer13000:
    unittalk(.luvia, "Long live Isbamuth... And death to traitors! Now begone!!");
    end;

OnTimer15000:
    // Create a new Luvia Gemini
    unitwarp(.luvia, "034-4", 98, 32);
    unitkill(.luvia);
    .luvia = monster(.mp$, 98, 38, "Luvia Gemini", Luvia, 1, "#GeminiShowdown::OnABC");

    // Grant her more HP if more players came to attack her
    .@hp = getunitdata(.luvia, UDT_MAXHP) + (getmapusers(.mp$) * 10000);
    setunitdata(.luvia, UDT_MAXHP, .@hp);
    setunitdata(.luvia, UDT_HP,    .@hp);

    // Reconfigure the AI
    .@opt=getunitdata(.luvia, UDT_MODE);
    // Add knockback immunity
    .@opt=.@opt|MD_NOKNOCKBACK;
    // Make it more op
    .@opt=.@opt|MD_DETECTOR;
    .@opt=.@opt|MD_CASTSENSOR_CHASE;
    .@opt=.@opt|MD_CASTSENSOR_IDLE;
    .@opt=.@opt|MD_CHANGECHASE;
    .@opt=.@opt|MD_CHANGETARGET_MELEE;
    .@opt=.@opt|MD_CHANGETARGET_CHASE;
    setunitdata(.luvia, UDT_MODE, .@opt);


    // Prepare the party, lalala!
    .@pi = getmapusers(.mp$) * 2 + 1;
    monster(.mp$, 117, 51, strmobinfo(1, Scar), Scar, .@pi);
    monster(.mp$,  83, 58, strmobinfo(1, Scar), Scar, .@pi);
    monster(.mp$,  83, 51, strmobinfo(1, Scar), Scar, .@pi);
    monster(.mp$, 114, 29, strmobinfo(1, Scar), Scar, .@pi);
    monster(.mp$,  98, 22, strmobinfo(1, Scar), Scar, .@pi);
    $@VALIA_STATUS[.pid] = 14;
    end;

// The fight loops from 20k (the restart point)
// So this cycle happens every 10 seconds
OnTimer60000:
OnTimer45000:
    consolewarn("Warning, fail-safe mechanism triggered to Luvia.");
OnTimer30000:
    if (mobcount(.mp$, "#GeminiShowdown::OnABC") < 1) {
        stopnpctimer;
        end;
    }
    .beats+=1;

    /* Prepare some data */
    .@hp = getunitdata(.luvia, UDT_HP) * 10 / getunitdata(.luvia, UDT_MAXHP);
    getmapxy(.@m$, .@x, .@y, UNITTYPE_MOB, .luvia);
    .@c=getunits(BL_PC, .@pcs, MAX_CYCLE_PC, .@m$);
    .@mvp=0;.@rnd=0;.@def=-1;
    for (.@i = 0; .@i < .@c; .@i++) {
        if (!.@rnd || !rand2(.@c))
            .@rnd=.@pcs[.@i];
        if (readbattleparam(.@pcs[.@i], UDT_DEF) > .@def) {
            if (readparam(Hp, .@pcs[.@i]) < 1) continue;
            .@mvp=.@pcs[.@i];
            .@def=readbattleparam(.@pcs[.@i], UDT_DEF);
        }
    }

    // Luvia's spell casting
    // She casts every ~30 seconds
    switch (.beats % 18) {
    case 0:
    case 6:
    case 12:
        unittalk(.luvia, "Hahahah, die, die!");
        specialeffect(64, AREA, .luvia);
        sleep(1000);
        monster(.mp$, .@x, .@y, strmobinfo(1, Scar), Scar, max(1, (11 - .@hp) / 10));
        break;
    case 3:
    case 9:
    case 15:
        specialeffect(60, AREA, .luvia);
        sleep(500);
        switch (rand2(3)) {
        case 1:
            unittalk(.luvia, "I am your doom, and ##Bpoison##b is my tool!");
            .@sc = (.@hp < 1 ? SC_DPOISON : SC_POISON);
            break;
        case 2:
            unittalk(.luvia, "You shall ##Bbleed##b, and cease!");
            .@sc = SC_BLOODING;
            break;
        case 3:
            unittalk(.luvia, "The dead are ##Bsilent##b, just like you!");
            .@sc = SC_SILENCE;
            break;
        default:
            unittalk(.luvia, "You won't see what killed you when ##Bblind##b!");
            .@sc = SC_BLIND;
            break;
        }
        areasc(9, 45000, .@sc, BL_PC|BL_HOM|BL_MER, 1, "filter_always", .luvia, 95000);
        .@dmg=100 + (max(1, (11 - .@hp) / 10) * 40);
        areaharm(.luvia, 9, .@dmg, HARM_MAGI, any(Ele_Water,Ele_Fire,Ele_Wind,Ele_Earth), "filter_always", BL_PC|BL_MER|BL_HOM);
        break;
    }

    // FIXME: Spawn other stuff as well, stronger stuff.
    // Let them come from the doors
    setnpctimer 20000;
    end;

OnInit:
OnInstanceInit:
    .state = false;
    .mp$ = "";
    .pid = 0;
    .luvia = 0;
    .beats = 0;
    end;
}