Model class for a player and a small static CombatSession tracker. Player stores name, vitals (hp, maxHp, attack, defense, magic), status flags (blocking, stunned, cursed, etc.), equipped weapon and enchantment type, spell lists and a Perks modifier. CombatSession holds static win/loss streak counters.
using Keyboard_Warriors_.Systems;
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
public int CurrentPrestige { get; set; } = 0;
public int attackDamage { get; set; }
public int DamageUpgradesCount { get; set; }
// Random Event Modifiers
public int eventAttackBuff = 0;
public int eventHealingBuff = 0;
// 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>();
public SessionStatModifiers Perks { get; set; } = new SessionStatModifiers();
// 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 = defense;
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;
this.Perks.ResetSession();
// Initialize event attack trainer cleanly to 0
this.eventAttackBuff = 0;
this.eventHealingBuff = 0;
}
}
public static class CombatSession
{
public static int WinStreak { get; set; } = 0;
public static int LossStreak { get; set; } = 0;
}