Dungeon Admin management
This commit is contained in:
@@ -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;
|
||||
}
|
||||
|
||||
|
||||
@@ -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
|
||||
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -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>
|
||||
|
||||
Reference in New Issue
Block a user