Compare commits
No commits in common. "341f5137ebea8160b386d377965e5ca8234a9c9c" and "57c821b55c5d16d20610182ca72645fd5131d0d9" have entirely different histories.
341f5137eb
...
57c821b55c
|
@ -27,7 +27,7 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
}
|
}
|
||||||
|
|
||||||
[Export]
|
[Export]
|
||||||
public CharacterStats Stats { get; protected set; }
|
public CharacterStats Stats { get; private set; }
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void HealthChangedEventHandler(Events.HealthChangedArgs args);
|
public delegate void HealthChangedEventHandler(Events.HealthChangedArgs args);
|
||||||
|
@ -115,7 +115,7 @@ public partial class Character : CharacterBody2D, IFaction
|
||||||
|
|
||||||
if (Stats is not null)
|
if (Stats is not null)
|
||||||
{
|
{
|
||||||
Stats.Stagger += (double time, float staggerDamage) =>
|
Stats.Stagger += (double time) =>
|
||||||
{
|
{
|
||||||
Stun(time);
|
Stun(time);
|
||||||
};
|
};
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
[gd_scene load_steps=70 format=3 uid="uid://d2skjvvx6fal0"]
|
[gd_scene load_steps=68 format=3 uid="uid://d2skjvvx6fal0"]
|
||||||
|
|
||||||
[ext_resource type="Script" path="res://Characters/Doc.cs" id="2_3elet"]
|
[ext_resource type="Script" path="res://Characters/Doc.cs" id="2_3elet"]
|
||||||
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_5jxom"]
|
[ext_resource type="Shader" path="res://Shaders/Flash.gdshader" id="2_5jxom"]
|
||||||
|
@ -7,10 +7,8 @@
|
||||||
[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="3_t5jjc"]
|
[ext_resource type="Script" path="res://State/Character/CharacterStateMachine.cs" id="3_t5jjc"]
|
||||||
[ext_resource type="Texture2D" uid="uid://dpepm54hjuyga" path="res://Assets/Sprites/Characters/forsen-hand.png" id="4_8lqj6"]
|
[ext_resource type="Texture2D" uid="uid://dpepm54hjuyga" path="res://Assets/Sprites/Characters/forsen-hand.png" id="4_8lqj6"]
|
||||||
[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="4_b35px"]
|
[ext_resource type="Script" path="res://State/Character/NPCIdleState.cs" id="4_b35px"]
|
||||||
[ext_resource type="Script" path="res://Utils/PlayerStats.cs" id="5_a7fiw"]
|
|
||||||
[ext_resource type="Script" path="res://State/Character/NPCMoveState.cs" id="5_pejsd"]
|
[ext_resource type="Script" path="res://State/Character/NPCMoveState.cs" id="5_pejsd"]
|
||||||
[ext_resource type="Script" path="res://State/NPC/NPCStateMachine.cs" id="6_kjpug"]
|
[ext_resource type="Script" path="res://State/NPC/NPCStateMachine.cs" id="6_kjpug"]
|
||||||
[ext_resource type="Script" path="res://Utils/Values/DoubleValue.cs" id="6_kyulo"]
|
|
||||||
[ext_resource type="Script" path="res://State/Character/CharacterDashState.cs" id="7_0ks57"]
|
[ext_resource type="Script" path="res://State/Character/CharacterDashState.cs" id="7_0ks57"]
|
||||||
[ext_resource type="Script" path="res://State/NPC/Doc/DocTelegraphState.cs" id="7_tfwbh"]
|
[ext_resource type="Script" path="res://State/NPC/Doc/DocTelegraphState.cs" id="7_tfwbh"]
|
||||||
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="7_tnve0"]
|
[ext_resource type="PackedScene" uid="uid://cjgxyhgcyvsv7" path="res://BoundingBoxes/Hurtbox.tscn" id="7_tnve0"]
|
||||||
|
@ -573,12 +571,6 @@ Inventory = NodePath("Inventory")
|
||||||
StateMachine = NodePath("StateMachine")
|
StateMachine = NodePath("StateMachine")
|
||||||
Hurtbox = NodePath("Hurtbox")
|
Hurtbox = NodePath("Hurtbox")
|
||||||
|
|
||||||
[node name="Stats" type="Node" parent="."]
|
|
||||||
script = ExtResource("5_a7fiw")
|
|
||||||
|
|
||||||
[node name="StaggerDamage" type="Node" parent="Stats"]
|
|
||||||
script = ExtResource("6_kyulo")
|
|
||||||
|
|
||||||
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
|
[node name="StateMachine" type="Node" parent="." node_paths=PackedStringArray("InitialState", "Character")]
|
||||||
script = ExtResource("3_t5jjc")
|
script = ExtResource("3_t5jjc")
|
||||||
InitialState = NodePath("Idle")
|
InitialState = NodePath("Idle")
|
||||||
|
|
|
@ -42,6 +42,7 @@ public sealed partial class Player : Character
|
||||||
[Export]
|
[Export]
|
||||||
public AnimationTree AnimationTree { get; private set; }
|
public AnimationTree AnimationTree { get; private set; }
|
||||||
|
|
||||||
|
[Export]
|
||||||
public new PlayerStats Stats { get; private set; }
|
public new PlayerStats Stats { get; private set; }
|
||||||
|
|
||||||
public InteractionRay InteractionRay { get; private set; }
|
public InteractionRay InteractionRay { get; private set; }
|
||||||
|
@ -53,10 +54,8 @@ public sealed partial class Player : Character
|
||||||
_characterEffects = GetNode<Node2D>("%CharacterEffects");
|
_characterEffects = GetNode<Node2D>("%CharacterEffects");
|
||||||
_targetTracer = GetNode<TargetTracer>("%TargetTracer");
|
_targetTracer = GetNode<TargetTracer>("%TargetTracer");
|
||||||
|
|
||||||
base.Stats = GetNode<PlayerStats>("Stats");
|
|
||||||
Stats = (PlayerStats)base.Stats;
|
|
||||||
|
|
||||||
base._Ready();
|
base._Ready();
|
||||||
|
Stats = GetNode<PlayerStats>("Stats");
|
||||||
|
|
||||||
Inventory.UsedItem += (Items.Item item) =>
|
Inventory.UsedItem += (Items.Item item) =>
|
||||||
{
|
{
|
||||||
|
|
|
@ -576,7 +576,7 @@ size = Vector2(8, 8)
|
||||||
closed = false
|
closed = false
|
||||||
polygon = PackedVector2Array(-3, 0, 2, 0)
|
polygon = PackedVector2Array(-3, 0, 2, 0)
|
||||||
|
|
||||||
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Camera", "DirectionMarker", "Stats", "Sprite", "Inventory", "StateMachine", "Hurtbox")]
|
[node name="Player" type="CharacterBody2D" node_paths=PackedStringArray("Camera", "DirectionMarker", "Stats", "Stats", "Sprite", "Inventory", "StateMachine", "Hurtbox")]
|
||||||
y_sort_enabled = true
|
y_sort_enabled = true
|
||||||
texture_filter = 3
|
texture_filter = 3
|
||||||
material = SubResource("ShaderMaterial_h78y7")
|
material = SubResource("ShaderMaterial_h78y7")
|
||||||
|
@ -585,6 +585,7 @@ collision_mask = 17
|
||||||
script = ExtResource("1_flygr")
|
script = ExtResource("1_flygr")
|
||||||
Camera = NodePath("Camera2D")
|
Camera = NodePath("Camera2D")
|
||||||
DirectionMarker = NodePath("Direction2D")
|
DirectionMarker = NodePath("Direction2D")
|
||||||
|
Stats = NodePath("Stats")
|
||||||
Speed = 80.0
|
Speed = 80.0
|
||||||
Stats = NodePath("Stats")
|
Stats = NodePath("Stats")
|
||||||
HandTexture = ExtResource("3_3dqh7")
|
HandTexture = ExtResource("3_3dqh7")
|
||||||
|
|
|
@ -10,7 +10,5 @@ public interface IParryable
|
||||||
|
|
||||||
public ulong ParryTimeOrigin { get; }
|
public ulong ParryTimeOrigin { get; }
|
||||||
|
|
||||||
public float BlockForce { get; }
|
public void Stun();
|
||||||
|
|
||||||
public void Stun(float blockForce);
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,9 +62,6 @@ public partial class Sword : Weapon, IParryable
|
||||||
|
|
||||||
public ulong ParryTimeOrigin { get; protected set; }
|
public ulong ParryTimeOrigin { get; protected set; }
|
||||||
|
|
||||||
[Export]
|
|
||||||
public float BlockForce { get; set; } = 1;
|
|
||||||
|
|
||||||
private Tween _currentTween;
|
private Tween _currentTween;
|
||||||
|
|
||||||
private AnimationNodeStateMachinePlayback _playback;
|
private AnimationNodeStateMachinePlayback _playback;
|
||||||
|
@ -217,7 +214,7 @@ public partial class Sword : Weapon, IParryable
|
||||||
{
|
{
|
||||||
// our character was parried
|
// our character was parried
|
||||||
ParryParticles.CloneOnWorld<GpuParticles2D>().EmitOneShot();
|
ParryParticles.CloneOnWorld<GpuParticles2D>().EmitOneShot();
|
||||||
Stun(otherParryable.BlockForce);
|
Stun();
|
||||||
|
|
||||||
if (otherParryable is Sword sword)
|
if (otherParryable is Sword sword)
|
||||||
{
|
{
|
||||||
|
@ -238,13 +235,12 @@ public partial class Sword : Weapon, IParryable
|
||||||
/// Stuns the wepaon holder. This is unique to swords and melee weapons
|
/// Stuns the wepaon holder. This is unique to swords and melee weapons
|
||||||
/// if they can parry.
|
/// if they can parry.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public void Stun(float blockForce)
|
public void Stun()
|
||||||
{
|
{
|
||||||
IsParried = true;
|
IsParried = true;
|
||||||
Character.Stats.AddStaggerDamage(Damage * blockForce);
|
AnimationPlayer.SpeedScale = 0.25f;
|
||||||
|
Character.Stun(2);
|
||||||
// optionally play parry sound
|
GetNode<AudioStreamPlayer2D>("ParrySound")
|
||||||
GetNode<AudioStreamPlayer2D>("ParrySound")?
|
|
||||||
.OnWorld()
|
.OnWorld()
|
||||||
.WithPitchDeviation(0.125f)
|
.WithPitchDeviation(0.125f)
|
||||||
.PlayOneShot();
|
.PlayOneShot();
|
||||||
|
|
|
@ -25,13 +25,9 @@ public partial class SwordBlockState : WeaponState
|
||||||
|
|
||||||
private bool _isAlternate = false;
|
private bool _isAlternate = false;
|
||||||
|
|
||||||
private float _oldBlockForce;
|
|
||||||
|
|
||||||
public override WeaponState Enter(IState<WeaponState> prevState)
|
public override WeaponState Enter(IState<WeaponState> prevState)
|
||||||
{
|
{
|
||||||
Sword.EnableParry(ulong.MaxValue);
|
Sword.EnableParry(ulong.MaxValue);
|
||||||
_oldBlockForce = Sword.BlockForce;
|
|
||||||
Sword.BlockForce *= 4;
|
|
||||||
|
|
||||||
_useDuration = Sword.UseAltTime;
|
_useDuration = Sword.UseAltTime;
|
||||||
_attackDuration = Sword.AttackAltTime;
|
_attackDuration = Sword.AttackAltTime;
|
||||||
|
@ -59,12 +55,6 @@ public partial class SwordBlockState : WeaponState
|
||||||
|
|
||||||
public override void Exit(IState<WeaponState> nextState)
|
public override void Exit(IState<WeaponState> nextState)
|
||||||
{
|
{
|
||||||
if (nextState == IdleState)
|
|
||||||
{
|
|
||||||
Sword.AnimationPlayer.Play("RESET");
|
|
||||||
}
|
|
||||||
|
|
||||||
Sword.BlockForce = _oldBlockForce;
|
|
||||||
Deattack();
|
Deattack();
|
||||||
HasBlocked = false;
|
HasBlocked = false;
|
||||||
}
|
}
|
||||||
|
@ -81,6 +71,7 @@ public partial class SwordBlockState : WeaponState
|
||||||
|
|
||||||
if ((_useDuration -= delta) <= 0)
|
if ((_useDuration -= delta) <= 0)
|
||||||
{
|
{
|
||||||
|
Sword.AnimationPlayer.Play("RESET");
|
||||||
return IdleState;
|
return IdleState;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -8,6 +8,7 @@ public partial class StunEffect : ColorRect
|
||||||
{
|
{
|
||||||
Events.EventBus.Instance.PlayerStun += () =>
|
Events.EventBus.Instance.PlayerStun += () =>
|
||||||
{
|
{
|
||||||
|
GD.Print("PLAYER STUNNED!!!");
|
||||||
GetNode<AnimationPlayer>("AnimationPlayer").Play("tighten");
|
GetNode<AnimationPlayer>("AnimationPlayer").Play("tighten");
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
|
@ -16,7 +16,7 @@ public partial class CharacterStats : Node
|
||||||
public double MaxStagger { get; set; } = 25;
|
public double MaxStagger { get; set; } = 25;
|
||||||
|
|
||||||
[Signal]
|
[Signal]
|
||||||
public delegate void StaggerEventHandler(double time, float damage);
|
public delegate void StaggerEventHandler(double time);
|
||||||
|
|
||||||
public bool ShouldStagger => StaggerDamage.Value >= MaxStagger;
|
public bool ShouldStagger => StaggerDamage.Value >= MaxStagger;
|
||||||
|
|
||||||
|
@ -42,12 +42,10 @@ public partial class CharacterStats : Node
|
||||||
|
|
||||||
public void AddStaggerDamage(float damage)
|
public void AddStaggerDamage(float damage)
|
||||||
{
|
{
|
||||||
float delta = damage * (float)StaggerCoefficient;
|
StaggerDamage.Value += damage * StaggerCoefficient;
|
||||||
StaggerDamage.Value += delta;
|
|
||||||
if (StaggerDamage.Value >= MaxStagger)
|
if (StaggerDamage.Value >= MaxStagger)
|
||||||
{
|
{
|
||||||
EmitSignal(SignalName.Stagger, 1, delta);
|
EmitSignal(SignalName.Stagger, 1);
|
||||||
StaggerDamage.Value = 0;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue