Compare commits

..

2 Commits

Author SHA1 Message Date
30793101df added some stuff 2025-08-24 08:06:04 -05:00
a1877e7ddb Re-add changes to interface so far. Broken at time of commit. 2025-08-24 07:47:14 -05:00
6 changed files with 39 additions and 4 deletions

View File

@@ -1,4 +1,13 @@
public sealed class Actions public interface IAction
{
void GetAction(Character character);
void DoNothing(Character character);
void Attack();
void HealthPotion();
Item Items();
}
public sealed class Actions : IAction
{ {
private static readonly Lazy<Actions> _instance = new Lazy<Actions>(() => new Actions()); private static readonly Lazy<Actions> _instance = new Lazy<Actions>(() => new Actions());
private Actions() { } private Actions() { }
@@ -9,6 +18,12 @@ public sealed class Actions
public void GetAction(Character character) public void GetAction(Character character)
{ {
switch (MenuItem.Description)
{
default:
}
while (true) while (true)
{ {
var type = character.GetType().ToString(); var type = character.GetType().ToString();

View File

@@ -6,4 +6,5 @@ public abstract class Character
public bool dead {get; set;} = false; public bool dead {get; set;} = false;
public string turnMarker = "*"; public string turnMarker = "*";
public bool isTurn {get; set;} = false; public bool isTurn {get; set;} = false;
public List<string>CharacterEnabledActions = new List<string>();
} }

View File

@@ -17,6 +17,23 @@ public sealed class GameState
public bool monstersAIControl = true; public bool monstersAIControl = true;
public bool lastRound = false; public bool lastRound = false;
public record MenuItem
{
string? Description;
bool IsEnabled;
IAction? ActionToPerform;
}
public void BuildMenu(Character character)
{
int number = 1;
foreach (string action in character.CharacterEnabledActions)
{
Console.WriteLine($"{number}. {action}");
number++;
}
}
public void Run() public void Run()
{ {
Rounds(currentRound); Rounds(currentRound);
@@ -155,7 +172,7 @@ public sealed class GameState
Console.WriteLine("You are victorious in your first battle!"); Console.WriteLine("You are victorious in your first battle!");
Thread.Sleep(2000); Thread.Sleep(2000);
Console.WriteLine("\nAs you make your way deeper into the Uncoded One's fortress" Console.WriteLine("\nAs you make your way deeper into the Uncoded One's fortress"
+ "\nmore enemies appear, blocking your way forward to defeat their master..."); + "\nmore enemies appear to block your way to defeat their master...");
Console.WriteLine("\n\nPress Enter to continue..."); Console.WriteLine("\n\nPress Enter to continue...");
Console.ReadLine(); Console.ReadLine();
Skeleton skeleton1 = new Skeleton(); Skeleton skeleton1 = new Skeleton();

View File

@@ -5,6 +5,8 @@ public class Player : Character
maxHP = 10; maxHP = 10;
currentHP = maxHP; currentHP = maxHP;
name = GetName(); name = GetName();
CharacterEnabledActions.AddRange("Do Nothing", "Attack", "Items");
} }
public string GetName() public string GetName()

View File

@@ -13,7 +13,7 @@ using System.Reflection;
[assembly: System.Reflection.AssemblyCompanyAttribute("FinalBattle")] [assembly: System.Reflection.AssemblyCompanyAttribute("FinalBattle")]
[assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")] [assembly: System.Reflection.AssemblyConfigurationAttribute("Debug")]
[assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyFileVersionAttribute("1.0.0.0")]
[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+f294bc8f7ce5a7072e2a6108aa95ee1297a03713")] [assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.0.0+a1877e7ddb649a0bfdd178b7542ad52b6dca820e")]
[assembly: System.Reflection.AssemblyProductAttribute("FinalBattle")] [assembly: System.Reflection.AssemblyProductAttribute("FinalBattle")]
[assembly: System.Reflection.AssemblyTitleAttribute("FinalBattle")] [assembly: System.Reflection.AssemblyTitleAttribute("FinalBattle")]
[assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")] [assembly: System.Reflection.AssemblyVersionAttribute("1.0.0.0")]

View File

@@ -1 +1 @@
4d30831f652eb3e97a094dcf73b4593eaa947859dffb351a659bb0f8eea58b70 c09c7b260214ced4ad1f8ef7f9de63fcbf763c569ec3ad6b676dfa19cb5cf7fc