change swords to not deal damage when parrying

issue-templates
John Montagu, the 4th Earl of Sandvich 2024-03-25 20:54:56 -07:00
parent 51682ef7ef
commit c5e110f92d
Signed by: sandvich
GPG Key ID: 9A39BE37E602B22D
2 changed files with 16 additions and 2 deletions

View File

@ -3,7 +3,12 @@ namespace SupaLidlGame.Items.Weapons;
public interface IParryable public interface IParryable
{ {
public bool IsParryable { get; } public bool IsParryable { get; }
public bool HasParried { get; }
public bool IsParried { get; } public bool IsParried { get; }
public ulong ParryTimeOrigin { get; } public ulong ParryTimeOrigin { get; }
public void Stun(); public void Stun();
} }

View File

@ -56,6 +56,8 @@ public partial class Sword : Weapon, IParryable
[Export] [Export]
public Node2D Anchor { get; set; } public Node2D Anchor { get; set; }
public bool HasParried { get; protected set; }
public override bool IsParryable { get; protected set; } public override bool IsParryable { get; protected set; }
public ulong ParryTimeOrigin { get; protected set; } public ulong ParryTimeOrigin { get; protected set; }
@ -85,6 +87,7 @@ public partial class Sword : Weapon, IParryable
/// </summary> /// </summary>
public void EnableParry(ulong parryTimeOrigin) public void EnableParry(ulong parryTimeOrigin)
{ {
HasParried = false;
IsParried = false; IsParried = false;
IsParryable = true; IsParryable = true;
ParryTimeOrigin = parryTimeOrigin; ParryTimeOrigin = parryTimeOrigin;
@ -95,6 +98,8 @@ public partial class Sword : Weapon, IParryable
/// </summary> /// </summary>
public void DisableParry() public void DisableParry()
{ {
HasParried = false;
IsParried = false;
IsParryable = false; IsParryable = false;
} }
@ -139,9 +144,9 @@ public partial class Sword : Weapon, IParryable
public void Deattack() public void Deattack()
{ {
IsAttacking = false; IsAttacking = false;
DisableParry();
Hitbox.IsDisabled = true; Hitbox.IsDisabled = true;
ProcessHits(); ProcessHits();
DisableParry();
Hitbox.ResetIgnoreList(); Hitbox.ResetIgnoreList();
AnimationPlayer.SpeedScale = 1; AnimationPlayer.SpeedScale = 1;
} }
@ -182,7 +187,7 @@ public partial class Sword : Weapon, IParryable
/// </summary> /// </summary>
public void ProcessHits() public void ProcessHits()
{ {
if (IsParried) if (IsParried || HasParried)
{ {
return; return;
} }
@ -219,6 +224,10 @@ public partial class Sword : Weapon, IParryable
} }
} }
} }
else
{
HasParried = true;
}
} }
} }