-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathAlfheim.m
2004 lines (1947 loc) · 83.9 KB
/
Alfheim.m
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
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
//
// Alfheim.m
// TEORWorldMapTest
//
// Created by Zach Babb on 7/25/11.
// Copyright 2011 InstantLazer. All rights reserved.
//
#import "Alfheim.h"
#import "GameController.h"
#import "AbstractBattleEnemy.h"
#import "FontManager.h"
#import "InputManager.h"
#import "SoundManager.h"
#import "ScriptReader.h"
#import "PackedSpriteSheet.h"
#import "TiledMap.h"
#import "ParticleEmitter.h"
#import "Animation.h"
#import "Image.h"
#import "Projectile.h"
#import "Character.h"
#import "StringWithDuration.h"
#import "AbstractBattleEnemy.h"
#import "AbstractEntity.h"
#import "Roderick.h"
#import "OldMan.h"
#import "Valkyrie.h"
#import "NPCVolur.h"
#import "FadeInOrOut.h"
#import "Textbox.h"
#import "Choicebox.h"
#import "Teleportal.h"
#import "Seior.h"
#import "NPCEnemySwordMan.h"
#import "NPCRedHairedRoderick.h"
#import "KenazMenuAnimation.h"
#import "SowiloMenuAnimation.h"
#import "IsaMenuAnimation.h"
#import "SwopazMenuAnimation.h"
#import "BattleWaterSpirit.h"
#import "BattlePoisonDemonMage.h"
#import "BattlePoisonDemonRider.h"
#import "BattleWizard.h"
#import "BattlePriest.h"
#import "BattleRoderick.h"
#import "OverMind.h"
#import "PackedSpriteSheet.h"
#import "MoveMap.h"
#import "WorldFlashColor.h"
#import "Bats.h"
#import "RuneTomb.h"
#import "EkwazMenuAnimation.h"
#import "GromanthMenuAnimation.h"
#import "HagalazMenuAnimation.h"
#import "RangerBattleTutorial.h"
#import "Nioavellir.h"
@implementation Alfheim
- (id)init
{
self = [super init];
if (self) {
battleImage = [[Image alloc] initWithImageNamed:@"AlfheimBackground.png" filter:GL_NEAREST];
battleFont = [sharedFontManager getFontWithKey:@"battleFont"];
sceneMap = [[TiledMap alloc] initWithFileName:@"AlfheimMap" fileExtension:@"tmx"];
cutScene = YES;
cutSceneTimer = 0.5;
[sharedInputManager setState:kNoTouchesAllowed];
[FadeInOrOut fadeInWithDuration:2];
sharedGameController.gameState = kGameState_World;
sharedGameController.realm = kRealm_Alfheim;
[self createCollisionMapArray];
[self createPortalsArray];
[sharedSoundManager loadMusicWithKey:@"Cave" musicFile:@"evil cave.mp3"];
[sharedSoundManager loadMusicWithKey:@"Mountain" musicFile:@"overworld 1.mp3"];
allowBattles = NO;
stage = 0;
//Stuff added so that I can start the scene here
/*Character *roderick = [sharedGameController.characters objectForKey:@"Roderick"];
Character *alex = [sharedGameController.characters objectForKey:@"Valkyrie"];
Character *seior = [sharedGameController.characters objectForKey:@"Wizard"];
int level = 1;
while (level < 5) {
[roderick levelUp];
[alex levelUp];
[seior levelUp];
level++;
}
IsaMenuAnimation *isam = [[IsaMenuAnimation alloc] init];
SowiloMenuAnimation *sowilo = [[SowiloMenuAnimation alloc] init];
KenazMenuAnimation *kenaz = [[KenazMenuAnimation alloc] init];
[sharedGameController.party addObject:roderick];
[sharedGameController.party addObject:alex];
[sharedGameController.party addObject:seior];
[roderick learnRune:isam withKey:@"Isa"];
[alex learnRune:sowilo withKey:@"Sowilo"];
[seior learnRune:kenaz withKey:@"Kenaz"];
[isam release];
[sowilo release];
[kenaz release];
roderick.essence = roderick.maxEssence = 10 + roderick.level;
alex.essence = alex.maxEssence = 10 + alex.level;
[sharedInputManager setUpRuneRect];
stage = 195;
Roderick *rod = [[Roderick alloc] initAtTile:CGPointMake(58, 90)];
sharedGameController.player = rod;
[self addEntityToActiveEntities:rod];
[rod release];
//Added to start at stage 165.
NPCVolur *dauphine = [[NPCVolur alloc] initAtTile:CGPointMake(25, 70)];
dauphine.triggerNextStage = YES;
[self addEntityToActiveEntities:dauphine];
[dauphine release];*/
}
return self;
}
- (void)moveToNextStageInScene {
switch (stage) {
case 0:
stage++;
[FadeInOrOut fadeInWithDuration:2];
Roderick *roderick = [[Roderick alloc] initAtTile:CGPointMake(76, 32)];
sharedGameController.player = roderick;
[self addEntityToActiveEntities:roderick];
//[sharedGameController.gameScenes removeObjectForKey:@"ChapterOne"];
doNotUpdate = NO;
[roderick release];
OldMan *oldMan = [[OldMan alloc] initAtTile:CGPointMake(70, 36)];
oldMan.triggerNextStage = YES;
[self addEntityToActiveEntities:oldMan];
[oldMan release];
cutSceneTimer = 2;
break;
case 1:
stage++;
cutScene = NO;
[sharedInputManager setState:kWalkingAround_NoTouches];
break;
case 2:
stage++;
[Textbox textboxWithText:@"Hermit: Who'sa what now? Who's there?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 3:
stage++;
Valkyrie *valk = [[Valkyrie alloc] initAtLocation:sharedGameController.player.currentLocation];
[valk fadeIn];
[valk faceUp];
[valk moveToPoint:CGPointMake(valk.currentLocation.x + 40, valk.currentLocation.y) duration:1];
[self addEntityToActiveEntities:valk];
[valk release];
[Textbox textboxWithText:@"Roderick: Listen old man. We need you to tell us where Urundyl's castle is."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 4:
stage++;
[Textbox textboxWithText:@"Valkyrie: You need to learn some respect Roderick."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 5:
stage++;
[Textbox textboxWithText:@"Hermit: You? Hahaha! You'll never make it."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 6:
stage++;
[Textbox textboxWithText:@"Roderick: What do you mean? Do you doubt our skills? I'll show you old man!"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 7:
stage++;
[Textbox textboxWithText:@"Hermit: Oh? I just think you'll need help."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 8:
stage++;
[Textbox textboxWithText:@"Valkyrie: What kind of help could we use?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 9:
stage++;
[Textbox textboxWithText:@"Hermit: Head West. There is a clearing where you might find Seior. Seior will help you."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 10:
stage++;
[Textbox textboxWithText:@"Roderick: Seior? Who's Seior?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 11:
stage++;
[Textbox textboxWithText:@"Hermit: An old wisened wizard."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 12:
stage++;
[Textbox textboxWithText:@"Valkyrie: Come, let's go find this wizard."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 13:
stage++;
for (AbstractEntity *entity in activeEntities) {
if ([entity isMemberOfClass:[Valkyrie class]]) {
[entity fadeOut];
[entity moveToPoint:sharedGameController.player.currentLocation duration:1];
}
if ([entity isMemberOfClass:[OldMan class]]) {
entity.triggerNextStage = NO;
entity.message = @"Hermit: Head West. You will find Seior there.";
}
}
cutScene = YES;
cutSceneTimer = 1;
break;
case 14:
stage = 1400;
for (AbstractEntity *entity in activeEntities) {
entity.active = NO;
}
sharedGameController.player.active = YES;
Seior *seior = [[Seior alloc] initAtTile:CGPointMake(60, 23)];
[self addEntityToActiveEntities:seior];
[seior release];
[sharedInputManager setState:kWalkingAround_NoTouches];
cutScene = NO;
break;
case 1400:
stage = 15;
allowBattles = YES;
break;
case 15:
stage = 1500;
[sharedGameController.player stopMoving];
sharedGameController.gameState = kGameState_Cutscene;
MoveMap *moveMap = [[MoveMap alloc] initMoveFromMapXY:sharedGameController.player.currentLocation to:CGPointMake(sharedGameController.player.currentLocation.x, sharedGameController.player.currentLocation.y + 120) withDuration:1];
[self addObjectToActiveObjects:moveMap];
[moveMap release];
[Textbox textboxWithText:@"Young Woman: It's got to be around here somewhere. I know it."];
cutScene = YES;
cutSceneTimer = 1;
break;
case 1500:
stage = 16;
cutScene = NO;
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 16:
stage++;
cutScene = NO;
Valkyrie *valk2 = [[Valkyrie alloc] initAtLocation:sharedGameController.player.currentLocation];
[valk2 fadeIn];
[valk2 moveToPoint:CGPointMake(sharedGameController.player.currentLocation.x + 40, sharedGameController.player.currentLocation.y) duration:1];
[valk2 faceUp];
[self addEntityToActiveEntities:valk2];
[valk2 release];
[Textbox textboxWithText:@"Roderick: Excuse me miss. We were told we would find a wizard around here. Have you seen him?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 17:
stage++;
[Textbox textboxWithText:@"Young Woman: A wizard eh? I think he may have gone East."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 18:
stage++;
[Textbox textboxWithText:@"Roderick: Great! Let's get on with it."];
[sharedGameController.player faceRight];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 19:
stage++;
[Textbox textboxWithText:@"Young Woman: Or maybe it was West..."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 20:
stage++;
[Textbox textboxWithText:@"Roderick: Well which was it?"];
[sharedGameController.player faceUp];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 21:
stage++;
[Textbox textboxWithText:@"Young Woman: Well you're an impatient one. What do you know of this wizard? Maybe that will help me remember."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 22:
stage++;
[Textbox textboxWithText:@"Roderick: He is a wise old wizard. Probably grey hair. They seem to like cloaks."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 23:
stage++;
NPCEnemySwordMan *esm = [[NPCEnemySwordMan alloc] initAtTile:CGPointMake(57, 24)];
[esm fadeIn];
[esm moveToTile:CGPointMake(58, 23) duration:1];
[self addEntityToActiveEntities:esm];
[esm release];
[Textbox textboxWithText:@"Young Woman: Grey hair and cloak huh? Doesn't ring a bell."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 24:
stage++;
[Textbox textboxWithText:@"Roderick: Hey watch out. There's a monster!"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 25:
stage++;
for (AbstractEntity *entity in activeEntities) {
if ([entity isMemberOfClass:[NPCEnemySwordMan class]]) {
[entity moveToTile:CGPointMake(60, 24) duration:1];
}
}
[Textbox timedTextboxWithText:@"Lookout!" andDuration:0.7];
cutScene = YES;
cutSceneTimer = 0.7;
break;
case 26:
stage++;
[self removeTextbox];
cutScene = NO;
Character *wizard = [sharedGameController.characters objectForKey:@"Wizard"];
[sharedGameController.party addObject:wizard];
KenazMenuAnimation *kma = [[KenazMenuAnimation alloc] init];
[wizard learnRune:kma withKey:@"Kenaz"];
while (wizard.level < 5) {
[wizard levelUp];
}
[self initBattle];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 27:
stage++;
for (AbstractBattleEntity *abe in activeEntities) {
if ([abe isKindOfClass:[AbstractBattleEntity class]]) {
abe.wait = YES;
abe.waitTimer = -1;
}
}
[Textbox textboxWithText:@"Young Woman: Ha! It's only a water spirit. Don't worry I'll handle this."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 28:
stage++;
[Textbox textboxWithText:@"Young Woman: Kenaz!"];
cutScene = YES;
cutSceneTimer = 0.7;
break;
case 29:
stage = 300;
cutScene = NO;
BattleWizard *wiz = [sharedGameController.battleCharacters objectForKey:@"BattleWizard"];
AbstractBattleEnemy *waterSpirit;
for (AbstractBattleEnemy *entity in activeEntities) {
if ([entity isMemberOfClass:[BattleWaterSpirit class]]) {
waterSpirit = entity;
waterSpirit.wait = NO;
}
}
[wiz queueRune:120];
[sharedInputManager setState:kNoTouchesAllowed];
[wiz runeWasPlacedOnEnemy:waterSpirit];
break;
case 300:
stage++;
[self removeTextbox];
allowBattles = NO;
[Textbox textboxWithText:@"Young Woman: Ahh, that's where it was."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 301:
stage = 302;
Image *ansuzRuneStone = [[[sharedGameController.teorPSS imageForKey:@"AnsuzRuneStone.png"] imageDuplicate] retain];
[sharedGameController.runeStones addObject:ansuzRuneStone];
[sharedGameController.runeStones addObject:ansuzRuneStone];
[ansuzRuneStone release];
[Textbox centerTextboxWithText:@"Ansuz Runestone received!"];
cutScene = YES;
cutSceneTimer = 0.5;
break;
case 302:
stage = 30;
cutScene = NO;
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 30:
stage++;
[Textbox textboxWithText:@"Roderick: Whoa! What the heck was that?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 31:
stage++;
[Textbox textboxWithText:@"Valkyrie: That looked like runic power. Where did you learn that?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 32:
stage++;
[Textbox textboxWithText:@"Roderick: Runic power? What is that?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 33:
stage++;
[Textbox textboxWithText:@"Valkyrie: Don't you know anything Roderick?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 34:
stage++;
[Textbox textboxWithText:@"Young Woman: Runes let you harness the power of the world around you."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 35:
stage++;
[Textbox textboxWithText:@"Young Woman: That was Kenaz. It is a fire rune. That water spirit didn't stand a chance."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 36:
stage++;
[Textbox textboxWithText:@"Roderick: So runes are like magic?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 37:
stage++;
[Textbox textboxWithText:@"Young Woman: Fool! This isn't some hocus pocus, these runes have real power."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 38:
stage++;
[Textbox textboxWithText:@"Valkyrie: It seems you might be more than you seem at first glance."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 39:
stage++;
[Textbox textboxWithText:@"Valkyrie: Roderick, I think this might be our old wizard."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 40:
stage++;
[Choicebox choiceboxWithChoices:[NSArray arrayWithObjects:@"No way, she's just a young lady.", @"Yeah, I think you might be right.", nil]];
break;
case 41:
stage++;
[Textbox textboxWithText:@"Young Woman: Hahahah! So you've found me out. I am indeed Seior."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 410:
stage = 42;
[Textbox textboxWithText:@"Young Woman: Your ignorance will be your undoing sir. I am indeed Seior!"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 42:
stage++;
[Textbox textboxWithText:@"Valkyrie: Seior, can you help us find Urundyl's castle? We must speak with the king."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 43:
stage++;
[Textbox textboxWithText:@"Seior: I was just heading that way after I had found this runestone. Come on, we need to head West from here."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 44:
stage++;
[Textbox centerTextboxWithText:@"You have now learned about runes. You can use runes you have learned in battle by drawing the rune on the middle of the screen."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 45:
stage++;
[Textbox centerTextboxWithText:@"The runes that each character knows will be shown in your runes menu. Check out that menu to see how to draw them and what they will do."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 46:
stage++;
[Textbox centerTextboxWithText:@"After drawing the rune, if you drew it correctly, you can then place it in one of four positions. On an enemy, on the enemy side but not on an enemy to affect all enemies, on a character, or on the character side but not on a character to affect all characters."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 47:
stage = 470;
[Textbox centerTextboxWithText:@"You have also found your first runestone. You can equip those to your weapon or armor to help you in battle. Check 'em out in the equipment menu."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 470:
stage++;
[Textbox textboxWithText:@"Seior: If you have a few moments, I can teach you both a rune. It should be helpful on the path to Urundyl."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 471:
stage++;
[Textbox centerTextboxWithText:@"Roderick has learned the rune Isa!"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 472:
stage++;
[Textbox centerTextboxWithText:@"The Valkyrie has learned the rune Sowilo."];
IsaMenuAnimation *isam = [[IsaMenuAnimation alloc] init];
SowiloMenuAnimation *sowilo = [[SowiloMenuAnimation alloc] init];
Character *roder = [sharedGameController.characters objectForKey:@"Roderick"];
Character *valky = [sharedGameController.characters objectForKey:@"Valkyrie"];
[roder learnRune:isam withKey:@"Isa"];
[valky learnRune:sowilo withKey:@"Sowilo"];
[isam release];
[sowilo release];
roder.essence = roder.maxEssence = 10 + roder.level;
valky.essence = valky.maxEssence = 10 + valky.level;
[sharedInputManager setUpRuneRect];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 473:
stage = 48;
[Textbox centerTextboxWithText:@"Check out how to draw them in the runes menu."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 48:
stage++;
for (AbstractEntity *entity in activeEntities) {
if ([entity isMemberOfClass:[Valkyrie class]]) {
[entity moveToPoint:sharedGameController.player.currentLocation duration:1];
[entity fadeOut];
} else if ([entity isMemberOfClass:[Seior class]]) {
[entity moveToPoint:sharedGameController.player.currentLocation duration:1];
[entity fadeOut];
}
}
cutScene = YES;
cutSceneTimer = 1;
break;
case 49:
stage++;
[self removeInactiveEntities];
Character *sei = [sharedGameController.characters objectForKey:@"Wizard"];
sei.fireAffinity = 4;
sei.power = sei.level * 2;
cutScene = NO;
allowBattles = YES;
for (int i = 0; i < 3; i++) {
NPCEnemySwordMan *nesm = [[NPCEnemySwordMan alloc] initAtTile:CGPointMake(35, 2 + (i * 2))];
NPCRedHairedRoderick *nrhr = [[NPCRedHairedRoderick alloc] initAtTile:CGPointMake(37, 2 + (i * 2))];
[nesm faceRight];
[nrhr faceLeft];
[self addEntityToActiveEntities:nesm];
[self addEntityToActiveEntities:nrhr];
[nesm release];
[nrhr release];
}
[sharedInputManager setState:kWalkingAround_NoTouches];
break;
case 50:
stage = 500;
[sharedGameController.player stopMoving];
sharedGameController.gameState = kGameState_Cutscene;
MoveMap *moveMap2 = [[MoveMap alloc] initMoveFromMapXY:sharedGameController.player.currentLocation to:CGPointMake(sharedGameController.player.currentLocation.x - 120, sharedGameController.player.currentLocation.y) withDuration:1];
[self addObjectToActiveObjects:moveMap2];
[moveMap2 release];
[Textbox textboxWithText:@"Elven Hunter: We've got them cornered men. Attack!"];
cutScene = YES;
cutSceneTimer = 1;
[sharedInputManager setState:kNoTouchesAllowed];
break;
case 500:
stage = 51;
cutScene = NO;
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 51:
stage++;
[self removeTextbox];
for (AbstractEntity *entity in activeEntities) {
if ([entity isMemberOfClass:[NPCEnemySwordMan class]]) {
[entity moveToPoint:CGPointMake(entity.currentLocation.x + 20, entity.currentLocation.y) duration:0.3];
} else if ([entity isMemberOfClass:[NPCRedHairedRoderick class]]) {
[entity moveToPoint:CGPointMake(entity.currentLocation.x - 20, entity.currentLocation.y) duration:0.3];
}
}
[WorldFlashColor worldFlashColor:Color4fMake(1, 1, 1, 0.3)];
cutScene = YES;
cutSceneTimer = 0.4;
Valkyrie *ally = [[Valkyrie alloc] initAtTile:sharedGameController.player.currentTile];
[ally fadeIn];
[ally moveToTile:CGPointMake(sharedGameController.player.currentTile.x - 1, sharedGameController.player.currentTile.y) duration:1];
[ally faceRight];
Seior *seior2 = [[Seior alloc] initAtTile:sharedGameController.player.currentTile];
[seior2 fadeIn];
[seior2 moveToTile:CGPointMake(sharedGameController.player.currentTile.x, sharedGameController.player.currentTile.y + 1) duration:1];
[seior2 faceLeft];
[self addEntityToActiveEntities:ally];
[self addEntityToActiveEntities:seior2];
[ally release];
[seior2 release];
[sharedInputManager setState:kNoTouchesAllowed];
break;
case 52:
stage++;
for (AbstractEntity *entity in activeEntities) {
if ([entity isMemberOfClass:[NPCEnemySwordMan class]]) {
[entity moveToPoint:CGPointMake(entity.currentLocation.x - 20, entity.currentLocation.y) duration:0.5];
entity.currentAnimation = entity.rightAnimation;
} else if ([entity isMemberOfClass:[NPCRedHairedRoderick class]]) {
[entity moveToPoint:CGPointMake(entity.currentLocation.x + 20, entity.currentLocation.y) duration:0.5];
[entity.currentAnimation retain];
entity.currentAnimation = entity.leftAnimation;
NSLog(@"Right animation state is: %d", entity.rightAnimation.state);
}
}
cutScene = YES;
cutSceneTimer = 0.6;
[Textbox textboxWithText:@"Elven Hunter: Damn! Their too strong. Keep at it men!"];
break;
case 53:
stage++;
cutScene = NO;
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 54:
stage++;
[Textbox textboxWithText:@"Seior: Roderick! Use the rune I taught you."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 55:
stage++;
[Textbox textboxWithText:@"Roderick: ISA!"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 56:
stage++;
[WorldFlashColor worldFlashColor:Color4fMake(0, 0, 1, 0.4)];
cutScene = YES;
cutSceneTimer = 0.3;
break;
case 57:
stage++;
for (AbstractEntity *entity in activeEntities) {
if ([entity isMemberOfClass:[NPCEnemySwordMan class]]) {
entity.currentAnimation.state = kAnimationState_Stopped;
[entity.currentAnimation currentFrameImage].color = Blue;
}
}
cutSceneTimer = 0.3;
break;
case 58:
stage++;
cutScene = YES;
for (AbstractEntity *entity in activeEntities) {
if ([entity isMemberOfClass:[NPCRedHairedRoderick class]]) {
NSLog(@"Right animation state is: %d", entity.rightAnimation.state);
[entity moveToPoint:CGPointMake(entity.currentLocation.x - 100, entity.currentLocation.y) duration:0.5];
}
}
cutSceneTimer = 0.4;
break;
case 59:
stage++;
[WorldFlashColor worldFlashColor:Color4fMake(1, 1, 1, 0.3)];
cutSceneTimer = 0.2;
break;
case 60:
stage++;
for (AbstractEntity *entity in activeEntities) {
if ([entity isMemberOfClass:[NPCEnemySwordMan class]]) {
[entity fadeOut];
} else if ([entity isMemberOfClass:[NPCRedHairedRoderick class]]) {
NSLog(@"Current tile is (%f, %f). %d and current location is (%f, %f).", entity.currentTile.x, entity.currentTile.y, entity.currentAnimation.state, entity.currentLocation.x, entity.currentLocation.y);
NSLog(@"Right animation state is: %d", entity.rightAnimation.state);
[entity moveToTile:CGPointMake(38, entity.currentTile.y) duration:1.5];
//[entity moveToPoint:CGPointMake(1540, entity.currentLocation.y) duration:1];
}
}
cutSceneTimer = 1.5;
break;
case 61:
stage++;
cutScene = NO;
[Textbox textboxWithText:@"Elven Hunter: Ahh Seior, well met! You and your companions have our thanks."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 62:
stage++;
[Textbox textboxWithText:@"Seior: Kelthe, what are you doing all the way out here?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 63:
stage++;
[Textbox textboxWithText:@"Kelthe: Monsters have been marauding our lands. We chased a group to this clearing, but they found reinforcements."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 64:
stage++;
[Textbox textboxWithText:@"Valkyrie: I thought Elven lands were free of monsters."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 65:
stage++;
[Textbox textboxWithText:@"Kelthe: They were, but recently they've returned. The land is being corrupted."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 66:
stage++;
[Textbox textboxWithText:@"Kelthe: If you had not happened along, we may have been corrupted as well..."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 67:
stage++;
[Choicebox choiceboxWithChoices:[NSArray arrayWithObjects:@"Damn right!", @"Roderick saves the day as usual.", @"Great luck indeed.", nil]];
break;
case 68:
stage++;
[Textbox textboxWithText:@"Kelthe: The gods employ a special kind of luck."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 680:
stage = 69;
[Textbox textboxWithText:@"Kelthe: Boasting, is not the way to the gods favor sir."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 6800:
stage = 69;
[Textbox textboxWithText:@"Kelthe: Roderick eh? Never heard of you. Perhaps you haven't saved enough days."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 69:
stage++;
[Textbox textboxWithText:@"Kelthe: What brought you all to this place?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 70:
stage++;
[Textbox textboxWithText:@"Seior: We were on our way to see Urundyl."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 71:
stage++;
[Textbox textboxWithText:@"Kelthe: Well let us accompany you then. We can head back now that these monsters have been dispatched."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 72:
stage++;
[Textbox textboxWithText:@"Seior: Your escort is appreciated. Let us be off."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 73:
stage++;
//Added to start here.
cutScene = NO;
for (AbstractEntity *entity in activeEntities) {
entity.active = NO;
}
sharedGameController.player.active = YES;
NPCRedHairedRoderick *rhr = [[NPCRedHairedRoderick alloc] initAtTile:CGPointMake(95, 36)];
[rhr faceDown];
rhr.triggerNextStage = YES;
[self addEntityToActiveEntities:rhr];
[rhr release];
sharedGameController.gameState = kGameState_World;
allowBattles = NO;
[Teleportal teleportalToTile:CGPointMake(95, 26)];
break;
case 74:
stage++;
[self removeInactiveEntities];
Valkyrie *alexdot = [[Valkyrie alloc] initAtTile:sharedGameController.player.currentTile];
Seior *wizzie = [[Seior alloc] initAtTile:sharedGameController.player.currentTile];
[alexdot fadeIn];
[wizzie fadeIn];
[alexdot moveToTile:CGPointMake(alexdot.currentTile.x + 1, alexdot.currentTile.y) duration:1];
[wizzie moveToTile:CGPointMake(wizzie.currentTile.x - 1, wizzie.currentTile.y) duration:1];
[alexdot faceUp];
[wizzie faceUp];
[self addEntityToActiveEntities:alexdot];
[self addEntityToActiveEntities:wizzie];
[alexdot release];
[wizzie release];
[Textbox textboxWithText:@"Urundyl: Seior, how have you been? Kelthe tells me you came to his aid on the hunt."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 75:
stage++;
[Textbox textboxWithText:@"Seior: Indeed we did. Kelthe says that monsters have begun to appear in these lands."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 76:
stage++;
[Textbox textboxWithText:@"Roderick: We need to ask you some questions."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 77:
stage++;
[Textbox textboxWithText:@"Urundyl: Because you helped Kelthe, I'll stay my hand, but your impertinance is ill received."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 78:
stage++;
[Textbox textboxWithText:@"Valkyrie: Forgive this loud mouth your highness, but we are in need of some information."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 79:
stage++;
[Textbox textboxWithText:@"Urundyl: Unfortunately valkyrie, I have no time for discussion right now. My men and I are hunting down these monsters and driving them from our land."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 80:
stage++;
[Textbox textboxWithText:@"Valkyrie: Understood. We will help you deal with this threat then. Then we can talk yes?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 81:
stage++;
[Textbox textboxWithText:@"Urundyl: Once the threat is neutralized, I'll answer any questions you have."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 82:
stage++;
[Textbox textboxWithText:@"Valkyrie: Excellent. What would you like us to do?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 83:
stage++;
[Textbox textboxWithText:@"Urundyl: We have tracked groups of monsters to three locations."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 84:
stage++;
[Textbox textboxWithText:@"Urundyl: To the North on Mount Kolbathe, to Northwest in the Swimpy Swamp, and to the Southwest in the Cave of Arank."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 85:
stage++;
[Textbox textboxWithText:@"Urundyl: Choose whichever path you'd like, my men will chase the monsters in the other two."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 86:
stage++;
for (AbstractEntity *entity in activeEntities) {
if ([entity isMemberOfClass:[Valkyrie class]] || [entity isMemberOfClass:[Seior class]]) {
[entity moveToTile:sharedGameController.player.currentTile duration:1];
[entity fadeOut];
} else if ([entity isMemberOfClass:[NPCRedHairedRoderick class]]) {
entity.message = @"Mount Kolbathe is a small mountain. The Swimpy Swamp is not too long, but the Cave of Arank is a deep cavern. Choose wisely.";
}
}
//Add once RuneTomb image is added to TEORPSS
RuneTomb *gromanthRuneTomb = [[RuneTomb alloc] initAtTile:CGPointMake(50, 22) withRune:[[GromanthMenuAnimation alloc] init] withRuneKey:@"Gromanth" forCharacter:[sharedGameController.characters objectForKey:@"Wizard"] withTriggerNextStage:YES];
[self addEntityToActiveEntities:gromanthRuneTomb];
[gromanthRuneTomb release];
RuneTomb *hagalazRuneTomb = [[RuneTomb alloc] initAtTile:CGPointMake(78, 59) withRune:[[HagalazMenuAnimation alloc] init] withRuneKey:@"Hagalaz" forCharacter:[sharedGameController.characters objectForKey:@"Valkyrie"] withTriggerNextStage:YES];
[self addEntityToActiveEntities:hagalazRuneTomb];
[hagalazRuneTomb release];
cutScene = YES;
cutSceneTimer = 1;
break;
case 87:
stage++;
cutScene = NO;
sharedGameController.gameState = kGameState_World;
[sharedInputManager setState:kWalkingAround_NoTouches];
break;
case 88:
stage++;
allowBattles = YES;
if (sharedGameController.player.currentTile.x == 33) {
stage = 890;
[sharedSoundManager playMusicWithKey:@"Cave" timesToRepeat:-1];
RuneTomb *ekwazRuneTomb = [[RuneTomb alloc] initAtTile:CGPointMake(23, 51) withRune:[[EkwazMenuAnimation alloc] init] withRuneKey:@"Ekwaz" forCharacter:[sharedGameController.characters objectForKey:@"Wizard"] withTriggerNextStage:YES];
[self addEntityToActiveEntities:ekwazRuneTomb];
[ekwazRuneTomb release];
} else if (sharedGameController.player.currentTile.x == 35) {
stage = 8900;
[sharedSoundManager playMusicWithKey:@"Mountain" timesToRepeat:-1];
}
break;
case 89:
stage++;
break;
case 890:
stage++;
[sharedGameController.player stopMoving];
[Textbox textboxWithText:@"Roderick: BATS!"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 891:
stage = 90;
[self initCaveBoss];
break;
break;
case 8900:
stage = 90;
break;
case 90:
stage = 910;
[Teleportal teleportalToTile:CGPointMake(95, 33)];
cutScene = YES;
cutSceneTimer = 0.55;
[sharedInputManager setState:kNoTouchesAllowed];
break;
case 910:
stage = 91;
cutSceneTimer = 0.55;
sharedGameController.gameState = kGameState_Cutscene;
cameraPosition = CGPointMake(95, 35);
[sharedGameController.player faceUp];
[Valkyrie valkyrieAppearAt:sharedGameController.player.currentLocation move:kMovingRight andFace:kMovingUp];
[Seior seiorAppearAt:sharedGameController.player.currentLocation move:kMovingLeft andFace:kMovingUp];
allowBattles = NO;
break;
case 91:
stage++;
cutScene = NO;
[Textbox textboxWithText:@"Urundyl: Thank you for assisting us. It seems we have staved off this invasion for now."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 92:
stage++;
[Textbox textboxWithText:@"Valkyrie: You are welcome Urundyl. Now if we may ask you some questions."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 93:
stage++;
[Textbox textboxWithText:@"Urundyl: Of course. Ask what you will."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 94:
stage++;
[Textbox textboxWithText:@"Roderick: We need to know your secret way of bringing the dead back to life."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 95:
stage++;
[Textbox textboxWithText:@"Urundyl: What? I know not what you speak of. Who are you people and how did you come to ask this question."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 96:
stage++;
[Textbox textboxWithText:@"Roderick: I am Roderick. I too was a king amongst my people."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 97:
stage++;
[Textbox textboxWithText:@"Valkyrie: And I am Alexdottir Falyndryl Amgernoth of Freya's Valkyries."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 98:
stage++;
[Textbox textboxWithText:@"Roderick: Really? I'm just going to call you Ally for short."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 99:
stage = 103;
[Textbox textboxWithText:@"Urundyl: Well Valkyrie, what has possessed you to enter Alfheim on such a foolish errand?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 103:
stage++;
[Textbox textboxWithText:@"Ally: The one the Volur call old man Wu said you may be able to help us resurrect Baldur."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 104:
stage++;
[Textbox textboxWithText:@"Urundyl: Old man Wu?!"];
Textbox *tb = [[Textbox alloc] initWithRect:CGRectMake(0, 0, 480, 80) color:Color4fMake(0.3, 0.3, 0.3, 0.9) duration:-1 animating:NO text:@"Seior: Old man Wu?!"];
[self addObjectToActiveObjects:tb];
[tb release];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 105:
stage++;
[Textbox textboxWithText:@"Urundyl: Seior, what do you know about this?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 106:
stage++;
[Textbox textboxWithText:@"Seior: I have seen a shadow cast upon the gods. But for Wu to be here..."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 107:
stage++;
[Textbox textboxWithText:@"Urundyl: Where did you meet this Wu?"];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 108:
stage++;
[Textbox textboxWithText:@"Roderick: He saved us from a fire giant that was attacking Valhalla."];
[sharedInputManager setState:kCutScene_TextboxOnScreen];
break;
case 109:
stage++;
for (AbstractEntity *seior in activeEntities) {
if ([seior isMemberOfClass:[Seior class]]) {
[seior moveToPoint:CGPointMake(seior.currentLocation.x - 40, seior.currentLocation.y) duration:1];
}
}
Textbox *teb = [[Textbox alloc] initWithRect:CGRectMake(0, 0, 480, 80) color:Color4fMake(0.3, 0.3, 0.3, 0.9) duration:-1 animating:YES text:@"Seior: Wu and Surt..."];
[self addObjectToActiveObjects:teb];
[teb release];