-
Notifications
You must be signed in to change notification settings - Fork 34
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Port] Blood Dagger / Кровавый Кинжал (#86)
add: blood dagger
- Loading branch information
Showing
20 changed files
with
330 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
17 changes: 17 additions & 0 deletions
17
Content.Server/_White/Melee/BloodAbsorb/BloodAbsorbComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
namespace Content.Server._White.Melee.BloodAbsorb; | ||
|
||
[RegisterComponent] | ||
public sealed partial class BloodAbsorbComponent : Component | ||
{ | ||
[DataField] | ||
public bool BloodLust; | ||
|
||
[DataField] | ||
public int MinAbsorb = 1; | ||
|
||
[DataField] | ||
public int MaxAbsorb = 20; | ||
|
||
[DataField] | ||
public float AbsorbModifierOnHeavy = 0.7f; | ||
} |
71 changes: 71 additions & 0 deletions
71
Content.Server/_White/Melee/BloodAbsorb/BloodAbsorbSystem.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,71 @@ | ||
using Content.Server._White.Melee.Crit; | ||
using Content.Server._White.Other.BloodLust; | ||
using Content.Server.Body.Components; | ||
using Content.Server.Body.Systems; | ||
using Content.Shared.Damage; | ||
using Content.Shared.Damage.Prototypes; | ||
using Content.Shared.Weapons.Melee.Events; | ||
using Robust.Shared.Prototypes; | ||
using Robust.Shared.Random; | ||
|
||
namespace Content.Server._White.Melee.BloodAbsorb; | ||
|
||
public sealed class BloodAbsorbSystem : EntitySystem | ||
{ | ||
[Dependency] private readonly IRobustRandom _random = default!; | ||
[Dependency] private readonly BloodstreamSystem _bloodstream = default!; | ||
[Dependency] private readonly DamageableSystem _damageable = default!; | ||
[Dependency] private readonly IPrototypeManager _prototype = default!; | ||
|
||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<BloodAbsorbComponent, CritHitEvent>(OnCritHit); | ||
SubscribeLocalEvent<BloodAbsorbComponent, MeleeHitEvent>(OnMeleeHit); | ||
} | ||
|
||
private void OnCritHit(EntityUid uid, BloodAbsorbComponent component, CritHitEvent args) | ||
{ | ||
if(args.Targets.Count == 0 | ||
|| args.Targets[0] == args.User) | ||
return; | ||
|
||
var absorbed = _random.Next(component.MinAbsorb, component.MaxAbsorb); | ||
|
||
if (args.Targets.Count != 1) // Heavy attack | ||
absorbed = (int) MathF.Round(absorbed * 0.7f); | ||
|
||
foreach (var target in args.Targets) | ||
{ | ||
if (!TryComp(target, out BloodstreamComponent? bloodstream)) | ||
continue; | ||
|
||
var blood = bloodstream.BloodSolution; | ||
|
||
if (blood == null) | ||
continue; | ||
|
||
var bloodLevel = blood.Value.Comp.Solution.Volume.Int(); | ||
|
||
if (!_bloodstream.TryModifyBloodLevel(target, -absorbed, bloodstream, false)) | ||
continue; | ||
|
||
absorbed = Math.Min(absorbed, bloodLevel); | ||
_bloodstream.TryModifyBloodLevel(args.User, absorbed); | ||
_damageable.TryChangeDamage(args.User, new DamageSpecifier(_prototype.Index<DamageGroupPrototype>("Brute"), -absorbed)); | ||
_damageable.TryChangeDamage(args.User, new DamageSpecifier(_prototype.Index<DamageGroupPrototype>("Burn"), -absorbed)); | ||
_damageable.TryChangeDamage(args.User, new DamageSpecifier(_prototype.Index<DamageGroupPrototype>("Airloss"), -absorbed)); | ||
} | ||
} | ||
|
||
private void OnMeleeHit(EntityUid uid, BloodAbsorbComponent component, MeleeHitEvent args) | ||
{ | ||
if (args.HitEntities.Count == 0 | ||
|| args.HitEntities[0] != args.User | ||
|| !component.BloodLust | ||
|| !TryComp(args.User, out BloodstreamComponent? bloodstream)) | ||
return; | ||
|
||
EnsureComp<BloodLustComponent>(args.User); | ||
_bloodstream.TryModifyBleedAmount(args.User, bloodstream.MaxBleedAmount, bloodstream); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
Content.Server/_White/Other/BloodLust/BloodLustComponent.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
namespace Content.Server._White.Other.BloodLust; | ||
|
||
[RegisterComponent] | ||
public sealed partial class BloodLustComponent : Component | ||
{ | ||
[DataField] | ||
public float SprintModifier = 1.3f; | ||
|
||
[DataField] | ||
public float WalkModifier = 1.3f; | ||
|
||
[DataField] | ||
public float AttackRateModifier = 1.5f; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,42 @@ | ||
using Content.Server.Body.Components; | ||
using Content.Shared.Movement.Systems; | ||
using Content.Shared.Weapons.Melee.Events; | ||
|
||
namespace Content.Server._White.Other.BloodLust; | ||
|
||
public sealed class BloodLustSystem : EntitySystem | ||
{ | ||
public override void Initialize() | ||
{ | ||
SubscribeLocalEvent<BloodLustComponent, GetMeleeAttackRateEvent>(OnGetMeleeAttackRate); | ||
SubscribeLocalEvent<BloodLustComponent, RefreshMovementSpeedModifiersEvent>(OnRefreshMovementSpeedModifiers); | ||
} | ||
|
||
private void OnGetMeleeAttackRate(EntityUid uid, BloodLustComponent component, GetMeleeAttackRateEvent args) | ||
{ | ||
if (!TryComp(args.User, out BloodLustComponent? bloodLust)) | ||
return; | ||
|
||
args.Multipliers *= GetBloodLustMultiplier(bloodLust.AttackRateModifier, GetBloodLustModifier(args.User)); | ||
} | ||
|
||
private void OnRefreshMovementSpeedModifiers(EntityUid uid, BloodLustComponent component, RefreshMovementSpeedModifiersEvent args) | ||
{ | ||
var modifier = GetBloodLustModifier(uid); | ||
args.ModifySpeed(GetBloodLustMultiplier(component.WalkModifier, modifier), | ||
GetBloodLustMultiplier(component.SprintModifier, modifier)); | ||
} | ||
|
||
private float GetBloodLustModifier(EntityUid uid) | ||
{ | ||
if (!TryComp(uid, out BloodstreamComponent? bloodstream) || bloodstream.MaxBleedAmount == 0f) | ||
return 1f; | ||
|
||
return Math.Clamp(bloodstream.BleedAmount / bloodstream.MaxBleedAmount, 0f, 1f); | ||
} | ||
|
||
private float GetBloodLustMultiplier(float multiplier, float modifier) | ||
{ | ||
return float.Lerp(1f, multiplier, modifier); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
7 changes: 5 additions & 2 deletions
7
Resources/Locale/ru-RU/_white/prototypes/entities/objects/weapons/melee/daggers.ftl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,5 @@ | ||
ent-BetrayalKnife = предательский кинжал | ||
.desc = Береги спину. | ||
ent-BetrayalDagger = предательский кинжал | ||
.desc = Береги спину. | ||
ent-BloodDagger = кровавый кинжал | ||
.desc = Кинжал из боли и крови. С него что-то капает... |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes
File renamed without changes
File renamed without changes
File renamed without changes.
Binary file added
BIN
+916 Bytes
Resources/Textures/_White/Objects/Weapons/Melee/Daggers/blood_dagger.rsi/icon.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+982 Bytes
.../Textures/_White/Objects/Weapons/Melee/Daggers/blood_dagger.rsi/inhand-left.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added
BIN
+958 Bytes
...Textures/_White/Objects/Weapons/Melee/Daggers/blood_dagger.rsi/inhand-right.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Oops, something went wrong.