| 1 |
/* |
| 2 |
* |
| 3 |
* Copyright (C) 2006 The Exult Team |
| 4 |
* |
| 5 |
* This program is free software; you can redistribute it and/or modify |
| 6 |
* it under the terms of the GNU General Public License as published by |
| 7 |
* the Free Software Foundation; either version 2 of the License, or |
| 8 |
* (at your option) any later version. |
| 9 |
* |
| 10 |
* This program is distributed in the hope that it will be useful, |
| 11 |
* but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 12 |
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 13 |
* GNU General Public License for more details. |
| 14 |
* |
| 15 |
* You should have received a copy of the GNU General Public License |
| 16 |
* along with this program; if not, write to the Free Software |
| 17 |
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. |
| 18 |
* |
| 19 |
* |
| 20 |
* This source file contains usecode for the Keyring Quest. |
| 21 |
* Specifically, it contains the last cutscene of the quest. |
| 22 |
* |
| 23 |
* Author: Marzo Junior |
| 24 |
* Last Modified: 2006-02-27 |
| 25 |
*/ |
| 26 |
|
| 27 |
enum Ritual_levels { |
| 28 |
BEGIN_RITUAL = 1, |
| 29 |
SPRITE_EFFECTS_LAURIANNA = 2, |
| 30 |
ERECT_BARRIER = 3, |
| 31 |
SPRITE_EFFECTS_ZAURIEL = 4, |
| 32 |
DRAGON_SHAPESHIFT = 5, |
| 33 |
PARTING_REMARKS = 6, |
| 34 |
BEGIN_ZAURIEL_COMBAT = 7, |
| 35 |
ZAURIEL_DIED = 8, |
| 36 |
RITUAL_END = 9 |
| 37 |
}; |
| 38 |
|
| 39 |
void zaurielTeleportPartyAround object#() () { |
| 40 |
//Get party list and append Laurianna: |
| 41 |
var party = [UI_get_party_list(), LAURIANNA->get_npc_object()]; |
| 42 |
var dist = 20; |
| 43 |
//Get Zauriel's position: |
| 44 |
struct<Position> pos = get_object_position(); |
| 45 |
//Find nearby eggs: |
| 46 |
var eggs = pos->find_nearby(SHAPE_EGG, dist, MASK_EGG); |
| 47 |
//Find nearby barriers: |
| 48 |
var barriers = pos->find_nearby(SHAPE_BARRIER, 3 * dist, MASK_TRANSLUCENT); |
| 49 |
var count = 0; |
| 50 |
struct<Position> new_pos; |
| 51 |
//The only four which are allowed to fight: |
| 52 |
var companions = [ |
| 53 |
UI_get_avatar_ref(), |
| 54 |
SHAMINO->get_npc_object(), |
| 55 |
IOLO->get_npc_object(), |
| 56 |
DUPRE->get_npc_object() |
| 57 |
]; |
| 58 |
|
| 59 |
for (egg in eggs) { |
| 60 |
//Each egg has a quality equal to the number |
| 61 |
//of a joinable NPC |
| 62 |
var qual = egg->get_item_quality(); |
| 63 |
var npc; |
| 64 |
if (qual == 0) { |
| 65 |
//Quality 0 means it is for the avatar: |
| 66 |
npc = UI_get_avatar_ref(); |
| 67 |
} else { |
| 68 |
//Get a reference to the NPC |
| 69 |
npc = qual->get_npc_object(); |
| 70 |
} |
| 71 |
if (npc in party) { |
| 72 |
//The NPC is in the party |
| 73 |
new_pos = egg->get_object_position(); |
| 74 |
if (!(npc in companions)) { |
| 75 |
//And he is not one of the 'companions' |
| 76 |
if (npc != LAURIANNA->get_npc_object()) { |
| 77 |
//Remove npc from party |
| 78 |
npc->remove_from_party(); |
| 79 |
} |
| 80 |
//Place them in WAIT mode facing south: |
| 81 |
npc->set_schedule_type(WAIT); |
| 82 |
npc->set_item_frame_rot(STAND_SOUTH); |
| 83 |
|
| 84 |
//Move the appropriate barrier: |
| 85 |
count += 1; |
| 86 |
pos = [new_pos.x + 1, new_pos.y + 1, new_pos.z]; |
| 87 |
barriers[count]->move_object(pos); |
| 88 |
} |
| 89 |
//Move the NPC to the egg: |
| 90 |
UI_sprite_effect(ANIMATION_TELEPORT, new_pos.x, new_pos.y, 0, 0, 0, -1); |
| 91 |
npc->move_object(new_pos); |
| 92 |
} else { |
| 93 |
//Remove the egg if the NPC is not here. |
| 94 |
egg->remove_item(); |
| 95 |
} |
| 96 |
} |
| 97 |
} |
| 98 |
|
| 99 |
void zaurielUnfreezeFormerParty () { |
| 100 |
struct<Position> pos = get_object_position(); |
| 101 |
//Find nearby eggs: |
| 102 |
var eggs = pos->find_nearby(SHAPE_EGG, 20, MASK_EGG); |
| 103 |
|
| 104 |
for (egg in eggs) { |
| 105 |
//Each egg has a quality equal to the number |
| 106 |
//of a joinable NPC |
| 107 |
var qual = egg->get_item_quality(); |
| 108 |
var npc = qual->get_npc_object(); |
| 109 |
npc->trueUnfreeze(); |
| 110 |
egg->remove_item(); |
| 111 |
} |
| 112 |
} |
| 113 |
|
| 114 |
void zaurielRitualCutscene object#() () { |
| 115 |
struct<Position> pos; |
| 116 |
var barrier; |
| 117 |
var body; |
| 118 |
var zauriel_journal; |
| 119 |
|
| 120 |
if (event == BEGIN_RITUAL) { |
| 121 |
//item = ZAURIEL |
| 122 |
|
| 123 |
//Prevents all party movement: |
| 124 |
freezeParty(); |
| 125 |
|
| 126 |
//Make Laurianna invulnerable: |
| 127 |
pos = LAURIANNA->get_object_position(); |
| 128 |
LAURIANNA->set_item_shape(SHAPE_LAURIANNA_MONSTER); |
| 129 |
LAURIANNA->set_last_created(); |
| 130 |
UI_update_last_created(pos); |
| 131 |
|
| 132 |
pos = get_object_position(); |
| 133 |
UI_sprite_effect(ANIMATION_FIREWORKS, pos.x, pos.y, 0, 0, 0, -1); |
| 134 |
|
| 135 |
item->begin_casting_mode(); |
| 136 |
//Zauriel script: |
| 137 |
script item { |
| 138 |
//cast spells: freeze party (Vas An Por), create magical barrier around |
| 139 |
//Laurianna (Vas Ort Sanct Grav) and move party around (Vas In Por): |
| 140 |
nohalt; |
| 141 |
continue; |
| 142 |
sfx 110; |
| 143 |
face north; |
| 144 |
say "@Vas An Por@"; |
| 145 |
actor frame standing; |
| 146 |
wait 1; |
| 147 |
actor frame cast_up; |
| 148 |
wait 1; |
| 149 |
next frame; |
| 150 |
wait 1; |
| 151 |
previous frame; |
| 152 |
sfx 108; |
| 153 |
say "@Vas Ort Sanct Grav@"; |
| 154 |
wait 2; |
| 155 |
next frame; |
| 156 |
wait 2; |
| 157 |
previous frame; |
| 158 |
wait 2; |
| 159 |
next frame; |
| 160 |
wait 2; |
| 161 |
previous frame; |
| 162 |
sfx SOUND_TELEPORT; |
| 163 |
say "@Vas In Por@"; |
| 164 |
|
| 165 |
//Actually teleport the party: |
| 166 |
call zaurielTeleportPartyAround; |
| 167 |
|
| 168 |
//Long casting ritual: |
| 169 |
wait 2; |
| 170 |
actor frame raise_2h; |
| 171 |
wait 2; |
| 172 |
next frame; |
| 173 |
wait 2; |
| 174 |
next frame; |
| 175 |
wait 3; |
| 176 |
|
| 177 |
//Make more spell effects: |
| 178 |
call zaurielRitualCutscene, SPRITE_EFFECTS_ZAURIEL; |
| 179 |
|
| 180 |
//Cast the dragon form spell (Rel An-Quas Ailem In BAL-ZEN) |
| 181 |
actor frame standing; |
| 182 |
say "@Rel An-Quas...@"; |
| 183 |
actor frame cast_up; |
| 184 |
wait 2; |
| 185 |
sfx 66; |
| 186 |
wait 2; |
| 187 |
next frame; |
| 188 |
wait 2; |
| 189 |
previous frame; |
| 190 |
wait 2; |
| 191 |
say "@...Ailem In BAL-ZEN@";wait 2; |
| 192 |
|
| 193 |
//Actually shapeshift Zauriel: |
| 194 |
call zaurielRitualCutscene, DRAGON_SHAPESHIFT; |
| 195 |
|
| 196 |
//Finish the ritual: |
| 197 |
next frame; |
| 198 |
sfx 64; |
| 199 |
wait 2; |
| 200 |
previous frame; |
| 201 |
wait 2; |
| 202 |
next frame; |
| 203 |
wait 2; |
| 204 |
face west; |
| 205 |
wait 2; |
| 206 |
|
| 207 |
//Say last words and wait a bit: |
| 208 |
call zaurielRitualCutscene, PARTING_REMARKS; |
| 209 |
wait 2; |
| 210 |
|
| 211 |
//Begin combat: |
| 212 |
call zaurielRitualCutscene, BEGIN_ZAURIEL_COMBAT; |
| 213 |
} |
| 214 |
|
| 215 |
var party = [UI_get_party_list(), LAURIANNA]; |
| 216 |
var companions = [ |
| 217 |
UI_get_avatar_ref(), |
| 218 |
SHAMINO->get_npc_object(), |
| 219 |
IOLO->get_npc_object(), |
| 220 |
DUPRE->get_npc_object() |
| 221 |
]; |
| 222 |
for (npc in party) { |
| 223 |
if (!(npc in companions)) { |
| 224 |
script npc { |
| 225 |
nohalt; |
| 226 |
continue; |
| 227 |
wait 15; |
| 228 |
//Make the spell effects: |
| 229 |
call zaurielRitualCutscene, SPRITE_EFFECTS_LAURIANNA; |
| 230 |
wait 12; |
| 231 |
//Create the magical barrier: |
| 232 |
call zaurielRitualCutscene, ERECT_BARRIER; |
| 233 |
} |
| 234 |
} |
| 235 |
} |
| 236 |
|
| 237 |
//Avatar script: |
| 238 |
script AVATAR { |
| 239 |
nohalt; |
| 240 |
continue; |
| 241 |
wait 2; |
| 242 |
say "@I-I... I can't move!@"; |
| 243 |
} |
| 244 |
} else if (event == SPRITE_EFFECTS_LAURIANNA) { |
| 245 |
//item = LAURIANNA |
| 246 |
pos = get_object_position(); |
| 247 |
UI_sprite_effect(ANIMATION_CIRCLE_BARRIER, pos.x, pos.y, 0, 0, 0, -1); |
| 248 |
} else if (event == ERECT_BARRIER) { |
| 249 |
//item varies |
| 250 |
//Create the protective barrier: |
| 251 |
pos = get_object_position(); |
| 252 |
barrier = UI_create_new_object(SHAPE_BARRIER); |
| 253 |
|
| 254 |
//Offset the position so that the barrier is in the right place: |
| 255 |
pos.x += 1; |
| 256 |
pos.y += 1; |
| 257 |
|
| 258 |
//Move the barrier to the target position: |
| 259 |
UI_update_last_created(pos); |
| 260 |
|
| 261 |
//Make the barrier temporary: |
| 262 |
barrier->set_item_flag(TEMPORARY); |
| 263 |
} else if (event == SPRITE_EFFECTS_ZAURIEL) { |
| 264 |
//item = ZAURIEL |
| 265 |
pos = get_object_position(); |
| 266 |
UI_sprite_effect(ANIMATION_FIREWORKS, pos.x, pos.y, 0, 0, 0, -1); |
| 267 |
} else if (event == DRAGON_SHAPESHIFT) { |
| 268 |
//item = ZAURIEL |
| 269 |
//Turn Zauriel into a dragon: |
| 270 |
pos = get_object_position(); |
| 271 |
UI_sprite_effect(ANIMATION_PURPLE_BUBBLES, pos.x, pos.y, 0, 0, 0, -1); |
| 272 |
UI_play_sound_effect2(SOUND_BIG_BLAST, item); |
| 273 |
set_item_shape(SHAPE_DRAGON); |
| 274 |
set_item_frame(0); |
| 275 |
set_last_created(); |
| 276 |
UI_update_last_created(pos); |
| 277 |
} else if (event == PARTING_REMARKS) { |
| 278 |
//item = ZAURIEL |
| 279 |
//Unfreeze the companions: |
| 280 |
AVATAR->trueUnfreeze(); |
| 281 |
if (isNearby(IOLO)) { |
| 282 |
IOLO->trueUnfreeze(); |
| 283 |
} |
| 284 |
if (isNearby(DUPRE)) { |
| 285 |
DUPRE->trueUnfreeze(); |
| 286 |
} |
| 287 |
if (isNearby(SHAMINO)) { |
| 288 |
SHAMINO->trueUnfreeze(); |
| 289 |
} |
| 290 |
|
| 291 |
//Speak using Dracothraxus' face: |
| 292 |
DRACOTHRAXUS_FACE.say("@I am truly sorry, Avatar, but I cannot think of a more worthy foe to bring about my demise!"); |
| 293 |
say("@Let the world know that I fell in glorious battle for the fate of my daughter!@"); |
| 294 |
} else if (event == BEGIN_ZAURIEL_COMBAT) { |
| 295 |
//item = ZAURIEL |
| 296 |
set_attack_mode(STRONGEST); |
| 297 |
//Have Zauriel start combat: |
| 298 |
item->trueUnfreeze(); |
| 299 |
set_alignment(2); |
| 300 |
pos = get_object_position(); |
| 301 |
set_schedule_type(IN_COMBAT); |
| 302 |
} else if (event == ZAURIEL_DIED) { |
| 303 |
//item = LAURIANNA |
| 304 |
//Unshapeshift Zauriel: |
| 305 |
body = find_nearest(SHAPE_LARGE_BODIES, 50); |
| 306 |
pos = body->get_object_position(); |
| 307 |
body->set_item_shape(SHAPE_BODIES_1); |
| 308 |
body->set_item_frame(FRAME_MONK_BODY_1); |
| 309 |
//The final effects of the ritual: |
| 310 |
UI_play_sound_effect2(SOUND_BIG_BLAST, body); |
| 311 |
UI_sprite_effect(ANIMATION_CIRCLE_BARRIER, pos.x, pos.y, 0, 0, 0, -1); |
| 312 |
UI_sprite_effect(ANIMATION_LIGHTNING, pos.x, pos.y, 0, 0, 0, -1); |
| 313 |
UI_sprite_effect(ANIMATION_FIREWORKS, pos.x, pos.y, 0, 0, 0, -1); |
| 314 |
//Create the journal and place it on the body: |
| 315 |
zauriel_journal = UI_create_new_object(SHAPE_JOURNAL); |
| 316 |
zauriel_journal->set_item_quality(1); |
| 317 |
body->give_last_created(); |
| 318 |
|
| 319 |
//parting comment and body disposal: |
| 320 |
script body { |
| 321 |
wait 3; |
| 322 |
say "@*gasp* T-t-thank thee *gasp* *cough* Avatar... *urgh*@"; |
| 323 |
wait 12; |
| 324 |
remove; |
| 325 |
} |
| 326 |
|
| 327 |
unfreezeParty(); |
| 328 |
|
| 329 |
script item after 16 ticks call zaurielRitualCutscene, RITUAL_END; |
| 330 |
} else if (event == RITUAL_END) { |
| 331 |
//item = LAURIANNA |
| 332 |
pos = get_object_position(); |
| 333 |
//Final effects of the ritual: |
| 334 |
UI_play_sound_effect2(SOUND_BIG_BLAST, item); |
| 335 |
UI_sprite_effect(ANIMATION_CIRCLE_BARRIER, pos.x, pos.y, 0, 0, 0, -1); |
| 336 |
UI_sprite_effect(ANIMATION_LIGHTNING, pos.x, pos.y, 0, 0, 0, -1); |
| 337 |
UI_sprite_effect(ANIMATION_FIREWORKS, pos.x, pos.y, 0, 0, 0, -1); |
| 338 |
//delete all magical barriers: |
| 339 |
var dist = 20; |
| 340 |
var barriers = pos->find_nearby(SHAPE_BARRIER, dist, MASK_TRANSLUCENT); |
| 341 |
for (obj in barriers) { |
| 342 |
script obj remove; |
| 343 |
} |
| 344 |
zaurielUnfreezeFormerParty(); |
| 345 |
|
| 346 |
item->trueUnfreeze(); |
| 347 |
|
| 348 |
//Mark Laurianna's cure: |
| 349 |
gflags[LAURIANNA_CURED] = true; |
| 350 |
|
| 351 |
//Make Laurianna vulnerable again: |
| 352 |
pos = LAURIANNA->get_object_position(); |
| 353 |
LAURIANNA->set_item_shape(SHAPE_LAURIANNA); |
| 354 |
LAURIANNA->set_last_created(); |
| 355 |
UI_update_last_created(pos); |
| 356 |
|
| 357 |
//Start dialog: |
| 358 |
script item after 10 ticks { |
| 359 |
nohalt; |
| 360 |
finish; |
| 361 |
say "@I-I am... cured?@"; |
| 362 |
wait 30; |
| 363 |
call Laurianna; |
| 364 |
} |
| 365 |
|
| 366 |
//More feedback: |
| 367 |
randomPartyBark(["@Look!@", "@A journal!@"]); |
| 368 |
} |
| 369 |
} |