Make mob projectiles visible for at least one tick and improve hit logs

- Add SpawnTick on projectiles and skip mob->player collision on spawn tick

- Prevent spawn-and-hit same-tick consumption that can hide projectiles from state feed

- Add explicit [ProjectileHit] server log with ability key and damage for troubleshooting
This commit is contained in:
dingo
2026-02-10 18:56:10 -05:00
parent 90821277eb
commit d9189be156
2 changed files with 8 additions and 0 deletions
+7
View File
@@ -710,6 +710,7 @@ public partial class DungeonSimulation
var projectile = new ProjectileInstance
{
Id = GetNextProjectileId(),
SpawnTick = CurrentTick,
SourceType = ProjectileSource.Mob,
SourceMobId = mob.Id,
AbilityId = ability.Id,
@@ -881,6 +882,11 @@ public partial class DungeonSimulation
{
foreach (var player in Players.Values.Where(p => p.IsAlive))
{
if (CurrentTick <= projectile.SpawnTick)
{
continue;
}
if (Distance(projectile.X, projectile.Y, player.X, player.Y) < 50) // Increased from 20 to account for projectile speed
{
// Hit!
@@ -896,6 +902,7 @@ public partial class DungeonSimulation
{
var result = CombatCalculator.CalculateMobToPlayerDamage(
sourceMob, player, projectile.DamageTypeKey, projectile.Damage, player.Resistances);
Console.WriteLine($"[ProjectileHit] Mob {sourceMob.Id} -> Player {player.CharacterId}: ability={ResolveProjectileAbilityKey(projectile)}, damage={result.FinalDamage}, type={projectile.DamageTypeKey}");
ApplyDamageToPlayer(sourceMob, player, result.FinalDamage, projectile.DamageTypeKey, result.WasResisted, result.WasWeakness);
}
}
+1
View File
@@ -12,6 +12,7 @@ public enum ProjectileSource
public class ProjectileInstance
{
public int Id { get; set; }
public long SpawnTick { get; set; }
// Source tracking
public ProjectileSource SourceType { get; set; }