Dungeon Admin management

This commit is contained in:
dingo
2026-01-31 11:19:38 -05:00
parent 4108d20555
commit 0b89cd06aa
5 changed files with 256 additions and 20 deletions
+1 -1
View File
@@ -496,7 +496,7 @@ public partial class DungeonHandler
return false;
if (!dungeon.Simulation.Players.TryGetValue(characterId, out var player))
return false;
player.Armor = invulnerable ? 999999 : 0;
player.IsInvulnerable = invulnerable;
return true;
}
+19 -13
View File
@@ -951,6 +951,7 @@ public partial class DungeonSimulation
private void ApplyDamageToPlayer(MobInstance? mob, PlayerInstance player, int damage, string damageTypeKey, bool wasResisted, bool wasWeakness)
{
if (player.IsInvulnerable) return;
player.Health -= damage;
player.IsInCombat = true;
player.LastCombatTick = CurrentTick;
@@ -1069,22 +1070,28 @@ public partial class DungeonSimulation
effect.NextTickIn -= TickDelta;
if (effect.NextTickIn <= 0)
{
player.Health -= effect.DamagePerTick;
player.IsInCombat = true;
player.LastCombatTick = CurrentTick;
if (!player.IsInvulnerable)
{
player.Health -= effect.DamagePerTick;
player.IsInCombat = true;
player.LastCombatTick = CurrentTick;
}
effect.NextTickIn = effect.TickInterval;
_pendingDamageEvents.Add(new DamageEvent
if (!player.IsInvulnerable)
{
SourceType = EntityType.Mob,
SourceId = effect.SourceMobId,
TargetType = EntityType.Player,
TargetId = (int)player.CharacterId,
Damage = effect.DamagePerTick,
DamageTypeKey = effect.EffectType
});
_pendingDamageEvents.Add(new DamageEvent
{
SourceType = EntityType.Mob,
SourceId = effect.SourceMobId,
TargetType = EntityType.Player,
TargetId = (int)player.CharacterId,
Damage = effect.DamagePerTick,
DamageTypeKey = effect.EffectType
});
}
if (player.Health <= 0)
if (!player.IsInvulnerable && player.Health <= 0)
{
player.Health = 0;
player.IsAlive = false;
@@ -1362,4 +1369,3 @@ public partial class DungeonSimulation
}
+5
View File
@@ -29,6 +29,11 @@ public class PlayerInstance
// Defensive stats (from gear)
public int Armor { get; set; }
/// <summary>
/// Admin override to prevent all incoming damage
/// </summary>
public bool IsInvulnerable { get; set; }
/// <summary>
/// Weapon damage type key (from equipped weapon, defaults to physical for unarmed)
/// </summary>