// Assets/_Project/Scripts/Gameplay/Draft/BuilderEffectUpgradeDraftOption.cs
using UnityEngine;
using TD.Core;
using TD.Gameplay.BuilderEffects;
namespace TD.Gameplay.Draft
{
///
/// Draft choice — "upgrade a builder effect you already have". Replaces
/// with in the player's
/// .
///
///
/// Mirrors , but swaps rather than adds. Only offered
/// while the player currently has granted — once taken,
/// is removed, which automatically makes this option (and any sibling
/// upgrade branching off the same base) invalid for future drafts.
///
[CreateAssetMenu(fileName = "BuilderEffectUpgradeOption",
menuName = "TD/Draft/Builder Effect Upgrade Option")]
public class BuilderEffectUpgradeDraftOption : DraftOption
{
[Header("Payload")]
[Tooltip("The builder effect this option upgrades from.")]
public BuilderEffectKind BaseKind;
[Tooltip("The builder effect this option upgrades to.")]
public BuilderEffectKind UpgradedKind;
public override bool IsValidFor(ulong clientId)
{
var upgrades = BuilderUpgradeManager.GetForClient(clientId);
return upgrades != null && upgrades.PlayerHasEffect(BaseKind);
}
public override bool ServerApply(ulong clientId)
{
var upgrades = BuilderUpgradeManager.GetForClient(clientId);
return upgrades != null && upgrades.ServerUpgradeEffect(BaseKind, UpgradedKind);
}
}
}