summaryrefslogtreecommitdiff
path: root/world/map/npc/052-2/partyroom.txt
blob: ce9c9f7d30474d4d2a7ca1abf431875708b70945 (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
//-----------------------------------------------------------------------------
// Illia Forsaken Inn - Party room
// $@illia_progress = 6
//
// Level progress:
//     0: Initial state
//     1: Luvia is talking, then spawns after a teleport
//     2: Luvia spawned, and witch guards may spawn to help
//     3: Luvia is defeated
//-----------------------------------------------------------------------------

052-2,88,19,0|script|#TriggerDialog|32767,3,2
{
    set @step, 7;
    if ($@illia_progress < @step) goto L_ShouldNotBeHere;
    if ($@illia_level_7_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_SpawnLuvia;
    end;

L_SpawnLuvia:
    set $@illia_level_7_progress, 1;
    donpcevent "Luvia::OnCommandStart";
    end;

L_ShouldNotBeHere:
    percentheal -100, 0;
    end;

}

// A trigger whose only purpose is to place Luvia npcs back in place.
// (even though the Janitor 7 will have done this job)
052-2,77,48,0|script|#TriggerPlaceLuvia|32767,1,1
{
    if (strcharinfo(0) != $@ILLIA_HERO$) end;
    if ($@illia_progress == 7 && $@illia_level_7_progress == 0) goto L_PlaceLuvia;
    end;

L_PlaceLuvia:
    npcwarp 88, 15, "#LuviaDaemon";
    npcwarp 88, 15, "Luvia";
    end;

}

052-2,88,15,0|script|Luvia|371
{
    set @step, 7;
    if ($@illia_progress < @step) goto L_ShouldNotBeHere;
    if ($@illia_level_7_progress == 0 && strcharinfo(0) == $@ILLIA_HERO$) goto L_Start;
    end;

OnCommandStart:
    goto L_Start;

L_Start:
    setnpctimer 0;
    if ($@illia_level_7_progress == 1)
        startnpctimer;
    end;

L_ShouldNotBeHere:
    percentheal -100, 0;
    end;

OnTimer1000:
    npctalk "Oh well, who thought you would survive so far?";
    end;

OnTimer5000:
    npctalk "All this way, for nothing, only to die from my hands...";
    end;

OnTimer10000:
    npctalk "Don't worry, you will continue to live, for my sake.";
    end;

OnTimer15000:
    npctalk "One piece of advice: get prepared!";
    stopnpctimer;
    setnpctimer 0;
    donpcevent "#LuviaDaemon::OnCommandInvoke";
    end;

}

052-2,88,15,0|script|#LuviaDaemon|127
{
end;

OnCommandInvoke:
    setnpctimer 0;
    if ($@illia_level_7_progress == 1)
        startnpctimer;
    end;

OnTimer2000:
    if ($@illia_level_7_progress != 1) end;
    misceffect FX_DARK_TELEPORT;
    // Kill any mob existing on the map
    // That's to terminate any attempt at players mass-summoning mobs
    // and hide in a corner of the map.
    killmonster "052-2", "All";
    npcwarp 1, 1, "Luvia";
    end;

OnTimer100:
    if ($@illia_progress != 7)
        goto L_Clear;
    if ($@illia_level_7_progress != 3)
        end;
    // Trance mode
    callsub S_SpawnWitchGuard;
    end;

OnTimer2600:
    if ($@illia_level_7_progress != 3)
        end;
    npcwarp 1, 1, "#LuviaDaemon";
    setnpctimer 0;
    end;

OnTimer5000:
    if ($@illia_level_7_progress != 1)
        end;
    // Warp to the place to spawn luvia once the teleport sequence is finished
    if (!(attachrid($@ILLIA_HERO_ID)))
        end;
    set $@illia_luvia_x, getx();
    set $@illia_luvia_y, gety();
    npcwarp $@illia_luvia_x, $@illia_luvia_y, "#LuviaDaemon";

    detachrid;
    // This is a fix to force the official mana client to display a npc after a warp.
    // Note: the manaplus client do not need this.
    disablenpc "#LuviaDaemon";
    end;

OnTimer5500:
    if ($@illia_level_7_progress != 1) end;
    // See the note above.
    enablenpc "#LuviaDaemon";
    misceffect FX_EVIL_SUMMON;
    misceffect FX_CHANNELLING_CAST;
    monster "052-2", $@illia_luvia_x, $@illia_luvia_y, "", 1102, 1, "#LuviaDaemon::OnDeath";
    set $@illia_luvia_x, 0;
    set $@illia_luvia_y, 0;
    end;

OnTimer9000:
    if ($@illia_level_7_progress != 1) end;
    set $@illia_luvia_trance_delay, 480; // 8 minutes before turning in trance mode
    set $@illia_witch_guard_threshold, 30 + ($Illia_Luvia_Harvest*3)/5;
    if ($@illia_witch_guard_threshold > 100)
        set $@illia_witch_guard_threshold, 100;
    set $@illia_level_7_progress, 2;
    npcwarp 1, 1, "#LuviaDaemon";
    setnpctimer 0;
    end;

// Extra monster spawn
OnTimer26000:
    if ($@illia_progress != 7)
        goto L_Clear;
    if ($@illia_level_7_progress != 2)
        end;
    // The more players Luvia "harvested", the stronger she is.
    if (rand(100) >= $@illia_witch_guard_threshold)
        end;
    // Decrease her power over time.
    set $@illia_witch_guard_threshold, $@illia_witch_guard_threshold - 7;
    // Keep always a small probability when it reached the minimum
    if ($@illia_witch_guard_threshold <= 0)
        set $@illia_witch_guard_threshold, 6 + $Illia_Luvia_Harvest/5;
    callsub S_SpawnWitchGuard;
    end;

S_SpawnWitchGuard:
    if (!(attachrid($@ILLIA_HERO_ID)))
        end;
    npcwarp getx(), gety(), "#LuviaDaemon";
    misceffect FX_EVIL_SUMMON;
    misceffect FX_GROUND_SPAWN;
    monster "052-2", getx(), gety(), "", 1103, 1, "#LuviaDaemon::OnWGD";
    detachrid;
    areatimer "052-2", 73, 11, 115, 49, 0, "#LuviaDaemon::OnWGS";
    return;

OnTimer30000:
    if ($@illia_level_7_progress != 2)
        end;
    npcwarp 1, 1, "#LuviaDaemon";
    set $@illia_luvia_trance_delay, $@illia_luvia_trance_delay - 30;
    if ($@illia_luvia_trance_delay <= 0)
        goto L_TriggerTrance;
    setnpctimer 0;
    end;

L_TriggerTrance:
    set $@illia_level_7_progress, 3;
    set $@illia_luvia_trance_delay, 0;
    areatimer "052-2", 73, 11, 115, 49, 0, "#LuviaDaemon::OnTT";
    setnpctimer 0;
    end;

L_Clear:
    stopnpctimer;
    setnpctimer 0;
    end;

OnDeath:
    stopnpctimer;
    setnpctimer 0;
    if ($@illia_progress != 7)
        end;
    set $@illia_level_7_progress, 4;
    killmonster "052-2", "#LuviaDaemon::OnWGD";
    mapannounce "052-2", "Luvia:* How? By mere humans! But we will see again! Enjoy your victory while it lasts, " + $@ILLIA_HERO$ + "!!", 0;

    set $@illia_bp, $Illia_Luvia_Harvest * 16 / 10 + 120;
    areatimer "052-2", 73, 11, 115, 49, 0, "#LuviaDaemon::OnBP";

    areatimer "052-2", 73, 11, 115, 49, 2000, "#LuviaDaemon::OnW00t";

    set $@illia_progress, 8;
    callfunc "UpdateIlliaProgress";
    // Set the number of common rewards rewards
    if ($Illia_Luvia_Harvest < 15)
        set $@illia_num_common_reward_items, 0;
    if ($Illia_Luvia_Harvest >= 15 && $Illia_Luvia_Harvest < 35)
        set $@illia_num_common_reward_items, 1;
    if ($Illia_Luvia_Harvest >= 35)
        set $@illia_num_common_reward_items, 2;

    // Set the number of unique rewards
    if ($Illia_Luvia_Harvest < 40)
        set $@illia_num_unique_reward_items, 1;
    if ($Illia_Luvia_Harvest >= 40)
        set $@illia_num_unique_reward_items, 2;
    set $Illia_Luvia_Harvest, 0;

    // Extend the time limit of +7 mins to leave enough time to pick
    // the rewards even if close to the time limit
    set $@illia_max_time, $@illia_max_time + 300;

    // Record how many times the quest was finished
    set $Illia_Win_Counter, $Illia_Win_Counter + 1;

    end;

OnBP:
    set BOSS_POINTS, BOSS_POINTS + $@illia_bp;
    message strcharinfo(0), "You gain " + $@illia_bp + " Boss Points giving you a total of " + BOSS_POINTS + ".";
    end;

OnWGD:
    end;

OnWGS:
    if ($@illia_level_7_progress == 2)
        message strcharinfo(0), "One of Luvia's guard spawned from the depths to assist her!";
    end;

OnTT:
    if ($@illia_level_7_progress == 3)
        message strcharinfo(0), "Luvia seems to become in trance!";
    end;

OnW00t:
    message strcharinfo(0), "You defeated this evil sorceress... But what about her sister now?";
    end;

}

// Warp from the party room, to the chest room
052-2,88,12,0|script|#ToLuviaRoomDoor|32767,1,2
{
    set @step, 7;
    if ($@illia_progress < @step) goto L_ShouldNotBeHere;
    if ($@illia_level_7_progress < 4) end;
    warp "052-2", 133, 84;
    end;

L_ShouldNotBeHere:
    percentheal -100, 0;
    end;
}