Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| e4b230a0ad | |||
| 69e6699e26 | |||
| 30793101df | |||
| a1877e7ddb |
704
Actions.cs
704
Actions.cs
@@ -1,295 +1,557 @@
|
||||
/*
|
||||
public interface IAction
|
||||
{
|
||||
void GetAction(Character character);
|
||||
void DoNothing(Character character);
|
||||
void Attack();
|
||||
void HealthPotion();
|
||||
Item Items();
|
||||
void DoAction(Character character, Action action);
|
||||
}
|
||||
*/
|
||||
|
||||
public sealed class Actions //: IAction
|
||||
public sealed class Actions
|
||||
{
|
||||
private static readonly Lazy<Actions> _instance = new Lazy<Actions>(() => new Actions());
|
||||
private Actions() { }
|
||||
|
||||
public static readonly Lazy<Actions> _instance = new Lazy<Actions> (() => new Actions());
|
||||
private Actions() {}
|
||||
public static Actions Instance
|
||||
{
|
||||
get { return _instance.Value; }
|
||||
get {return _instance.Value;}
|
||||
}
|
||||
|
||||
public void GetAction(Character character)
|
||||
public int GetAction(Character character)
|
||||
{
|
||||
/*
|
||||
switch (MenuItem.Description)
|
||||
if (GameState.Instance.heros.Contains(character) && GameState.Instance.herosAIControl == false)
|
||||
{
|
||||
|
||||
default:
|
||||
}
|
||||
*/
|
||||
|
||||
while (true)
|
||||
{
|
||||
var type = character.GetType().ToString();
|
||||
switch (type)
|
||||
int input;
|
||||
while (true)
|
||||
{
|
||||
case "Player": PlayerActions(character); break;
|
||||
case "Skeleton": MonsterActions(character); break;
|
||||
case "UncodedOne": MonsterActions(character); break;
|
||||
default:
|
||||
try
|
||||
{
|
||||
input = Int32.Parse(ColoredConsole.Prompt("Select an action"));
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
ColoredConsole.WriteLine("Sorry. That's not a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
if (input <= 0 || input > character.CharacterEnabledActions.Count)
|
||||
{
|
||||
ColoredConsole.WriteLine("Sorry. That's not a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
break;
|
||||
return input - 1;
|
||||
}
|
||||
}
|
||||
|
||||
public void PlayerActions(Character character)
|
||||
{
|
||||
string? action;
|
||||
|
||||
while (true)
|
||||
else if (GameState.Instance.monsters.Contains(character) && GameState.Instance.monstersAIControl == false)
|
||||
{
|
||||
Console.Clear();
|
||||
GameState.Instance.DisplayStatus();
|
||||
Console.WriteLine($"Current Round: {GameState.Instance.currentRound}");
|
||||
Console.WriteLine("\n1. Do Nothing");
|
||||
Console.WriteLine("2. Punch");
|
||||
if (GameState.Instance.herosAIControl == true)
|
||||
int input;
|
||||
while (true)
|
||||
{
|
||||
action = AIPickAction();
|
||||
input = Int32.Parse(ColoredConsole.Prompt("Select an action"));
|
||||
if (input <= 0 || input > character.CharacterEnabledActions.Count)
|
||||
{
|
||||
ColoredConsole.WriteLine("Sorry. That's not a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
return input - 1;
|
||||
}
|
||||
else if (GameState.Instance.heros.Contains(character) && GameState.Instance.herosAIControl == true)
|
||||
{
|
||||
if (character.currentHP < character.maxHP / 2)
|
||||
{
|
||||
Random random = new Random();
|
||||
int roll = random.Next(1, 5);
|
||||
if (roll == 1)
|
||||
{
|
||||
return 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
else if (GameState.Instance.monsters.Contains(character) && GameState.Instance.monstersAIControl == true)
|
||||
{
|
||||
Random random = new Random();
|
||||
if (character.currentHP < character.maxHP / 2)
|
||||
{
|
||||
int roll = random.Next(1, 5);
|
||||
if (roll == 1)
|
||||
{
|
||||
return roll;
|
||||
}
|
||||
else
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
int notPotionAction = random.Next(0, character.CharacterEnabledActions.Count);
|
||||
if (notPotionAction != 1)
|
||||
{
|
||||
return notPotionAction;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Write($"\n{character.name}, select an action: ");
|
||||
action = Console.ReadLine();
|
||||
while (true)
|
||||
{
|
||||
int notPotionAction = random.Next(0, character.CharacterEnabledActions.Count);
|
||||
if (notPotionAction != 1)
|
||||
{
|
||||
return notPotionAction;
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
switch (action)
|
||||
{
|
||||
case "1": DoNothing(character); break;
|
||||
case "2": Punch(character); break;
|
||||
default:
|
||||
Console.WriteLine("Sorry, you can't do that...");
|
||||
Thread.Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
else return 0;
|
||||
}
|
||||
|
||||
public void MonsterActions(Character character)
|
||||
public bool DoAction(Character character, int action)
|
||||
{
|
||||
while (true)
|
||||
string actionToDo = character.CharacterEnabledActions[action];
|
||||
if (actionToDo == "Do Nothing")
|
||||
{
|
||||
string? action;
|
||||
Console.Clear();
|
||||
GameState.Instance.DisplayStatus();
|
||||
Console.WriteLine($"Current Round: {GameState.Instance.currentRound}");
|
||||
if (character.name == "Skeleton")
|
||||
{
|
||||
Console.WriteLine("\n1. Do Nothing");
|
||||
Console.WriteLine("2. Bone Crunch");
|
||||
if (GameState.Instance.monstersAIControl == true)
|
||||
{
|
||||
action = AIPickAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Write($"\n{character.name}, select an action: ");
|
||||
action = Console.ReadLine();
|
||||
}
|
||||
switch (action)
|
||||
{
|
||||
case "1": DoNothing(character); break;
|
||||
case "2": BoneCrunch(character); break;
|
||||
default:
|
||||
Console.WriteLine("Sorry, you can't do that...");
|
||||
Thread.Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
if (character.name == "The Uncoded One")
|
||||
{
|
||||
Console.WriteLine("\n1. Do Nothing");
|
||||
Console.WriteLine("2. Unraveling");
|
||||
if (GameState.Instance.monstersAIControl == true)
|
||||
{
|
||||
action = AIPickAction();
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.Write($"\n{character.name}, select and action: ");
|
||||
action = Console.ReadLine();
|
||||
}
|
||||
switch (action)
|
||||
{
|
||||
case "1": DoNothing(character); break;
|
||||
case "2": Unraveling(character); break;
|
||||
default: Console.WriteLine("Sorry, you can't do that...");
|
||||
Thread.Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
break;
|
||||
DoNothing(character);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public Character SelectTarget(Character character)
|
||||
{
|
||||
int target;
|
||||
|
||||
while (true)
|
||||
if (actionToDo == "Punch")
|
||||
{
|
||||
if (GameState.Instance.heros.Contains(character))
|
||||
{
|
||||
Console.WriteLine();
|
||||
int number = 1;
|
||||
foreach (var monster in GameState.Instance.monsters)
|
||||
{
|
||||
Console.WriteLine($"{number}. {monster.name}");
|
||||
number++;
|
||||
}
|
||||
}
|
||||
else if (GameState.Instance.monsters.Contains(character))
|
||||
{
|
||||
int number = 1;
|
||||
Console.WriteLine();
|
||||
foreach (var hero in GameState.Instance.heros)
|
||||
{
|
||||
Console.WriteLine($"{number}. {hero.name}");
|
||||
number++;
|
||||
}
|
||||
}
|
||||
Console.Write("\nSelect a target: ");
|
||||
try
|
||||
{
|
||||
target = Int32.Parse(Console.ReadLine());
|
||||
}
|
||||
catch (System.FormatException)
|
||||
{
|
||||
Console.WriteLine("\nSorry, that's not a valid target...");
|
||||
continue;
|
||||
}
|
||||
try
|
||||
{
|
||||
if (GameState.Instance.heros.Contains(character))
|
||||
{
|
||||
return GameState.Instance.monsters[target - 1];
|
||||
}
|
||||
else if (GameState.Instance.monsters.Contains(character))
|
||||
{
|
||||
return GameState.Instance.heros[target - 1];
|
||||
}
|
||||
}
|
||||
catch (System.ArgumentOutOfRangeException)
|
||||
{
|
||||
Console.WriteLine("\nSorry, that's not a valid target...");
|
||||
continue;
|
||||
}
|
||||
Punch(character);
|
||||
return true;
|
||||
}
|
||||
if (actionToDo == "Sword Attack")
|
||||
{
|
||||
SwordAttack(character);
|
||||
return true;
|
||||
}
|
||||
if (actionToDo == "Health Potion")
|
||||
{
|
||||
HealthPotion(character);
|
||||
return true;
|
||||
}
|
||||
if (actionToDo == "Items")
|
||||
{
|
||||
bool useItem = Items(character);
|
||||
return useItem;
|
||||
}
|
||||
if (actionToDo == "Bone Crunch")
|
||||
{
|
||||
BoneCrunch(character);
|
||||
return true;
|
||||
}
|
||||
if (actionToDo == "Unraveling")
|
||||
{
|
||||
Unraveling(character);
|
||||
return true;
|
||||
}
|
||||
if (actionToDo == "Bow Shot")
|
||||
{
|
||||
BowShot(character);
|
||||
return true;
|
||||
}
|
||||
if (actionToDo == "Quick Shot")
|
||||
{
|
||||
QuickShot(character);
|
||||
return true;
|
||||
}
|
||||
if (actionToDo == "Hero's Sword")
|
||||
{
|
||||
HerosSword(character);
|
||||
return true;
|
||||
}
|
||||
if (actionToDo == "Bite")
|
||||
{
|
||||
Bite(character);
|
||||
return true;
|
||||
}
|
||||
else
|
||||
{
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void DoNothing(Character character)
|
||||
{
|
||||
|
||||
Console.WriteLine($"\n{character.name} does nothing...");
|
||||
Thread.Sleep(1000);
|
||||
ColoredConsole.WriteLine($"\n{character.name} does NOTHING.", ConsoleColor.Yellow);
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
|
||||
public void Punch(Character character)
|
||||
{
|
||||
Character target = null;
|
||||
if (GameState.Instance.herosAIControl == true)
|
||||
var target = GetTarget(character);
|
||||
int damage = character.damageModifier + 1 - target.damageReduction;
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses PUNCH!", ConsoleColor.Yellow);
|
||||
if (target.name == "Amarok")
|
||||
{
|
||||
target = AIPickTarget(character);
|
||||
ColoredConsole.WriteLine("STONE ARMOR reduced damage to Amarok by 1.", ConsoleColor.Red);
|
||||
}
|
||||
ColoredConsole.Write($"{target.name} loses ", ConsoleColor.Cyan);
|
||||
ColoredConsole.Write($"{damage} ", ConsoleColor.Red);
|
||||
ColoredConsole.Write("HP.", ConsoleColor.Cyan);
|
||||
target.currentHP -= damage;
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
|
||||
public void SwordAttack(Character character)
|
||||
{
|
||||
var target = GetTarget(character);
|
||||
int damage;
|
||||
Random random = new Random();
|
||||
|
||||
if (character.equipedItems.Any())
|
||||
{
|
||||
damage = character.damageModifier + character.equipedItems[0].ItemDamageModifier - target.damageReduction;
|
||||
}
|
||||
else
|
||||
{
|
||||
target = SelectTarget(character);
|
||||
damage = character.damageModifier - target.damageReduction;
|
||||
}
|
||||
|
||||
Console.WriteLine($"\n{character.name} uses PUNCH on {target.name}!");
|
||||
Console.WriteLine($"{target.name} took 1 damage!");
|
||||
target.currentHP -= 1;
|
||||
Thread.Sleep(1000);
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses SWORD ATTACK!", ConsoleColor.Yellow);
|
||||
if (target.name == "Amarok")
|
||||
{
|
||||
ColoredConsole.WriteLine("STONE ARMOR reduced damage to Amarok by 1.", ConsoleColor.Red);
|
||||
}
|
||||
ColoredConsole.Write($"{target.name} loses ", ConsoleColor.Cyan);
|
||||
ColoredConsole.Write($"{damage} ", ConsoleColor.Red);
|
||||
ColoredConsole.Write("HP.", ConsoleColor.Cyan);
|
||||
target.currentHP -= damage;
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
|
||||
public void HerosSword(Character character)
|
||||
{
|
||||
var target = GetTarget(character);
|
||||
int damage;
|
||||
Random random = new Random();
|
||||
|
||||
damage = random.Next(1, 4) + character.equipedItems[0].ItemDamageModifier - target.damageReduction;
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses HERO'S SWORD!", ConsoleColor.Yellow);
|
||||
if (target.name == "Amarok")
|
||||
{
|
||||
ColoredConsole.WriteLine("STONE ARMOR reduced damage to Amarok by 1.", ConsoleColor.Red);
|
||||
}
|
||||
ColoredConsole.Write($"{target.name} loses ", ConsoleColor.Cyan);
|
||||
ColoredConsole.Write($"{damage} ", ConsoleColor.Red);
|
||||
ColoredConsole.Write("HP.", ConsoleColor.Cyan);
|
||||
target.currentHP -= damage;
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
|
||||
}
|
||||
|
||||
public void BoneCrunch(Character character)
|
||||
{
|
||||
Character target = null;
|
||||
if (GameState.Instance.monstersAIControl == true)
|
||||
{
|
||||
target = AIPickTarget(character);
|
||||
}
|
||||
else
|
||||
{
|
||||
target = SelectTarget(character);
|
||||
}
|
||||
var target = GetTarget(character);
|
||||
int damage;
|
||||
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses BONE CRUNCH!", ConsoleColor.Yellow);
|
||||
Random random = new Random();
|
||||
int coin = random.Next(1, 101);
|
||||
Console.WriteLine($"\n{character.name} used Bone Crunch on {target.name}!");
|
||||
if (coin > 50)
|
||||
if (character.equipedItems.Any())
|
||||
{
|
||||
Console.WriteLine($"{target.name} took 1 damage!");
|
||||
target.currentHP -= 1;
|
||||
Thread.Sleep(1000);
|
||||
return;
|
||||
damage = random.Next(0, 2) + character.damageModifier + character.equipedItems[0].ItemDamageModifier - target.damageReduction;
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Nothing happened!");
|
||||
Thread.Sleep(1000);
|
||||
return;
|
||||
damage = random.Next(0, 2) - target.damageReduction;
|
||||
}
|
||||
ColoredConsole.Write($"{target.name} loses ", ConsoleColor.Cyan);
|
||||
ColoredConsole.Write($"{damage} ", ConsoleColor.Red);
|
||||
ColoredConsole.Write("HP.", ConsoleColor.Cyan);
|
||||
target.currentHP -= damage;
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
|
||||
public void HealthPotion(Character character)
|
||||
{
|
||||
if (GameState.Instance.heros.Contains(character))
|
||||
{
|
||||
if (GameState.Instance.heroPotionsAvailable > 0)
|
||||
{
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses a HEALTH POTION!", ConsoleColor.Yellow);
|
||||
GameState.Instance.heroPotionsAvailable -= 1;
|
||||
if (character.currentHP + 5 > character.maxHP)
|
||||
{
|
||||
character.currentHP = character.maxHP;
|
||||
ColoredConsole.WriteLine($"{character.name}'s HP is now {character.maxHP}.", ConsoleColor.Green);
|
||||
}
|
||||
else
|
||||
{
|
||||
character.currentHP += 5;
|
||||
ColoredConsole.WriteLine($"{character.name}'s HP is now {character.currentHP}.", ConsoleColor.Green);
|
||||
}
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ColoredConsole.WriteLine("There are no more potions!", ConsoleColor.Red);
|
||||
return;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
if (GameState.Instance.monsterPotionsAvailable > 0)
|
||||
{
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses a HEALTH POTION!", ConsoleColor.Yellow);
|
||||
GameState.Instance.monsterPotionsAvailable -= 1;
|
||||
if (character.currentHP + 5 > character.maxHP)
|
||||
{
|
||||
character.currentHP = character.maxHP;
|
||||
ColoredConsole.WriteLine($"{character.name}'s HP is now {character.maxHP}.", ConsoleColor.Green);
|
||||
}
|
||||
else
|
||||
{
|
||||
character.currentHP += 5;
|
||||
ColoredConsole.WriteLine($"{character.name}'s HP is now {character.currentHP}.", ConsoleColor.Green);
|
||||
}
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
ColoredConsole.WriteLine("There are no more potions!", ConsoleColor.Red);
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public bool Items(Character character)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Console.Clear();
|
||||
GameState.Instance.DisplayStatus();
|
||||
Menu.BuildItemsMenu(character);
|
||||
Item item = GetItem(character);
|
||||
if (item is null)
|
||||
{
|
||||
return false;
|
||||
}
|
||||
//Console.WriteLine(ItemDamageModifier);
|
||||
if (item != null)
|
||||
{
|
||||
Item.EquipItem(character, item);
|
||||
return true;
|
||||
}
|
||||
break;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
public Item? GetItem(Character character)
|
||||
{
|
||||
int selection;
|
||||
while (true)
|
||||
{
|
||||
selection = Int32.Parse(ColoredConsole.Prompt("Select an item")) - 1;
|
||||
if (character.equipedItems.Any() && selection == 0)
|
||||
{
|
||||
Item.UnequipItem(character, character.equipedItems[selection]);
|
||||
return null;
|
||||
}
|
||||
if (!character.equipedItems.Any() && selection >= 0 && selection < GameState.Instance.heroInventory.Count)
|
||||
{
|
||||
break;
|
||||
}
|
||||
if (selection == GameState.Instance.heroInventory.Count)
|
||||
{
|
||||
return null;
|
||||
}
|
||||
else
|
||||
{
|
||||
ColoredConsole.WriteLine("Sorry. That's not a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
Item item = GameState.Instance.heroInventory[selection];
|
||||
return item;
|
||||
}
|
||||
|
||||
public void Unraveling(Character character)
|
||||
{
|
||||
Character target = null;
|
||||
if (GameState.Instance.monstersAIControl == true)
|
||||
var target = GetTarget(character);
|
||||
int damage;
|
||||
Random random = new Random();
|
||||
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses UNRAVELING!", ConsoleColor.Yellow);
|
||||
damage = random.Next(0, 6) - target.damageReduction;
|
||||
ColoredConsole.Write($"{target.name} loses ", ConsoleColor.Cyan);
|
||||
ColoredConsole.Write($"{damage} ", ConsoleColor.Red);
|
||||
ColoredConsole.Write("HP.", ConsoleColor.Cyan);
|
||||
target.currentHP -= damage;
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
|
||||
public void Bite(Character character)
|
||||
{
|
||||
var target = GetTarget(character);
|
||||
int damage;
|
||||
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses BITE!", ConsoleColor.Yellow);
|
||||
damage = character.damageModifier + 1 - target.damageReduction;
|
||||
ColoredConsole.Write($"{target.name} loses ", ConsoleColor.Cyan);
|
||||
ColoredConsole.Write($"{damage} ", ConsoleColor.Red);
|
||||
ColoredConsole.Write("HP.", ConsoleColor.Cyan);
|
||||
target.currentHP -= damage;
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
|
||||
public void BowShot(Character character)
|
||||
{
|
||||
var target = GetTarget(character);
|
||||
int damage;
|
||||
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses BOW SHOT!", ConsoleColor.Yellow);
|
||||
if (target.name == "Amarok")
|
||||
{
|
||||
target = AIPickTarget(character);
|
||||
ColoredConsole.WriteLine("STONE ARMOR reduced damage to Amarok by 1.", ConsoleColor.Red);
|
||||
}
|
||||
damage = character.equipedItems[0].ItemDamageModifier - target.damageReduction;
|
||||
ColoredConsole.Write($"{target.name} loses ", ConsoleColor.Cyan);
|
||||
ColoredConsole.Write($"{damage} ", ConsoleColor.Red);
|
||||
ColoredConsole.Write($"HP.", ConsoleColor.Cyan);
|
||||
target.currentHP -= damage;
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
|
||||
public void QuickShot(Character character)
|
||||
{
|
||||
var target = GetTarget(character);
|
||||
int damage;
|
||||
Random random = new Random();
|
||||
|
||||
ColoredConsole.WriteLine($"\n{character.name} uses QUICK SHOT!", ConsoleColor.Yellow);
|
||||
int roll = random.Next(1, 101);
|
||||
if (roll < 50)
|
||||
{
|
||||
ColoredConsole.WriteLine("Nothing happened!", ConsoleColor.Yellow);
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
else
|
||||
{
|
||||
target = SelectTarget(character);
|
||||
}
|
||||
Random random = new Random();
|
||||
Console.WriteLine($"\n{character.name} used Unraveling on {target.name}!");
|
||||
int damage = random.Next(3);
|
||||
if (damage > 0)
|
||||
{
|
||||
Console.WriteLine($"{target.name} took {damage} damage!");
|
||||
if (target.name == "Amarok")
|
||||
{
|
||||
ColoredConsole.WriteLine("STONE ARMOR reduced damage to Amarok by 1.", ConsoleColor.Red);
|
||||
}
|
||||
damage = random.Next(2,6) - target.damageReduction;
|
||||
ColoredConsole.Write($"{target.name} loses ", ConsoleColor.Cyan);
|
||||
ColoredConsole.Write($"{damage} ", ConsoleColor.Red);
|
||||
ColoredConsole.Write($"HP.", ConsoleColor.Cyan);
|
||||
target.currentHP -= damage;
|
||||
Thread.Sleep(1000);
|
||||
Thread.Sleep(1500);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
public Character AIPickTarget(Character character)
|
||||
public Character GetTarget(Character character)
|
||||
{
|
||||
Random random = new Random();
|
||||
if (GameState.Instance.heros.Contains(character))
|
||||
if (GameState.Instance.heros.Contains(character) && GameState.Instance.herosAIControl == false)
|
||||
{
|
||||
var lastItem = GameState.Instance.monsters.Count();
|
||||
var target = random.Next(1, lastItem + 1);
|
||||
return GameState.Instance.monsters[target - 1];
|
||||
while (true)
|
||||
{
|
||||
foreach (Character monster in GameState.Instance.monsters)
|
||||
{
|
||||
int index = GameState.Instance.monsters.IndexOf(monster) + 1;
|
||||
int indexOf = GameState.Instance.monsters.IndexOf(monster);
|
||||
int indexLast = GameState.Instance.monsters.IndexOf(GameState.Instance.monsters[^1]);
|
||||
Console.Write($"{index}. {monster.name}");
|
||||
if (indexOf != indexLast && index != GameState.Instance.monsters.Count())
|
||||
{
|
||||
Console.Write("\n");
|
||||
}
|
||||
}
|
||||
try
|
||||
{
|
||||
int target = Int32.Parse(ColoredConsole.Prompt("\nSelect a target"));
|
||||
return GameState.Instance.monsters[target - 1];
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
ColoredConsole.WriteLine("\nSorry. That's not a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
ColoredConsole.WriteLine("\nSorry. That's not a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
else if (GameState.Instance.monsters.Contains(character) && GameState.Instance.monstersAIControl == false)
|
||||
{
|
||||
var lastItem = GameState.Instance.heros.Count();
|
||||
var target = random.Next(1, lastItem + 1);
|
||||
return GameState.Instance.heros[target - 1];
|
||||
while (true)
|
||||
{
|
||||
foreach (Character hero in GameState.Instance.heros)
|
||||
{
|
||||
int index = GameState.Instance.heros.IndexOf(hero) + 1;
|
||||
Console.Write($"{index}. {hero.name}");
|
||||
}
|
||||
try
|
||||
{
|
||||
int target = Int32.Parse(ColoredConsole.Prompt("\nSelect a target"));
|
||||
return GameState.Instance.heros[target - 1];
|
||||
}
|
||||
catch (ArgumentOutOfRangeException)
|
||||
{
|
||||
ColoredConsole.WriteLine("\nSorry. That's not a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
ColoredConsole.WriteLine("\nSorry. That's not a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public string AIPickAction()
|
||||
{
|
||||
Random random = new Random();
|
||||
Thread.Sleep(1000);
|
||||
return random.Next(1, 3).ToString();
|
||||
else if (GameState.Instance.heros.Contains(character) && GameState.Instance.herosAIControl == true)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Random random = new Random();
|
||||
int index = random.Next(0, GameState.Instance.monsters.Count);
|
||||
if (GameState.Instance.monsters.Contains(GameState.Instance.monsters[index]))
|
||||
{
|
||||
return GameState.Instance.monsters[index];
|
||||
}
|
||||
else continue;
|
||||
}
|
||||
}
|
||||
else if (GameState.Instance.monsters.Contains(character) && GameState.Instance.monstersAIControl == true)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
Random random = new Random();
|
||||
int index = random.Next(0, GameState.Instance.heros.Count);
|
||||
if (GameState.Instance.heros.Contains(GameState.Instance.heros[index]))
|
||||
{
|
||||
return GameState.Instance.heros[index];
|
||||
}
|
||||
else continue;
|
||||
}
|
||||
}
|
||||
else return GameState.Instance.heros[0];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
11
Amarok.cs
Normal file
11
Amarok.cs
Normal file
@@ -0,0 +1,11 @@
|
||||
public class Amarok : Character
|
||||
{
|
||||
public Amarok()
|
||||
{
|
||||
maxHP = 4;
|
||||
currentHP = maxHP;
|
||||
name = "Amarok";
|
||||
damageReduction = 1;
|
||||
CharacterEnabledActions.AddRange("Bite", "Health Potion", "Do Nothing");
|
||||
}
|
||||
}
|
||||
@@ -4,7 +4,10 @@ public abstract class Character
|
||||
public int maxHP {get; set;}
|
||||
public int currentHP {get; set;}
|
||||
public bool dead {get; set;} = false;
|
||||
public string turnMarker = "*";
|
||||
public bool isTurn {get; set;} = false;
|
||||
//public List<Actions>CharacterEnabledActions = new List<Actions>();
|
||||
public bool isTurn {get; set;}
|
||||
public List<string>? CharacterEnabledActions = new List<string>();
|
||||
public int damageReduction {get; set;} = 0;
|
||||
public int damageModifier {get; set;} = 0;
|
||||
public List<Item>? equipedItems = new List<Item>();
|
||||
public List<string>? CharacterDisabledActions = new List<string>();
|
||||
}
|
||||
|
||||
36
ColoredConsole.cs
Normal file
36
ColoredConsole.cs
Normal file
@@ -0,0 +1,36 @@
|
||||
public static class ColoredConsole
|
||||
{
|
||||
public static void WriteLine(string text, ConsoleColor color)
|
||||
{
|
||||
ConsoleColor previousColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = color;
|
||||
Console.WriteLine(text);
|
||||
Console.ForegroundColor = previousColor;
|
||||
}
|
||||
|
||||
public static void Write(string text, ConsoleColor color)
|
||||
{
|
||||
ConsoleColor previousColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = color;
|
||||
Console.Write(text);
|
||||
Console.ForegroundColor = previousColor;
|
||||
}
|
||||
|
||||
public static string Prompt(string text)
|
||||
{
|
||||
try
|
||||
{
|
||||
ConsoleColor previousColor = Console.ForegroundColor;
|
||||
Console.ForegroundColor = ConsoleColor.Green;
|
||||
Console.Write($"{text}: ");
|
||||
Console.ForegroundColor = ConsoleColor.Cyan;
|
||||
string input = Console.ReadLine() ?? "";
|
||||
Console.ForegroundColor = previousColor;
|
||||
return input;
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
throw;
|
||||
}
|
||||
}
|
||||
}
|
||||
116
GameState.cs
116
GameState.cs
@@ -11,32 +11,31 @@ public sealed class GameState
|
||||
public List<Character> monsters = new List<Character>();
|
||||
public List<Character> heroRemove = new List<Character>();
|
||||
public List<Character> monsterRemove = new List<Character>();
|
||||
public List<Item> heroInventory = new List<Item>();
|
||||
public int currentRound = 1;
|
||||
public bool gameOver = false;
|
||||
public bool herosAIControl = false;
|
||||
public bool monstersAIControl = true;
|
||||
public bool lastRound = false;
|
||||
public int heroPotionsAvailable = 5;
|
||||
public int monsterPotionsAvailable = 2;
|
||||
public bool BowIsEquippedBy = false;
|
||||
public bool SwordIsEquippedBy = false;
|
||||
|
||||
/*
|
||||
public record MenuItem
|
||||
{
|
||||
string? Description;
|
||||
bool IsEnabled;
|
||||
IAction? ActionToPerform;
|
||||
}
|
||||
|
||||
public void BuildMenu()
|
||||
{
|
||||
foreach (action in Character.EnabledActions)
|
||||
int number = 1;
|
||||
}
|
||||
*/
|
||||
//Menu menu = new Menu();
|
||||
|
||||
public void Run()
|
||||
{
|
||||
Sword heroSword = new Sword();
|
||||
Bow bow = new Bow();
|
||||
VinFletcher vin = new VinFletcher();
|
||||
heroInventory.Add(heroSword);
|
||||
heroInventory.Add(bow);
|
||||
heros.Add(vin);
|
||||
Rounds(currentRound);
|
||||
while (gameOver == false)
|
||||
{
|
||||
int action;
|
||||
GameOver();
|
||||
if (gameOver == true)
|
||||
{
|
||||
@@ -46,22 +45,52 @@ public sealed class GameState
|
||||
{
|
||||
foreach (Character hero in heros)
|
||||
{
|
||||
BeginHeroTurn:
|
||||
hero.isTurn = true;
|
||||
Actions.Instance.GetAction(hero);
|
||||
CheckDead();
|
||||
hero.isTurn = false;
|
||||
Console.Clear();
|
||||
DisplayStatus();
|
||||
if (GameState.Instance.herosAIControl == false)
|
||||
{
|
||||
Menu.BuildMenu(hero);
|
||||
}
|
||||
action = Actions.Instance.GetAction(hero);
|
||||
bool actionPerformed = Actions.Instance.DoAction(hero, action);
|
||||
if (actionPerformed == true)
|
||||
{
|
||||
Console.Clear();
|
||||
DisplayStatus();
|
||||
CheckDead();
|
||||
foreach (Character monster in monsterRemove)
|
||||
{
|
||||
monsters.Remove(monster);
|
||||
}
|
||||
hero.isTurn = false;
|
||||
}
|
||||
else
|
||||
{
|
||||
goto BeginHeroTurn;
|
||||
}
|
||||
if (!monsters.Any())
|
||||
{
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
foreach (Character monster in monsterRemove)
|
||||
{
|
||||
monsters.Remove(monster);
|
||||
}
|
||||
if (monsters.Any() && heros.Any())
|
||||
{
|
||||
foreach (Character monster in monsters)
|
||||
{
|
||||
monster.isTurn = true;
|
||||
Actions.Instance.GetAction(monster);
|
||||
Console.Clear();
|
||||
DisplayStatus();
|
||||
if (GameState.Instance.monstersAIControl == false)
|
||||
{
|
||||
Menu.BuildMenu(monster);
|
||||
}
|
||||
action = Actions.Instance.GetAction(monster);
|
||||
Actions.Instance.DoAction(monster, action);
|
||||
Console.Clear();
|
||||
DisplayStatus();
|
||||
CheckDead();
|
||||
foreach (Character hero in heroRemove)
|
||||
{
|
||||
@@ -167,47 +196,52 @@ public sealed class GameState
|
||||
if (currentRound == 2)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("You are victorious in your first battle!");
|
||||
Thread.Sleep(2000);
|
||||
Console.WriteLine("\nAs you make your way deeper into the Uncoded One's fortress"
|
||||
+ "\nmore enemies appear to block your way to defeat their master...");
|
||||
ColoredConsole.WriteLine("You are victorious in your first battle!", ConsoleColor.Green);
|
||||
Thread.Sleep(1500);
|
||||
ColoredConsole.WriteLine("\nAs you make your way deeper into the Uncoded One's fortress"
|
||||
+ "\nmore enemies appear to block your way to defeat their master...", ConsoleColor.Cyan);
|
||||
Console.WriteLine("\n\nPress Enter to continue...");
|
||||
Console.ReadLine();
|
||||
Skeleton skeleton1 = new Skeleton();
|
||||
Skeleton skeleton2 = new Skeleton();
|
||||
monsters.AddRange(skeleton1, skeleton2);
|
||||
Amarok amarok1 = new Amarok();
|
||||
monsters.AddRange(skeleton1, skeleton2, amarok1);
|
||||
}
|
||||
if (currentRound == 3)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.WriteLine("You have completed the second battle in your assualt on the"
|
||||
+ " Uncoded One's fortress!");
|
||||
Thread.Sleep(2000);
|
||||
Console.WriteLine("\nAs you move deeper into the fortress, you come upon two great"
|
||||
ColoredConsole.WriteLine("You have completed the second battle in your assualt on the"
|
||||
+ " Uncoded One's fortress!", ConsoleColor.Green);
|
||||
Thread.Sleep(1500);
|
||||
ColoredConsole.WriteLine("\nAs you move deeper into the fortress, you come upon two great"
|
||||
+ "\nsteel doors set into a wall of stone. You push open the doors, and"
|
||||
+ "\nfind yourself in the Uncoded One's throne room. The Uncoded One stands"
|
||||
+ "\nfrom his throne of blackened steel and hisses, \"You have finally"
|
||||
+ "\nappeared before me True Programmer. Now you will die, and the world"
|
||||
+ "\nwill be mine!\"");
|
||||
+ "\nwill be mine!\"", ConsoleColor.Cyan);
|
||||
Console.WriteLine("\n\nPress Enter to continue...");
|
||||
Console.ReadLine();
|
||||
Amarok amarok1 = new Amarok();
|
||||
Amarok amarok2 = new Amarok();
|
||||
Skeleton skeleton1 = new Skeleton();
|
||||
Skeleton skeleton2 = new Skeleton();
|
||||
Skeleton skeleton3 = new Skeleton();
|
||||
UncodedOne uncodedOne = new UncodedOne();
|
||||
monsters.AddRange(skeleton1, skeleton2, skeleton3, uncodedOne);
|
||||
monsters.AddRange(skeleton1, skeleton2, skeleton3, amarok1, amarok2, uncodedOne);
|
||||
}
|
||||
}
|
||||
|
||||
public void HerosWin()
|
||||
{
|
||||
Console.Clear();
|
||||
Thread.Sleep(2000);
|
||||
Console.WriteLine("As you strike the Uncoded One down, the sky brightens and the"
|
||||
+ " miasma\nsurrounding his dark fortress begins to lift...\n\n"
|
||||
+ "You are victorious!\n\nTrue Programming has been restored to the lands, and"
|
||||
Thread.Sleep(1500);
|
||||
ColoredConsole.WriteLine("As you strike the Uncoded One down, the sky brightens and the"
|
||||
+ " miasma\nsurrounding his dark fortress begins to lift...\n\n", ConsoleColor.Cyan);
|
||||
ColoredConsole.Write("You are ", ConsoleColor.Cyan);
|
||||
ColoredConsole.WriteLine("VICTORIOUS!\n\n", ConsoleColor.Green);
|
||||
ColoredConsole.WriteLine("True Programming has been brough back to the lands, and"
|
||||
+ " the people\ncan now improve their lives through the various arts of code you\n"
|
||||
+ "have helped restore...");
|
||||
+ "have helped restore...", ConsoleColor.Cyan);
|
||||
Console.WriteLine("\nPress Enter to exit your final challenge, True Programmer!");
|
||||
Console.ReadLine();
|
||||
}
|
||||
@@ -215,11 +249,11 @@ public sealed class GameState
|
||||
public void MonstersWin()
|
||||
{
|
||||
Console.Clear();
|
||||
Thread.Sleep(2000);
|
||||
Console.WriteLine("You have been brutally struck down by the Uncoded One and his evil\n"
|
||||
Thread.Sleep(1500);
|
||||
ColoredConsole.WriteLine("You have been brutally struck down by the Uncoded One and his evil\n"
|
||||
+ "minions. This is a devastating loss for the all the people whom you have helped...\n"
|
||||
+ "The Uncoded One will now reign supreme in unchecked war against the entire land, and\n"
|
||||
+ "\nTrue Programming may forever be lost...");
|
||||
+ "\nTrue Programming may forever be lost...", ConsoleColor.Red);
|
||||
Console.ReadLine();
|
||||
}
|
||||
}
|
||||
|
||||
107
Item.cs
Normal file
107
Item.cs
Normal file
@@ -0,0 +1,107 @@
|
||||
public abstract class Item
|
||||
{
|
||||
public string? Description {get; set;}
|
||||
public int ItemDamageModifier {get; set;} = 0;
|
||||
public int ItemDamageReduction {get; set;} = 0;
|
||||
public string? ActionEnable {get; set;}
|
||||
public string? IsEquippedBy {get; set;}
|
||||
|
||||
public static void EquipItem(Character character, Item item)
|
||||
{
|
||||
if (character.equipedItems.Count == 0)
|
||||
{
|
||||
ColoredConsole.WriteLine($"{character.name} has equipped {item.Description}", ConsoleColor.Yellow);
|
||||
Thread.Sleep(1500);
|
||||
item.IsEquippedBy = character.name;
|
||||
character.equipedItems.Insert(0, item);
|
||||
GameState.Instance.heroInventory.Remove(item);
|
||||
character.CharacterEnabledActions[0] = Convert.ToString(item.ActionEnable);
|
||||
CheckEquipped(character, item);
|
||||
}
|
||||
else
|
||||
{
|
||||
ColoredConsole.WriteLine($"{character.name} has unequipped {character.equipedItems[0].Description}.", ConsoleColor.Yellow);
|
||||
ColoredConsole.WriteLine($"{character.name} has equipped {item.Description}", ConsoleColor.Yellow);
|
||||
Thread.Sleep(1500);
|
||||
item.IsEquippedBy = character.name;
|
||||
foreach (Item equipped in character.equipedItems)
|
||||
{
|
||||
GameState.Instance.heroInventory.Add(equipped);
|
||||
}
|
||||
character.equipedItems.Clear();
|
||||
character.equipedItems.Insert(0, item);
|
||||
GameState.Instance.heroInventory.Remove(item);
|
||||
character.CharacterEnabledActions[0] = Convert.ToString(item.ActionEnable);
|
||||
CheckEquipped(character, item);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
public static void UnequipItem(Character character, Item item)
|
||||
{
|
||||
ColoredConsole.WriteLine($"{character.name} has unequipped {item.Description}.", ConsoleColor.Yellow);
|
||||
Thread.Sleep(1500);
|
||||
GameState.Instance.heroInventory.Insert(0, item);
|
||||
character.equipedItems.Clear();
|
||||
character.CharacterEnabledActions.Insert(0, "Punch");
|
||||
character.CharacterEnabledActions.Remove(item.ActionEnable);
|
||||
return;
|
||||
}
|
||||
|
||||
public static void CheckEquipped(Character character, Item item)
|
||||
{
|
||||
if (character.name == "Vin Fletcher")
|
||||
{
|
||||
if (item.Description == "Vin's Bow")
|
||||
{
|
||||
character.CharacterEnabledActions[0] = "Quick Shot";
|
||||
return;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
if (character.name != "Vin Fletcher")
|
||||
{
|
||||
if (item.Description == "Hero's Sword")
|
||||
{
|
||||
character.CharacterEnabledActions[0] = "Hero's Sword";
|
||||
return;
|
||||
}
|
||||
else return;
|
||||
}
|
||||
else
|
||||
{
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
public class Sword : Item
|
||||
{
|
||||
public Sword()
|
||||
{
|
||||
Description = "Hero's Sword";
|
||||
ItemDamageModifier = 2;
|
||||
ActionEnable = "Sword Attack";
|
||||
}
|
||||
}
|
||||
|
||||
class Armor : Item
|
||||
{
|
||||
public Armor()
|
||||
{
|
||||
Description = "Armor";
|
||||
ItemDamageReduction = 1;
|
||||
}
|
||||
}
|
||||
|
||||
class Bow : Item
|
||||
{
|
||||
public Bow()
|
||||
{
|
||||
Description = "Vin's Bow";
|
||||
ItemDamageModifier = 2;
|
||||
ActionEnable = "Bow Shot";
|
||||
}
|
||||
|
||||
}
|
||||
35
Menu.cs
Normal file
35
Menu.cs
Normal file
@@ -0,0 +1,35 @@
|
||||
public struct Menu
|
||||
{
|
||||
public static void BuildMenu(Character character)
|
||||
{
|
||||
int index = 1;
|
||||
foreach (string action in character.CharacterEnabledActions)
|
||||
{
|
||||
if (action == "Health Potion")
|
||||
{
|
||||
Console.WriteLine($"{index}. {action} ({GameState.Instance.heroPotionsAvailable})");
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine($"{index}. {action}");
|
||||
}
|
||||
index++;
|
||||
}
|
||||
}
|
||||
|
||||
public static void BuildItemsMenu(Character character)
|
||||
{
|
||||
int index = 1;
|
||||
if (character.equipedItems.Any())
|
||||
{
|
||||
Console.WriteLine($"{index}. Unequip {character.equipedItems[0].Description}");
|
||||
index++;
|
||||
}
|
||||
foreach (Item item in GameState.Instance.heroInventory)
|
||||
{
|
||||
Console.WriteLine($"{index}. {item.Description}");
|
||||
index++;
|
||||
}
|
||||
Console.WriteLine($"{index}. Go back");
|
||||
}
|
||||
}
|
||||
43
Player.cs
43
Player.cs
@@ -2,20 +2,43 @@ public class Player : Character
|
||||
{
|
||||
public Player()
|
||||
{
|
||||
maxHP = 10;
|
||||
currentHP = maxHP;
|
||||
name = GetName();
|
||||
//List<IherosAction>CharacterEnabledActions = new List<IAction>();
|
||||
//CharacterEnabledActions.Add(Actions.Instance.DoNothing()
|
||||
|
||||
maxHP = 25;
|
||||
currentHP = maxHP;
|
||||
dead = false;
|
||||
CharacterEnabledActions.AddRange("Punch", "Health Potion", "Items", "Do Nothing");
|
||||
}
|
||||
|
||||
public string GetName()
|
||||
{
|
||||
string? input;
|
||||
Console.Write("Enter your player's name: ");
|
||||
input = Console.ReadLine();
|
||||
return input;
|
||||
string input = null;
|
||||
if (GameState.Instance.herosAIControl == false)
|
||||
{
|
||||
while (true)
|
||||
{
|
||||
try
|
||||
{
|
||||
input = ColoredConsole.Prompt("Enter your name");
|
||||
if (input.Length < 1)
|
||||
{
|
||||
ColoredConsole.WriteLine("Sorry, that isn't a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return input;
|
||||
}
|
||||
}
|
||||
catch (FormatException)
|
||||
{
|
||||
ColoredConsole.WriteLine("Sorry, that isn't a valid input.", ConsoleColor.Red);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return "The True Programmer";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
70
Program.cs
70
Program.cs
@@ -1,62 +1,56 @@
|
||||
string? input;
|
||||
|
||||
Console.Clear();
|
||||
Console.WriteLine("Welcome True Programmer, to the final battle for the realms of C#.");
|
||||
Console.WriteLine("------------------------------------------------------------------");
|
||||
ColoredConsole.WriteLine("------------------------------------------------------------------", ConsoleColor.Cyan);
|
||||
ColoredConsole.WriteLine("Welcome True Programmer, to the final battle for the realms of C#.", ConsoleColor.Cyan);
|
||||
Thread.Sleep(1000);
|
||||
Console.WriteLine("\nThis will be the final battle against the Uncoded One..."
|
||||
+ "\nAre you ready?");
|
||||
Console.WriteLine("--------------------------------------------------------"
|
||||
+ "--------------");
|
||||
ColoredConsole.WriteLine("\nThis will be the final battle against the Uncoded One..."
|
||||
+ "\nAre you ready?", ConsoleColor.Cyan);
|
||||
ColoredConsole.WriteLine("--------------------------------------------------------"
|
||||
+ "----------", ConsoleColor.Cyan);
|
||||
Console.ReadLine();
|
||||
|
||||
while (true)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.Write("\nWould you like the heroes party to be controlled by AI? (yes/no): ");
|
||||
input = Console.ReadLine().ToLower();
|
||||
if (input == "yes" || input == "no")
|
||||
try
|
||||
{
|
||||
if (input == "yes")
|
||||
{
|
||||
GameState.Instance.herosAIControl = true;
|
||||
}
|
||||
if (input == "no")
|
||||
Console.Clear();
|
||||
ColoredConsole.WriteLine("Game mode:", ConsoleColor.Green);
|
||||
Console.WriteLine("\n1. Player vs Computer\n2. Player vs Player\n3. Computer vs Computer");
|
||||
ColoredConsole.WriteLine("-----------------------", ConsoleColor.Cyan);
|
||||
input = ColoredConsole.Prompt("Enter a game mode");
|
||||
if (input == "1")
|
||||
{
|
||||
GameState.Instance.herosAIControl = false;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
Console.WriteLine("Please answer yes or no.");
|
||||
Thread.Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
while (true)
|
||||
{
|
||||
Console.Clear();
|
||||
Console.Write("\nWould you like the monsters party to be controlled by AI? (yes/no): ");
|
||||
input = Console.ReadLine().ToLower();
|
||||
if (input == "yes" || input == "no")
|
||||
{
|
||||
if (input == "yes")
|
||||
{
|
||||
GameState.Instance.monstersAIControl = true;
|
||||
break;
|
||||
}
|
||||
if (input == "no")
|
||||
if (input == "2")
|
||||
{
|
||||
GameState.Instance.herosAIControl = false;
|
||||
GameState.Instance.monstersAIControl = false;
|
||||
break;
|
||||
}
|
||||
if (input == "3")
|
||||
{
|
||||
GameState.Instance.herosAIControl = true;
|
||||
GameState.Instance.monstersAIControl = true;
|
||||
break;
|
||||
}
|
||||
else
|
||||
{
|
||||
ColoredConsole.WriteLine("Sorry. That isn't a valid input...", ConsoleColor.Red);
|
||||
Thread.Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
|
||||
}
|
||||
else
|
||||
catch (FormatException)
|
||||
{
|
||||
Console.WriteLine("Please answer yes or no.");
|
||||
ColoredConsole.WriteLine("Sorry. That isn't a valid input...", ConsoleColor.Red);
|
||||
Thread.Sleep(1000);
|
||||
continue;
|
||||
}
|
||||
break;
|
||||
}
|
||||
|
||||
Player player = new Player();
|
||||
|
||||
@@ -5,5 +5,6 @@ public class Skeleton : Character
|
||||
maxHP = 5;
|
||||
currentHP = maxHP;
|
||||
name = "Skeleton";
|
||||
CharacterEnabledActions.AddRange("Bone Crunch", "Health Potion", "Do Nothing");
|
||||
}
|
||||
}
|
||||
|
||||
@@ -5,5 +5,6 @@ public class UncodedOne : Character
|
||||
maxHP = 15;
|
||||
currentHP = maxHP;
|
||||
name = "The Uncoded One";
|
||||
CharacterEnabledActions.AddRange("Unraveling", "Health Potion", "Do Nothing");
|
||||
}
|
||||
}
|
||||
|
||||
10
VinFletcher.cs
Normal file
10
VinFletcher.cs
Normal file
@@ -0,0 +1,10 @@
|
||||
class VinFletcher : Character
|
||||
{
|
||||
public VinFletcher()
|
||||
{
|
||||
maxHP = 15;
|
||||
currentHP = maxHP;
|
||||
name = "Vin Fletcher";
|
||||
CharacterEnabledActions.AddRange("Punch", "Health Potion", "Items", "Do Nothing");
|
||||
}
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
@@ -13,7 +13,7 @@ using System.Reflection;
|
||||
[assembly: System.Reflection.AssemblyCompanyAttribute("FinalBattle")]
|
||||
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
|
||||
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0")]
|
||||
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+69e6699e26437733347c699bdfce91e200b6319c")]
|
||||
[assembly: System.Reflection.AssemblyProductAttribute("FinalBattle")]
|
||||
[assembly: System.Reflection.AssemblyTitleAttribute("FinalBattle")]
|
||||
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]
|
||||
|
||||
@@ -1 +1 @@
|
||||
15175f65f6f63f0c4c3ae8d13187889e73fe451b685fbc2643b44dd8e1084a87
|
||||
e00ffe98b8c56894d814e7bb3259dda6570fc0986ec9409909259c374f9f4a7c
|
||||
|
||||
@@ -1 +1 @@
|
||||
3235bef0a15147595cd9d8b95c54ad6a8e17ed84b619b5a0ff9feb9b9eb6f2e3
|
||||
fc5e7a79401482b5116e4f706afeb0a9e24e4ee24b315420ef0280d76b87f3ac
|
||||
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Reference in New Issue
Block a user