using System.Numerics;
using Content.Shared.Damage;
using Content.Shared.FixedPoint;
using Robust.Shared.Audio;
namespace Content.Shared.Weapons.Melee.Events;
///
/// Raised directed on the melee weapon entity used to attack something in combat mode,
/// whether through a click attack or wide attack.
///
public sealed class MeleeHitEvent : HandledEntityEventArgs
{
///
/// The base amount of damage dealt by the melee hit.
///
public readonly DamageSpecifier BaseDamage;
///
/// Modifier sets to apply to the hit event when it's all said and done.
/// This should be modified by adding a new entry to the list.
///
public List ModifiersList = new();
///
/// Damage to add to the default melee weapon damage. Applied before modifiers.
///
///
/// This might be required as damage modifier sets cannot add a new damage type to a DamageSpecifier.
///
public DamageSpecifier BonusDamage = new();
///
/// A list containing every hit entity. Can be zero.
///
public IReadOnlyList HitEntities;
///
/// Used to define a new hit sound in case you want to override the default GenericHit.
/// Also gets a pitch modifier added to it.
///
public SoundSpecifier? HitSoundOverride;
///
/// The user who attacked with the melee weapon.
///
public readonly EntityUid User;
///
/// The melee weapon used.
///
public readonly EntityUid Weapon;
///
/// The direction of the attack.
/// If null, it was a click-attack.
///
public readonly Vector2? Direction;
///
/// Check if this is true before attempting to do something during a melee attack other than changing/adding bonus damage.
/// For example, do not spend charges unless equals true.
///
///
/// Examining melee weapons calls this event, but with set to false.
///
public bool IsHit = true;
public MeleeHitEvent(List hitEntities, EntityUid user, EntityUid weapon, DamageSpecifier baseDamage, Vector2? direction)
{
HitEntities = hitEntities;
User = user;
Weapon = weapon;
BaseDamage = baseDamage;
Direction = direction;
}
}
///
/// Raised on a melee weapon to calculate potential damage bonuses or decreases.
///
[ByRefEvent]
public record struct GetMeleeDamageEvent(EntityUid Weapon, DamageSpecifier Damage, List Modifiers, EntityUid User, bool ResistanceBypass = false);
///
/// Raised on a melee weapon to calculate the attack rate.
///
[ByRefEvent]
public record struct GetMeleeAttackRateEvent(EntityUid Weapon, float Rate, float Multipliers, EntityUid User);
///
/// Raised on a melee weapon to calculate the heavy damage modifier.
///
[ByRefEvent]
public record struct GetHeavyDamageModifierEvent(EntityUid Weapon, FixedPoint2 DamageModifier, float Multipliers, EntityUid User);