diff --git a/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomComponent.cs b/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomComponent.cs index c8cb5d2f28..ef15498a70 100644 --- a/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomComponent.cs +++ b/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomComponent.cs @@ -14,25 +14,13 @@ internal sealed partial class WeaponRandomComponent : Component public DamageSpecifier DamageBonus = new(); /// - /// Chance for the damage bonus to occur. + /// Chance for the damage bonus to occur (1 = 100%). /// [ViewVariables(VVAccess.ReadWrite)] public float RandomDamageChance = 0.00001f; /// - /// If this is true then the random damage will occur. - /// - [DataField("randomDamage")] - public bool RandomDamage = true; - - /// - /// If this is true then the weapon will have a unique interaction with cluwnes. - /// - [DataField("antiCluwne")] - public bool AntiCluwne = true; - - /// - /// Noise to play when the damage bonus occurs. + /// Sound effect to play when the damage bonus occurs. /// [DataField("damageSound")] public SoundSpecifier DamageSound = new SoundPathSpecifier("/Audio/Items/bikehorn.ogg"); diff --git a/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomSystem.cs b/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomSystem.cs index 8cb22ca8bd..7b246b8d09 100644 --- a/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomSystem.cs +++ b/Content.Server/Weapons/Melee/WeaponRandom/WeaponRandomSystem.cs @@ -1,11 +1,12 @@ using Content.Shared.Weapons.Melee.Events; using Robust.Shared.Random; -using Content.Shared.Cluwne; -using Robust.Shared.Audio; using Robust.Shared.Audio.Systems; namespace Content.Server.Weapons.Melee.WeaponRandom; +/// +/// This adds a random damage bonus to melee attacks based on damage bonus amount and probability. +/// public sealed class WeaponRandomSystem : EntitySystem { [Dependency] private readonly IRobustRandom _random = default!; @@ -17,22 +18,15 @@ public sealed class WeaponRandomSystem : EntitySystem SubscribeLocalEvent(OnMeleeHit); } - + /// + /// On Melee hit there is a possible chance of additional bonus damage occuring. + /// private void OnMeleeHit(EntityUid uid, WeaponRandomComponent component, MeleeHitEvent args) { - foreach (var entity in args.HitEntities) + if (_random.Prob(component.RandomDamageChance)) { - if (HasComp(entity) && component.AntiCluwne) - { - _audio.PlayPvs(component.DamageSound, uid); - args.BonusDamage = component.DamageBonus; - } - - else if (_random.Prob(component.RandomDamageChance) && component.RandomDamage) - { - _audio.PlayPvs(component.DamageSound, uid); - args.BonusDamage = component.DamageBonus; - } + _audio.PlayPvs(component.DamageSound, uid); + args.BonusDamage = component.DamageBonus; } } }