-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathEncounters.cs
223 lines (188 loc) · 7.86 KB
/
Encounters.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
using System;
namespace Helvete
{
public class Encounters
{
static readonly Random rand = new Random();
//Encounter Generic
//Encounters
public static void FirstEncounter()
{
Console.WriteLine("You throw open the door and grab a rusty metal sword while charging toward your captor.");
Console.WriteLine("He turns...");
Console.ReadKey();
Combat(false, "Human Rogue", 1, 4);
}
public static void BasicEncounter()
{
Console.Clear();
Console.WriteLine("You turn the corner and there you see a hulking beast...");
Console.ReadKey();
Combat(true, "", 0, 0);
}
public static void WizardEncounter()
{
Console.Clear();
Console.WriteLine("The door slowly creaks open as you peer into the dark room. You see a tall man with a ");
Console.WriteLine("long beard looking at large tome.");
Console.ReadKey();
Combat(false, "Dark Wizard", 10, 20);
}
//Encounter Tools
public static void RandomEncounter()
{
switch(rand.Next(0, 2))
{
case 0:
BasicEncounter();
break;
case 1:
WizardEncounter();
break;
}
}
public static void Combat(bool random, string name, int power, int health)
{
string n = "";
int p = 0;
int h = 0;
if (random)
{
n = GetName();
p = Program.currentPlayer.GetPower();
h = Program.currentPlayer.GetHealth();
}
else
{
n = name;
p = power;
h = health;
}
while (h > 0)
{
Console.Clear();
Console.WriteLine(n);
Console.WriteLine(p + "/" + h);
Console.WriteLine("==========================");
Console.WriteLine("| (A)ttack (D)efend |");
Console.WriteLine("| (R)un (H)eal |");
Console.WriteLine("==========================");
Console.WriteLine(" Potions: " + Program.currentPlayer.potion + " Health: " + Program.currentPlayer.health);
string input = Console.ReadLine();
if (input.ToLower() == "a" || input.ToLower() == "attack")
{
//Attack
Console.WriteLine("With haste you surge forth, your sword flying in your hands! As you pass, the " + n + " strikes you...");
int damage = p - Program.currentPlayer.armor;
if(damage < 0)
{
damage = 0;
}
int attack = rand.Next(1, Program.currentPlayer.weapon) + rand.Next(1, 4);
Console.WriteLine("You lose " + damage + " health and deal " + attack + " damage");
Program.currentPlayer.health -= damage;
h -= attack;
}
else if (input.ToLower() == "d" || input.ToLower() == "defend")
{
//Defend
Console.WriteLine("As the " + n + " prepares to strike, you ready your sword in a defensive stance...");
int damage = (p/4) - Program.currentPlayer.armor;
if (damage < 0)
{
damage = 0;
}
int attack = rand.Next(0, Program.currentPlayer.weapon)/2;
Console.WriteLine("You lose " + damage + " health and deal " + attack + " damage");
Program.currentPlayer.health -= damage;
h -= attack;
}
else if (input.ToLower() == "r" || input.ToLower() == "run")
{
//Run - 50% chance
if(rand.Next(0,2) == 0)
{
Console.WriteLine("As you sprint away from the " + n + ", its strike catches you in the back, sending you sprawling onto the ground.");
int damage = p - Program.currentPlayer.armor;
if (damage <= 0)
{
damage = 0;
Console.WriteLine("You lose " + damage + " health, but you got trapped and are unable to escape!");
Console.ReadKey();
}
else
{
Console.WriteLine("You lose " + damage + " health and are unable to escape!");
Console.ReadKey();
Shop.LoadShop(Program.currentPlayer);
}
}
else
{
Console.WriteLine("You use your crazy Jiu-Jitsu skills to evade the " + n + " and you successfully escape!");
Console.ReadKey();
//Go to store
}
}
else if (input.ToLower() == "h" || input.ToLower() == "heal")
{
//Heal
if (Program.currentPlayer.potion == 0)
{
Console.WriteLine("As you desperately grasp for a potion in your bag, all that you feel are empty glass flasks...");
int damage = p - Program.currentPlayer.armor;
if (damage < 0)
{
damage = 0;
}
Console.WriteLine("The " + n + " strikes you with a mighty blow and you lose " + damage + " health!");
}
else
{
Console.WriteLine("You reach into your bag and pull out a glowing purple flask. You take a drink.");
int potionValue = 5;
Console.WriteLine("You gain " + potionValue + " health!");
Program.currentPlayer.health += potionValue;
Console.WriteLine("As you were occupied, the " + n + " advanced and struck!");
int damage = (p / 2) - Program.currentPlayer.armor;
if(damage < 0)
{
damage = 0;
}
Console.WriteLine("You lose " + damage + " health.");
}
Console.ReadKey();
}
if(Program.currentPlayer.health <= 0)
{
//Death
Console.WriteLine("The " + n + " stands tall and comes down to strike. You have been slayn by the mighty " + n + "!");
Console.ReadKey();
System.Environment.Exit(0);
}
Console.ReadKey();
}
int c = rand.Next(10, 50);
Console.WriteLine("As you stand victorious over the " + n + ", its body dissolves into " + c + " gold coins!");
Program.currentPlayer.coins += c;
Console.ReadKey();
}
public static string GetName()
{
switch (rand.Next(0, 4))
{
case 0:
return "Skeleton";
case 1:
return "Zombie";
case 2:
return "Human Cultist";
case 3:
return "Grave Robber";
default:
break;
}
return "Human Rogue";
}
}
}