Dungeon fix
This commit is contained in:
@@ -328,15 +328,19 @@ public partial class DungeonSimulation
|
|||||||
{
|
{
|
||||||
CurrentTick = tick;
|
CurrentTick = tick;
|
||||||
|
|
||||||
if (Phase != DungeonPhase.Active)
|
|
||||||
return new TickResult { Phase = Phase };
|
|
||||||
|
|
||||||
_pendingDamageEvents.Clear();
|
_pendingDamageEvents.Clear();
|
||||||
_pendingDeathEvents.Clear();
|
_pendingDeathEvents.Clear();
|
||||||
_pendingAbilityEvents.Clear();
|
_pendingAbilityEvents.Clear();
|
||||||
_pendingProjectileHitEvents.Clear();
|
_pendingProjectileHitEvents.Clear();
|
||||||
_pendingProjectileExpiredEvents.Clear();
|
_pendingProjectileExpiredEvents.Clear();
|
||||||
|
|
||||||
|
// If dungeon is not active, still allow basic updates (movement, corpse cleanup)
|
||||||
|
// but skip combat/AI
|
||||||
|
bool skipCombat = Phase != DungeonPhase.Active;
|
||||||
|
|
||||||
|
// Only do combat/AI if dungeon is active
|
||||||
|
if (!skipCombat)
|
||||||
|
{
|
||||||
// Update all mobs (AI)
|
// Update all mobs (AI)
|
||||||
foreach (var mob in Mobs.Values.Where(m => m.IsAlive))
|
foreach (var mob in Mobs.Values.Where(m => m.IsAlive))
|
||||||
{
|
{
|
||||||
@@ -362,8 +366,9 @@ public partial class DungeonSimulation
|
|||||||
|
|
||||||
// Update hazard zones
|
// Update hazard zones
|
||||||
UpdateHazardZones();
|
UpdateHazardZones();
|
||||||
|
}
|
||||||
|
|
||||||
// Update players (movement, regeneration, status effects)
|
// Always update players (movement, regeneration, status effects) - even when cleared
|
||||||
foreach (var player in Players.Values.Where(p => p.IsAlive))
|
foreach (var player in Players.Values.Where(p => p.IsAlive))
|
||||||
{
|
{
|
||||||
UpdatePlayer(player);
|
UpdatePlayer(player);
|
||||||
@@ -393,8 +398,8 @@ public partial class DungeonSimulation
|
|||||||
Mobs.Remove(mobId, out _);
|
Mobs.Remove(mobId, out _);
|
||||||
}
|
}
|
||||||
|
|
||||||
// Check dungeon completion
|
// Check dungeon completion (only once when phase is still Active)
|
||||||
if (Mobs.Values.All(m => !m.IsAlive))
|
if (Phase == DungeonPhase.Active && Mobs.Values.All(m => !m.IsAlive))
|
||||||
{
|
{
|
||||||
Phase = DungeonPhase.Cleared;
|
Phase = DungeonPhase.Cleared;
|
||||||
SpawnExit();
|
SpawnExit();
|
||||||
|
|||||||
Reference in New Issue
Block a user