Skip to content

Commit

Permalink
Nerf bible (space-wizards#10023)
Browse files Browse the repository at this point in the history
  • Loading branch information
metalgearsloth authored Sep 16, 2022
1 parent d50af6e commit 4df4238
Show file tree
Hide file tree
Showing 4 changed files with 57 additions and 37 deletions.
52 changes: 30 additions & 22 deletions Content.Server/Bible/BibleSystem.cs
Original file line number Diff line number Diff line change
@@ -1,36 +1,34 @@
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;
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 ActionBlockerSystem _blocker = 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 ActionBlockerSystem _blocker = default!;
[Dependency] private readonly SharedActionsSystem _actionsSystem = default!;
[Dependency] private readonly MobStateSystem _mobStateSystem = default!;
[Dependency] private readonly UseDelaySystem _delay = default!;

public override void Initialize()
{
Expand Down Expand Up @@ -94,28 +92,23 @@ private void OnAfterInteract(EntityUid uid, BibleComponent component, AfterInter
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<BibleUserComponent>(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;
}
Expand All @@ -133,18 +126,31 @@ private void OnAfterInteract(EntityUid uid, BibleComponent component, AfterInter

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);

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);

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-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<AlternativeVerb> args)
Expand Down Expand Up @@ -238,5 +244,7 @@ private void AttemptSummon(SummonableComponent component, EntityUid user, Transf
}

public sealed class SummonActionEvent : InstantActionEvent
{}
{

}
}
23 changes: 14 additions & 9 deletions Content.Server/Bible/Components/BibleComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,34 @@ namespace Content.Server.Bible.Components
[RegisterComponent]
public sealed class BibleComponent : Component
{
// Damage that will be healed on a success
/// <summary>
/// Damage that will be healed on a success
/// </summary>
[DataField("damage", required: true)]
[ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier Damage = default!;
// Damage that will be dealt on a failure

/// <summary>
/// Damage that will be dealt on a failure
/// </summary>
[DataField("damageOnFail", required: true)]
[ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier DamageOnFail = default!;
// Damage that will be dealt when a non-chaplain attempts to heal

/// <summary>
/// Damage that will be dealt when a non-chaplain attempts to heal
/// </summary>
[DataField("damageOnUntrainedUse", required: true)]
[ViewVariables(VVAccess.ReadWrite)]
public DamageSpecifier DamageOnUntrainedUse = default!;

//Chance the bible will fail to heal someone with no helmet
/// <summary>
/// Chance the bible will fail to heal someone with no helmet
/// </summary>
[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")]
Expand Down
9 changes: 7 additions & 2 deletions Resources/Locale/en-US/chapel/bible.ftl
Original file line number Diff line number Diff line change
@@ -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)}.
Expand Down
10 changes: 6 additions & 4 deletions Resources/Prototypes/Entities/Objects/Specific/Chapel/bibles.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down

0 comments on commit 4df4238

Please sign in to comment.