-
Notifications
You must be signed in to change notification settings - Fork 0
/
precursor.js
2630 lines (2353 loc) · 106 KB
/
precursor.js
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
var ButtonsAndGrid = React.createClass({
getInitialState: function() {
return {
GameStatus: 'stopped',
testPosition: 0,
GameOver: 0,
currentDungeonLevel: [],
currentLevel: 1,
totalColumns: 40,
totalRows: 42,
masterArray: [],
mrBluesPosition: 0,
mrBlueHealth: 50,
weaponPower: 50,
experiencePoints: 0,
thisLevelKillCount: 0,
dungeonLevel1: [],
dungeonLevel2: [],
zPlus: 0,
zPlusArray: [],
isZplus:0,
assumeZmoves:1,
runRunRUNmodalActive: 0,
divimage: "https://www.w3schools.com/tags/smiley.gif",
wormPursuit: 0,
numberOfRedWorms: 0,
wormPursuitIteration: 0,
lastZmessage0: "no z's yet!",
lastZmessage1: "no z's yet!",
zPlusArray0: "no z's yet!",
randomMessageArray: [],
randomPositionsArray: [],
newTempArray: [],
ironCondition: 0,
vitriolCondition: 0,
mrBlueCondition: 0,
coagulatorCondition: 0,
levelMessage: "Welcome to Precusor! You are at Level 1. To attain Enlightenment, and to Ascend bodily to the next level of wisdom, carry out the following Arcanum that comes to us from Albertus Magnus:",
levelMessageCondition: 0,
temporaryPositionArray: [], // for each level, this keeps track of which locations are already assigned a moster weapon or treasure
message: "Find ye the Iron, and find ye the Oil of Vitriol; combineth both in the Coagulator. Use the arrows to move. Oh, and don't get eaten!"
};
},
componentWillMount: function() {
console.log("componentWillMount");
this.createDungeonLevels();
document.addEventListener("keydown", this.playerMove);
},
componentDidMount: function() {
console.log("componentDidMount");
this.generateMrBlue();
document.addEventListener("keydown", this.playerMove);
window.focus();
},
createDungeonLevels: function() {
for(var g = 1; g<4; g++){
// evaluatedArray is the original map of floors and walls for that level
// newArray is a copy of evaluatedArray for that level
// newArray gets sent to aMW&Ts
// newArray gets monsters and treasures added to it by aMW&ts
var evaluatedArray = this.generateRandomLevel();
var newArray = [];
var i;
var evaltotal = this.state.totalColumns * this.state.totalRows;
for ( i = 0; i < evaltotal; i++)
{ // copies the base map over to an array for evaluation
var adjacent = 0;
if(evaluatedArray[i] === "light grey")
{
if(evaluatedArray[i + this.state.totalColumns]==='light grey')
{
newArray.push('grey');
}
else
{
newArray.push(evaluatedArray[i]);
}
}
else
{
newArray.push(evaluatedArray[i]);
}
}
this.setState({
newTempArray: evaluatedArray
});
newArray = this.addMonstersWeaponsAndTreasures(newArray);
if(g === 1){
this.setState({
dungeonLevel1: newArray
});
this.setState({
currentDungeonLevel: newArray
});
}
else if(g === 2){
this.setState({
dungeonLevel2: newArray
});
}
else if(g === 3){
this.setState({
dungeonLevel3: newArray
});
}
else{
this.setState({
dungeonLevel4: newArray
});
}
}
console.log("createDungeonLevels has completed.");
}, // END OF createDungeonLevels
addMonstersWeaponsAndTreasures: function(k){
var listOfRandomPositions = [];
while ( listOfRandomPositions.length < 19)
{
var pushme = this.getRandomStartingPosition(k);
if(listOfRandomPositions.length === 0)
{
listOfRandomPositions.push(pushme);
}
else
{
var test = listOfRandomPositions.indexOf(pushme)
if (test === -1)
{
listOfRandomPositions.push(pushme);
}
else{console.log("Already taken!");}
}
}
var arrayWithMonstersWeaponsAndTreasures = [];
var gridtotal2 = this.state.totalColumns * this.state.totalRows;
for (var p = 0; p < gridtotal2; p++) {
if(p === listOfRandomPositions[0])
{arrayWithMonstersWeaponsAndTreasures.push('purple');} // trigger color for a Mystery Chest that hides a Worm
else if(p === listOfRandomPositions[1])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[2])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[3])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[4])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[5])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[6])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[7])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[8])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[9])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[10])
{arrayWithMonstersWeaponsAndTreasures.push('green');
console.log(p + " is hiding the coagulator!")
} // trigger color for coagulator
else if(p === listOfRandomPositions[11])
{arrayWithMonstersWeaponsAndTreasures.push('azure');
console.log(p + " is hiding the acid!")
} // trigger color for for a Mystery Chest that hides Oil of Vitriol
else if(p === listOfRandomPositions[12])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[13])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[14])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[15])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[16])
{arrayWithMonstersWeaponsAndTreasures.push('gold');
console.log(p + " is hiding the iron!")
} // trigger color for for a Mystery Chest that hides Iron
else if(p === listOfRandomPositions[17])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if(p === listOfRandomPositions[18])
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[19]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[20]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[21]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[22]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[23]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[24]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[25]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[26]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[27]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[28]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[29]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[30]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[31]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[32]) || (this.state.currentLevel >= 2))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[33]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[34]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[35]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[36]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[37]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[38]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[39]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[40]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[41]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[42]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[43]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[44]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[45]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else if((p === listOfRandomPositions[46]) || (this.state.currentLevel === 3))
{arrayWithMonstersWeaponsAndTreasures.push('purple');}
else{arrayWithMonstersWeaponsAndTreasures.push(k[p])}
}
this.setState({
temporaryPositionArray: []
})
return(arrayWithMonstersWeaponsAndTreasures)
},
generateMrBlue: function() {
console.log("generateMrBlue");
var tempArrforMrBlue = [],
dungeonLevelToRender = this.state.currentDungeonLevel;
var randomStartingPosition = this.getRandomStartingPositionForMrBlue();
var gridtotal7 = this.state.totalColumns * this.state.totalRows;
for (var p = 0; p < gridtotal7; p++) {
if(p === randomStartingPosition)
{tempArrforMrBlue.push('blue');
}
else if(p === randomStartingPosition+143 || p === randomStartingPosition+145 || p === randomStartingPosition+144 || p === randomStartingPosition-143 || p === randomStartingPosition-145 || p === randomStartingPosition-144 || p === randomStartingPosition-48 || p === randomStartingPosition-49 || p === randomStartingPosition-50 || p === randomStartingPosition-47 || p === randomStartingPosition-46 || p === randomStartingPosition-45 || p === randomStartingPosition-51 ||
p === randomStartingPosition+45 || p === randomStartingPosition+48 || p === randomStartingPosition+47 || p === randomStartingPosition+46 || p === randomStartingPosition+49 || p === randomStartingPosition+50 || p === randomStartingPosition+51 ||
p === randomStartingPosition-96 || p === randomStartingPosition-97 || p === randomStartingPosition-98 || p === randomStartingPosition-95 || p === randomStartingPosition-94 || p === randomStartingPosition+96 || p === randomStartingPosition+95 || p === randomStartingPosition+94 || p === randomStartingPosition+97 || p === randomStartingPosition+98 ||
p === randomStartingPosition+1 || p === randomStartingPosition-1 || p === randomStartingPosition+2 || p === randomStartingPosition-2 || p === randomStartingPosition-3 || p === randomStartingPosition+3)
{tempArrforMrBlue.push(dungeonLevelToRender[p])}
else{tempArrforMrBlue.push('black')}
//else{tempArrforMrBlue.push(dungeonLevelToRender[p])}
}
this.setState({
mrBluesPosition: randomStartingPosition
});
this.setState({
masterArray: tempArrforMrBlue
});
this.setState({
randomMessageArray: ["Ere Chymes drew breath, this darkness was deep!", "Verily, this darkness would vex Hermes himself!",
"Zosimos' zippers, it's dark in here!", "Fie, this darkness would madden a bat!",
"The Ladder of Wisdom unites Earth and Heaven!",
"Alack, this labrynth hath no end!",
"Separate thou ye earth from ye fire, ye subtle from ye gross sweetly with great industry.",
"Perchance, these dark corridors will yet reveal their secrets?",
"The Ancient Sages long sought a way to increase the power and efficiency of the Lapidis Stibil",
"Take care always to help and counsel the poor.",
"Mercury is the permanent water without which nothing takes place!",
"By the Dictums of Iximidrus, I'm really lost down here!",
"The aim of the Alchemist is to bring about Transmutation!",
"The light that shines from the Alchemist's furnace illumines the recesses of Nature's secrets!",
"There are two ways of knowing reality, the Lunar consciousness and the Solar. I prefer the Solar.",
"The four steps of prayer are Gratitude, then Humility, then Contrition, then Supplication.",
"Mammas, don't let your babes grow up to be alchemists!",
"These halls are dark, but the mind glows with curiosity!",
"Great Coins of Arisleus, it is really dark down here!",
"Zosimos' zippers, it's dark in here!", "Fie, this darkness would madden a bat!",
"The Ladder of Wisdom unites Earth and Heaven!",
"Alack, this labrynth hath no end!",
"Separate thou ye earth from ye fire, ye subtle from ye gross sweetly with great industry.",
"Perchance, these dark corridors will yet reveal their secrets?",
"Mercury is the permanent water without which nothing takes place!",
"The aim of the Alchemist is to bring about Transmutation!",
"The light that shines from the Alchemist's furnace illumines the recesses of Nature's secrets!",
"There are two ways of knowing reality, the Lunar consciousness and the Solar. I prefer the Solar.",
"The four steps of prayer are Gratitude, then Humility, then Contrition, then Supplication.",
"Mammas, don't let your babes grow up to be alchemists!",
"These halls are dark, but the mind glows with curiosity!",
"Thither lets us go into this abysimal darkness!",
"The neophyte is enjoined to become as simple and pure as the nature he or she wishes to understand!",
"A pious soul, when joined with an iron will, can find the keys to the gates of truth!",
"The Alchemist must arrange matter within its chaos.",
"By Artephius' teeth, it's dark in here!",
"Zounds, I stubbed my toe!",
"Gadzooks, where does it end!",
"By the Dictums of Iximidrus, I'm really lost down here!",
"The Ancient Sages long sought a way to increase the power and efficiency of the Lapidis Stibil",
"Take care always to help and counsel the poor.",
"Great Coins of Arisleus, it is really dark down here!",
"Consarn it, I really can't see anything down here!",
"By Al-Farbi's foot, this is very dark.",
"As soon as fire has become air, the inferior grosser waters and earth mix therewith.",
"The soluble Earth is Volatile, its salt is sooner dissolved by water than pebble or sand.",
"Alchemy is only learned by making mistakes. Eschew experimenting with explosives!!!",
"Pray, read, re-read, work, and you shall find!",
"You know, an Alchemist could get lost down here!",
"Not since I delved into the chronicles of Agathodaemon have I encountered such darkess!",
"Within everything is the seed of everything!",
"I have an intense dislike of giant man-eating worms",
"An alchemist drinks lots of water to stay hydrated, but SHOULD NEVER DO SO IN THE LAB!",
"Gosh, I hope I don't get eaten",
"I desire Enlightenment!",
"I seek Ascension!",
"True disciples of Wisdom are all brothers and sisters, divided only by time and place!",
"Nature chastises the Alchemist!", "The operations of Alchemy seek to mimic the creation of the Universe itself!",
"That which is above is like that which is below!",
"All things arise from the One by the work of the One, by adaptation.",
"The athanor, Old Lame Vulcan, is the heart of your lab, the soul of your operations",
"If you rectify this volatile mixture over a steam bath, it becomes luminous, which is proof it contains air and fire.",
"The Lyfe so short, the Craft so long to Learn!",
"In the Balneo you will find the blessed bloodred Oleum Antimonii in the retort, which should be taken out very carefully.",
"Maybe I'll find Roger Bacon down here...",
"Why did I decide to delve into Alchemy? Why?",
"The Stone is the catalyst that completes the transmutation of metals!",
"My father told me to enter the Clergy. Shoulda' listened perhaps.",
"The path to Wisdom is arduous, fraught with many traps and dead ends.",
"To learn anything of value, it takes a lyfe of dedication.",
"One is the whole, and from this comes all!",
"Have I sought the Arcanum in vain? Will the Lodestone always beckon?",
"I'm beginning to have doubts down here.",
"Fear of the Lord is truly the Beginning of Wisdom",
"To be a true Adept of the Alchemical, one must be willing to get lost in the darkness!",
"Marvelous are the Operations accomplished by the work of the Sun!",
"As above, so below!",
"Be careful to understand the Philospher's stone; ou will have attained a clear understanding of Nature!",
"The Albedo is the intermediate perfection of the Philosopher's stone.",
"The path to Knowlege is oft shrouded in a vale of such gloom.",
"Verily, one eye is good but two are better. Wear goggles in the lab!",
"To say that common nitre and the Philosopher's nitre are distinct and different, is folly and superstition.",
"The cause of the sun's explosion downwards is because it is a fixed earth which inclines downwards, whereas gunpowder shows its greatest force upwards.",
"The water is the body, the Vehicle and Tool, but the spirit is the Universal Agent and fabricator of all Natural Things.",
"Those whome Wisdom loves, she chastises!", "Do not court death by the errors of your ways!",
"I could reveal something here, but as it would be abused by profligate men, I am obliged to be silent.",
"Antimony is in the parts of Saturn and in nature, in all its modes.",
"Corporified Anima Mundi is but little known, although it may be got in great quantity.",
"God endowed the Principle Fire with an unerring instinct, and a capacity to manifest itself in 3 Ways.",
"The fixation of nitre is done more expeditiously with quicklime viva, rather then by the detonation with charcoal or sulphur",
"Putrefaction is the author of destruction and regeneration of all things.",
"Through fire, at the end of a series of long and complex oerations, the Alchemist draws a new body from the Athanor!",
"Heaven and air have their influence not upward, but downwards, toward earth and water.",
"By Mercury and Anubis, these depths are passing strange!", "So, three alchemists walk into a bar...",
"The breath in our nostrils is a puff of smoke, reason a spark from the beating of our hearts.",
"Wretched are they who scorn Wisdom and Discipline!"]
});
}, // END OF generateMrBlue
moveMrBlue: function(n) { // what gets passed to moveMrBlue is the NEW position
if(this.state.levelMessageCondition === 0)
{
this.setState({
levelMessageCondition: 1
});
this.setState({
levelMessage: "You are at Level 1! FInd the Iron and find the Oil of Vitriol. Put both in the Coagulator to effect the Alchemical operation for this level. Oh, and do not die!"
});
}
if(this.state.currentLevel === 2)
{
this.setState({
levelMessage: "You have reached LEvel 2! "
});
}
if(this.state.currentLevel === 3)
{
this.setState({
levelMessage: "You have reached the third and final level! "
});
}
this.runRunRUN();
var dungeonLevelToRender = this.state.currentDungeonLevel;
var mrBluesPresentPosition = this.state.mrBluesPosition;
if(dungeonLevelToRender[n] === 'grey'){
var messageArray = this.state.randomMessageArray
var randomMessageValue = Math.floor((Math.random() * messageArray.length) + 0);
var randomMessage = messageArray[randomMessageValue];
this.setState({
message: randomMessage
});
this.setState({
testPosition: n
});
this.updatePosition(n);
this.updateDungeonMap(n);
}
else if(dungeonLevelToRender[n] === 'purple') // mrBlue encounters a Mystery Chest that hides a Worm OR some other beast depending on level
{
// var stayPut = this.state.mrBluesPosition;
this.addZplus(n);
this.setState({
numberOfRedWorms: this.state.numberOfRedWorms + 1
});
// this.updatePosition(stayPut);
this.updateDungeonMap2(n);
this.setState({wormPursuit: 1}); // this tells any worms with background Pink to start chasing mrBlue
this.setState({wormPursuitIteration: 0});
if(this.state.currentLevel === 2)
{
this.setState({message: "Fie! A repugnant Dicephaelus! Flee!!!"});
}
else if(this.state.currentLevel === 3)
{
this.setState({message: "Egads! A giant Fiend! Escape!!!"});
}
else
{
this.setState({message: "Forsooth! A vile Worm! Run!!!"});
}
}
else if(dungeonLevelToRender[n] === 'red') // mrBlue encounters a Worm that is unhidden OR some other beast depending on level
{
this.setState({
GameOver:1
})
this.updatePosition(n);
this.updateDungeonMap2(n);
this.setState({wormPursuit: 1});
this.setState({wormPursuitIteration: 0});
this.setState({message: "Yum!!"});
this.setState({
mrBluesPosition: 9000
});
}
else if(dungeonLevelToRender[n] === 'green') // mrBlue encounters a Mystery Chest that hides a Coagulator
{
this.updateDungeonMap3(n); // makes the Coagulator appear (green changes to pink)
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have uncovered the Alembic!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have uncovered the Athanor!"
});
}
else
{
this.setState({
message: "You have uncovered the Coagulator!"
});
}
if(this.state.mrBlueCondition ===1) // mrBlue encounters a Mystery Chest that hides a Coagulator while carrying Vitriol (OR Blue Stone)
{
this.setState({
mrBlueCondition: 0
})
this.setState({
vitriolCondition: 1 // this means the vitriol (or the Blue Stone) has now been deposited in the coagulator
})
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have set the Blue Stone in the Alembic. Now, seek out the Salt of Alembroth!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have set the Aqua Vitae in the Athanor. Now, seek out the Lactusa Virosa!"
});
}
else
{
this.setState({
message: "You have set the Oil of Vitriol in the Coagulator. Now, seek out the Iron!"
});
}
}
else if(this.state.mrBlueCondition === 2)// mrBlue encounters a Mystery Chest that hides a Coagulator while carrying Iron OR has encountered a Mystery Chest that hides a Alembic while carrying Salt of Alembroth
{
this.setState({
mrBlueCondition: 0
})
this.setState({
ironCondition: 1 // this means the iron(OR the Salt of Alembroth) has now been deposited in the coagulator
})
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have set the Salt of Alembroth in the Alembic. Now, seek out the Blue Stone!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have set the Lactusa Virosa in the Athanor. Now, seek out the Aqua Vitae!"
});
}
else
{
this.setState({
message: "You have set the Iron in the Coagulator. Now, seek out the Oil of Vitriol!"
});
}
}
else // mrBlue encounters a Mystery Chest that hides a Coagulator (OR an Alembic) while empty handed
{
this.setState({
mrBlueCondition: 0
})
}
}
else if(dungeonLevelToRender[n] === 'pink')// mrBlue encounters an unhidden Coagulator (OR an unhidden Alembic)
{
if (this.state.mrBlueCondition === 1) // mrBlue encounters an unhidden Coagulator while carrying Vitriol (OR Blue Stone)
{
// mrBlue encounters an unhidden Coagulator while carrying Vitriol and has already deposited iron in the coagulator but not vitriol (OR Mr Blue encounters an unhidden Alembic while carrying Blue Stone and has already deposited Salt of Alembroth in the Alembic but not Blue Stone)
if(this.state.ironCondition === 1 && this.state.vitriolCondition === 0 )
{
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have ascended to Level 3! "
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You are now an Alchemical Adept. You have won the game!"
});
}
else
{
this.setState({
message: "You have ascended to Level 2! Follow the metallurgical Dictates of Agricola: find Blue Stone, deposit it along with Salt of Alembroth into the Alembic, and Ye shall come away with Brimstone! "
});
}
this.setState({
ironCondition: 0
});
this.setState({
ironCondition: 0
});
this.setState({
vitriolCondition: 0
});
this.setState({
mrBlueCondition: 0
});
this.setState({
coagulatorCondition: 0
});
this.setState({
levelMessage: "You have attained Level 2!"
});
if(this.state.currentLevel === 2)
{
var upNext = this.state.dungeonLevel2;
}
else
{
var upNext = this.state.dungeonLevel3;
}
this.setState({
currentDungeonLevel: upNext
});
var mrBlueLevel2StartingPosition = this.getRandomStartingPositionForMrBlue();
this.updateDungeonMapTONEXTLEVEL(mrBlueLevel2StartingPosition);
}
// mrBlue encounters an unhidden Coagulator while carrying Vitriol and has already deposited vitriol in the coagulator)
else if(this.state.ironCondition === 0 && this.state.vitriolCondition === 1)
{
this.updateDungeonMap(n);
this.setState({
message: "You have already deposited vitriol into the Coagulator! Now, go seek Iron!"
});
this.setState({
mrBlueCondition: 0
})
}
// mrBlue encounters an unhidden Coagulator while carrying Vitriol and hasn't deposited anything yet in the coagulator (OR while carrying Blue Stone and hasn't deposited anything yet in the Alembic)
else
{
this.updateDungeonMap(n);
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have deposited Blue Stone into the Alembic! Now, go seek Salt of Alembroth!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have deposited Aqua Vitae into the Athanor! Now, go seek Lactusa Virosa!"
});
}
else
{
this.setState({
message: "You have deposited vitriol into the Coagulator! Now, go seek Iron!"
});
}
this.setState({
vitriolCondition: 1
})
this.setState({
mrBlueCondition: 0
})
}
}
else if (this.state.mrBlueCondition === 2)// mrBlue encounters an unhidden Coagulator while carrying Iron (OR encounters an unhidden Alembic while carrying Salt of Alembroth)
{
// mrBlue encounters an unhidden Coagulator while carrying Iron and has already deposited iron in the coagulator but not vitriol
if(this.state.ironCondition === 1 && this.statevitriolCondition === 0)
{
this.setState({
message: "You have already deposited Iron into the Coagulator! Now, go seek the Oil of Vitriol!"
});
this.setState({
mrBlueCondition: 0
})
}
// mrBlue encounters an unhidden Coagulator while carrying Iron and has already deposited vitriol in the coagulator (OR alembic)
else if(this.state.ironCondition === 0 && this.state.vitriolCondition === 1)
{
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have ascended to Level 3! "
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You are now an Alchemical Adept. You have won the game!"
});
}
else
{
this.setState({
message: "You have ascended to Level 2! Follow the metallurgical Dictates of Agricola: find Blue Stone, deposit it along with Salt of Alembroth into the Alembic, and Ye shall come away with Brimstone! "
});
}
this.setState({
ironCondition: 0
});
this.setState({
ironCondition: 0
});
this.setState({
vitriolCondition: 0
});
this.setState({
mrBlueCondition: 0
});
this.setState({
coagulatorCondition: 0
});
this.setState({
levelMessage: "You have attained Level 2!"
});
var upNext = this.state.dungeonLevel2;
this.setState({
currentDungeonLevel: upNext
});
var mrBlueLevel2StartingPosition = this.getRandomStartingPositionForMrBlue();
this.updateDungeonMapTONEXTLEVEL(mrBlueLevel2StartingPosition);
}
// mrBlue encounters an unhidden Coagulator while carrying Iron that has nothing in it already (OR encounters an ampty alembic while carrying Salt of Alembroth)
else
{
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have found the Alembic and deposited the Salt of Alembroth! Now, go seek the Blue Stone!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have found the Athanor and deposited the Lactusa Virosa! Now, go seek the Aqua Vitae!"
});
}
else
{
this.setState({
message: "You have found the Coagulator and deposited the Iron! Now, go seek the Oil of Vitriol!"
});
}
this.setState({
ironCondition: 1
});
this.setState({
mrBlueCondition: 0
})
}
}
else // mrBlue is carrying neither
{
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have found the Alembic! To attain purity and wisdom, seek you the Salt of Alembroth and with it the Blue Stone!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have found the Athanor and deposited the Aqua Vitae! Now, go seek the Lactusa Virosa!"
});
}
else
{
this.setState({
message: "You have found the Coagulator! What is required to attain Enlightenment is the Iron and also the Oil of Vitriol!"
});
}
}
}
else if(dungeonLevelToRender[n] === 'azure') //mrBlue encounters a Mystery Chest that hides Oil of Vitriol (OR hides the Blue Stone)
{
// you do want the map to update but you need to account for when mrBlue already carrying iron
this.updateDungeonMap4(n);
// if mrBlueCondition === 2 (mrBlue is carrying iron OR the Salt of Alembroth)
if(this.state.mrBlueCondition === 2)
{
// send message that the iron needs to be deposited in the coagulator first
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have found Blue Stone, but first you must deposit into the Alembic the very Salt of Alembroth that you carry!!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have found Aqua Vitae, but first you must deposit into the Athanor the very Lactusa Virosa that you carry!!"
});
}
else
{
this.setState({
message: "You have found Oil of Vitriol but first you must deposit the Iron you carry into the Coagulator!"
});
}
}
// else
else
{
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have found Blue Stone!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have found Aqua Vitae!"
});
}
else
{
this.setState({
message: "You have found Oil of Vitriol!"
});
}
}
}
else if(dungeonLevelToRender[n] === 'gold') //mrBlue encounters a Mystery Chest that hides Iron (OR that hides Salt of Alembroth)
{
this.updateDungeonMap5(n);
// if mrBlueCondition === 1 (mrBlue is carrying vitriol)
if(this.state.mrBlueCondition === 1)
{
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have found Salt of Alembroth but first you must deposit the Blue Stone you carry into the Alembic!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have found Lactusa Virosa but first you must deposit the Aqua Vitae you carry into the Athanor!"
});
}
else
{
this.setState({
message: "You have found Iron but first you must deposit the vitriol you carry into the Coagulator!"
});
}
}
// else
else
{
if(this.state.currentLevel === 2)
{
this.setState({
message: "You have found Salt of Alembroth!"
});
}
else if(this.state.currentLevel === 3)
{
this.setState({
message: "You have found Lactusa Virosa!"
});
}
else
{
this.setState({
message: "You have found Iron!"
});
}
this.setState({
mrBlueCondition: 2
});
}