start of draft option upgrades

This commit is contained in:
Ian Woods 2026-07-22 00:00:05 -07:00
parent e78ae0cda1
commit db9c828e63
7 changed files with 235 additions and 2 deletions

View file

@ -139,6 +139,28 @@ namespace TD.Gameplay
return true;
}
/// <summary>
/// Server-only: replaces a previously granted spell with a different one (an upgrade
/// pick), in place — the upgraded spell keeps the base spell's hotkey slot and starts
/// off cooldown. No-op if the old spell isn't currently granted or the new one already
/// is. Returns true if the swap happened.
/// </summary>
public bool ServerUpgradeSpell(BuilderSpellKind oldKind, BuilderSpellKind newKind)
{
if (!IsServer) return false;
if (PlayerHasSpell(newKind)) return false;
for (int i = 0; i < spells.Count; i++)
{
if (spells[i].Kind == oldKind)
{
spells[i] = SpellSlot.CreateReady(newKind);
return true;
}
}
return false;
}
// ----- Cast RPC -----------------------------------------------------
/// <summary>