summaryrefslogtreecommitdiff
path: root/npc/034-4/lobby.txt
blob: 3af9043f1bacc667f9563261a7977ab6e1949257 (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
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
// 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:
    // Extra drop chance (20% chance)
    getmapxy(.@m$, .@x, .@y, 0);
    if (!rand2(5))
        makeitem BronzeBossGift, 1, .@m$, .@x, .@y;
    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$) * 12000);
    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);
    .@pi = getmapusers(.mp$);
    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, .@pi + max(1, (11 - .@hp) / 10));
        monster(.mp$, .@x, .@y, strmobinfo(1, MagicGoblin), MagicGoblin, .@pi + max(1, (11 - .@hp) / 10));
        // Doors reinforcements
        // As time passes, they get stronger
        // But after 7 minutes, it resets
        switch ((.beats / 6) % 14) {
        case 0:
            .@mob = Skeleton; break; // Shouldn't trigger
        case 1:
            .@mob = LavaSlime; break;
        case 2:
            .@mob = ArmoredSkeleton; break;
        case 3:
            .@mob = DustRifle; break;
        case 4:
            .@mob = DarkLizard; break;
        case 5:
            .@mob = HoodedNinja; break;
        case 6:
            .@mob = Archant; break;
        case 7:
            .@mob = Scar; break;
        case 8:
            .@mob = Terranite; break;
        case 9:
            .@mob = EliteDuck; break;
        case 10:
            .@mob = Troll; break;
        case 11:
            .@mob = YellowSkullSlime; break;
        case 12:
            .@mob = Michel; break;
        case 13:
            .@mob = JackO; break;
        }

        monster(.mp$, 114, 29, strmobinfo(1, .@mob), .@mob, 1);
        // If you can't deal enough damage, less support comes
        if (.@hp <= 7) // Up to 79% HP
            monster(.mp$, 117, 51, strmobinfo(1, .@mob), .@mob, 1);
        if (.@hp <= 6) // Up to 69% HP
            monster(.mp$,  98, 22, strmobinfo(1, .@mob), .@mob, 1);
        if (.@hp <= 4) // Up to 39% HP
            monster(.mp$,  83, 58, strmobinfo(1, .@mob), .@mob, 1);
        if (.@hp <= 3) // Up to 29% HP
            monster(.mp$,  83, 51, strmobinfo(1, .@mob), .@mob, 1);
        break;
    case 3:
    case 9:
    case 15:
        specialeffect(60, AREA, .luvia);
        sleep(500);
        .@r = (10-.@hp) / 5 + rand2(4); // From 0 to 5
        // Blind has extra chance until her HP falls below 60%
        // Curse won't happen if her HP is equal or above 60%
        // Once her HP falls below 10%, she no longer silences
        // And her poison is strengthened.
        switch (.@r) {
        case 1:
            unittalk(.luvia, "The dead are ##Bsilent##b, just like you!");
            .@sc = SC_SILENCE;
            break;
        case 2:
            unittalk(.luvia, "I am your doom, and ##Bpoison##b is my tool!");
            .@sc = (.@hp < 1 ? SC_DPOISON : SC_POISON);
            break;
        case 3:
            unittalk(.luvia, "You shall ##Bbleed##b, and cease!");
            .@sc = SC_BLOODING;
            break;
        case 4:
            unittalk(.luvia, "You dare to underestimate me?! ##BCurse##b you!");
            .@sc = SC_CURSE;
            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;
    default:
        specialeffect(60, AREA, .luvia);
        unittalk(.luvia, any("I am getting tired of you!",
                             "That's all you can muster?",
                             "Long live Isbamuth!",
                             "Hahahahah!",
                             "Incompetent! Simply incompetent!",
                             "You shall not resist!",
                             "I'm not afraid of you!"));
        sleep(500);
        .@dmg=40 + (max(1, (11 - .@hp) / 10) * 20);
        areaharm(.luvia, 9, .@dmg, HARM_MAGI, any(Ele_Water,Ele_Fire,Ele_Wind,Ele_Earth), "filter_always", BL_PC|BL_MER|BL_HOM);
        break;
    }

    // And we're done! Wait 10 seconds before next casting
    setnpctimer 20000;
    end;

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