summaryrefslogtreecommitdiff
path: root/npc/052-2/partyroom.txt
blob: dfd0613e6be31ea3f37276586c3c63ee81010c18 (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
052-2,98,29,0	script	#TriggerDialog	NPC32767,3,2,{
    @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:
    $@illia_level_7_progress = 1;
    donpcevent "Luvia::OnCommandStart";
    end;

L_ShouldNotBeHere:
    heal -Hp, 0;
    end;

}

052-2,87,58,0	script	#TriggerPlaceLuvia	NPC32767,1,1,{
    if (strcharinfo(0) != $@iLLIA_HERO$) end;
    if ($@illia_progress == 7 && $@illia_level_7_progress == 0) goto L_PlaceLuvia;
    end;

L_PlaceLuvia:
    npcwarp 98, 25, "#LuviaDaemon";
    npcwarp 98, 25, "Luvia";
    end;

}

052-2,98,25,0	script	Luvia	NPC371,{
    @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:
    heal -Hp, 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,98,25,0	script	#LuviaDaemon	NPC32767,{
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;
    $@illia_luvia_x = getx();
    $@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";
    $@illia_luvia_x = 0;
    $@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
    $@illia_witch_guard_threshold = 30 + ($Illia_Luvia_Harvest*3)/5;
    if ($@illia_witch_guard_threshold > 100)
        $@illia_witch_guard_threshold = 100;
    $@illia_level_7_progress = 2;
    npcwarp 1, 1, "#LuviaDaemon";
    setnpctimer 0;
    end;

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.
    $@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)
        $@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 0, "052-2", 83, 21, 125, 59, 0, "#LuviaDaemon::OnWGS";
    return;

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

L_TriggerTrance:
    $@illia_level_7_progress = 3;
    $@illia_luvia_trance_delay = 0;
    areatimer 0, "052-2", 83, 21, 125, 59, 0, "#LuviaDaemon::OnTT";
    setnpctimer 0;
    end;

L_Clear:
    stopnpctimer;
    setnpctimer 0;
    end;

OnDeath:
    stopnpctimer;
    setnpctimer 0;
    if ($@illia_progress != 7)
        end;
    $@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;

    $@illia_bp = $Illia_Luvia_Harvest * 16 / 10 + 120;
    areatimer 0, "052-2", 83, 21, 125, 59, 0, "#LuviaDaemon::OnBP";

    areatimer 0, "052-2", 83, 21, 125, 59, 2000, "#LuviaDaemon::OnW00t";

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

    // Set the number of unique rewards
    if ($Illia_Luvia_Harvest < 40)
        $@illia_num_unique_reward_items = 1;
    if ($Illia_Luvia_Harvest >= 40)
        $@illia_num_unique_reward_items = 2;
    $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
    $@illia_max_time = $@illia_max_time + 300;

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

    end;

OnBP:
    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;

}

052-2,98,22,0	script	#ToLuviaRoomDoor	NPC32767,1,2,{
    @step = 7;
    if ($@illia_progress < @step) goto L_ShouldNotBeHere;
    if ($@illia_level_7_progress < 4) end;
    warp "052-2", 143, 94;
    end;

L_ShouldNotBeHere:
    heal -Hp, 0;
    end;
}