using System;
using System.Linq;
using NitroxModel.DataStructures;
using NitroxModel.Packets;
using NitroxModel_Subnautica.DataStructures.GameLogic;
namespace NitroxModel_Subnautica.Packets
{
///
/// A state update packet for the Cyclops that could be sent due to a create/repair, create/extinguish,
/// or a general Cyclops health change. A health change to 0 means the Cyclops has been destroyed.
///
[Serializable]
public class CyclopsDamage : Packet
{
public NitroxId Id { get; }
public float SubHealth { get; }
public float DamageManagerHealth { get; }
public float SubFireHealth { get; }
public int[] DamagePointIndexes { get; }
public CyclopsFireData[] RoomFires { get; }
public CyclopsDamageInfoData DamageInfo { get; }
/// Id.
/// .
/// .
/// .
/// where .
/// Null if only a Cyclops health change.
/// where > 0.
/// Null if only a Cyclops health change.
/// Null if a repair or extinguish.
public CyclopsDamage(NitroxId id, float subHealth, float damageManagerHealth, float subFireHealth, int[] damagePointIndexes, CyclopsFireData[] roomFires, CyclopsDamageInfoData damageInfo = null)
{
Id = id;
SubHealth = subHealth;
DamageManagerHealth = damageManagerHealth;
SubFireHealth = subFireHealth;
DamagePointIndexes = damagePointIndexes;
RoomFires = roomFires;
DamageInfo = damageInfo;
}
public override string ToString()
{
return $"[CyclopsDamage - Id: {Id}, SubHealth: {SubHealth}, DamageManagerHealth: {DamageManagerHealth}, SubFireHealth: {SubFireHealth}{(DamagePointIndexes == null ? "" : $" DamagePointIndexes: {string.Join(", ", DamagePointIndexes.Select(x => x.ToString()).ToArray())}")}{(RoomFires == null ? "" : $" RoomFires: {string.Join(", ", RoomFires.Select(x => x.ToString()).ToArray())}")}{(DamageInfo == null ? "" : $" DamageInfo: DealerId: {DamageInfo?.DealerId}")}";
}
}
}