Changed a lot of Actions.cs and a few other things to be more easily

extendable.
This commit is contained in:
2025-09-03 23:32:20 -05:00
parent 69e6699e26
commit e4b230a0ad
21 changed files with 834 additions and 314 deletions

View File

@@ -2,19 +2,43 @@ public class Player : Character
{
public Player()
{
maxHP = 10;
currentHP = maxHP;
name = GetName();
CharacterEnabledActions.AddRange("Do Nothing", "Attack", "Items");
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";
}
}
}