Skip to content

Commit

Permalink
Fix issues with nail related attacks on teammates
Browse files Browse the repository at this point in the history
  • Loading branch information
Extremelyd1 committed Oct 8, 2023
1 parent 4dbc11a commit 37c047a
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 9 deletions.
9 changes: 4 additions & 5 deletions HKMP/Animation/Effects/DashSlash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,13 @@ public override void Play(GameObject playerObject, bool[] effectInfo) {
dashSlash.LocateMyFSM("Control Collider").SetState("Init");

var damage = ServerSettings.DashSlashDamage;
if (ServerSettings.IsPvpEnabled) {
if (ServerSettings.IsPvpEnabled && ShouldDoDamage) {
// Somehow adding a DamageHero component or the parry FSM simply to the dash slash object doesn't work,
// so we create a separate object for it
var dashSlashCollider = Object.Instantiate(
new GameObject(
"DashSlashCollider",
typeof(PolygonCollider2D),
typeof(DamageHero)
typeof(PolygonCollider2D)
),
dashSlash.transform
);
Expand All @@ -83,8 +82,8 @@ public override void Play(GameObject playerObject, bool[] effectInfo) {
AddParryFsm(dashSlashCollider);
}

if (ShouldDoDamage && damage != 0) {
dashSlashCollider.GetComponent<DamageHero>().damageDealt = damage;
if (damage != 0) {
dashSlashCollider.AddComponent<DamageHero>().damageDealt = damage;
}
}

Expand Down
4 changes: 2 additions & 2 deletions HKMP/Animation/Effects/GreatSlash.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,12 @@ public override void Play(GameObject playerObject, bool[] effectInfo) {
greatSlash.LocateMyFSM("Control Collider").SetState("Init");

var damage = ServerSettings.GreatSlashDamage;
if (ServerSettings.IsPvpEnabled) {
if (ServerSettings.IsPvpEnabled && ShouldDoDamage) {
if (ServerSettings.AllowParries) {
AddParryFsm(greatSlash);
}

if (ShouldDoDamage && damage != 0) {
if (damage != 0) {
greatSlash.AddComponent<DamageHero>().damageDealt = damage;
}
}
Expand Down
4 changes: 2 additions & 2 deletions HKMP/Animation/Effects/SlashBase.cs
Original file line number Diff line number Diff line change
Expand Up @@ -181,12 +181,12 @@ protected void Play(GameObject playerObject, bool[] effectInfo, GameObject prefa
}

var damage = ServerSettings.NailDamage;
if (ServerSettings.IsPvpEnabled) {
if (ServerSettings.IsPvpEnabled && ShouldDoDamage) {
if (ServerSettings.AllowParries) {
AddParryFsm(slash);
}

if (ShouldDoDamage && damage != 0) {
if (damage != 0) {
slash.AddComponent<DamageHero>().damageDealt = damage;
}
}
Expand Down

0 comments on commit 37c047a

Please sign in to comment.