remove deprecated buff system
This commit is contained in:
parent
35ea90f71b
commit
330a929985
22 changed files with 11 additions and 615 deletions
|
|
@ -67,11 +67,6 @@ namespace TD.Combat
|
|||
// Cached on OnNetworkSpawn — avoids GetComponent every Update.
|
||||
private TowerInstance towerInstance;
|
||||
|
||||
// Lazily resolved on first attack — the owner's slot isn't guaranteed to be
|
||||
// set at spawn time, so we defer the lookup until combat actually begins.
|
||||
private PlayerBuffManager ownerBuffManager;
|
||||
private bool buffManagerResolved;
|
||||
|
||||
// Shared OverlapSphere result buffer. 32 covers any realistic enemy
|
||||
// density; size up if profiling reveals overflow.
|
||||
private static readonly Collider[] s_overlapBuffer = new Collider[32];
|
||||
|
|
@ -239,25 +234,6 @@ namespace TD.Combat
|
|||
ClearTarget();
|
||||
}
|
||||
|
||||
// ----- Buff multiplier lookup -------------------------------------
|
||||
|
||||
// Resolved lazily on the first attack because the owner slot NetworkVariable
|
||||
// may not yet have replicated by the time OnNetworkSpawn runs.
|
||||
private PlayerBuffManager GetOwnerBuffManager()
|
||||
{
|
||||
if (buffManagerResolved) return ownerBuffManager;
|
||||
|
||||
var slot = towerInstance.Owner;
|
||||
if (slot == PlayerSlot.None) return null;
|
||||
|
||||
var matchState = PlayerMatchState.GetForSlot(slot);
|
||||
if (matchState == null) return null;
|
||||
|
||||
ownerBuffManager = matchState.GetComponent<PlayerBuffManager>();
|
||||
buffManagerResolved = true;
|
||||
return ownerBuffManager;
|
||||
}
|
||||
|
||||
// ----- Attack tick -------------------------------------------------
|
||||
|
||||
private void TickAttack(TowerDefinition def)
|
||||
|
|
@ -265,9 +241,7 @@ namespace TD.Combat
|
|||
attackCooldown -= Time.deltaTime;
|
||||
if (attackCooldown > 0f) return;
|
||||
|
||||
float effectiveFireRate = def.AttacksPerSecond
|
||||
* (GetOwnerBuffManager()?.GetMultiplier(BuffStat.AttackSpeed) ?? 1f);
|
||||
attackCooldown = 1f / effectiveFireRate;
|
||||
attackCooldown = 1f / def.AttacksPerSecond;
|
||||
Fire(def);
|
||||
}
|
||||
|
||||
|
|
@ -484,9 +458,7 @@ namespace TD.Combat
|
|||
|
||||
private void HitEnemy(in CombatProfile p, EnemyHealth target, PlayerSlot owner)
|
||||
{
|
||||
var multiplier = GetOwnerBuffManager()?.GetMultiplier(BuffStat.Damage) ?? 1f;
|
||||
float effectiveDamage = p.Damage * multiplier;
|
||||
target.TakeDamage(effectiveDamage, p.DamageType, owner);
|
||||
target.TakeDamage(p.Damage, p.DamageType, owner);
|
||||
ApplyStatusEffect(p, target, owner);
|
||||
}
|
||||
|
||||
|
|
@ -525,11 +497,9 @@ namespace TD.Combat
|
|||
return;
|
||||
}
|
||||
|
||||
float effectiveDamage = def.Damage
|
||||
* (GetOwnerBuffManager()?.GetMultiplier(BuffStat.Damage) ?? 1f);
|
||||
proj.InitializeServer(
|
||||
target,
|
||||
effectiveDamage,
|
||||
def.Damage,
|
||||
p.DamageType,
|
||||
p.TargetType,
|
||||
p.SplashRadius,
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue