Implement Kyuuketsuki

This commit is contained in:
2025-03-03 21:21:48 -08:00
parent d883b2b05f
commit 78068e1170
3 changed files with 32 additions and 1 deletions

View File

@@ -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);
}
}

View File

@@ -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"