Data model for a player in the game. Defines player stats, state flags, equipped weapon/enchantment and lists of spell names, and initializes defaults in the constructor.
using Sandbox;
using System;
using System.Collections.Generic;
namespace Keyboard_Warriors_.Models;
public class Player
{
// Identifiers and Core Vitals
public string name { get; set; }
public int hp { get; set; }
public int maxHp { get; set; }
public int attack { get; set; }
public int defense { get; set; } // Serving as Armor
public int maxDefense { get; set; }
public int magic { get; set; } // Serving as Mana/Spell Points
// State Status Check Arrays
public bool isBlocking { get; set; }
public bool isMagicBlocking { get; set; }
public bool cursed { get; set; } // Serving as Poison/Debuff flag
public string activeMagicShield { get; set; }
// Missing Engine State Flags (Added)
public bool isStunned { get; set; }
public bool antiStun { get; set; }
public bool counterReady { get; set; }
// Equipment Hook
public Weapon equippedWeapon { get; set; }
public Weapon.EnchantmentType ActiveEnchantment { get; set; }
// Spellbook Inventories
public List<string> offensiveSpells { get; set; } = new List<string>();
public List<string> defensiveSpells { get; set; } = new List<string>();
public List<string> healingSpells { get; set; } = new List<string>();
public List<string> specialSpells { get; set; } = new List<string>();
// Main Constructor matching your existing system initialization
public Player( string name, int hp, int attack, int defense, bool isBlocking )
{
this.name = name;
this.hp = hp;
this.attack = attack;
this.defense = defense;
this.isBlocking = isBlocking;
// Setting default stat baselines for s&box layout parameters
this.defense = 0;
this.magic = 50; // Starting pool for spell testing
this.isMagicBlocking = false;
this.cursed = false;
this.activeMagicShield = "";
// Initializing missing status states to false
this.isStunned = false;
this.antiStun = false;
this.counterReady = false;
}
}