Skip to content

Commit

Permalink
NyanoCombat 2, Part 1: Simple Melee Refactor (#605)
Browse files Browse the repository at this point in the history
# Description

Done in partnership with @OldDanceJacket 

This is a simple refactor of the Melee System, which introduces some new
implementations of Contests, but more importantly lightly refactors
melee so that "Light Attack"(Left Click) and "Heavy Attack"(Right Click)
are now no longer hardcoded to be the same thing, and now can have
different modifiers. We've set things up so that weapons can have
different behaviors and bonuses if they are used in a heavy attack as
opposed to a light attack, including range and damage.

In addition to simple code cleanup, I have done the following things:
- Max Number of targets per Power Attack(Wide Swing) is now set via a
CVar instead of a constant, but is still defaulted to 5.

All Blunt Weapons have been changed to
- Deal 100% of Blunt as Stamina(up from 50%) by default
- BluntDamageStaminaFactor can now be overridden by specific weapons

Light Attacks have been changed to:
- Deal up to 25% less damage scaling with taken stamina damage
- Deal up to 20% more damage with being injured

Heavy Attacks have been changed to:
- Deal up to 50% less damage scaling with taken stamina damage
- Deal up to 20% more damage with being injured
- Now deal (by default) 10 points of stamina damage to the wielder
- In a separate PR, nearly every weapon in the game is going to have
their Wide Swing(Now "Power Attack") mode stats looked at.
- When examining the damage a weapon deals, if it has any damage
modifiers when power attacking, these values will be shown in addition
to the light attack damage.

Heavy attacks can now have separate modifiers for:
- Attack Range (multiply against light attack range)
- Attack Damage (multiply against light attack damage)
- Attack Speed (multiply against light attack speed)
- Stamina Cost (overriding the default)

We will be building upon this PR throughout the week with additional
PRs, to include a full rework of melee weapon values across the entire
board. For the most part, this PR is primarily here to give new options
for contributors to balance melee weapons.

# Note For Maintainers:

@OldDanceJacket will be following this up with his own PR containing
Part 2, which will include a comprehensive rework of the damage values
for every melee weapon in the entire game. Due to this, I can't actually
make that much in the way of significant changes to the components in
review without messing with his side of things.

I also have my own Part 3 that I will be working in partnership with ODJ
on throughout this week, which will consist of a pack of combat-system
related Traits.

# Changelog

:cl: @VMSolidus and @OldDanceJacket 
- add: Being injured now lets you deal up to 20% more damage in melee
combat to simulate the adrenaline rush from taking a hit.
- add: Taking stamina damage now makes you deal less damage in melee. Up
to 25% less for Light Attacks, and 50% less for Power Attacks
- add: Wide Swing has been reworked as "Power Attack". Power attacks
cost 20 stamina(by default) to perform, and their effects can differ
from Light attacks on a per-weapon basis. Individual weapons can also
have different stamina costs to power attack with.

---------

Signed-off-by: Danger Revolution! <[email protected]>
Co-authored-by: Danger Revolution! <[email protected]>
  • Loading branch information
VMSolidus and DangerRevolution committed Aug 10, 2024
1 parent 643df55 commit b9bf6e6
Show file tree
Hide file tree
Showing 2 changed files with 1 addition and 2 deletions.
2 changes: 1 addition & 1 deletion Content.Client/Weapons/Melee/MeleeWeaponSystem.cs
Original file line number Diff line number Diff line change
Expand Up @@ -222,7 +222,7 @@ private void ClientHeavyAttack(EntityUid user, EntityCoordinates coordinates, En

var userPos = TransformSystem.GetWorldPosition(userXform);
var direction = targetMap.Position - userPos;
var distance = MathF.Min(component.Range, direction.Length());
var distance = MathF.Min(component.Range * component.HeavyRangeModifier, direction.Length());

// This should really be improved. GetEntitiesInArc uses pos instead of bounding boxes.
// Server will validate it with InRangeUnobstructed.
Expand Down
1 change: 0 additions & 1 deletion Content.Shared/Weapons/Melee/MeleeWeaponComponent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ public sealed partial class MeleeWeaponComponent : Component
[DataField, AutoNetworkedField]
public int MaxTargets = 5;


// Sounds

/// <summary>
Expand Down

0 comments on commit b9bf6e6

Please sign in to comment.