using UnityEngine;

public class HumanCharacter : Character
{
    public Weapon weaponPrefab; // Assign the weapon prefab in the inspector
    public GameObject arrowPrefab; // Assign the arrow prefab in the inspector
    protected override void InitializeStats()
    {
        MaxHealth = 20;
        CurrentHealth = MaxHealth;
        Attack = 8;
        Constitution = 5;
        Dexterity = 3;
        Wisdom = 2;

        InitModifier = -2;
        DamageModifier = 0;
        SpellModifier = 0;
        MovementSpeed = 10;
        ArmorClass = 10;
    }

    public override Weapon GetWeapon()
    {
        // Return null to trigger direct weapon creation in SpawnAndEquipWeapon
        return weaponPrefab == null ? CreateDirectWeapon() : weaponPrefab;
    }

    protected override Weapon CreateDirectWeapon()
    {
        // Create weapon directly without prefab system
        GameObject swordObject = new GameObject("Simple Sword");
        swordObject.transform.SetParent(this.transform, false);
        spawnedWeapon = swordObject.AddComponent<SimpleSword>();
        spawnedWeapon.SetWielder(this);
        return spawnedWeapon;
    }

    public override Character Spawn(int count)
    {
        name = "Human";
        CharacterName = "Human";
        if (count > 1)
        {
            name += " " + count;
            CharacterName += " " + count;
        }

        return this;
    }
}
