-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathouRPG.pl
executable file
·1584 lines (1507 loc) · 67.2 KB
/
ouRPG.pl
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
#!/usr/bin/env perl -w
use strict;
# http://perldoc.perl.org/open.html
# http://stackoverflow.com/questions/627661/how-can-i-output-utf-8-from-perl/627975#627975
use open qw/:std :utf8/;
use utf8;
use feature qw(say);
use Switch;
use Cwd;
my $abs_path = Cwd::abs_path($0);
use locale;
use Term::ANSIColor qw(:constants colored);
use Term::ExtendedColor qw(:all);
use Term::ReadKey;
my $user_color_choice = "sandybrown";
my $undiscovered = ' ';
my $revealed = fg('blue7','-');
my $impasse = fg($user_color_choice,'#');
my $shop = fg('yellow9','$');
my $count_NS = 0;
my $count_EW = 0;
my $is_shop = 0;
my $has_bomb = 0;
my $impasse01_cleared = 0;
my $impasse11_cleared = 0;
my $main_boss_dead = 0;
my $initialHelpScreen = 1;
my $haveMap = 0;
my $autoLook = 1;
my $autoMap = 0;
my $chest = 0;
my @talkToPerson;
my $ascii_explosion = << "EOL";
\\ . ./
\\ .:";'.:.." /
(M^^.^~~:.'").
- (/ . . . \\ \\) -
O ((| :. ~ ^ :. .|))
|\\\\ - (\\- | \\ / | /) -
| T -\\ \\ / /-
/ \\[_]..........................\\ \\ / /
EOL
my $irs_guy_pic = << "EOL";
,,,
i i'
\\~;\\
\\; \\
\\ ;\\ ====
\\ ;\\ ==== \\
__,--';;;\\-' ( 0
__,--';;; ;;; ;;\\ >
__,--'\\\\ ;;; ;;; ;;; ;;;\\--__<
_ _,--' __,--'\\\\ ;;; __,~~' \\ ;\\
(_)|_,--' __,--'\\\\;,~~' \\ ;\\
|(_)|_,--' ~~ \\; \\
|| | \\ ;\\
|_/ !~!,
.---'''---.
| WWE |
| IRS |
| GUY |
`---------'
EOL
my $struttin_guy_pic = << "EOL";
/
/ .'
/ .'
/ ______. .'
/ / __/_// '
/ / / c c
/ \\ G > _.-'
/ \\/. - _.-'
/ .---\\ / --. _.-'
/ / \\( \\ _.-'
/ / \\ \\ (. ) '
/ / /\\ \\ /
/ \\ | \\ \\ __..--''
/ .' \\_\\ ) )\\\\ __..--''
/ .' ) \\ | / \\ -''
/ .' _ '///` ( /\\ \\
/.' _.-' __ / ) ) )
'.-'..--'' / ,' / /
.__---------- /__./ / / --------------------
``--.. __// / ) /
/ _J) /)`-\\
`-__/-' ` \\\\ |(
`\\ \\ -..__
`--' ``--..__
``--
EOL
my $grim_reaper_statue_pic = << "EOL";
____,
/.---|
` | ___
(=\\. /-. \\
|\\/\\_|"| |
|_\\ |;-| ;
| / \\| |_/ \\
| )/\\/ \\
| ( '| \\ |
| \\_ / \\
| / \\_.--\\
\\ | (|\\`
| | \\
| | '.
| / \\
\\ \\.__.__.-._)
EOL
my $dirty_french_guy_pic = << "EOL";
____...
.-"--"""".__ `.
| ` |
( `._....------.._.:
) .()'' ``().
' () .==' `=== `-.
. ) ( <o> <o> g)
) ) / J
( |. / . (
\$\$ (. (_'. , )|`
|| |\\`-....--'/ ' \\
/||. \\\\ | | | / / \\.
//||(\\ \`-===-' ' \\o.
.//7' |) `. -- / ( OObaaaad888b.
(<<. / | .a888b`.__.'d\\ OO888888888888a.
\\ Y' | .8888888aaaa88POOOOOO888888888888888.
\\ \\ | .888888888888888888888888888888888888b
| | .d88888P88888888888888888888888b8888888.
b.--d .d88888P8888888888888888a:f888888|888888b
88888b 888888|8888888888888888888888888\\8888888
EOL
my $birds_shitting_on_a_car_pic = << "EOL";
`-. .
\\`. . ``.
\\\\`. .'`. `.`-. ///
_.`.\\`._ _..-'.'.' `. `--'_'_.
=_` ` "--..'.' .-' ._.-'
`--.___.:; ; , , _.-'
`v' v -'
----------..
. .-' `.
';` .-' `.
-------.-' `.. `._
\\`-. '` / .''''''\
\\ `. @.' .'|
\\. `._ _..-' .' /|
`. .' /L/
`-.______.--' /O/
|/L/
_.-._ |/
---/.-"-.\\----'
\\`._.'/\\/
"""
EOL
my $crows_pic = << "EOL";
__,---,
.---. /__|o\\ ) .-"-. .----.""".
/ 6_6 `-\\ / / / 4 4 \\ /____/ (0 )\
\\_ (__\\ ,) (, \\_ v _/ `--\\_ /
// \\\\ // \\\\ // \\\\ // \\\\
(( )) {( )} (( )) {{ }}
=======""===""=========""===""======""===""=========""===""=======
||| ||||| ||| |||
| ||| | '|'
EOL
my $roaming_bovine_pic = << "EOL";
___,,,___ _..............._
'-/~'~\\-'` :::::' .:: \
|a a | ':::' `:: ||
| /::. :::. .:::. ::||
(oo/::' .::::..::::::. /|
`` '._ /:::'''::::' <`\\/
| /`--....-'`Y \\))
||| //'. |((
||| // ||
//( ` /(
``` ``
EOL
my $juggalette_pic = << "EOL";
__.------._
.' -| - . `.
/ '.' `-. ` \\
/ / `. ` \\ \\
| / `. \\ |
| | `. |
| |.---. .---.\\ |
| ||><@> ) ( <@><|` |
| | / \\ || |
| | ((_)) | |
| `|` / \\ '| |
| | _.---._ | |
/ \\ `---' / |
/ `. " .' \\
/ / | | `-.___.-' || \\
/ '| | \\ \\
/' / | |\\ ` \\
/ . /-' `--.__ \\\\
/ .-'| || | `-.\\
/.' / / | | `.
EOL
my $corporate_satan_pic = << "EOL";
| /\\ /\\
( | ) ( (__) )
\\_|_/ \\@..@/
| __\\\\//__
|\\ / \\/ \\
|\\\\/ ( | ) |
| \\_/| | | |
| | | |o|
| |==-==| |
| ( )_|
| | | |()
| | | |
| | | |
| _| | |_
| (___/ \\___)
EOL
my $impatient_waiter_pic = << "EOL";
[_________]
,,,,, _|//
, , ;; ( /
< D =o
|. / /\\|
_____|><|_______/o /
/ '==| :: |==' < /
/ \\ < > /____/
/ _/\\ | :: | /
\\ ||_|____|/
|o| | x |
( \\ / _'_ \
//// | \
| | |
| | |
| | |
\\ _ | _ /
\\ | /
\\ | /
|_|_|
/o | o\
/o _|_ o\
(__/ \\__)
EOL
my $icp_clown_pic = << "EOL";
, _..._ ,
{'. .' '. .'}
{ ~ '. _|= __|_ .' ~}
{ ~ ~ '-._ (___________) _.-'~ ~ }
{~ ~ ~ ~.' '. ~ ~ }
{ ~ ~ ~ / /\\ /\\ \\ ~ ~ }
{ ~ ~ / __ __ \\ ~ ~ }
{ ~ /\\/ -<( o) ( o)>- \\/\\ ~ ~}
{ ~ ;( \\/ .-. \\/ ); ~ }
{ ~ ~\\_ () ^ ( ) ^ () _/ ~ }
'-._~ \\ (`-._'-'_.-') / ~_.-'
'--\\ `'._'"'_.'` /--'
\\ \\`-'/ /
`\\ '-' /'
`\\ /'
'-...-'
EOL
my $skeleton_pic = << "EOL";
_.--"""""--._
.' '.
/ \
; ;
| |
| |
; ;
\\ (`'--, ,--'`) /
\\ \\ _ ) ( _ / /
) )(')/ \\(')( (
(_ `""` /\\ `""` _)
\\`"-, / \\ ,-"`/
`\\ / `""` \\ /`
|/\\/\\/\\/\\/\\|
|\\ /|
; |/\\/\\/\\| ;
\\`-`--`-`/
\\ /
',__,'
q__p
q__p
q__p
q__p
EOL
my $jbizzle_pic = << "EOL";
.
/^\\ .
/\\ "V"
/__\\ I O o
//..\\\\ I .
\\].`[/ I
/l\\/j\\ (] . O
/. ~~ ,\\/I .
\\\\L__j^\\/I o
\\/--v} I o .
| | I _________
| | I c(` ')o
| l I \\. ,/
_/j L l\\_! _//^---^\\\\_
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
EOL
my $lead_skeleton_pic = << "EOL";
.""--.._
[] `'--.._
||__ `'-,
`)||_ ```'--.. \
_ /|//} ``--._ |
.'` `'. /////} `\\/
/ .""".\\ //{///
/ /_ _`\\\\ // `||
| |(_)(_)|| _// ||
| | /\\ )| _///\\ ||
| |L====J | / |/ | ||
/ /'-..-' / .'` \\ | ||
/ | :: | |_.-` | \\ ||
/| `\\-::.| | \\ | ||
/` `| / | | | / ||
|` \\ | / / \\ | ||
| `\\_| |/ ,.__. \\ | ||
/ /` `\\ || ||
| . / \\|| ||
| | |/ ||
/ / | ( ||
/ . / ) ||
| \\ | ||
/ | / ||
|\\ / | ||
\\ `-._ | / ||
\\ ,//`\\ /` | ||
///\\ \\ | \\ ||
|||| ) |__/ | ||
|||| `.( | ||
`\\\\` /` / ||
/` / ||
/ | ||
| \\ ||
/ | ||
/` \\ ||
/` | ||
`-.___,-. .-. ___,' ||
`---'` `'----'`
EOL
my $boner_pic = << "EOL";
_ .-.
( `. .' )
`. ` /'
| |
| |
_|69 |
(__, |
L_,)|
| |
,_/ |
| |
| |
/ '.
( , )
'-' '--'
EOL
# A robot named Y2DT , Yum Yum Tasty Donuts, he provides you with baked goods
my %playerChar = (
NAME => '"Guy Playington"',
CLASS => '"Human"',
PORTRAIT => 'o',
CURRENT_HP => '130',
MAX_HP => '130',
LVL => '1',
DMG_MIN => '10',
DMG_MAX => '20',
CRIT_CHANCE => '15',
CURRENT_XP => '0',
NEXT_LVL_XP => '100',
DEFENSE => '0',
TYPICAL => 'N',
EQUIPPED_LEFT => '',
EQUIPPED_RIGHT => '',
EQUIPPED_HEAD => '',
EQUIPPED_BODY => '',
GOLD => '100',
);
my %charClass = (
Dwarf => { PORTRAIT => 'ö', DESC => 'This tiny Joe can fit in small crevices. Their short stature makes them hard to budge.'},
Human => { PORTRAIT => '@', DESC => 'Your average Joe. They can do what most other races can and can\'t'},
Elf => { PORTRAIT => '§', DESC => 'Your skinny pointy eared Joe. They\'re typically faster than most'},
Orc => { PORTRAIT => '&', DESC => 'Your typical ugly looking Joe. Orcs are tough and strong.'},
Giant => { PORTRAIT => 'Ö', DESC => 'Giants can reach the top of the refridgerator that old adventurers can no longer get to.'},
Underling => { PORTRAIT => '_', DESC => 'Underlings slink by in the shadows and like to stay out of site. They like to go under things.'},
Overling => { PORTRAIT => '^', DESC => 'Overlings like to stay in shadows, but prefer to go over things.'},
Wizard => { PORTRAIT => 'ᐂ', DESC => 'Mutha fuckin wizards never die.'}
);
my @monsterName = ("Boner","Corporate Satan","Skeleton","Impatient Waiter","Crows","IRS Guy","ICP Clown","Juggalette","Roaming bovine","Struttin guy","Grim Reaper Statue","Dirty French Guy","Birds shitting on a car");
my %monsterChar = (
NAME => '',
MAX_HP => '',
CURRENT_HP => '',
DMG_MIN => '',
DMG_MAX => '',
DEATH_XP => '',
DEATH_GOLD => '',
);
# Autovivification
my %items = (
SWORD01 => {
NAME => 'Long Sword',
DESC => 'Your typical metal sword.',
PRICE => '300',
DMG => '12',
TYPE => 'WEAPON',
},
SWORD02 => {
NAME => 'Short Sword',
DESC => 'A short sword for the short adventurer.',
PRICE => '150',
DMG => '6',
TYPE => 'WEAPON',
},
HELMET01 => {
NAME => 'Wool Cap',
DESC => 'This wool cap will protect you from the slightest scratches.',
PRICE => "125",
DEF => '6',
TYPE => 'HELMET',
},
HELMET02 => {
NAME => 'Steel Helmet',
DESC => 'This helmet will help protect your head.',
PRICE => '350',
DEF => '12',
TYPE => 'HELMET',
},
ARMOR01 => {
NAME => 'Leather Armor Mk.1',
DESC => 'Your basic all leather apparel. Finely crafted from tanned brahmin hide.',
PRICE => '170',
DEF => '8',
TYPE => 'ARMOR',
},
ARMOR02 => {
NAME => 'Leather Armor Mk.2',
DESC => "An enhanced version of the basic leather armor with extra layers of\nprotection. Finely crafted from tanned brahmin hide.",
PRICE => '375',
DEF => '14',
TYPE => 'ARMOR',
},
OCARINA => {
NAME => "THE Ocarina",
DESC => "You see a blue transverse ocarina.",
PRICE => "666",
TYPE => "MISC",
},
MAP => {
NAME => "a map",
DESC => "Allows you to orient yourself in the world.",
PRICE => "200",
TYPE => "MISC",
}
);
my %quests = (
# ESCAPE => {
# NAME => "Escape from wherever the hell you got warped into.",
# STATE_A => '2',
# STATE_B => '2',
# LOG_ENTRY_A1 => "Some shit",
# LOG_ENTRY_B1 => "Some other shit",
# LOG_ENTRY_A2 => "More shit",
# LOG_ENTRY_B2 => "The most shit",
# },
MOVELOGS => {
NAME => "Find a way past the fallen trees.",
STATE_A => '0',
STATE_B => '0',
LOG_ENTRY_A1 => "The shopkeeper mentioned to go back to the burly guys.",
LOG_ENTRY_B1 => "Some burly guys say that the path is blocked. I have to find a way around it.",
LOG_ENTRY_A2 => "I've gotten the burly guys to clear a path and I can now head North from here.",
LOG_ENTRY_B2 => "",
},
);
my @fightIntro = ("HALT!","I EAT PIECES OF SHIT LIKE YOU FOR BREAKFAST!","GARBAGE DAY!","C'MERE YOU!","WHY I OUGHTTA","I'M GONNA PASTEURIZE YOU!","I'M GONNA MURDA YA!","I'MA WARIO I'MA GONNA WEEN","I'M GUNNA MOYDA YA!","I'M GONNA FOLD YOUR CLOTHES WITH YOU IN 'EM","YOU WANNA SEE TOUGH? I'LL SHOW YOU TOUGH","I NEVER LOSE!","LEMME AT 'EM","I'M GONNA PARK MY CAR ON TOP OF YOU!","GET READY!","YOU HAVE HUGE GUTS!","RIP AND TEAR!","I'LL TURN YOU INTO A MEAT POPSICLE!","FRESH MEAT!","TO KILL OR NOT TO KILL?","BRING THE NOISE!","BRING THE PAIN!","FOR ZUUL!","YOU'RE FUCKING DEAD!","YOU'RE FUCKING WORMFOOD!");
my @fightWords = ("POW!","ZAP!","BLAMMO!","THUD!!","CRACK!", "BIFF!", "WHOOP","OVER 9000!!!", "BOOP", "BOP", "BLAM SLAM", "TOASTIEEE", "SHAZZAM!", "BANG!", "SPLAT!", "SHWOMP!", "BOING!", "GLAVEN!", "JINKIES!", "YOWZA!", "UHH! I FEEL GOOD!","BONK!","CLONK!","HHHWHACK!","HHHWWAAMM!","THUNK!!","KRUNCH!","MEOW!","SPREZCEHN ZE POW!","HUUU!","KABLAM!","BONK!","KLUNK!","THWACK!","OOOOFF!","ZAM!","ZOWIE!","SWOOSH!","PAM!","CRRAAACK!");
my @fightEnd = ("BURY ME WITH MY...MONEY","X_X","X_x","I'M GONNA TELL MY MOM!","HEY","RUDE :P <3 :)","*trumpet* WAAA WAAA WAAAAAAA","FUCK!", "SHITCOCKS!","DO IT!","SOMETIMES I JUST KILL MYSELF!","I'M BATMAN!","HOW DID YOU DO SUCH AMAZING STUNTS WITH SUCH LITTLE FEET?","NICE SHOT!","GOODBYE MR. $playerChar{NAME}!","HAPPY LANDINGS ASSHOLE!","THAT'LL DO IT!","ENOUGHH! ENOUGHHHH!","FOR ENGLAND?","I AM INVINCIBLE!","I SHOULD HAVE HAD BETTER LAST WORDS!","I REGRET NOTHING!");
push@{$playerChar{INVENTORY}},'Ocarina';
sub ENTER_PROMPT {
say "\nPress ".BOLD.CYAN."[ENTER]".RESET." to continue";
my $input = <STDIN>;
if ($input !~ /\012/) { ENTER_PROMPT(); }
}
sub GAME_INTRO {
system("clear");
print "\n\n\n";
printf ("%65s", "##############################################\n");
printf ("%70s", colored("Quest Through The Deathly Dungeon of Doom!", "bold"));
print "\n";
printf ("%65s", "##############################################\n");
printf ("%65s", " Version: Best damn beta anyone's ever played\n");
ENTER_PROMPT();
system("clear");
say "Welcome!\n";
sleep 1;
my $intro = "You're in a small room with one window. You notice a computer chair sitting in\nthe corner of the room. There is a table with a computer on it in the\nmiddle of the room. Behind you is a door.";
say $intro;
my $chairMoved = 0;
my $tempVar = 0;
my $tempName;
my $input;
while(1) {
print "\nWhat would you like to do?\n".MAGENTA."%> ".RESET;
$input = uc(<STDIN>);
chomp($input);
if ($chairMoved == 0 && ($input =~ m/^GET CHAIR$/ || $input =~ m/^MOVE CHAIR$/ || $input =~ m/^PUSH CHAIR/)) {
say "You move the chair over to the table and sit down. You notice ";
say "a big red button on the computer. There is a note on the table ";
say "that reads in big letters, \"".BOLD."DO NOT TOUCH".RESET."\"";
$chairMoved = 1;
next;
}
elsif ($input =~ m/^LOOK$/) { say YELLOW."=> ".RESET."Seek and ye shall find. Where may not always be clear."; }
elsif ($input =~ m/^LOOK WINDOW$/ || $input =~ m/^CHECK WINDOW$/) { say "You look out the window. You realize that you're several floors up in\na skyscraper. Their is a storm raging outside but you can make out the\ndim lights of cars and other businesses below. Squinting you can see\nthe corner of Base and 64th."}
elsif ($input =~ m/^USE DOOR$/ || $input =~ m/^CHECK DOOR$/) {
say "You jiggle the knob but the door is firmly shut. There is no lock on the inside.";
if ($tempVar == 0) {
say "There is a sliding viewport abd you knock on door. You see a pair of eyes stare back\nat you as the viewport opens up. A gruff voice asks for your name.";
print ITALIC."\n\"What is your name?\"\n".RESET.MAGENTA."%> ".RESET;
$tempName = uc(<STDIN>);
chomp($tempName);
say "\"Oh yeah, nice to meet you $tempName, it seems the door is stuck.\" You think about\nforcing it open.";
$tempVar = 1;
}
}
elsif ($input =~ m/^REPEAT$/) {
say $intro;
}
elsif ($input =~ m/^FORCE THE DOOR/ || $input =~ m/^FORCE DOOR/) {
if ($tempName !~ m/^RON/) {
say "You get a running start and kick the door with everything you've got.\nThe door does not budge and your knee shatters completely. As you lay on the\nground screaming, the door falls and crushes you.\n\nYour days trapped in this room are over, but so is your life.";
} else {
say "You absolutely blow the door in half. The force of your kick blasts a shockwave through\nthe person that was on the other side and turns them into a fine mist of red against the\nback wall. You see an elevator and ride it down to freedom town.\n".BOLD."Congratulations!".RESET;
}
sleep 10;
system("clear");
exit;
}
elsif ($input =~ m/^WHERE$/) { say "TW92ZSB0aGUgY2hhaXIsIHByZXNzIHRoZSBidXR0b24sIGFuZCBjb25ncmF0cyBmb3IgZGVjb2RpbmcgdGhpcw=="; }
elsif ($input =~ m/^SEEK$/) { say YELLOW."=> ".RESET."You didn't actually believe me did you?"; }
elsif ($chairMoved == 1 && ($input =~ m/^USE COMPUTER$/ || $input =~ m/^PRESS BUTTON$/ || $input =~ m/^PUSH BUTTON$/ || $input =~ m/^TOUCH BUTTON$/)) {
# Match the word before the first occurrence of white space. The \s* makes sure there's no white space at the beginning of the line JUSTIN CASE.
$input =~ m/^\s*(\w+)/;
say "You ".BOLD.$1.RESET" the button on the computer and it whirs to life.";
last;
} else {
say YELLOW."=> ".RESET."I don't understand what you mean by ".BOLD.$input.RESET;
}
}
#e it in front of the monitor, and sit down.\n\nYou notice a button on the computer.";
ENTER_PROMPT();
sleep 1;
say ITALIC, "*Whhhhhiiiirrrrrrr*", RESET;
sleep 1;
say ITALIC, "*Vvvvvvvrrrrrrrrrrrrr*", RESET;
sleep 2;
say ITALIC, "*BzzzRRRRRrrzzttt*", RESET;
sleep 3;
say ITALIC, "*DING!*\n", RESET;
say "Suddenly, a wild popup appears! ";
say ITALIC."\"If only you had some computer repair flyers...\"".RESET." you think to yourself.";
ENTER_PROMPT();
say GREEN."=> ".RESET."Insert Coins because this computer takes coins. 1 play = ".YELLOW."3".RESET."gp\n";
say "You think to yourself, \"That's strange, and proceed to check your pockets for some spare change.\"";
say "In your pockets you find ".YELLOW.$playerChar{GOLD}.RESET."gp. How convienient!";
my $coinCount = 1;
my $stopCount = 0;
while ($coinCount <= 3) {
print GREEN." \$ ".RESET."Insert coin into cd drive? [", BOLD, "Y", RESET, "/", BOLD, "N", RESET, "] ";
$input = uc(<STDIN>);
chomp($input);
if ($input =~ m/Y{1}E*S*/) {
say GREEN." \$ ".RESET."You've inserted ".YELLOW.$coinCount.RESET."gp!";
$coinCount += 1;
$playerChar{GOLD} -= 1;
}
else {
$stopCount += 1;
if ($stopCount < 3) { say GREEN." \$ ".RESET."You know you want to play. I can hear ".YELLOW.$playerChar{GOLD}.RESET."gp in there."; }
if ($stopCount == 2) { say GREEN." \$ ".RESET."Guess you want to quit, huh?"; }
if ($stopCount == 3) { say GREEN." \$ ".RESET."Well rats\' off to ya then!"; }
}
}
say "\n\n#-----------------------------------------------------------------#\n\n";
say "\nThe computer displays a character creation screen.\nYou lean in close to take a look.\n\n";
say "If you choose to take the default values, just press ".CYAN."[ENTER]".RESET;
print GREEN." \$ ".RESET."What do they call you? ".YELLOW."=> ".RESET;
$input = <STDIN>;
chomp($input);
if ($input) {
$playerChar{NAME} = $input;
}
system("/usr/bin/afplay Sounds/EricGreene_charCreationScreen.wav &");
say GREEN." \$ ".RESET."Welcome to the fray, ".BOLD.$playerChar{NAME}.RESET.".\n";
say GREEN." \$ ".RESET."Choose your race. Currently the race is cosmetic but race traits and flaws will be added later.";
say GREEN." \$ ".RESET."#---------------------------------------------------------- ------------------------------------------#";
foreach (keys %charClass) {
print GREEN." \$ ".RESET.BOLD;
printf ("%-13s %-1s %-70s", $_.RESET, ":", $charClass{$_}{DESC});
print "\n";
}
say GREEN." \$ ".RESET."#----------------------------------------------------------------------------------------------------#\n";
print GREEN." \$ ".RESET."Enter ".BOLD."class name".RESET." to select a character ".YELLOW."=> ".RESET;
$input = uc(<STDIN>);
chomp($input);
if ($input) {
foreach my $var (keys %charClass) {
if ($input =~ /^$var$/i) {
$playerChar{CLASS} = $var;
$playerChar{PORTRAIT} = $charClass{$var}{PORTRAIT};
if (($playerChar{NAME} =~ m/JENNY/i || $playerChar{NAME} =~ m/BREAKDANCINGCAT/i || $playerChar{NAME} =~ m/JINGLES/i) && $playerChar{CLASS} =~ m/DWARF/i) {
say GREEN." \$ ".RESET."Typical. :P ".RED."<3".RESET;
$playerChar{TYPICAL} = "Y";
}
elsif ($playerChar{NAME} =~ m/^JENNY$/i && $playerChar{CLASS} =~ m/^GIANT$/i) {
say GREEN." \$ ".RESET."Maybe in your dreams :P ".RED."<3".RESET;
}
elsif ($playerChar{NAME} =~ m/PHILI*P*/i && $playerChar{CLASS} =~ m/GIANT/i) {
say GREEN." \$ ".RESET."Typical. :P ".RED."<3".RESET;
$playerChar{TYPICAL} = "Y";
}
last;
}
}
}
ENTER_PROMPT();
say "As soon as you press the enter key, you get sucked in through the computer monitor.";
say "Your heart is ".BLINK."pounding".RESET." so hard and you have trouble breathing.";
say "You collapse onto the floor in a panic. As you bring your hands to your face you";
say "notice something strange. You no longer have your normal hands. You're in control";
say "of another body.".ITALIC."\"Did I get sucked into the game!?!?\"".RESET." your mind races.";
say "The only way out of this mess is to see what the path ahead of you has in store\n";
say "\n".ITALIC."\"If there's one thing for sure, it's that I, $playerChar{NAME} the $playerChar{CLASS} will find a way out of this mess.\"".RESET;
ENTER_PROMPT();
}
sub FINALE {
sleep 10;
print "Will you marry me? ";
my $input = <STDIN>;
chomp ($input);
if ($input =~ m/Y/i || $input =~ m/YES/i) {
system("clear");
say "\n\n\n\nMission Accomplished";
system("open \"END.png\"");
exit;
} else {
system("clear");
print "\n\n\n\nReally?\n";
exit;
}
}
#Location on the grid = current X[0], current Y[1], previous X[2], previous Y[3], AoAIndexCount[4]
my @MapLoc = (0,0,0,0,0);
# data structure: X[0], Y[1], state[2], boss[3], exit N[4], exit S[5], exit E[6], exit W[7], enemy[8], tile[9]
# state[2] will be 0=undiscovered,1=discovered,2=impasse,3=shop
# enemy[8] will be 0=no enemy,1=enemy
# tile[9] will be 0=ascii_Up_Down, 1=ascii_Left_Right, 2=ascii_Top_Left_Corner, 3=ascii_Bottom_left_Corner, 4=ascii_Top_Right_Corner , 5=ascii_Bottom_Right_Corner, 6=ascii_3Way
# For the tiles, when you enter the room and it determines what your exits are, it will print the correct tile. [NOT DONE]
# Not every room will have an enemy. There will be a post-enter and pre-leave check done for each room. There will be a percentage chance of not encountering a monster in the room if there is an enemy. This percentage can be based off of a character stat or something later down the line. If there is an enemy in the room but you successfully escape the post check, you'll still need to encounter the pre-leave check. If you pass both, then consider yourself lucky ;) and may you live to fight another day. [NOT DONE]
my @MapAoA = ( [0,0,1,0,0,1,0,0,0,0], #[0] array.
[1,0,2,0,0,1,1,0,1,0], #[1] array..
[2,0,0,0,0,1,1,0,1,0], #[2] array...
[3,0,0,0,0,0,1,1,1,0], #[3] etc
[4,0,0,0,0,1,0,1,1,0], #[4] etc.
[0,1,0,0,1,1,0,0,1,0], #[5] etc..
[1,1,2,0,1,0,0,0,1,0], #[6] etc...
[2,1,0,0,1,0,1,0,1,0], #[7]
[3,1,0,0,0,1,0,1,1,0], #[8]
[4,1,0,1,1,1,0,0,1,0], #[9]
[0,2,0,0,1,1,0,0,1,0], #[10]
[1,2,0,0,0,1,1,0,1,0], #[11]
[2,2,0,0,0,0,1,1,1,0], #[12]
[3,2,0,0,0,1,0,1,0,0], #[13]
[4,2,0,0,0,1,0,0,0,0], #[14]
[0,3,0,0,1,1,0,0,1,0], #[15]
[1,3,0,0,1,1,0,0,1,0], #[16]
[2,3,3,0,0,1,0,0,0,0], #[17]
[3,3,0,0,1,1,0,0,1,0], #[18]
[4,3,0,0,0,1,0,0,0,0], #[19]
[0,4,0,0,1,0,1,0,1,0], #[20]
[1,4,0,0,1,0,0,1,1,0], #[21]
[2,4,0,0,1,0,1,0,1,0], #[22]
[3,4,0,0,1,0,0,1,1,0], #[23]
[4,4,0,0,0,1,0,0,0,0] #[24]
);
my %cheats = (
doom1 => 'idclip',
doom2 => 'idspispopd',
halflife => 'noclip',
);
sub tileTypeChecker {
my $ascii_Up_Down="\x{2502}";
my $ascii_Left_Right="\x{2500}";
my $ascii_Top_Left_Corner="\x{250C}";
my $ascii_Bottom_Left_Corner="\x{2514}";
my $ascii_Top_Right_Corner="\x{2510}";
my $ascii_Bottom_Right_Corner="\x{2518}";
my $ascii_3Way="\x{2524}";
}
sub UPDATE_MAP_DATA {
# Inner/Outer exist so that I can get 0-24 for X,Y to access the correct array and check if the
# current spot has been revealed. Without these, the entire row or column would be marked as revealed
my $innerCount = 0;
my $outerCount = 0;
for(my $i=0; $i <= 4; $i++) {
for(my $j=0; $j <= 4; $j++) {
# Prints your current position out from the @MapLoc array
if ($MapLoc[0] == $j && $MapLoc[1] == $i) {
# Changes the current positions state to "1" to reveal it
# Upon traveling, the UPDATE_MAP_DATA function is called so this will update your map correctly
if (@{$MapAoA[$innerCount]}[2] == 0) { splice @{$MapAoA[$innerCount]},2,1,1; }
# If you destroy the walls then the map should be updated accordingly
if ($impasse01_cleared == 1 && @{$MapAoA[1]}[2] != 1) { splice @{$MapAoA[1]},2,1,0; }
if ($impasse11_cleared == 1 && @{$MapAoA[6]}[2] != 1) { splice @{$MapAoA[6]},2,1,0; }
if (@{$MapAoA[$innerCount]}[2] == 3) { $is_shop = 1; }
}
$innerCount+=1;
}
$outerCount+=1;
}
}
sub PRINT_MAP {
if ($haveMap == 0) {
say "\n=> What are you talking about? You do not have a map.";
return;
}
my $innerCount = 0;
my $outerCount = 0;
for(my $i=0; $i <= 4; $i++) {
for(my $j=0; $j <= 4; $j++) {
# Prints your current position out from the @MapLoc array
if ($MapLoc[0] == $j && $MapLoc[1] == $i) {
print "[$playerChar{PORTRAIT}]";
}
elsif (@{$MapAoA[$innerCount]}[2] == 3 && $is_shop == 1) { print "[$shop]"; }
elsif (@{$MapAoA[$innerCount]}[2] == 2) { print "[$impasse]"; }
elsif (@{$MapAoA[$innerCount]}[2] == 1) { print "[$revealed]"; }
else { print "[$undiscovered]"; }
$innerCount+=1;
}
print "\n";
$outerCount+=1;
}
}
sub PRINT_DIRECTIONS {
print "\nYou can travel in the following direction(s)\n[ ";
if (@{$MapAoA[$MapLoc[4]]}[4] == 1) {
print BOLD."N".RESET."orth ";
}
if (@{$MapAoA[$MapLoc[4]]}[5] == 1) {
print BOLD "S".RESET."outh ";
}
if (@{$MapAoA[$MapLoc[4]]}[6] == 1) {
print BOLD "E".RESET."ast ";
}
if (@{$MapAoA[$MapLoc[4]]}[7] == 1) {
print BOLD "W".RESET."est ";
}
print "]\n";
}
sub TRAVEL_DIR {
# Final check to make sure you can't leave the current room without possibly encountering something
my $input = shift;
if ( $input =~ m/^N{1}O*R*T*H*$/ && @{$MapAoA[$MapLoc[4]]}[4] == 1) {
PRELEAVEROOMCHECK();
$count_NS -= 1;
# Sets a value so we can know what index we're in in the MapAoA structure
splice @MapLoc,4,1,$MapLoc[4]-5;
# Doesn't allow you to leave the map boundaries
if ($MapLoc[1] <= 0 && @{$MapAoA[$MapLoc[4]]}[2] != 2) {
$count_NS += 1;
splice @MapLoc,1,1,0; #Resets you to the Y position of the top row
splice @MapLoc,4,1,$MapLoc[4]+5; # Resets the MapAoA index
}
# Takes care of running into an "impasse" and resets your location to the previous location
elsif ($MapLoc[1] >= 0 && @{$MapAoA[$MapLoc[4]]}[2] == 2) {
splice @MapLoc,1,1,$MapLoc[3]; # Moves your position to the previous location
splice @MapLoc,4,1,$MapLoc[4]+5; # Resets the MapAoA index
}
# Allows movement if within the map boundaries
else {
splice @MapLoc,1,1,$count_NS; # Current
splice @MapLoc,3,1,$count_NS+1; # Previous
splice @MapLoc,2,1,$count_EW; # Previous
}
}
elsif ( $input =~ m/^S{1}O*U*T*H*$/ && @{$MapAoA[$MapLoc[4]]}[5] == 1) {
PRELEAVEROOMCHECK();
$count_NS += 1;
# Sets a value so we can know what index we're in in the MapAoA structure
splice @MapLoc,4,1,$MapLoc[4]+5;
# Doesn't allow you to leave the map boundaries
if ($MapLoc[1] >= 4 && @{$MapAoA[$MapLoc[4]]}[2] != 2) {
$count_NS -= 1;
splice @MapLoc,1,1,4; # Resets you to the Y position of the bottom row
splice @MapLoc,4,1,$MapLoc[4]-5; # Resets the MapAoA index
}
# Takes care of running into an "impasse" and resets your location to the previous location
elsif ($MapLoc[1] <= 4 && @{$MapAoA[$MapLoc[4]]}[2] == 2) {
splice @MapLoc,1,1,$MapLoc[3]; # Moves your position to the previous location
splice @MapLoc,4,1,$MapLoc[4]-5; # Resets the MapAoA index
}
# Allows movement if within the map boundaries
else {
splice @MapLoc,1,1,$count_NS; # Current
splice @MapLoc,3,1,$count_NS-1; # Previous
splice @MapLoc,2,1,$count_EW; # Previous
}
}
elsif ( $input =~ m/^E{1}A*S*T*$/ && @{$MapAoA[$MapLoc[4]]}[6] == 1) {
PRELEAVEROOMCHECK();
$count_EW += 1;
# Sets a value so we can know what index we're in in the MapAoA structure
splice @MapLoc,4,1,$MapLoc[4]+1;
# Doesn't allow you to leave the map boundaries
if ($MapLoc[0] >= 4 && @{$MapAoA[$MapLoc[4]]}[2] != 2) {
$count_EW -= 1;
splice @MapLoc,0,1,4; # Rests you to the X position of the rightmost column
splice @MapLoc,4,1,$MapLoc[4]-1; # Resets the MapAoA index
}
# Takes care of running into an "impasse" and resets your location to the previous location
elsif ($MapLoc[0] <= 4 && @{$MapAoA[$MapLoc[4]]}[2] == 2) {
splice @MapLoc,0,1,$MapLoc[2]; # Moves your position to the previous location
splice @MapLoc,4,1,$MapLoc[4]-1; # Resets the MapAoA index
}
# Allows movement if within the map boundaries
else {
splice @MapLoc,0,1,$count_EW; # Current
splice @MapLoc,2,1,$count_EW-1; # Previous
splice @MapLoc,3,1,$count_NS; # Previous
}
}
elsif ( $input =~ m/^W{1}E*S*T*$/ && @{$MapAoA[$MapLoc[4]]}[7] == 1) {
PRELEAVEROOMCHECK();
$count_EW -= 1;
# Sets a value so we can know what index we're in in the MapAoA structure
splice @MapLoc,4,1,$MapLoc[4]-1;
# Doesn't allow you to leave the map boundaries
if ($MapLoc[0] <= 0 && @{$MapAoA[$MapLoc[4]]}[2] != 2) {
$count_EW += 1;
splice @MapLoc,0,1,0; # Resets you to the X position of the leftmost column
splice @MapLoc,4,1,$MapLoc[4]+1; # Resets the MapAoA index
}
# Takes care of running into an "impasse" and resets your location to the previous location
elsif ( $MapLoc[0] >= 0 && @{$MapAoA[$MapLoc[4]]}[2] == 2) {
splice @MapLoc,0,1,$MapLoc[2];
splice @MapLoc,4,1,$MapLoc[4]+1; # Resets the MapAoA index
}
# Allows movement if within the map boundaries
else {
splice @MapLoc,0,1,$count_EW; # Current
splice @MapLoc,2,1,$count_EW+1; # Previous
splice @MapLoc,3,1,$count_NS; # Previous
}
} else {
if (rand(121) >= 100) { say RED."=> ".RESET."You should really ".BOLD."LOOK".RESET." where you're going"; }
elsif (rand(121) >= 80) { say RED."=> ".RESET."Traveling into the ".BOLD.$input.RESET." wall is ill advised."; }
elsif (rand(121) >= 60) { say RED."=> ".RESET."You've ran into the ".BOLD.$input.RESET." wall. Good job."; }
elsif (rand(121) >= 40) {
my $val = [@_=%cheats]->[1|rand@_];
say RED."=> ".RESET."Despite how hard you want to walk through walls, you cannot. Try $val instead.";
}
elsif (rand(121) >= 20) {
say "You knock your noggin off the wall and hurt yourself! ".RED."You lose 10hp".RESET.".";
$playerChar{CURRENT_HP} -= 10;
} else {
say "Your body attempts to merge with the wall in front of you.".RED."You lose 15hp".RESET.".";
$playerChar{CURRENT_HP} -= 15;
}
return;
}
say "\n\n#-----------------------------------------------------------------#\n\n";
POSTENTERROOMCHECK();
}
sub LOCATION_SETTINGS {
# Unset the people you can talk to
@talkToPerson = ();
if ($MapLoc[0] == 0 && $MapLoc[1] == 0 && $initialHelpScreen == 1) {
$initialHelpScreen = 0;
ACTION("HELP");
}
if ($MapLoc[0] == 0 && $MapLoc[1] == 3 && $haveMap == 0) {
say YELLOW."\n=> ".RESET.BOLD."You found a map!".RESET;
say YELLOW."=> ".RESET."Take time to review the ".BOLD."HELP".RESET." options. During gameplay, acquiring items will alter the possible available actions of your character.\n";
$haveMap = 1;
ACTION("GET");
ACTION("HELP");
}
# Once you get help from the shopkeeper, the pathing can change to allow access to the rest of the map at 3,2
if ($MapLoc[0] == 3 && $MapLoc[1] == 2) {
if ($quests{MOVELOGS}{STATE_A} == 0 || $quests{MOVELOGS}{STATE_B} == 1) {
say YELLOW."=> ".RESET."You see some ".BOLD."burly guys".RESET." standing around.";
push @talkToPerson,'BURLY GUYS';
$playerChar{CURRENT_HP} = $playerChar{MAX_HP};
}
}
if ($MapLoc[0] == 2 && $MapLoc[1] == 3) {
say YELLOW."=> ".RESET."The ".BOLD."shopkeeper".RESET." looks at you.";
push @talkToPerson,'SHOPKEEPER';
}
# Script to destroy the impasse at 0,1
if ($MapLoc[0] == 2 && $MapLoc[1] == 0 && $impasse01_cleared == 0) {
print "\nYou see a crack in the wall. As you investigate you realize you have a bomb to deal with this certain thing!\n";
print "Use bomb? [".BOLD."Y".RESET."es ".BOLD."N".RESET."o ]\n".YELLOW."=> ".RESET;
my $input = uc(<STDIN>);
chomp($input);
if ($input =~ m/^Y+E*S*$/) {
$impasse01_cleared = 1;
print $ascii_explosion."\n";
system("/usr/bin/afplay Sounds/LOZ_Secret.wav &");
splice @{$MapAoA[$MapLoc[4]]},7,1,1;
UPDATE_MAP_DATA();
PRINT_MAP();
}
}
# Script to destroy the impasse at 1,1 while standing in 0,1
if ($MapLoc[0] == 1 && $MapLoc[1] == 0 && $impasse11_cleared == 0 && $impasse01_cleared == 1) {
say "\nYou see a crack in the wall. As you investigate you realize you have a bomb to deal with this certain thing!";
print "Use bomb? [".BOLD."Y".RESET."es ".BOLD."N".RESET."o ]\n".YELLOW."=> ".RESET;
my $input = uc(<STDIN>);
chomp($input);
if ($input =~ m/^Y+E*S*/) {
$impasse11_cleared = 1;
print $ascii_explosion."\n";
system("/usr/bin/afplay Sounds/LOZ_Secret.wav &");
splice @{$MapAoA[$MapLoc[4]]},5,1,1;
UPDATE_MAP_DATA();
PRINT_MAP();
}
}
if ($MapLoc[0] == 1 && $MapLoc[1] == 1) {
say "You see a chest on the ground.\n";
$chest = 1;
}
# If the main boss has died, the room will start collapsing. The falling rocks chase you the rest of the way out of the dungeon.
if ($MapLoc[0] == 4 && $MapLoc[1] == 2 && $main_boss_dead == 0) {
say YELLOW."=> ".RESET.BOLD."You enter the lair of the final boss. Prepare your buttholes for total annihilation.";
ENTER_PROMPT();
COMBAT("BOSS");
}
if ($main_boss_dead == 1 && @{$MapAoA[$MapLoc[4]]}[2] == 1) {
splice @{$MapAoA[$MapLoc[4]]},2,1,2;
}
if ($MapLoc[0] == 4 && $MapLoc[1] == 4) {
say "\n\n".BOLD."Congrats, you beat the shit out of the game!".RESET."\n";
ENTER_PROMPT();
# Tests for existance and if it's not an empty file then rolls the credits
-e "credits.pl" && -r "credits.pl" ? system("perl credits.pl") : print "[".RED."-".RESET."] Could not open credits.pl\n";
# FINALE
#system("/usr/bin/afplay Sounds/END.mp3 &");
FINALE();
exit;
}