new builder option per draft - first one is gold per kill

This commit is contained in:
Ian Woods 2026-07-07 22:55:35 -07:00
parent 4a37d3747c
commit 157b77ebfa
21 changed files with 456 additions and 7 deletions

View file

@ -0,0 +1,37 @@
// Assets/_Project/Scripts/Gameplay/Draft/BuilderEffectDraftOption.cs
using UnityEngine;
using TD.Core;
using TD.Gameplay.BuilderEffects;
namespace TD.Gameplay.Draft
{
/// <summary>
/// Draft choice #2 — "gain a builder effect". Grants the player a passive effect that
/// applies to every tower they own, adding it to their <see cref="BuilderUpgradeManager"/>.
/// </summary>
/// <remarks>
/// Unlike <see cref="NewTowerDraftOption"/>, this carries the <see cref="BuilderEffectKind"/>
/// directly rather than an asset reference — there's no id to resolve, the enum value is the
/// stable identifier <see cref="BuilderUpgradeManager"/> and <see cref="BuilderEffectPool"/>
/// already key off of.
/// </remarks>
[CreateAssetMenu(fileName = "BuilderEffectOption", menuName = "TD/Draft/Builder Effect Option")]
public class BuilderEffectDraftOption : DraftOption
{
[Header("Payload")]
[Tooltip("The builder effect this option grants.")]
public BuilderEffectKind Kind;
public override bool IsValidFor(ulong clientId)
{
var upgrades = BuilderUpgradeManager.GetForClient(clientId);
return upgrades != null && !upgrades.PlayerHasEffect(Kind);
}
public override bool ServerApply(ulong clientId)
{
var upgrades = BuilderUpgradeManager.GetForClient(clientId);
return upgrades != null && upgrades.ServerGrantEffect(Kind);
}
}
}