From 78068e11706fb0c64b2ef644164909751d64daeb Mon Sep 17 00:00:00 2001 From: Zenny Date: Mon, 3 Mar 2025 21:21:48 -0800 Subject: [PATCH] Implement Kyuuketsuki --- src/items/effect/EffectItem.cs | 13 +++++++++++++ src/items/effect/resources/Kyuuketsuki.tres | 18 ++++++++++++++++++ src/map/dungeon/floors/Floor00.tscn | 2 +- 3 files changed, 32 insertions(+), 1 deletion(-) create mode 100644 src/items/effect/resources/Kyuuketsuki.tres diff --git a/src/items/effect/EffectItem.cs b/src/items/effect/EffectItem.cs index 4641641a..0c05ee34 100644 --- a/src/items/effect/EffectItem.cs +++ b/src/items/effect/EffectItem.cs @@ -49,6 +49,8 @@ public partial class EffectItem : Node3D, IUsableItem TurnAllEnemiesInRoomIntoHealingItem(); if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.HealsAllInRoomToMaxHP)) HealAllEnemiesAndPlayerInRoomToFull(); + if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.AbsorbHPFromAllEnemiesInRoom)) + AbsorbHPFromAllEnemiesInRoom(); } public void SetItemStats(InventoryItemStats inventoryItemStats) @@ -142,4 +144,15 @@ public partial class EffectItem : Node3D, IUsableItem enemy.SetCurrentHP(enemy.GetMaximumHP()); Player.Stats.SetCurrentHP(Player.Stats.MaximumHP.Value); } + + private void AbsorbHPFromAllEnemiesInRoom() + { + var currentRoom = Player.GetCurrentRoom(); + var currentEnemies = currentRoom.EnemiesInRoom; + var hpToAbsorb = 0.0; + foreach (var enemy in currentEnemies) + hpToAbsorb += enemy.CurrentHP * 0.05; + Player.Stats.SetCurrentHP(Player.Stats.CurrentHP.Value + (int)hpToAbsorb); + GD.Print("HP to absorb: " + hpToAbsorb); + } } diff --git a/src/items/effect/resources/Kyuuketsuki.tres b/src/items/effect/resources/Kyuuketsuki.tres new file mode 100644 index 00000000..37ab9f66 --- /dev/null +++ b/src/items/effect/resources/Kyuuketsuki.tres @@ -0,0 +1,18 @@ +[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://bldgbv38yplgk"] + +[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_0tcgy"] +[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="1_hxj1b"] + +[resource] +script = ExtResource("1_hxj1b") +UsableItemTags = Array[int]([7]) +Name = "Kyuuketsuki" +Description = "Absorbs HP from all enemies in the room." +Texture = ExtResource("1_0tcgy") +SpawnRate = 0.5 +ThrowSpeed = 12.0 +HealHPAmount = 0 +HealVTAmount = 0 +ThrowDamage = 5 +ItemTags = Array[int]([]) +metadata/_custom_type_script = "uid://b5w4iw4iqmxtn" diff --git a/src/map/dungeon/floors/Floor00.tscn b/src/map/dungeon/floors/Floor00.tscn index 60f419bf..7a9e123d 100644 --- a/src/map/dungeon/floors/Floor00.tscn +++ b/src/map/dungeon/floors/Floor00.tscn @@ -16,7 +16,7 @@ [ext_resource type="Texture2D" uid="uid://4k6vtn4oip5f" path="res://src/map/dungeon/models/Set A/02. Altar/02_ALTAR_FLOOR_ZER0_VER_TILE4.png" id="14_qqc7i"] [ext_resource type="Texture2D" uid="uid://cururtxtgylxf" path="res://src/map/dungeon/models/Set A/02. Altar/02_ALTAR_FLOOR_ZER0_VER_COLUMN.jpg" id="15_ojbcg"] [ext_resource type="PackedScene" uid="uid://d0pl1n1jf77jm" path="res://src/items/effect/EffectItem.tscn" id="16_aqomv"] -[ext_resource type="Resource" uid="uid://5tbtsch3qagg" path="res://src/items/effect/resources/HeavensRebellion.tres" id="17_ntxe5"] +[ext_resource type="Resource" uid="uid://bldgbv38yplgk" path="res://src/items/effect/resources/Kyuuketsuki.tres" id="17_ntxe5"] [ext_resource type="Resource" uid="uid://bptg6eybj5dxk" path="res://src/items/effect/resources/DevicRecall.tres" id="18_ntxe5"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3ubi4"]