// Assets/_Project/Scripts/Gameplay/Draft/BuilderSpellDraftOption.cs
using UnityEngine;
using TD.Core;
using TD.Gameplay.BuilderSpells;
namespace TD.Gameplay.Draft
{
///
/// Draft choice — "gain a builder spell". Grants the player a key-triggered active ability,
/// adding it to their .
///
///
/// Mirrors : carries the
/// directly rather than an asset reference, since the enum value is the stable identifier
/// and already key off of.
/// also checks slot capacity — once
/// is reached, no further spell options are
/// offered.
///
[CreateAssetMenu(fileName = "BuilderSpellOption", menuName = "TD/Draft/Builder Spell Option")]
public class BuilderSpellDraftOption : DraftOption
{
[Header("Payload")]
[Tooltip("The builder spell this option grants.")]
public BuilderSpellKind Kind;
public override bool IsValidFor(ulong clientId)
{
var loadout = PlayerSpellLoadout.GetForClient(clientId);
if (loadout == null) return false;
if (loadout.SlotCount >= PlayerSpellLoadout.MaxSpellSlots) return false;
return !loadout.PlayerHasSpell(Kind);
}
public override bool ServerApply(ulong clientId)
{
var loadout = PlayerSpellLoadout.GetForClient(clientId);
return loadout != null && loadout.ServerGrantSpell(Kind);
}
}
}