-
Notifications
You must be signed in to change notification settings - Fork 0
/
Program.cs
148 lines (137 loc) · 5.44 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
using Generic_Text_Based_RPG_Epic_Edition.BaseClasses;
using Generic_Text_Based_RPG_Epic_Edition.Enemies;
using Generic_Text_Based_RPG_Epic_Edition.Items;
using System;
using System.IO;
using System.Runtime.InteropServices;
using static System.Console;
namespace Generic_Text_Based_RPG_Epic_Edition
{
internal class Program
{
public static Player CurrentPlayer { get; set; } = new Player();
public static Enemy CurrentEnemy { get; set; }
public static string AppDataDirectory { get; set; } = Environment.GetFolderPath(Environment.SpecialFolder.ApplicationData);
public static string AppDataFolderName { get; set; } = Path.DirectorySeparatorChar + "GTBRPGEE";
public static string FullPath { get; set; }
public static bool MainLoop { get; set; } = true;
[STAThread]
static void Main()
{
Start();
while (MainLoop)
{
Encounters.RandomEncounter();
}
}
static void Start()
{
Enemy.RuntimeGetChildren();
Weapon.RuntimeGetChildren();
Item.RuntimeGetChildren();
if (Directory.Exists(AppDataDirectory + AppDataFolderName) == false)
Directory.CreateDirectory(AppDataDirectory + AppDataFolderName);
FullPath = AppDataDirectory + AppDataFolderName;
Clear();
WriteLine("Generic Text Based RPG - Epic Edition\n");
WriteLine("(N)ew Game");
WriteLine("(L)oad Game");
string input = ReadKey(true).Key.ToString().ToLower();
if (input == "n")
{
NewGame();
}
else if (input == "l")
{
Clear();
if (File.Exists(FullPath + Path.DirectorySeparatorChar + "save.json"))
{
SaveManager.LoadVarStorage(SaveManager.LoadGame());
Shop.RunShop(CurrentPlayer);
Clear();
CurrentEnemy.StartBattle();
}
else
{
WriteLine("You do not have a save.");
ReadKey(true);
Clear();
Start();
}
Clear();
}
else
{
Clear();
WriteLine("Invalid Input (Press Any Button)");
ReadKey();
Start();
}
}
static void NewGame()
{
CurrentPlayer.CurrentWeapon = new Stick();
Clear();
WriteLine("Generic Text Based RPG - Epic Edition\n");
Write("Name (Optional): ");
CurrentPlayer.Name = ReadLine();
Clear();
Write("Do you want to customize your game? \n(YES) (NO) \n");
string customizationInput = ReadLine().ToLower();
if (customizationInput == "yes")
{
Write("Young Traveler, how do you want to see the world? (COLOR NAME)\n");
string Color = ReadLine().ToLower();
if (Color == "red")
BackgroundColor = ConsoleColor.Red;
else if (Color == "blue")
BackgroundColor = ConsoleColor.Blue;
else if (Color == "green")
BackgroundColor = ConsoleColor.Green;
else if (Color == "Cyan")
BackgroundColor = ConsoleColor.Cyan;
else if (Color == "DarkBlue")
BackgroundColor = ConsoleColor.DarkBlue;
else if (Color == "DarkGray")
BackgroundColor = ConsoleColor.DarkGray;
else if (Color == "DarkGreen")
BackgroundColor = ConsoleColor.DarkGreen;
else if (Color == "DarkMagenta")
BackgroundColor = ConsoleColor.DarkMagenta;
else if (Color == "DarkRed")
BackgroundColor = ConsoleColor.DarkRed;
else if (Color == "DarkYellow")
BackgroundColor = ConsoleColor.DarkYellow;
else if (Color == "Gray")
BackgroundColor = ConsoleColor.Gray;
else if (Color == "Magenta")
BackgroundColor = ConsoleColor.Magenta;
else if (Color == "white")
BackgroundColor = ConsoleColor.White;
else if (Color == "Yellow")
BackgroundColor = ConsoleColor.Yellow;
}
else
Clear();
WriteLine("You awake in a bright field. You're feeling dazed and having trouble remembering what happened.\n");
if (CurrentPlayer.Name == "")
WriteLine("You can't even remember your own name...");
#if DEBUG
else if (CurrentPlayer.Name == "Dev Mode")
{
CurrentPlayer.Health = 1000000;
CurrentPlayer.Coins = 1000000;
WriteLine("You remember you are a god.");
}
#endif
else
WriteLine("You remember that your name is " + CurrentPlayer.Name + ".");
WriteLine("(Press any key to continue)");
ReadKey();
Clear();
WriteLine("You wander around in the fields till you find a creature.");
FirstEncounter firstEncounter = new();
firstEncounter.StartBattle();
}
}
}