From 68a8769834f64d1a6bf843da27c5d0ef6a796cdd Mon Sep 17 00:00:00 2001 From: Zenny Date: Wed, 17 Jun 2026 19:09:09 -0700 Subject: [PATCH] HP Drain sigil (shura) implementation Drains 15% of damage done but HP isn't restored by VT timer --- .../Components/ISigil.cs | 12 +++++++++--- Zennysoft.Game.Ma/src/audio/SFXDatabase.tscn | 9 ++++++++- Zennysoft.Game.Ma/src/audio/SfxDatabase.cs | 3 +++ Zennysoft.Game.Ma/src/player/Player.cs | 14 +++++++++++--- Zennysoft.Game.Ma/src/sigil/SigilComponent.cs | 16 ++++++++++++++++ 5 files changed, 47 insertions(+), 7 deletions(-) diff --git a/Zennysoft.Game.Ma.Implementation/Components/ISigil.cs b/Zennysoft.Game.Ma.Implementation/Components/ISigil.cs index 7913418a..010365f2 100644 --- a/Zennysoft.Game.Ma.Implementation/Components/ISigil.cs +++ b/Zennysoft.Game.Ma.Implementation/Components/ISigil.cs @@ -11,12 +11,18 @@ public interface ISigil [Export] public double MoveSpeedModifier { get; } - [Export] - public bool AutoRevive { get; } - [Export] public ElementType ElementType { get; } [Export] public ElementalResistanceSet ElementalResistanceSet { get; } + + [Export] public SigilTag SigilTag { get; } +} + +public enum SigilTag +{ + None, + AutoRevive, + HPDrain, } diff --git a/Zennysoft.Game.Ma/src/audio/SFXDatabase.tscn b/Zennysoft.Game.Ma/src/audio/SFXDatabase.tscn index a319a7b9..5ef73487 100644 --- a/Zennysoft.Game.Ma/src/audio/SFXDatabase.tscn +++ b/Zennysoft.Game.Ma/src/audio/SFXDatabase.tscn @@ -1,4 +1,4 @@ -[gd_scene load_steps=41 format=3 uid="uid://brgi35xj3b4ud"] +[gd_scene load_steps=42 format=3 uid="uid://brgi35xj3b4ud"] [ext_resource type="Script" uid="uid://cw100tox0ufsy" path="res://src/audio/SfxDatabase.cs" id="1_ojkqd"] [ext_resource type="AudioStream" uid="uid://cye8wlqbx66h4" path="res://src/audio/sfx/player_heal.ogg" id="2_158j8"] @@ -37,6 +37,7 @@ [ext_resource type="AudioStream" uid="uid://bfpxwnxn2o0cy" path="res://src/audio/sfx/general_telluric_damage.ogg" id="24_vn70h"] [ext_resource type="AudioStream" uid="uid://n8anuovfoqmp" path="res://src/audio/sfx/general_holy_damage_2.ogg" id="25_153g4"] [ext_resource type="AudioStream" uid="uid://b4ks6pgrqn0gh" path="res://src/audio/sfx/general_curse_damage.ogg" id="26_je0ug"] +[ext_resource type="AudioStream" uid="uid://ba8xendacec6" path="res://src/audio/sfx/item_kyuu_layer_2.ogg" id="28_ur8ax"] [ext_resource type="AudioStream" uid="uid://d2h4l0gxcs5i2" path="res://src/audio/sfx/item_glued.ogg" id="30_cx2n8"] [ext_resource type="AudioStream" uid="uid://dcfqkapxwvmdd" path="res://src/audio/sfx/iTEM_identify_ALL.ogg" id="31_vpeit"] [ext_resource type="AudioStream" uid="uid://bio3xjbanwas1" path="res://src/audio/sfx/player_item_identified.ogg" id="40_rqu44"] @@ -205,6 +206,12 @@ process_mode = 3 stream = ExtResource("26_je0ug") bus = &"SFX" +[node name="AbsorbHPSound" type="AudioStreamPlayer" parent="Player"] +unique_name_in_owner = true +process_mode = 3 +stream = ExtResource("28_ur8ax") +bus = &"SFX" + [node name="Item" type="Node" parent="."] [node name="TransferItemSound" type="AudioStreamPlayer" parent="Item"] diff --git a/Zennysoft.Game.Ma/src/audio/SfxDatabase.cs b/Zennysoft.Game.Ma/src/audio/SfxDatabase.cs index 28df1466..d35637ce 100644 --- a/Zennysoft.Game.Ma/src/audio/SfxDatabase.cs +++ b/Zennysoft.Game.Ma/src/audio/SfxDatabase.cs @@ -56,6 +56,7 @@ public partial class SfxDatabase : Node {SoundEffect.EarthDamage, EarthDamageSound}, {SoundEffect.HolyDamage, HolyDamageSound}, {SoundEffect.CurseDamage, CurseDamageSound }, + {SoundEffect.AbsorbHP, AbsorbHPSound}, }; } @@ -98,6 +99,7 @@ public partial class SfxDatabase : Node [Node] private AudioStreamPlayer EarthDamageSound { get; set; } [Node] private AudioStreamPlayer HolyDamageSound { get; set; } [Node] private AudioStreamPlayer CurseDamageSound { get; set; } + [Node] private AudioStreamPlayer AbsorbHPSound { get; set; } private Dictionary _sfxMap; @@ -152,5 +154,6 @@ public enum SoundEffect EarthDamage, HolyDamage, CurseDamage, + AbsorbHP, } diff --git a/Zennysoft.Game.Ma/src/player/Player.cs b/Zennysoft.Game.Ma/src/player/Player.cs index 27d11ce9..b3905c7b 100644 --- a/Zennysoft.Game.Ma/src/player/Player.cs +++ b/Zennysoft.Game.Ma/src/player/Player.cs @@ -354,7 +354,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide { PlayerFXAnimations.Play("death"); - if (AutoRevive || SigilComponent.Sigil.AutoRevive) + if (AutoRevive || SigilComponent.Sigil.SigilTag == SigilTag.AutoRevive) return; SetSigil(new NoneSigil()); @@ -801,7 +801,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide { if (animName == "death") { - if (AutoRevive || SigilComponent.Sigil.AutoRevive) + if (AutoRevive || SigilComponent.Sigil.SigilTag == SigilTag.AutoRevive) PlayerFXAnimations.PlayBackwards("revive"); else PlayerDied?.Invoke(); @@ -903,7 +903,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide if (((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag == AccessoryTag.HalfVTConsumption) _healthTimerActive = !_healthTimerActive; - HealthComponent.Heal(HealthTimerHPRate); + if (SigilComponent.Sigil.SigilTag != SigilTag.HPDrain) + HealthComponent.Heal(HealthTimerHPRate); if (_healthTimerActive) VTComponent.Reduce(1); @@ -965,6 +966,13 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide enemy.StatusEffectComponent.Rust.OnNext(true); } } + + if (SigilComponent.Sigil.SigilTag == SigilTag.HPDrain) + { + SfxDatabase.Instance.Play(SoundEffect.AbsorbHP); + var hpToDrain = Mathf.RoundToInt(totalDamage * 0.15f); + HealthComponent.Heal(hpToDrain); + } } private async void CollisionDetector_AreaEntered(Area3D area) diff --git a/Zennysoft.Game.Ma/src/sigil/SigilComponent.cs b/Zennysoft.Game.Ma/src/sigil/SigilComponent.cs index 0f92055d..7d21402d 100644 --- a/Zennysoft.Game.Ma/src/sigil/SigilComponent.cs +++ b/Zennysoft.Game.Ma/src/sigil/SigilComponent.cs @@ -23,6 +23,8 @@ public partial class NoneSigil : ISigil public ElementType ElementType { get; } = ElementType.None; public ElementalResistanceSet ElementalResistanceSet => ElementalResistanceSet.None; + + public SigilTag SigilTag => SigilTag.None; } public partial class AeolicSigil : ISigil @@ -36,6 +38,8 @@ public partial class AeolicSigil : ISigil public ElementType ElementType { get; } = ElementType.Aeolic; public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0.25, 0, -0.25, 0, 0, 0, 0); + + public SigilTag SigilTag => SigilTag.None; } public partial class IgneousSigil : ISigil @@ -48,6 +52,8 @@ public partial class IgneousSigil : ISigil public ElementType ElementType { get; } = ElementType.Igneous; public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, -0.25, 0.25, 0, 0, 0, 0); + + public SigilTag SigilTag => SigilTag.None; } public partial class TelluricSigil : ISigil @@ -61,6 +67,8 @@ public partial class TelluricSigil : ISigil public ElementType ElementType { get; } = ElementType.Telluric; public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(-0.25, 0, 0, 0, 0.25, 0, 0); + + public SigilTag SigilTag => SigilTag.None; } public partial class HydricSigil : ISigil @@ -74,6 +82,8 @@ public partial class HydricSigil : ISigil public ElementType ElementType { get; } = ElementType.Hydric; public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, 0.25, 0, 0, -0.25, 0, 0); + + public SigilTag SigilTag => SigilTag.None; } public partial class FerrumSigil : ISigil @@ -87,6 +97,8 @@ public partial class FerrumSigil : ISigil public ElementType ElementType { get; } = ElementType.Ferrum; public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(-0.25, -0.25, -0.25, 0.25, -0.25, -0.25, -0.25); + + public SigilTag SigilTag => SigilTag.None; } public partial class SanktaSigil : ISigil @@ -100,6 +112,8 @@ public partial class SanktaSigil : ISigil public ElementType ElementType { get; } = ElementType.Sankta; public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, 0, 0, 0, 0, 0.25, -0.25); + + public SigilTag SigilTag => SigilTag.AutoRevive; } public partial class ShuraSigil : ISigil @@ -113,4 +127,6 @@ public partial class ShuraSigil : ISigil public ElementType ElementType { get; } = ElementType.Shura; public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, 0, 0, 0, 0, -0.25, 0.25); + + public SigilTag SigilTag => SigilTag.HPDrain; }