using System.Collections.Generic; using Content.Shared.Acts; using Content.Shared.Damage.Resistances; using Robust.Shared.GameObjects; namespace Content.Shared.Damage.Components { public interface IDamageableComponent : IComponent, IExAct { /// /// The sum of all damages types in the DamageableComponent. /// int TotalDamage { get; } /// /// Returns a dictionary of the damage in the container, indexed by applicable . /// /// /// The values represent the sum of all damage in each group. If a supported damage type is a member of more than one group, it will contribute to each one. /// Therefore, the sum of the values may be greater than the sum of the values in the dictionary returned by /// IReadOnlyDictionary GetDamagePerApplicableGroup { get; } /// /// Returns a dictionary of the damage in the container, indexed by fully supported instances of . /// /// /// The values represent the sum of all damage in each group. As the damage container may have some damage /// types that are not part of a fully supported damage group, the sum of the values may be less of the values /// in the dictionary returned by . On the other hand, if a supported damage type /// is a member of more than one group, it will contribute to each one. Therefore, the sum may also be greater /// instead. /// IReadOnlyDictionary GetDamagePerFullySupportedGroup { get; } /// /// Returns a dictionary of the damage in the container, indexed by . /// IReadOnlyDictionary GetDamagePerType { get; } /// /// Like , but indexed by /// IReadOnlyDictionary GetDamagePerApplicableGroupIDs { get; } /// /// Like , but indexed by /// IReadOnlyDictionary GetDamagePerFullySupportedGroupIDs { get; } /// /// Like , but indexed by /// IReadOnlyDictionary GetDamagePerTypeIDs { get; } /// /// Collection of damage types supported by this DamageableComponent. /// /// /// Each of these damage types is fully supported. If any of these damage types is a /// member of a damage group, these groups are represented in /// HashSet SupportedDamageTypes { get; } /// /// Collection of damage groups that are fully supported by DamageableComponent. /// /// /// This describes what damage groups this damage container explicitly supports. It supports every damage type /// contained in these damage groups. It may also support other damage types not in these groups. To see all /// damage types , and to see all applicable damage groups . /// HashSet FullySupportedDamageGroups { get; } /// /// Collection of damage groups that could apply damage to this DamageableComponent. /// /// /// This describes what damage groups could have an effect on this damage container. However not every damage /// group has to be fully supported. For example, the container may support ONLY the piercing damage type. It should /// therefore be affected by instances of brute damage, but does not necessarily support blunt or slash damage. /// For a list of supported damage types, see . /// HashSet ApplicableDamageGroups { get; } /// /// The resistances of this component. /// ResistanceSet Resistances { get; } /// /// Tries to get the amount of damage of a type. /// /// The type to get the damage of. /// The amount of damage of that type. /// /// True if the given is supported, false otherwise. /// bool TryGetDamage(DamageTypePrototype type, out int damage); /// /// Returns the amount of damage of a given type, or zero if it is not supported. /// int GetDamage(DamageTypePrototype type); /// /// Tries to get the total amount of damage in a damage group. /// /// The group to get the damage of. /// The amount of damage in that group. /// /// True if the given group is applicable to this container, false otherwise. /// bool TryGetDamage(DamageGroupPrototype group, out int damage); /// /// Returns the amount of damage present in an applicable group, or zero if no members are supported. /// int GetDamage(DamageGroupPrototype group); /// /// Tries to change the specified , applying /// resistance values only if it is dealing damage. /// /// Type of damage being changed. /// /// Amount of damage being received (positive for damage, negative for heals). /// /// /// Whether or not to ignore resistances when taking damage. /// Healing always ignores resistances, regardless of this input. /// /// /// False if the given type is not supported or no damage change occurred; true otherwise. /// bool TryChangeDamage(DamageTypePrototype type, int amount, bool ignoreDamageResistances = false); /// /// Tries to change damage of the specified , applying resistance values /// only if it is damage. /// /// /// /// If dealing damage, this spreads the damage change amount evenly between the s in this group (subject to integer rounding). If only a subset of the /// damage types in the group are actually supported, then the total damage dealt may be less than expected /// (unsupported damage is ignored). /// /// /// If healing damage, this spreads the damage change proportional to the current damage value of each (subject to integer rounding). If there is less damage than is being /// healed, some healing is wasted. Unsupported damage types do not waste healing. /// /// /// group of damage being changed. /// /// Amount of damage being received (positive for damage, negative for heals). /// /// /// Whether to ignore resistances when taking damage. Healing always ignores resistances, regardless of this /// input. /// /// /// Returns false if the given group is not applicable or no damage change occurred; true otherwise. /// bool TryChangeDamage(DamageGroupPrototype group, int amount, bool ignoreDamageResistances = false); /// /// Forcefully sets the specified to the given value, ignoring resistance /// values. /// /// Type of damage being set. /// New damage value to be set. /// /// Returns false if a given type is not supported or a negative value is provided; true otherwise. /// bool TrySetDamage(DamageTypePrototype type, int newValue); /// /// Forcefully sets all damage types in a specified damage group using . /// /// /// Note that the actual damage of this group will be equal to the given value times the number damage group /// members that this container supports. /// /// Group of damage being set. /// New damage value to be set. /// /// Returns false if the given group is not applicable or a negative value is provided; true otherwise. /// bool TrySetDamage(DamageGroupPrototype group, int newValue); /// /// Sets all supported damage types to specified value using . /// /// New damage value to be set. /// /// Returns false if a negative value is provided; true otherwise. /// bool TrySetAllDamage(int newValue); /// /// Returns true if the given damage group is applicable to this damage container. /// public bool IsApplicableDamageGroup(DamageGroupPrototype group); /// /// Returns true if the given damage group is fully supported by this damage container. /// public bool IsFullySupportedDamageGroup(DamageGroupPrototype group); /// /// Returns true if the given damage type is supported by this damage container. /// public bool IsSupportedDamageType(DamageTypePrototype type); /// /// Invokes the HealthChangedEvent with the current values of health. /// void ForceHealthChangedEvent(); } }