summaryrefslogtreecommitdiff
path: root/npc/006-9/ctrl.txt
blob: 836e1c3894ff4dae21e30ba616b12ff30ab2e56e (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
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
// TMW2 Script
// Author:
//    Jesusalva

006-9	mapflag	zone	MMO No Tricks

006-9,37,21,0	script	#OutOf0069	NPC_HIDDEN,0,0,{
    end;

OnTouch:
    if (!$@SURVIVAL_CANDOR)
        warp "006-6", 54, 36;
    end;
}

006-9,55,32,0	script	Bloodbath	NPC_NO_SPRITE,{
    function spawn;
    if ($@SURVIVAL_CANDOR) {
        npctalk3 l("Score: %s / %s", FuzzyTime($@SURVIVAL_CANDOR), FuzzyTime(gettimetick(2)+SCANDORPTS));
        end;
    }
    mesn;
    mes l("Goal: Survive the longest possible.");
    mes l("Monsters will spawn in the south fountain continuously.");
    mes l("They'll also start spawning on whole map, so be careful.");
    mesc l("The fee to use this room is %s GP.", fnum(.price)), 1;
    mes "";
    mes l("Current score: %s", FuzzyTime(gettimetick(2)+SCANDORPTS));

    if (Zeny < .price) close;
    next;
    mesc l("Begin?");
    menuint
        l("Yes"), ASK_YES,
        l("No"), ASK_NO,
        l("Scoreboards"), -1;
    mes "";
    if (@menuret == ASK_NO || Zeny < .price) {
        closeclientdialog;
        close;
    } else if (@menuret < 0) {
        HallOfBloodbath();
        close;
    }

    Zeny-=.price;
    $@SURVIVAL_CANDOR = gettimetick(2);
    initnpctimer;
    close;

// Timer logic
OnTimer4000:
    .diff += 1;
    if (.diff == 75)
        mapannounce "006-9","Five minutes have passed, changing spawn pattern!",0;
    if (.diff == 225)
        mapannounce "006-9", "Fifteen minutes have passed, changing spawn pattern!", 0;
    if (.diff == 450)
        mapannounce "006-9", "Half hour has passed, changing spawn pattern!", 0;
    if (.diff == 900)
        mapannounce "006-9", "One hour has passed, changing spawn pattern!", 0;
    initnpctimer;
OnTimer2000:
    /* Verify for game over */
    if (getmapusers("006-9") < 1) {
        sleep(25);
        stopnpctimer;
        .diff = 0;
        $@SURVIVAL_CANDOR = 0;
        killmonsterall("006-9");
        end;
    }
    spawn(.diff);
    end;

// Spawn logic
function spawn {
    .@lv = getarg(0);
    if (.@lv < 225) {
        .@mb[0] = MagicGoblin;
        .@mb[1] = IceMaggot;
    }

    // Artillery
    if (is_between2(40, .@lv, 450))
        array_push(.@mb, RobinBandit);
    if (.@lv > 50)
        array_push(.@mb, DustGatling);
    if (.@lv > 60)
        array_push(.@mb, DustRifle);
    if (.@lv > 70)
        array_push(.@mb, DustRevolver);
    if (.@lv > 80)
        array_push(.@mb, DustBoss);
    if (.@lv > 90)
        array_push(.@mb, GreatMoubooSlime);
    if (.@lv > 100)
        array_push(.@mb, Jhon);

    // Monsters
    if (is_between2(0, .@lv, 60)) {
        array_push(.@mb, Piou);
        array_push(.@mb, Piousse);
        array_push(.@mb, Squirrel);
        array_push(.@mb, ManaPiou);
        array_push(.@mb, ForestPiou);
        array_push(.@mb, RedButterfly);
        array_push(.@mb, Maggot);
        array_push(.@mb, CandorScorpion);
        array_push(.@mb, HouseMaggot);
        array_push(.@mb, LittleYellowSlime);
        array_push(.@mb, Ratto);
        array_push(.@mb, RudolphSlime);
        array_push(.@mb, MoubooSlime);
        array_push(.@mb, Croc);
        array_push(.@mb, Scorpion);
        array_push(.@mb, SmallFrog);
    }
    if (is_between2(20, .@lv, 80)) {
        array_push(.@mb, BigFrog);
        array_push(.@mb, Lavern);
        array_push(.@mb, LittleRedSlime);
        array_push(.@mb, ChocolateSlime);
        array_push(.@mb, Blub);
        array_push(.@mb, Duck);
        array_push(.@mb, Bat);
        array_push(.@mb, CaveMaggot);
        array_push(.@mb, ManaGhost);
        array_push(.@mb, ManaBug);
        array_push(.@mb, Fluffy);
        array_push(.@mb, FireGoblin);
        array_push(.@mb, ViciousSquirrel);
        array_push(.@mb, RedScorpion);
        array_push(.@mb, WhiteSlime);
        array_push(.@mb, AzulSlime);
        array_push(.@mb, DesertLogHead);
    }
    if (is_between2(30, .@lv, 100)) {
        array_push(.@mb, RedSlime);
        array_push(.@mb, PoisonSpikyMushroom);
        array_push(.@mb, DesertBandit);
        array_push(.@mb, OceanCroc);
        array_push(.@mb, ToppyBlub);
        array_push(.@mb, Sarracenus);
        array_push(.@mb, IceMaggot);
        array_push(.@mb, VampireBat);
        array_push(.@mb, Bandit);
        array_push(.@mb, Pinkie);
        array_push(.@mb, LivingPotato);
        array_push(.@mb, Assassin);
        array_push(.@mb, Skeleton);
    }
    if (is_between2(50, .@lv, 120)) {
        array_push(.@mb, CaveSnake);
        array_push(.@mb, GreenSlime);
        array_push(.@mb, CopperSlime);
        array_push(.@mb, YellowSlime);
        array_push(.@mb, SantaSlime);
        array_push(.@mb, LavaSlime);
        array_push(.@mb, Bluepar);
        array_push(.@mb, DeathCat);
        array_push(.@mb, Moggun);
        array_push(.@mb, SeaSlime);
        array_push(.@mb, RedMushroom);
        array_push(.@mb, Mouboo);
        array_push(.@mb, LogHead);
        array_push(.@mb, CandiedSlime);
        array_push(.@mb, OldSnake);
        array_push(.@mb, GrassSnake);
    }
    if (is_between2(60, .@lv, 140)) {
        array_push(.@mb, GiantMaggot);
        array_push(.@mb, IcedFluffy);
        array_push(.@mb, Snake);
        array_push(.@mb, BlackSlime);
        array_push(.@mb, Tipiou);
        array_push(.@mb, AlphaMouboo);
        array_push(.@mb, Pollet);
        array_push(.@mb, Snowman);
        array_push(.@mb, PiouKnight);
        array_push(.@mb, Shrewboo);
    }
    if (is_between2(70, .@lv, 160)) {
        array_push(.@mb, Wolvern);
        array_push(.@mb, FireSkull);
        array_push(.@mb, DarkLizard);
    }
    if (is_between2(90, .@lv, 180)) {
        array_push(.@mb, ArmoredSkeleton);
        array_push(.@mb, BlackScorpion);
        array_push(.@mb, ElectroWorm);
        array_push(.@mb, EarthFairy);
        array_push(.@mb, FireFairy);
        array_push(.@mb, WaterFairy);
        array_push(.@mb, WindFairy);
        array_push(.@mb, PoisonFairy);
        array_push(.@mb, MountainSnake);
        array_push(.@mb, HoodedNinja);
        array_push(.@mb, ForestMushroom);
        array_push(.@mb, GoldenScorpion);
    }
    if (is_between2(110, .@lv, 200)) {
        array_push(.@mb, Yeti);
        array_push(.@mb, FallenGuard1);
        array_push(.@mb, GreenSlimeMother);
        array_push(.@mb, SnowFlower);
        array_push(.@mb, BlueSlimeMother);
        array_push(.@mb, WickedMushroom);
        array_push(.@mb, CopperSlimeMother);
        array_push(.@mb, YellowSlimeMother);
        array_push(.@mb, RedSlimeMother);
        array_push(.@mb, ChocolateSlimeMother);
        array_push(.@mb, WhiteSlimeMother);
        array_push(.@mb, Archant);
        array_push(.@mb, Scar);
    }
    if (is_between2(140, .@lv, 220)) {
        array_push(.@mb, AzulSlimeMother);
        array_push(.@mb, SeaSlimeMother);
        array_push(.@mb, LavaSlimeMother);
        array_push(.@mb, BlackSlimeMother);
        array_push(.@mb, Crafty);
        array_push(.@mb, Forain);
        array_push(.@mb, GreenDragon);
        array_push(.@mb, Michel);
        array_push(.@mb, Troll);
    }
    if (is_between2(160, .@lv, 240)) {
        array_push(.@mb, EliteDuck);
        array_push(.@mb, AzulSkullSlime);
        array_push(.@mb, Moonshroom);
        array_push(.@mb, RedSkullSlime);
        array_push(.@mb, Terranite);
        array_push(.@mb, JackO);
        array_push(.@mb, BlackMamba);
        array_push(.@mb, GreenSkullSlime);
        array_push(.@mb, BloodyMouboo);
        array_push(.@mb, Centaur);
        array_push(.@mb, GoboBear);
    }
    if (is_between2(180, .@lv, 260)) {
        array_push(.@mb, CopperSkullSlime);
        array_push(.@mb, LavaSkullSlime);
        array_push(.@mb, BlackSkullSlime);
        array_push(.@mb, GiantCaveMaggot);
        array_push(.@mb, TerraniteProtector);
        array_push(.@mb, VanityPixie);
        array_push(.@mb, HolyPixie);
    }
    if (is_between2(200, .@lv, 280)) {
        array_push(.@mb, ShadowPixie);
        array_push(.@mb, NulityPixie);
        array_push(.@mb, Reaper);
        array_push(.@mb, NightmareDragon);
        array_push(.@mb, Snail);
        array_push(.@mb, WhirlyBird);
    }
    if (is_between2(250, .@lv, 350)) {
        array_push(.@mb, PinkieSuseran);
        array_push(.@mb, Mandragora);
        array_push(.@mb, PinkieMaximus);
    }
    if (.@lv > 240) {
        array_push(.@mb, Junglefowl);
        array_push(.@mb, Tengu);
        array_push(.@mb, Moubi);
    }
    if (.@lv > 260) {
        array_push(.@mb, SuperiorShroom);
        array_push(.@mb, Nutcracker);
        array_push(.@mb, Golem);
    }
    if (.@lv > 280) {
        array_push(.@mb, SiegeTower);
        array_push(.@mb, GreenhornAbomination);
        array_push(.@mb, ShadowTortuga);
        array_push(.@mb, FireElement);
        array_push(.@mb, WaterElement);
        array_push(.@mb, EarthElement);
        array_push(.@mb, WindElement);
    }
    if (.@lv > 320) {
        array_push(.@mb, SacredWisp);
        array_push(.@mb, EvilWisp);
        array_push(.@mb, PanthomWisp);
        array_push(.@mb, EpiphanyWisp);
    }
    if (.@lv >= 350)
        array_push(.@mb, Tortuga);

    /* The final attack pattern is aimed at nukes */
    if (.@lv >= 900)
        .@lv *= 3; // 12 -> 36 mobs

    /* Spawn them and make hostile */
    // But ONLY if there are less than 1200 monsters and you are on pattern 1
    // Or if you're in pattern 4 and there aren't enough critters in the map
    if (.@lv < 450 ||
        (.@lv < 900 && mobcount("006-9", "all") < 1200) ||
        (.@lv >= 900 && mobcount("006-9", "all") < 600)) {
        .@mid = any_of(.@mb);
        .@m=areamonster("006-9", 35, 63, 36, 65, strmobinfo(1, .@mid), .@mid, 1);
        set_aggro(.@m);
    } else if (.@lv > 450) {
        // Otherwise, we'll randomly evolve a monster into a super-boss
        // Ascended units cannot be killed. Double ascension is possible.
        // Ascensions only happen every 15 seconds, but boosts are every 4s.
        do {
        getunits(BL_MOB, .@lucky, 1, "006-9", 20, 20,
        rand2(getmapinfo(MAPINFO_SIZE_X,"006-9")-40)+20,
        rand2(getmapinfo(MAPINFO_SIZE_Y,"006-9")-40)+20);
        sleep(2); // To prevent map-server from collapsing
        } while (.@lucky == 0);
        if (.diff % 4 == 1) {
            // Visual aspect of the ascension
            unittalk(.@lucky, "*This unit has ascended*");
            setunitdata(.@lucky, UDT_CLASS, Birb); // any(Birb, EntAbomination, Maverick) //, SpiderQueen, Yetifly, Moubootaur)
            immortal(.@lucky); // Jump straight to "plain unkillable" levels
            setunitdata(.@lucky, UDT_CRIT, 32767); // Always does criticals
            // Retrieve some data
            .@atk1 = getunitdata(.@lucky, UDT_ATKMIN);
            .@atk2 = getunitdata(.@lucky, UDT_ATKMAX);
            .@atkR = getunitdata(.@lucky, UDT_ATKRANGE);
            .@aspd = getunitdata(.@lucky, UDT_ADELAY);
            .@wspd = getunitdata(.@lucky, UDT_SPEED);
            .@mode = getunitdata(.@lucky, UDT_MODE);
            // Damage multiplier: ×3
            setunitdata(.@lucky, UDT_ATKMIN, .@atk1 * 3);
            setunitdata(.@lucky, UDT_ATKMAX, .@atk2 * 3);
            // Increase attack range in 2
            setunitdata(.@lucky, UDT_ATKRANGE, .@atkR + 2);
            // Make them faster, both to move as to attack
            setunitdata(.@lucky, UDT_ADELAY, min(100, .@aspd - 80));
            setunitdata(.@lucky, UDT_SPEED,  min(100, .@wspd - 35));
            // Set their AI to something more fearsome, if it isn't set yet
            .@mode = .@mode | MD_NOKNOCKBACK;
            .@mode = .@mode | MD_ANGRY;
            .@mode = .@mode | MD_CASTSENSOR_IDLE;
            .@mode = .@mode | MD_BOSS;
            .@mode = .@mode | MD_DETECTOR;
            .@mode = .@mode | MD_CHANGETARGET_CHASE;
            setunitdata(.@lucky, UDT_MODE, .@mode);
            // And mark them as something else for all eyes to see
            setunitname(.@lucky, "ASCENDED MONSTER");
        } else {
            // Just a minor boost, otherwise you'll be quickly put out of scene
            // It'll be more difficult to notice these
            .@aspd = getunitdata(.@lucky, UDT_ADELAY);
            .@wspd = getunitdata(.@lucky, UDT_SPEED);
            setunitdata(.@lucky, UDT_ADELAY, min(100, .@aspd - 40));
            setunitdata(.@lucky, UDT_SPEED,  min(100, .@wspd - 25));
        }
    } else {
        // Otherwise, nothing happens (although you could get a penalty?)
    }
    /* After five minutes, spawn some globally */
    // These will bypass the monster amount protection from earlier every 40s
    if (.diff % 10 == 1 || mobcount("006-9", "all") < 1000) {
        freeloop(true);
        for (.@i = 0; .@i < 1+(.@lv / 75); .@i++) {
            .@mid = any_of(.@mb);
            .@m=areamonster("006-9", 20, 20, getmapinfo(MAPINFO_SIZE_X,"006-9"), getmapinfo(MAPINFO_SIZE_Y,"006-9"), strmobinfo(1, .@mid), .@mid, 1);
            set_aggro(.@m);
        }
        freeloop(false);
    }
    return;
}

OnInit:
    .distance=3;
    .price=2400;
    .diff = 0;
    end;
}