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 bool IsParryable { get; }
public bool HasParried { get; }
public bool IsParried { get; }
public ulong ParryTimeOrigin { get; }
public void Stun();
}

View File

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