HP Drain sigil (shura) implementation

Drains 15% of damage done but HP isn't restored by VT timer
This commit is contained in:
2026-06-17 19:09:09 -07:00
parent 35f4b2018d
commit 68a8769834
5 changed files with 47 additions and 7 deletions
@@ -11,12 +11,18 @@ public interface ISigil
[Export] [Export]
public double MoveSpeedModifier { get; } public double MoveSpeedModifier { get; }
[Export]
public bool AutoRevive { get; }
[Export] [Export]
public ElementType ElementType { get; } public ElementType ElementType { get; }
[Export] [Export]
public ElementalResistanceSet ElementalResistanceSet { get; } public ElementalResistanceSet ElementalResistanceSet { get; }
[Export] public SigilTag SigilTag { get; }
}
public enum SigilTag
{
None,
AutoRevive,
HPDrain,
} }
+8 -1
View File
@@ -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="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"] [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://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://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://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://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://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"] [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") stream = ExtResource("26_je0ug")
bus = &"SFX" 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="Item" type="Node" parent="."]
[node name="TransferItemSound" type="AudioStreamPlayer" parent="Item"] [node name="TransferItemSound" type="AudioStreamPlayer" parent="Item"]
@@ -56,6 +56,7 @@ public partial class SfxDatabase : Node
{SoundEffect.EarthDamage, EarthDamageSound}, {SoundEffect.EarthDamage, EarthDamageSound},
{SoundEffect.HolyDamage, HolyDamageSound}, {SoundEffect.HolyDamage, HolyDamageSound},
{SoundEffect.CurseDamage, CurseDamageSound }, {SoundEffect.CurseDamage, CurseDamageSound },
{SoundEffect.AbsorbHP, AbsorbHPSound},
}; };
} }
@@ -98,6 +99,7 @@ public partial class SfxDatabase : Node
[Node] private AudioStreamPlayer EarthDamageSound { get; set; } [Node] private AudioStreamPlayer EarthDamageSound { get; set; }
[Node] private AudioStreamPlayer HolyDamageSound { get; set; } [Node] private AudioStreamPlayer HolyDamageSound { get; set; }
[Node] private AudioStreamPlayer CurseDamageSound { get; set; } [Node] private AudioStreamPlayer CurseDamageSound { get; set; }
[Node] private AudioStreamPlayer AbsorbHPSound { get; set; }
private Dictionary<SoundEffect, AudioStreamPlayer> _sfxMap; private Dictionary<SoundEffect, AudioStreamPlayer> _sfxMap;
@@ -152,5 +154,6 @@ public enum SoundEffect
EarthDamage, EarthDamage,
HolyDamage, HolyDamage,
CurseDamage, CurseDamage,
AbsorbHP,
} }
+11 -3
View File
@@ -354,7 +354,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
{ {
PlayerFXAnimations.Play("death"); PlayerFXAnimations.Play("death");
if (AutoRevive || SigilComponent.Sigil.AutoRevive) if (AutoRevive || SigilComponent.Sigil.SigilTag == SigilTag.AutoRevive)
return; return;
SetSigil(new NoneSigil()); SetSigil(new NoneSigil());
@@ -801,7 +801,7 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
{ {
if (animName == "death") if (animName == "death")
{ {
if (AutoRevive || SigilComponent.Sigil.AutoRevive) if (AutoRevive || SigilComponent.Sigil.SigilTag == SigilTag.AutoRevive)
PlayerFXAnimations.PlayBackwards("revive"); PlayerFXAnimations.PlayBackwards("revive");
else else
PlayerDied?.Invoke(); PlayerDied?.Invoke();
@@ -903,7 +903,8 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
if (((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag == AccessoryTag.HalfVTConsumption) if (((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag == AccessoryTag.HalfVTConsumption)
_healthTimerActive = !_healthTimerActive; _healthTimerActive = !_healthTimerActive;
HealthComponent.Heal(HealthTimerHPRate); if (SigilComponent.Sigil.SigilTag != SigilTag.HPDrain)
HealthComponent.Heal(HealthTimerHPRate);
if (_healthTimerActive) if (_healthTimerActive)
VTComponent.Reduce(1); VTComponent.Reduce(1);
@@ -965,6 +966,13 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
enemy.StatusEffectComponent.Rust.OnNext(true); 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) private async void CollisionDetector_AreaEntered(Area3D area)
@@ -23,6 +23,8 @@ public partial class NoneSigil : ISigil
public ElementType ElementType { get; } = ElementType.None; public ElementType ElementType { get; } = ElementType.None;
public ElementalResistanceSet ElementalResistanceSet => ElementalResistanceSet.None; public ElementalResistanceSet ElementalResistanceSet => ElementalResistanceSet.None;
public SigilTag SigilTag => SigilTag.None;
} }
public partial class AeolicSigil : ISigil public partial class AeolicSigil : ISigil
@@ -36,6 +38,8 @@ public partial class AeolicSigil : ISigil
public ElementType ElementType { get; } = ElementType.Aeolic; public ElementType ElementType { get; } = ElementType.Aeolic;
public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0.25, 0, -0.25, 0, 0, 0, 0); public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0.25, 0, -0.25, 0, 0, 0, 0);
public SigilTag SigilTag => SigilTag.None;
} }
public partial class IgneousSigil : ISigil public partial class IgneousSigil : ISigil
@@ -48,6 +52,8 @@ public partial class IgneousSigil : ISigil
public ElementType ElementType { get; } = ElementType.Igneous; public ElementType ElementType { get; } = ElementType.Igneous;
public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, -0.25, 0.25, 0, 0, 0, 0); public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, -0.25, 0.25, 0, 0, 0, 0);
public SigilTag SigilTag => SigilTag.None;
} }
public partial class TelluricSigil : ISigil public partial class TelluricSigil : ISigil
@@ -61,6 +67,8 @@ public partial class TelluricSigil : ISigil
public ElementType ElementType { get; } = ElementType.Telluric; public ElementType ElementType { get; } = ElementType.Telluric;
public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(-0.25, 0, 0, 0, 0.25, 0, 0); public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(-0.25, 0, 0, 0, 0.25, 0, 0);
public SigilTag SigilTag => SigilTag.None;
} }
public partial class HydricSigil : ISigil public partial class HydricSigil : ISigil
@@ -74,6 +82,8 @@ public partial class HydricSigil : ISigil
public ElementType ElementType { get; } = ElementType.Hydric; public ElementType ElementType { get; } = ElementType.Hydric;
public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, 0.25, 0, 0, -0.25, 0, 0); public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, 0.25, 0, 0, -0.25, 0, 0);
public SigilTag SigilTag => SigilTag.None;
} }
public partial class FerrumSigil : ISigil public partial class FerrumSigil : ISigil
@@ -87,6 +97,8 @@ public partial class FerrumSigil : ISigil
public ElementType ElementType { get; } = ElementType.Ferrum; 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 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 public partial class SanktaSigil : ISigil
@@ -100,6 +112,8 @@ public partial class SanktaSigil : ISigil
public ElementType ElementType { get; } = ElementType.Sankta; public ElementType ElementType { get; } = ElementType.Sankta;
public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, 0, 0, 0, 0, 0.25, -0.25); public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, 0, 0, 0, 0, 0.25, -0.25);
public SigilTag SigilTag => SigilTag.AutoRevive;
} }
public partial class ShuraSigil : ISigil public partial class ShuraSigil : ISigil
@@ -113,4 +127,6 @@ public partial class ShuraSigil : ISigil
public ElementType ElementType { get; } = ElementType.Shura; public ElementType ElementType { get; } = ElementType.Shura;
public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, 0, 0, 0, 0, -0.25, 0.25); public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(0, 0, 0, 0, 0, -0.25, 0.25);
public SigilTag SigilTag => SigilTag.HPDrain;
} }