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:
@@ -710,6 +710,7 @@ public partial class DungeonSimulation
|
|||||||
var projectile = new ProjectileInstance
|
var projectile = new ProjectileInstance
|
||||||
{
|
{
|
||||||
Id = GetNextProjectileId(),
|
Id = GetNextProjectileId(),
|
||||||
|
SpawnTick = CurrentTick,
|
||||||
SourceType = ProjectileSource.Mob,
|
SourceType = ProjectileSource.Mob,
|
||||||
SourceMobId = mob.Id,
|
SourceMobId = mob.Id,
|
||||||
AbilityId = ability.Id,
|
AbilityId = ability.Id,
|
||||||
@@ -881,6 +882,11 @@ public partial class DungeonSimulation
|
|||||||
{
|
{
|
||||||
foreach (var player in Players.Values.Where(p => p.IsAlive))
|
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
|
if (Distance(projectile.X, projectile.Y, player.X, player.Y) < 50) // Increased from 20 to account for projectile speed
|
||||||
{
|
{
|
||||||
// Hit!
|
// Hit!
|
||||||
@@ -896,6 +902,7 @@ public partial class DungeonSimulation
|
|||||||
{
|
{
|
||||||
var result = CombatCalculator.CalculateMobToPlayerDamage(
|
var result = CombatCalculator.CalculateMobToPlayerDamage(
|
||||||
sourceMob, player, projectile.DamageTypeKey, projectile.Damage, player.Resistances);
|
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);
|
ApplyDamageToPlayer(sourceMob, player, result.FinalDamage, projectile.DamageTypeKey, result.WasResisted, result.WasWeakness);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -12,6 +12,7 @@ public enum ProjectileSource
|
|||||||
public class ProjectileInstance
|
public class ProjectileInstance
|
||||||
{
|
{
|
||||||
public int Id { get; set; }
|
public int Id { get; set; }
|
||||||
|
public long SpawnTick { get; set; }
|
||||||
|
|
||||||
// Source tracking
|
// Source tracking
|
||||||
public ProjectileSource SourceType { get; set; }
|
public ProjectileSource SourceType { get; set; }
|
||||||
|
|||||||
Reference in New Issue
Block a user