-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
3164 lines (2823 loc) · 163 KB
/
Program.cs
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
using System;
using System.Collections;
using System.Collections.Generic;
using System.ComponentModel;
using System.Linq;
using System.Security.Cryptography;
using System.Threading;
namespace Scholomance
{
class Program
{
public static Player _player;
static void Main(string[] args)
{
Console.ResetColor();
Console.ResetColor();
Console.WriteLine("");
Console.ResetColor();
Console.WriteLine("Welcome.");
Thread.Sleep(200);
Console.WriteLine("What is your name?");
string characterName = Console.ReadLine();
characterName = (char.ToUpper(characterName[0]) + characterName.Substring(1));
string characterClass = "default";
Console.WriteLine("Select your Class:");
Console.Write(" 1.) - "); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("Paladin \n"); Console.ResetColor();
Console.Write(" 2.) - "); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write("Huntsman\n"); Console.ResetColor();
Console.Write(" 3.) - "); Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("Warrior\n"); Console.ResetColor();
Console.Write(" 4.) - "); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.Write("Sorcerer\n"); Console.ResetColor();
Console.Write(" 5.) - "); Console.ForegroundColor = ConsoleColor.DarkYellow; Console.Write("Rogue\n"); Console.ResetColor();
Console.ResetColor();
//Console.WriteLine("\n(If no class is selected, then you will be assigned one at random...)");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("");
Console.Write("Or, enter ");
Console.ForegroundColor = ConsoleColor.Yellow;
Console.Write("i");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write(" to learn more about the classes.");
Console.ResetColor();
int health, wisdom, strength, spellPower, determination;
health = -2; wisdom = -2; strength = -2; spellPower = -2; determination = -2;
bool menu = true;
Console.Write("> ");
while (menu)
{
switch (Console.ReadLine().ToLower())
{
case "1":
characterClass = "Paladin"; health = 10; wisdom = 5; strength = 8; spellPower = 7; determination = 5;
menu = false;
break;
case "2":
characterClass = "Huntsman"; health = 10; wisdom = 5; strength = 6; spellPower = 4; determination = 10;
menu = false;
break;
case "3":
characterClass = "Warrior"; health = 12; wisdom = 1; strength = 12; spellPower = 0; determination = 10;
menu = false;
break;
case "4":
characterClass = "Sorcerer"; health = 8; wisdom = 10; strength = 2; spellPower = 10; determination = 5;
menu = false;
break;
case "5":
characterClass = "Rogue"; health = 8; wisdom = 5; strength = 8; spellPower = 2; determination = 12;
menu = false;
break;
case "i":
Console.WriteLine("\n - Paladins are holy agents, who are strong both physically and magically. They have high health, and are privy to maces and axes. They have damage bonus against undead type enemies. They are a very balanced class.");
Console.WriteLine(" - Huntsmen are survivalists, in tune with nature, and while they tend to favor physical damage, they do have magical defensive abilities. They are best with axes or staves. They have a strong damage bonus against beast type enemies. They are a very balanced class.");
Console.WriteLine(" - Warriors are strong, and are capable of dealing and receiving enormous amounts of damage. They have no magical abilities, but are able to get damage bonuses from most of the weapons in the game, where other classes get only one or two. They have the highest strength and health of any class.");
Console.WriteLine(" - Sorcerers are strongly magical, and most of their damage will come from spell casting. They have a high wisdom pool and depend very little on physical attacks. They can have Spell Power or Wisdom buffs from their choice weapon - staves. They have a damage bonus against ghost type enemies. Sorcerers can also use daggers and swords for a balanced magical and physical build. They have the highest wisdom and spell power of any class.");
Console.WriteLine(" - Rogues are silent and cunning adversaries, who tend to favor physcial damage over magical damage. They are unqiue in that they are able to use two weapons at the same time, where every other class uses one, and due to their Sneak Attack passive ability, they almost always get to attack first. Their magcal abilities are purely defensive. They have a damage buff with daggers. They have a damage bonus against human enemies. They also have the highest determination of any class.");
Console.WriteLine("\n ");
Console.WriteLine("Select your Class:");
Console.Write(" 1.) - "); Console.ForegroundColor = ConsoleColor.Yellow; Console.Write("Paladin \n"); Console.ResetColor();
Console.Write(" 2.) - "); Console.ForegroundColor = ConsoleColor.DarkGreen; Console.Write("Woodsman\n"); Console.ResetColor();
Console.Write(" 3.) - "); Console.ForegroundColor = ConsoleColor.DarkRed; Console.Write("Warrior\n"); Console.ResetColor();
Console.Write(" 4.) - "); Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.Write("Sorcerer\n"); Console.ResetColor();
Console.Write(" 5.) - "); Console.ForegroundColor = ConsoleColor.DarkYellow; Console.Write("Rogue\n"); Console.ResetColor();
Console.ResetColor();
menu = true;
break;
default:
Console.WriteLine("Incorrect choice - please enter a number 1 through 5 to select class.");
health = -1; wisdom = -1; strength = -1; spellPower = -1; determination = -1;
menu = true;
break;
}
}
_player = Player.CreatePlayer(characterName, characterClass, health, wisdom, strength, spellPower, determination, wisdom, health, 0, 1);
_player.CurrentLocation = World.LocationByID(World.LOCATION_ID_EMPTY_FIELD);
EquipWeapon("gnarlegnarled stick");
Console.WriteLine("You are {0}, a fledgling {1} in Gravothos, at the foot of the mountain where the fabled Scholomanarie school of dark magic lies.", _player.Name, _player.Class);
Console.WriteLine("Stats:");
Console.WriteLine("Total Health Points: {0}", _player.Health);
Console.WriteLine("Total Wisdom Points: {0}", _player.Wisdom);
Console.WriteLine("Strength: {0}", _player.Strength);
Console.WriteLine("Spell Power: {0}", _player.SpellPower);
Console.WriteLine("Determination: {0}", _player.Determination);
Console.WriteLine("");
Console.WriteLine("\nWould you like to read an explanation on your stats? (Y/n)");
Console.Write("> ");
string yn = Console.ReadLine();
if (yn.ToLower() == "y" || yn.ToLower() == "yes")
{
Console.Write(" - ");
Console.ForegroundColor = ConsoleColor.DarkRed;
Console.Write("Health");
Console.ResetColor();
Console.WriteLine(" is how much damage you can sustain from enemies, monsters, and the environment.");
Console.Write(" - ");
Console.ForegroundColor = ConsoleColor.DarkBlue;
Console.Write("Wisdom ");
Console.ResetColor();
Console.WriteLine(" is the meter that determines how strong a spell can be cast in any given turn. More powerful spells require more wisdom to cast.");
Console.Write(" - ");
Console.ForegroundColor = ConsoleColor.DarkGreen;
Console.Write("Strength ");
Console.ResetColor();
Console.WriteLine(" correlates to how much physical damage you can do to enemies and objects, and also correlates to how much health you regenerate per turn.");
Console.Write(" - ");
Console.ForegroundColor = ConsoleColor.Magenta;
Console.Write("Spell Power ");
Console.ResetColor();
Console.WriteLine(" correlates to how much magical damage you can do to enemies, or the general effectiveness of your spells, and also correlates to how much wisdom you regenerate per turn.");
Console.Write(" - ");
Console.ForegroundColor = ConsoleColor.Blue;
Console.Write("Determination ");
Console.ResetColor();
Console.Write("correlates to your chance to land a critical strike against an enemy, the chance to resist a strike from an enemy, and also general luck in loot.");
}
Console.WriteLine("\nWould you like to read an explanation of your Class? (Y/n)");
Console.WriteLine("> ");
yn = Console.ReadLine();
if (yn.ToLower() == "y" || yn.ToLower() == "yes")
{
ClassInfo();
}
Console.WriteLine("\nAre you ready to begin your journey into the Scholomanarie? (Y/n)");
yn = Console.ReadLine();
if (yn.ToLower() == "y" || yn.ToLower() == "yes")
{
//Game Start
Console.WriteLine("\n ============================================== \n Deep inside the wooded hills of Gravothos, overlooking a lake of still black water, wolves howl in the night. A giant stone spire erupts out of the side of the mountain, its windows illuminated by candle light within, but even the very stars behind it seem to be sucked into dark forboding. There stands the Scholomanarie, a vessel of dark academia, where withes and wizards and scholars of black magic study under the Devil himself.");
Console.WriteLine("");
Console.WriteLine("Get started by equipping a weapon. Type 'inventory' to see what items you currently have, and then type 'equip gnarled stick' to equip your default weapon");
Console.WriteLine("");
Console.WriteLine("Then, see where you are by typing 'Look'");
Console.ForegroundColor = ConsoleColor.DarkMagenta;
Console.WriteLine("Type 'Help' to see a list of commands");
Console.ResetColor();
}
else
{
Console.WriteLine("Do you want to change your name or your class?");
// add functionality to change class or name.
}
while (true)
{
// Display a prompt, so the user knows to type something
Console.Write(">");
// Wait for the user to type something, and press the <Enter> key
string userInput = Console.ReadLine();
// If they typed a blank line, loop back and wait for input again
if (userInput == null)
{
continue;
}
// Convert to lower-case, to make comparisons easier
string cleanedInput = userInput.ToLower();
// Save the current game data, and break out of the "while(true)" loop
if (cleanedInput == "exit")
{
break;
}
// If the user typed something, try to determine what to do
ParseInput(cleanedInput);
}
}
private static void ClassInfo()
{
switch (_player.Class.ToLower())
{
case "paladin":
Console.WriteLine("The Paladin is an agent of God, sent to this demonic academy to purge the unholiness that is studied within. You have high health, and high stregnth, and high spell power. In combat, he has the ability to Heal Self to recoupe a fair amount of health, and also the option to cast Smite, to cause the enemy a large amount of damage. Undead-type enemies being the most vulnerable to your holy magic and blessed weapons. The paladin is trained in maces and axes, and will see a greater damage bonus if he chooses these weapons over others.");
break;
case "huntsman":
Console.WriteLine("The Huntsman is a man of nature, living reclusively on the mountain, living off the fertile land and streams. he is a master of all beasts, but recent dark activity have corrupted the beast, deforming them and turning them violent and unworldly. He has set upon the dark academy to destroy the source of nature's corruption. The huntsman is a balanced class, with high health and high determination. He has offensive and defensive magical abilites. In combat, he can cast Stun, which causes the enemy to lose a turn. In combat with beasts, he can cast Cure Beast, which has a chance to cure the beast of its magical corruption, causing it to run away with no further harm to the hunter. Spell Power increases the effectiveness of Stun, and the likelihood that Cure Beast is sucessfull. The hunter has a strong damage bonus against beasts. He is adept at staves, axes, and daggers.");
break;
case "warrior":
Console.WriteLine("The Warrior is a combatantant trained in all manner of weapons, and has come to the Scholomanarie academy as revenge for the corruption of Earth on his father's farm, at the foot of the mountain. The dry and rotting soil, corrupted by the dark magic of the school has rotted his families crops and drained the area of life. The warrior has high health and high strength, meaning he can take a lot of damage, and deal out a lot of damage as well. He lacks magical abilities, but makes up for this with his vast weapon specialization - meaning he gets a damage buff from axes, swords, maces, and daggers. He also has high determination, meaning he is more likely to land a critical strike.");
break;
case "sorcerer":
Console.WriteLine("The Sorcerer is an agent of great magical ability, but was banished from his studies after the head priest of his village wrongfully accused him of studying dark magic at the Scholomanarie. To clear his name and return home, he has set upon the dark academy with the intent to destroy it and release its fearful hold on the population of Gravothos. The sorcerer has strong magical abilities, each of which consume an amount of regenerable wisdom when cast. The effectiveness of each spell he weilds is determined by his spell power stat. His wisdom stat and his spell power stat are the highest of any class, but he has low health and medium strength. He can cast Fireball, Frostbolt, Arcanae Beam, and the defensive Nether Shield, which reduces damage dealth to the sorcerer temporarily. The sorcerer is most effective against ghost-type enemies, and will earn a damage bonus when fighting against them. The sorcerer also has the ability to attack physically, and will have a damage bonus for staves, swords and daggers.");
break;
case "rogue":
Console.WriteLine("The Rogue is a man of great cunning, an assassin that can move through the night undetected. It is known that there is great treasure in this cursed academy and was hired to take it by a mysterious patron. What the Rogue lacks in health and magic, he makes up in strength and determination, meaning that he can land huge critical strikes. He is also able to weild two weapons at the same time, as long as one is a dagger. A passive stealth ability means his has a very high chance of always attacking first in combat against any enemy besides beasts. His only magical ability is to Distract, which subdues the enemy, if it is human or undead, and allows the rogue to escape unscathed. He has a strong damage bonus with daggers, and a fair damage bonus with swords.");
break;
default:
break;
}
}
private static void ParseInput(string input)
{
CheckLevel();
int _currentLevel = _player.Level;
Console.ResetColor();
if (input.Contains("help") || input == "?")
{
DisplayHelpText();
}
else if (input == "stats")
{
DisplayPlayerStats();
}
else if (input == "look")
{
DisplayCurrentLocation();
}
else if (input.Contains("north"))
{
if (_player.CurrentLocation.LocationToNorth == null)
{
Console.WriteLine("You cannot move North");
}
else
{
_player.MoveNorth();
DisplayCurrentLocation();
}
}
else if (input.Contains("east"))
{
if (_player.CurrentLocation.LocationToEast == null)
{
Console.WriteLine("You cannot move East");
}
else
{
_player.MoveEast();
DisplayCurrentLocation();
}
}
else if (input.Contains("south"))
{
if (_player.CurrentLocation.LocationToSouth == null)
{
Console.WriteLine("You cannot move South");
}
else
{
_player.MoveSouth();
DisplayCurrentLocation();
}
}
else if (input.Contains("west"))
{
if (_player.CurrentLocation.LocationToWest == null)
{
Console.WriteLine("You cannot move West");
}
else
{
_player.MoveWest();
DisplayCurrentLocation();
}
}
else if ((input == "inventory") || (input == "inv") || (input == "i"))
{
string spacer = " ";
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine(" Weapons");
Console.ResetColor();
foreach (Weapon wep in _player.Weapons)
{
if ((_player.CurrentWeapon == _player.CurrentOffhand) && (_player.CurrentOffhand != null))
{
spacer = " ";
}
Console.Write(" - {0} - {1}", wep.Name, wep.Type);
try
{
if (wep.Name == _player.CurrentWeapon.Name) { Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine(" (Currently Equipped)"); }
}
catch (NullReferenceException ex)
{
Console.WriteLine("");
EquipWeapon("gnarlegnarled stick");
if (wep.Name == _player.CurrentWeapon.Name) { Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine(" (Currently Equipped)"); }
}
try
{
if (wep.Name == _player.CurrentOffhand.Name) { Console.ForegroundColor = ConsoleColor.DarkMagenta; Console.WriteLine("{0}(Current Offhand)", spacer); }
}
catch (NullReferenceException ex)
{
Console.Write("");
}
Console.ForegroundColor = ConsoleColor.DarkGray;
Console.WriteLine(" dmg: {0}-{1}", wep.MinDamage, wep.MaxDamage); //minDamage+1 because technically a roll of min damage = a miss
Console.ResetColor();
if (wep.Stat != null)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(" +{0} {1}", wep.StatInt, wep.Stat);
Console.ResetColor();
if (wep.Stat2 != null)
{
Console.WriteLine("");
Console.ForegroundColor = ConsoleColor.Green;
Console.Write(" +{0} {1}", wep.StatInt2, wep.Stat2);
Console.ResetColor();
Console.WriteLine("");
}
}
Console.WriteLine("");
}
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine("");
Console.Write(" Food");
Console.ResetColor();
foreach (InventoryItem inventoryItem in _player.Inventory.Where(inventoryItem => inventoryItem.Details is Food))
{
Console.WriteLine("");
Console.WriteLine(" - {0}: {1}", inventoryItem.Details.Name, inventoryItem.Quantity);
}
Console.WriteLine("");
Console.ResetColor();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.Write(" Items");
Console.ResetColor();
foreach (InventoryItem inventoryItem in _player.Inventory.Where(inventoryItem => !(inventoryItem.Details is Food) && !(inventoryItem.Details is Weapon)))
{
Console.WriteLine("");
if (!inventoryItem.Details.Name.ToLower().Contains("key"))
{
Console.Write(" - {0}: {1}", inventoryItem.Details.Name, inventoryItem.Quantity);
}
}
Console.WriteLine("");
Console.ResetColor();
Console.ForegroundColor = ConsoleColor.Cyan;
Console.WriteLine(" Keys");
Console.ResetColor();
foreach (InventoryItem inventoryItem in _player.Inventory.Where(inventoryItem => (inventoryItem.Details.Name.ToLower().Contains("key"))))
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" - {0}", inventoryItem.Details.Name);
Console.ResetColor();
}
Console.ResetColor();
Console.WriteLine("----------------");
}
else if (input.Contains("attack"))
{
AttackMob();
}
else if (input.Contains("cast"))
{
CastSpell(input);
}
else if (input.StartsWith("equip "))
{
EquipWeapon(input);
}
else if (input.StartsWith("offhand "))
{
if (_player.Class.ToLower() != "rogue")
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("Only Rogues can equip off-hand weapons,");
Console.ResetColor();
}
else
{
EquipOffhand(input);
}
}
else if (input.StartsWith("eat "))
{
EatFood(input);
}
else if (input.StartsWith("info"))
{
ClassInfo();
}
else
{
Console.WriteLine("I do not understand");
Console.WriteLine("Type 'Help' to see a list of available commands");
}
Console.WriteLine("");
}
private static void DisplayHelpText()
{
Console.WriteLine("Available commands");
Console.WriteLine("====================================");
Console.WriteLine("Stats - Display player information");
Console.WriteLine("Look - Get the description of your location");
Console.WriteLine("Inventory - Display your inventory");
Console.WriteLine("Attack - Fight the monster");
Console.WriteLine("Equip <weapon name> - Set your current weapon");
Console.WriteLine("Offhand <weapon> - Set your current Offhand (rogues only)");
Console.WriteLine("Eat <potion name> - Drink a potion");
Console.WriteLine("Cast <spell> - Cast a spell. Check your class info to find out which spells you can cast");
Console.WriteLine("Info - Class information and class-specific commands");
Console.WriteLine("North - Move North");
Console.WriteLine("South - Move South");
Console.WriteLine("East - Move East");
Console.WriteLine("West - Move West");
Console.WriteLine("Exit - Save the game and exit");
_player.AddItemToInventory(World.ItemByID(World.ITEM_ID_WOLF_PAW), 12);
}
private static void DisplayPlayerStats()
{
Console.WriteLine("=======================");
Console.WriteLine("Name: {0}", _player.Name);
Console.WriteLine("Level {0} {1}", _player.Level, _player.Class);
Console.Write("Current Weapon: ");
Console.ForegroundColor = ConsoleColor.Yellow;
if (_player.CurrentHealth > _player.Health) { _player.CurrentHealth = _player.Health; }
try
{
Console.WriteLine(_player.CurrentWeapon.Name + " - (" + _player.CurrentWeapon.Type + ")");
}
catch (NullReferenceException ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("No Weapon Equipped.");
Console.ResetColor();
}
if (_player.Class.ToLower() == "rogue")
{
Console.ResetColor();
Console.Write("Offhand Weapon: ");
Console.ForegroundColor = ConsoleColor.Yellow;
try
{
Console.WriteLine(_player.CurrentOffhand.Name + " - (" + _player.CurrentOffhand.Type + ")");
Console.ResetColor();
}
catch (NullReferenceException ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("No Weapon Equipped.");
Console.ResetColor();
}
}
if (_player.Class.ToLower() == "huntsman")
{
Console.ResetColor();
Console.Write("Tamed Beast: ");
Console.ForegroundColor = ConsoleColor.Yellow;
try
{
Console.Write(_player.CurrentPet.Name);
Console.WriteLine(" - (dmg: {0}-{1})", _player.CurrentPet.MinDamage, _player.CurrentPet.MaxDamage);
Console.ResetColor();
}
catch (NullReferenceException ex)
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("No beast tamed.");
Console.ResetColor();
}
}
Console.ResetColor();
Console.WriteLine("Current health: {0}/{1}", _player.CurrentHealth, _player.Health);
Console.WriteLine("Current Wisdom: {0}/{1}", _player.CurrentWisdom, _player.Wisdom);
Console.WriteLine("Experience Points: {0}/{1}", _player.Experience, _player.Level * 35);
Console.WriteLine("Wisdom: {0}", _player.Wisdom);
Console.WriteLine("Strength {0}", _player.Strength);
Console.WriteLine("Spell Power {0}", _player.SpellPower);
Console.WriteLine("Determination {0}", _player.Determination);
Console.WriteLine("========================");
//_player.AddItemToInventory(World.ItemByID(World.ITEM_ID_BONE_HANDLED_STILETTO), 2);
}
public static void CheckLevel(int _currentLevel = 0)
{
//if ()
//if (_player.Level > _currentlevel)
}
private static void CastSpell(string input)
{
string inputSpellName = input.Substring(5).Trim();
if (string.IsNullOrEmpty(inputSpellName))
{
Console.WriteLine("You must enter the name of a spell to cast it.");
}
else
{
switch (inputSpellName.ToLower())
{
case " ":
Console.WriteLine("Hunters can cast:");
Console.WriteLine(" - Cleanse: a small self heal with low wisdom cost.");
Console.WriteLine(" - Tame: cast tame on an beast-type mob to have it be your pet and serve you in battle.");
Console.WriteLine(" - To tame a Rat, you must have 3 Rat Tails in your inventory.");
Console.WriteLine(" - To tame a Serpent, you must have 8 Snake Fangs in your inventory.");
Console.WriteLine(" - To tame a Wolf, you must have 10 Wolf Pars in your inventory.");
Console.WriteLine(" - Cure Animal: cast Cure Animal on any beast for a chance to have it run away during battle, dropping its loot.");
Console.WriteLine("Paladins can cast:");
Console.WriteLine(" - Smite: a strong attack with medium wisdom cost, and a small chance to miss.");
Console.WriteLine(" - Heal: a strong self heal with medium wisdom cost.");
Console.WriteLine("Sorcerers can cast:");
Console.WriteLine(" - Fireball: a strong attack that incurs a high wisdom cost.");
Console.WriteLine(" - Frostbolt: a weak attack with very low wisdom cost, and has no chance to miss");
Console.WriteLine(" - Nethershield: a defensive spell that reduces damage taken by the sorcerer by 75% for 4 turns, but also prevents him from using physical attacks and reduces magical attack damage by 25%.");
Console.WriteLine("Rogues can cast:");
Console.WriteLine(" - Distract: a spell that has a small chance of distracting a human enemy, causing him to leave, but does not drop loot.");
Console.WriteLine(" - ");
break;
case "heal":
if (_player.Class.ToLower() != "paladin")
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You can not cast Heal.");
Console.ResetColor();
break;
}
else { _player.CastHeal(); }
break;
case "smite":
if (_player.Class.ToLower() != "paladin")
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You can not cast Smite.");
Console.ResetColor();
break;
}
else { _player.CastSmite(); }
break;
case "cleanse":
if (_player.Class.ToLower() != "huntsman")
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You can not cast Cleanse.");
Console.ResetColor();
break;
}
else { _player.CastCleanse(); }
break;
case "cure animal":
if (_player.Class.ToLower() == "huntsman")
{
Console.ForegroundColor = ConsoleColor.DarkMagenta;
Console.Write("You attempt to Cure Beast...");
_player.CureBeast();
Console.ResetColor();
break;
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You can not cast ;Cure Beast.;");
Console.ResetColor();
break;
}
break;
case "tame":
if(_player.Class.ToLower() == "huntsman")
{
Console.WriteLine("You attempt to tame the beast");
_player.TameAnimal();
break;
}
else
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You can not cast ;Tame Beast.;");
Console.ResetColor();
break;
}
case "fireball":
if (_player.Class.ToLower() != "sorcerer")
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You can not cast Fireball.");
Console.ResetColor();
break;
}
else
{
_player.CastFireball();
}
break;
case "frostbolt":
if (_player.Class.ToLower() != "sorcerer")
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You can not cast Frostbolt.");
Console.ResetColor();
break;
}
else
{
_player.CastFrostbolt();
}
break;
case "nethershield":
if (_player.Class.ToLower() != "sorcerer")
{
Console.ForegroundColor = ConsoleColor.Red;
Console.WriteLine("You can not cast Nethersheild.");
Console.ResetColor();
break;
}
else
{
_player.CastNethershield();
}
break;
default:
Console.WriteLine("You did not enter a valid command. Try doing 'cast <spell>', and type 'class' to learn which spells your class can cast.");
break;
}
}
if (!_player.CurrentLocation.HasMob)
{
Console.WriteLine("There is no monster here to cast on.");
}
else
{
if (_player.Class.ToLower() == "paladin")
{
Console.WriteLine("You can cast either a heal or a smite. The effectiveness of either is determined by your SpellPower and both consume Wisdom.");
}
}
}
private static void AttackMob()
{
if (!_player.CurrentLocation.HasMob) //|| (_player.CurrentLocation.)isDead)
{
Console.WriteLine("There is nothing here to attack");
}
else
{
if (_player.CurrentWeapon == null)
{
// Select the first weapon in the player's inventory
// (or 'null', if they do not have any weapons)
_player.CurrentWeapon = _player.Weapons.FirstOrDefault();
}
if (_player.CurrentWeapon == null)
{
Console.WriteLine("You do not have any weapons");
}
else
{
try
{
if (_player.Class.ToLower() == "rogue")
{
//_player.UseWeapon(_player.CurrentWeapon);
try
{
_player.UseWeapon(_player.CurrentOffhand);
}
catch (NullReferenceException ex) { }
}
if(_player.Class.ToLower() == "huntsman")
{
_player.UseWeapon(_player.CurrentWeapon);
try
{
_player.UseWeapon(_player.CurrentPet);
}
catch (NullReferenceException ex) { }
}
else
{
_player.UseWeapon(_player.CurrentWeapon);
}
}
catch (NullReferenceException ex)
{
Console.ForegroundColor = ConsoleColor.DarkYellow;
Console.WriteLine("This monster is already dead.");
Console.ResetColor();
}
//_player.UseWeapon(_player.CurrentWeapon);northhhh
}
}
}
private static void EquipWeapon(string input)
{
//somehow adapt this so rogues get two. Best practices would be to make it the same method instead of EquipWeapon + nearly-identical equipOffhand
// int currHealth = _player.Health;
// int currWisdom = _player.Wisdom;
// int currStrength = _player.Strength;
// int currSpellPower = _player.SpellPower;
// int currdetermination = _player.Determination;
string inputWeaponName = input.Substring(6).Trim();
if (string.IsNullOrEmpty(inputWeaponName))
{
Console.WriteLine("You must enter the name of the weapon to equip");
}
else
{
Weapon weaponToEquip =
_player.Weapons.SingleOrDefault(
x => x.Name.ToLower() == inputWeaponName || x.NamePlural.ToLower() == inputWeaponName);
if (weaponToEquip == null)
{
Console.WriteLine("You do not have the weapon: {0}", inputWeaponName);
}
if (weaponToEquip.Type.ToLower() == "pet")
{
// cannot equip pet
}
else
{
RemoveWeapon();
_player.CurrentWeapon = weaponToEquip;
Console.WriteLine("You equip your {0}", _player.CurrentWeapon.Name);
if (weaponToEquip.Stat != null)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" - Your {0} has increased by {1}", weaponToEquip.Stat, weaponToEquip.StatInt);
Console.ResetColor();
switch (weaponToEquip.Stat.ToLower())
{
case "health":
_player.Health += weaponToEquip.StatInt;
_player.CurrentHealth++;
//_player.Health -= weaponToRemove.StatInt;
break;
case "wisdom":
_player.Wisdom += weaponToEquip.StatInt;
_player.CurrentWisdom++;
break;
case "strength":
_player.Strength += weaponToEquip.StatInt;
break;
case "spellpower":
_player.SpellPower += weaponToEquip.StatInt;
break;
case "determination":
_player.Determination += weaponToEquip.StatInt;
break;
default:
Console.WriteLine("ERROR ASSIGNING BUFFS!!!");
break;
}
}
if (weaponToEquip.Stat2 != null)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" - Your {0} has increased by {1}", weaponToEquip.Stat2, weaponToEquip.StatInt2);
Console.ResetColor();
switch (weaponToEquip.Stat2.ToLower())
{
case "health":
_player.Health += weaponToEquip.StatInt2;
break;
case "wisdom":
_player.Wisdom += weaponToEquip.StatInt2;
break;
case "strength":
_player.Strength += weaponToEquip.StatInt2;
break;
case "spellpower":
_player.SpellPower += weaponToEquip.StatInt2;
break;
case "determination":
_player.Determination += weaponToEquip.StatInt2;
break;
default:
Console.WriteLine("ERROR ASSIGNING BUFFS!!! (2)");
break;
}
}
}
}
//}
}
private static void RemoveWeapon()
{
Weapon weaponToRemove = _player.CurrentWeapon;
if (_player.CurrentWeapon != null)
{
if (_player.CurrentWeapon.Stat != null)
{
switch (weaponToRemove.Stat.ToLower())
{
case "health":
_player.Health -= weaponToRemove.StatInt;
if (_player.CurrentHealth >= _player.Health) { _player.CurrentHealth = _player.Health; }
break;
case "wisdom":
_player.Wisdom -= weaponToRemove.StatInt;
if (_player.CurrentWisdom >= _player.Wisdom) { _player.CurrentWisdom = _player.Wisdom; }
break;
case "strength":
_player.Strength -= weaponToRemove.StatInt;
break;
case "spellpower":
_player.SpellPower -= weaponToRemove.StatInt;
break;
case "determination":
_player.Determination -= weaponToRemove.StatInt;
break;
default:
Console.WriteLine("ERROR ASSIGNING BUFFS!!!");
break;
}
}
if (weaponToRemove.Stat2 != null)
{
switch (weaponToRemove.Stat2.ToLower())
{
case "health":
_player.Health -= weaponToRemove.StatInt2;
if (_player.CurrentHealth >= _player.Health) { _player.CurrentHealth = _player.Health; }
//_player.Health -= weaponToRemove.StatInt;
break;
case "wisdom":
_player.Wisdom -= weaponToRemove.StatInt2;
if (_player.CurrentWisdom >= _player.Wisdom) { _player.CurrentWisdom = _player.Wisdom; }
break;
case "strength":
_player.Strength -= weaponToRemove.StatInt2;
break;
case "spellpower":
_player.SpellPower -= weaponToRemove.StatInt2;
break;
case "determination":
_player.Determination -= weaponToRemove.StatInt2;
break;
default:
Console.WriteLine("ERROR ASSIGNING BUFFS!!! (2)");
break;
}
}
}
}
private static void EquipOffhand(string input)
{
string inputWeaponName = input.Substring(8).Trim();
if (string.IsNullOrEmpty(inputWeaponName))
{
Console.WriteLine("You must enter the name of the weapon to equip");
}
else
{
Weapon weaponToEquip =
_player.Weapons.SingleOrDefault(
x => x.Name.ToLower() == inputWeaponName || x.NamePlural.ToLower() == inputWeaponName);
Console.ForegroundColor = ConsoleColor.Red;
if (weaponToEquip == null)
{
try
{
Console.WriteLine("You do not have the weapon: {0}", inputWeaponName);
}
catch (NullReferenceException ex)
{
Console.WriteLine("You do not have the weapon: {0}", inputWeaponName);
}
Console.ResetColor();
}
else
{
if (weaponToEquip.Type == "dagger")
{
Console.ResetColor();
RemoveOffhand();
_player.CurrentOffhand = weaponToEquip;
if (_player.CurrentWeapon == weaponToEquip)
{
RemoveWeapon();
}
Console.WriteLine("You equip your {0}", _player.CurrentOffhand.Name);
if (weaponToEquip.Stat != null)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" - Your {0} has increased by {1}", weaponToEquip.Stat, weaponToEquip.StatInt);
Console.ResetColor();
switch (weaponToEquip.Stat.ToLower())
{
case "health":
_player.Health += weaponToEquip.StatInt;
_player.CurrentHealth++;
//_player.Health -= weaponToRemove.StatInt;
break;
case "wisdom":
_player.Wisdom += weaponToEquip.StatInt;
_player.CurrentWisdom++;
break;
case "strength":
_player.Strength += weaponToEquip.StatInt;
break;
case "spellpower":
_player.SpellPower += weaponToEquip.StatInt;
break;
case "determination":
_player.Determination += weaponToEquip.StatInt;
break;
default:
Console.WriteLine("ERROR ASSIGNING BUFFS!!!");
break;
}
}
if (weaponToEquip.Stat2 != null)
{
Console.ForegroundColor = ConsoleColor.Green;
Console.WriteLine(" - Your {0} has increased by {1}", weaponToEquip.Stat2, weaponToEquip.StatInt2);
Console.ResetColor();
switch (weaponToEquip.Stat2.ToLower())
{
case "health":
_player.Health += weaponToEquip.StatInt2;
break;
case "wisdom":
_player.Wisdom += weaponToEquip.StatInt2;
break;
case "strength":
_player.Strength += weaponToEquip.StatInt2;
break;
case "spellpower":
_player.SpellPower += weaponToEquip.StatInt2;