Abilities

This commit is contained in:
dingo
2026-01-25 19:08:00 -05:00
parent 5f545bc8f7
commit 21b09ed90a
3 changed files with 222 additions and 24 deletions
+12 -10
View File
@@ -1135,7 +1135,8 @@ public sealed partial class DungeonHandler : IClientMessageHandler
float statBonus = baseDamage * (statModifier / 100f);
int totalDamage = (int)(baseDamage + statBonus);
Console.WriteLine($"[HandleFireProjectile] Weapon: {weapon.Name} ({weapon.MinDamage}-{weapon.MaxDamage}), Ammo: {ammo.Name} ({ammo.MinDamage}-{ammo.MaxDamage}), Total: {totalDamage}");
// Debug logging disabled
// Console.WriteLine($"[HandleFireProjectile] Weapon: {weapon.Name} ({weapon.MinDamage}-{weapon.MaxDamage}), Ammo: {ammo.Name} ({ammo.MinDamage}-{ammo.MaxDamage}), Total: {totalDamage}");
// Create projectile
var projectile = new ProjectileInstance
@@ -1165,17 +1166,18 @@ public sealed partial class DungeonHandler : IClientMessageHandler
};
dungeon.Simulation.Projectiles.TryAdd(projectile.Id, projectile);
Console.WriteLine($"[HandleFireProjectile] Added projectile {projectile.Id} to simulation. Total projectiles: {dungeon.Simulation.Projectiles.Count}");
// Debug logging disabled
// Console.WriteLine($"[HandleFireProjectile] Added projectile {projectile.Id} to simulation. Total projectiles: {dungeon.Simulation.Projectiles.Count}");
// Broadcast projectile spawned
Console.WriteLine($"[HandleFireProjectile] Broadcasting projectile {projectile.Id} to {dungeon.Simulation.Players.Count} players");
// Console.WriteLine($"[HandleFireProjectile] Broadcasting projectile {projectile.Id} to {dungeon.Simulation.Players.Count} players");
foreach (var dungeonPlayer in dungeon.Simulation.Players.Values)
{
Console.WriteLine($"[HandleFireProjectile] Checking player CharId={dungeonPlayer.CharacterId}");
// Console.WriteLine($"[HandleFireProjectile] Checking player CharId={dungeonPlayer.CharacterId}");
var playerSession = _playerSessions.Values.FirstOrDefault(p => p.CharacterId == dungeonPlayer.CharacterId);
if (playerSession != null)
{
Console.WriteLine($"[HandleFireProjectile] Sending EVENT_PROJECTILE_SPAWNED (504) to player {playerSession.Character.Name} (CharId={playerSession.CharacterId})");
// Console.WriteLine($"[HandleFireProjectile] Sending EVENT_PROJECTILE_SPAWNED (504) to player {playerSession.Character.Name} (CharId={playerSession.CharacterId})");
try
{
await SendAsync(playerSession.Connection, DungeonOpCodes.EVENT_PROJECTILE_SPAWNED, new
@@ -1194,17 +1196,17 @@ public sealed partial class DungeonHandler : IClientMessageHandler
backX = projectile.BackX,
backY = projectile.BackY
}, ct);
Console.WriteLine($"[HandleFireProjectile] Successfully sent EVENT_PROJECTILE_SPAWNED to {playerSession.Character.Name}");
// Console.WriteLine($"[HandleFireProjectile] Successfully sent EVENT_PROJECTILE_SPAWNED to {playerSession.Character.Name}");
}
catch (Exception ex)
{
Console.WriteLine($"[HandleFireProjectile] ERROR sending EVENT_PROJECTILE_SPAWNED to {playerSession.Character.Name}: {ex.Message}");
}
}
else
{
Console.WriteLine($"[HandleFireProjectile] WARNING: No session found for player CharId={dungeonPlayer.CharacterId}");
}
// else
// {
// Console.WriteLine($"[HandleFireProjectile] WARNING: No session found for player CharId={dungeonPlayer.CharacterId}");
// }
}
_log.LogDebug("Player {Name} fired projectile with {Weapon} using {Ammo} for {Damage} damage",