Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Power Attack Stamina Update #1238

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 10 additions & 0 deletions Content.Server/Weapons/Melee/MeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@
using Robust.Shared.Map;
using Robust.Shared.Player;
using Robust.Shared.Random;
using Robust.Shared.Utility;
using System.Linq;
using System.Numerics;
using Content.Shared.Chat;
Expand Down Expand Up @@ -60,6 +61,15 @@ private void OnMeleeExamineDamage(EntityUid uid, MeleeWeaponComponent component,

if (damageSpec * component.HeavyDamageBaseModifier != damageSpec)
_damageExamine.AddDamageExamine(args.Message, damageSpec * component.HeavyDamageBaseModifier, Loc.GetString("damage-melee-heavy"));

if (component.HeavyStaminaCost != 0)
{
var staminaCostMarkup = FormattedMessage.FromMarkupOrThrow(
Loc.GetString("damage-melee-heavy-stamina-cost",
("type", Loc.GetString("damage-melee-heavy")), ("cost", component.HeavyStaminaCost)));
args.Message.PushNewline();
args.Message.AddMessage(staminaCostMarkup);
}
}

protected override bool ArcRaySuccessful(EntityUid targetUid, Vector2 position, Angle angle, Angle arcWidth, float range, MapId mapId,
Expand Down
15 changes: 11 additions & 4 deletions Content.Shared/Weapons/Melee/SharedMeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -545,6 +545,17 @@ private bool DoHeavyAttack(EntityUid user, HeavyAttackEvent ev, EntityUid meleeU
if (targetMap.MapId != userXform.MapID)
return false;

if (TryComp<StaminaComponent>(user, out var stamina))
{
if (stamina.CritThreshold - stamina.StaminaDamage <= component.HeavyStaminaCost)
{
PopupSystem.PopupClient(Loc.GetString("melee-heavy-no-stamina"), meleeUid, user);
return false;
}

_stamina.TakeStaminaDamage(user, component.HeavyStaminaCost, stamina, visual: false);
}

var userPos = TransformSystem.GetWorldPosition(userXform);
var direction = targetMap.Position - userPos;
var distance = Math.Min(component.Range * component.HeavyRangeModifier, direction.Length());
Expand Down Expand Up @@ -670,10 +681,6 @@ private bool DoHeavyAttack(EntityUid user, HeavyAttackEvent ev, EntityUid meleeU
DoDamageEffect(targets, user, Transform(targets[0]));
}

if (TryComp<StaminaComponent>(user, out var stamina))
_stamina.TakeStaminaDamage(user, component.HeavyStaminaCost, stamina);


return true;
}

Expand Down
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/damage/damage-examine.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ damage-throw = throw
damage-examine = It does the following damage:
damage-examine-type = It does the following [color=cyan]{$type}[/color] damage:
damage-value = - [color=red]{$amount}[/color] units of [color=yellow]{$type}[/color].

damage-melee-heavy-stamina-cost = A [color=cyan]{$type}[/color] costs [color=orange]{$cost}[/color] [color=yellow]Stamina[/color].
2 changes: 2 additions & 0 deletions Resources/Locale/en-US/weapons/melee/melee.ftl
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ melee-balloon-pop = {CAPITALIZE(THE($balloon))} popped!

# BatteryComponent
melee-battery-examine = It has enough charge for [color={$color}]{$count}[/color] hits.

melee-heavy-no-stamina = You are too tired to perform a power attack!
Loading