From 4df4238c4ce9b4f1fefa1c1917892558c8214f66 Mon Sep 17 00:00:00 2001 From: metalgearsloth <31366439+metalgearsloth@users.noreply.github.com> Date: Sat, 17 Sep 2022 00:27:05 +1000 Subject: [PATCH] Nerf bible (#10023) --- Content.Server/Bible/BibleSystem.cs | 54 +++++++++++-------- .../Bible/Components/BibleComponent.cs | 23 ++++---- Resources/Locale/en-US/chapel/bible.ftl | 9 +++- .../Objects/Specific/Chapel/bibles.yml | 10 ++-- 4 files changed, 58 insertions(+), 38 deletions(-) diff --git a/Content.Server/Bible/BibleSystem.cs b/Content.Server/Bible/BibleSystem.cs index 5607ed58e1..952c73389e 100644 --- a/Content.Server/Bible/BibleSystem.cs +++ b/Content.Server/Bible/BibleSystem.cs @@ -1,12 +1,10 @@ using Content.Shared.Interaction; using Content.Shared.Inventory; -using Content.Shared.MobState.Components; using Content.Shared.MobState; using Content.Shared.Damage; using Content.Shared.Verbs; using Content.Shared.ActionBlocker; using Content.Shared.Actions; -using Content.Server.Cooldown; using Content.Server.Bible.Components; using Content.Server.MobState; using Content.Server.Popups; @@ -14,23 +12,23 @@ using Content.Server.Ghost.Roles.Components; using Content.Server.Ghost.Roles.Events; using Content.Shared.IdentityManagement; using Content.Shared.Popups; +using Content.Shared.Timing; using Robust.Shared.Random; using Robust.Shared.Audio; using Robust.Shared.Player; -using Robust.Shared.Timing; namespace Content.Server.Bible { public sealed class BibleSystem : EntitySystem { - [Dependency] private readonly InventorySystem _invSystem = default!; [Dependency] private readonly IRobustRandom _random = default!; - [Dependency] private readonly IGameTiming _gameTiming = default!; - [Dependency] private readonly DamageableSystem _damageableSystem = default!; - [Dependency] private readonly PopupSystem _popupSystem = default!; [Dependency] private readonly ActionBlockerSystem _blocker = default!; - [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; + [Dependency] private readonly DamageableSystem _damageableSystem = default!; + [Dependency] private readonly InventorySystem _invSystem = default!; [Dependency] private readonly MobStateSystem _mobStateSystem = default!; + [Dependency] private readonly PopupSystem _popupSystem = default!; + [Dependency] private readonly SharedActionsSystem _actionsSystem = default!; + [Dependency] private readonly UseDelaySystem _delay = default!; public override void Initialize() { @@ -94,28 +92,23 @@ namespace Content.Server.Bible if (!args.CanReach) return; - var currentTime = _gameTiming.CurTime; + UseDelayComponent? delay = null; - if (currentTime < component.CooldownEnd) - { + if (_delay.ActiveDelay(uid, delay)) return; - } if (args.Target == null || args.Target == args.User || !_mobStateSystem.IsAlive(args.Target.Value)) { return; } - component.LastAttackTime = currentTime; - component.CooldownEnd = component.LastAttackTime + TimeSpan.FromSeconds(component.CooldownTime); - RaiseLocalEvent(uid, new RefreshItemCooldownEvent(component.LastAttackTime, component.CooldownEnd), false); - if (!HasComp(args.User)) { _popupSystem.PopupEntity(Loc.GetString("bible-sizzle"), args.User, Filter.Entities(args.User)); SoundSystem.Play(component.SizzleSoundPath.GetSound(), Filter.Pvs(args.User), args.User); _damageableSystem.TryChangeDamage(args.User, component.DamageOnUntrainedUse, true); + _delay.BeginDelay(uid, delay); return; } @@ -133,18 +126,31 @@ namespace Content.Server.Bible SoundSystem.Play("/Audio/Effects/hit_kick.ogg", Filter.Pvs(args.Target.Value), args.User); _damageableSystem.TryChangeDamage(args.Target.Value, component.DamageOnFail, true); + _delay.BeginDelay(uid, delay); return; } } - var othersMessage = Loc.GetString(component.LocPrefix + "-heal-success-others", ("user", Identity.Entity(args.User, EntityManager)),("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid)); - _popupSystem.PopupEntity(othersMessage, args.User, Filter.PvsExcept(args.User), PopupType.Medium); + var damage = _damageableSystem.TryChangeDamage(args.Target.Value, component.Damage, true); - var selfMessage = Loc.GetString(component.LocPrefix + "-heal-success-self", ("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid)); - _popupSystem.PopupEntity(selfMessage, args.User, Filter.Entities(args.User), PopupType.Large); + if (damage == null || damage.Total == 0) + { + var othersMessage = Loc.GetString(component.LocPrefix + "-heal-success-none-others", ("user", Identity.Entity(args.User, EntityManager)),("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid)); + _popupSystem.PopupEntity(othersMessage, args.User, Filter.PvsExcept(args.User), PopupType.Medium); - SoundSystem.Play(component.HealSoundPath.GetSound(), Filter.Pvs(args.Target.Value), args.User); - _damageableSystem.TryChangeDamage(args.Target.Value, component.Damage, true); + var selfMessage = Loc.GetString(component.LocPrefix + "-heal-success-none-self", ("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid)); + _popupSystem.PopupEntity(selfMessage, args.User, Filter.Entities(args.User), PopupType.Large); + } + else + { + var othersMessage = Loc.GetString(component.LocPrefix + "-heal-success-others", ("user", Identity.Entity(args.User, EntityManager)),("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid)); + _popupSystem.PopupEntity(othersMessage, args.User, Filter.PvsExcept(args.User), PopupType.Medium); + + var selfMessage = Loc.GetString(component.LocPrefix + "-heal-success-self", ("target", Identity.Entity(args.Target.Value, EntityManager)),("bible", uid)); + _popupSystem.PopupEntity(selfMessage, args.User, Filter.Entities(args.User), PopupType.Large); + SoundSystem.Play(component.HealSoundPath.GetSound(), Filter.Pvs(args.Target.Value), args.User); + _delay.BeginDelay(uid, delay); + } } private void AddSummonVerb(EntityUid uid, SummonableComponent component, GetVerbsEvent args) @@ -238,5 +244,7 @@ namespace Content.Server.Bible } public sealed class SummonActionEvent : InstantActionEvent - {} + { + + } } diff --git a/Content.Server/Bible/Components/BibleComponent.cs b/Content.Server/Bible/Components/BibleComponent.cs index 9683b1fa22..d4acbd8732 100644 --- a/Content.Server/Bible/Components/BibleComponent.cs +++ b/Content.Server/Bible/Components/BibleComponent.cs @@ -6,29 +6,34 @@ namespace Content.Server.Bible.Components [RegisterComponent] public sealed class BibleComponent : Component { - // Damage that will be healed on a success + /// + /// Damage that will be healed on a success + /// [DataField("damage", required: true)] [ViewVariables(VVAccess.ReadWrite)] public DamageSpecifier Damage = default!; - // Damage that will be dealt on a failure + + /// + /// Damage that will be dealt on a failure + /// [DataField("damageOnFail", required: true)] [ViewVariables(VVAccess.ReadWrite)] public DamageSpecifier DamageOnFail = default!; - // Damage that will be dealt when a non-chaplain attempts to heal + + /// + /// Damage that will be dealt when a non-chaplain attempts to heal + /// [DataField("damageOnUntrainedUse", required: true)] [ViewVariables(VVAccess.ReadWrite)] public DamageSpecifier DamageOnUntrainedUse = default!; - //Chance the bible will fail to heal someone with no helmet + /// + /// Chance the bible will fail to heal someone with no helmet + /// [DataField("failChance")] [ViewVariables(VVAccess.ReadWrite)] public float FailChance = 0.34f; - public TimeSpan LastAttackTime; - public TimeSpan CooldownEnd; - [DataField("cooldownTime")] - public float CooldownTime { get; } = 5f; - [DataField("sizzleSound")] public SoundSpecifier SizzleSoundPath = new SoundPathSpecifier("/Audio/Effects/lightburn.ogg"); [DataField("healSound")] diff --git a/Resources/Locale/en-US/chapel/bible.ftl b/Resources/Locale/en-US/chapel/bible.ftl index d9287cf635..c59492b70a 100644 --- a/Resources/Locale/en-US/chapel/bible.ftl +++ b/Resources/Locale/en-US/chapel/bible.ftl @@ -1,12 +1,17 @@ -bible-heal-success-self = You hit {THE($target)} with {THE($bible)}, and {POSS-ADJ($target)} wounds close in a flash of holy light! -bible-heal-success-others = {CAPITALIZE(THE($user))} hits {THE($target)} with {THE($bible)}, and {POSS-ADJ($target)} wounds close in a flash of holy light! +bible-heal-success-self = You hit {THE($target)} with {THE($bible)}, and their wounds close in a flash of holy light! +bible-heal-success-others = {CAPITALIZE(THE($user))} hits {THE($target)} with {THE($bible)}, and their wounds close in a flash of holy light! +bible-heal-success-none-self = You hit {THE($target)} with {THE($bible)}, but they have no wounds you can heal! +bible-heal-success-none-others = {CAPITALIZE(THE($user))} hits {THE($target)} with {THE($bible)}! + bible-heal-fail-self = You hit {THE($target)} with {THE($bible)}, and it lands with a sad thwack, dazing {OBJECT($target)}! bible-heal-fail-others = {CAPITALIZE(THE($user))} hits {THE($target)} with {THE($bible)}, and it lands with a sad thack, dazing {OBJECT($target)}! bible-sizzle = The book sizzles in your hands! + bible-summon-verb = Summon familiar bible-summon-verb-desc = Summon a familiar that will aid you and gain humanlike intelligence once inhabited by a soul. bible-summon-requested = Your familiar will arrive once a willing soul comes forth. bible-summon-respawn-ready = {CAPITALIZE(THE($book))} surges with ethereal power. {CAPITALIZE(POSS-ADJ($book))} resident is home again. + necro-heal-success-self = You hit {THE($target)} with {THE($bible)}, and {POSS-ADJ($target)} flesh warps as it melts! necro-heal-success-others = {CAPITALIZE(THE($user))} hits {THE($target)} with {THE($bible)}, and {POSS-ADJ($target)} flesh warps as it melts! necro-heal-fail-self = You hit {THE($target)} with {THE($bible)}, and it lands with a sad thwack, failing to smite {OBJECT($target)}. diff --git a/Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml b/Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml index 4040fc903d..0b48fdf2c4 100644 --- a/Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml +++ b/Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml @@ -4,18 +4,20 @@ parent: BaseStorageItem id: Bible components: + - type: UseDelay + delay: 10.0 - type: Bible damage: groups: - Brute: -35 - Burn: -35 + Brute: -15 + Burn: -15 damageOnFail: groups: Brute: 15 - Airloss: 25 + Airloss: 15 damageOnUntrainedUse: ## What a non-chaplain takes when attempting to heal someone groups: - Burn: 30 + Burn: 10 - type: Summonable specialItem: SpawnPointGhostRemilia - type: ItemCooldown