Implement Elemental Caster item

This commit is contained in:
2025-03-03 21:33:19 -08:00
parent 78068e1170
commit 4363c4d2eb
9 changed files with 110 additions and 2 deletions

View File

@@ -2,7 +2,6 @@
using Chickensoft.Introspection; using Chickensoft.Introspection;
using Godot; using Godot;
using System; using System;
using System.Collections.Generic;
using System.Linq; using System.Linq;
namespace GameJamDungeon; namespace GameJamDungeon;
@@ -51,6 +50,8 @@ public partial class EffectItem : Node3D, IUsableItem
HealAllEnemiesAndPlayerInRoomToFull(); HealAllEnemiesAndPlayerInRoomToFull();
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.AbsorbHPFromAllEnemiesInRoom)) if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.AbsorbHPFromAllEnemiesInRoom))
AbsorbHPFromAllEnemiesInRoom(); AbsorbHPFromAllEnemiesInRoom();
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.DealElementalDamageToAllEnemiesInRoom))
DealElementalDamageToAllEnemiesInRoom(ElementType.Hydric);
} }
public void SetItemStats(InventoryItemStats inventoryItemStats) public void SetItemStats(InventoryItemStats inventoryItemStats)
@@ -155,4 +156,12 @@ public partial class EffectItem : Node3D, IUsableItem
Player.Stats.SetCurrentHP(Player.Stats.CurrentHP.Value + (int)hpToAbsorb); Player.Stats.SetCurrentHP(Player.Stats.CurrentHP.Value + (int)hpToAbsorb);
GD.Print("HP to absorb: " + hpToAbsorb); GD.Print("HP to absorb: " + hpToAbsorb);
} }
private void DealElementalDamageToAllEnemiesInRoom(ElementType elementType)
{
var currentRoom = Player.GetCurrentRoom();
var currentEnemies = currentRoom.EnemiesInRoom;
foreach (var enemy in currentEnemies)
enemy.TakeDamage(20, elementType);
}
} }

View File

@@ -7,4 +7,7 @@ public partial class EffectItemStats : InventoryItemStats
{ {
[Export] [Export]
public Godot.Collections.Array<UsableItemTag> UsableItemTags { get; set; } = new Godot.Collections.Array<UsableItemTag>(); public Godot.Collections.Array<UsableItemTag> UsableItemTags { get; set; } = new Godot.Collections.Array<UsableItemTag>();
[Export]
public ElementType ElementalDamageType { get; set; }
} }

View File

@@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://crvn3srgpj2fh"]
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_u0h2q"]
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="2_yytis"]
[resource]
script = ExtResource("2_yytis")
UsableItemTags = Array[int]([9])
ElementalDamageType = 1
Name = "Aeolic Caster"
Description = "Deal Aeolic Damage to all enemies in the room."
Texture = ExtResource("1_u0h2q")
SpawnRate = 0.5
ThrowSpeed = 12.0
HealHPAmount = 0
HealVTAmount = 0
ThrowDamage = 5
ItemTags = Array[int]([])
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"

View File

@@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://d3to07qm7fm4"]
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_xsfvc"]
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="2_i4na1"]
[resource]
script = ExtResource("2_i4na1")
UsableItemTags = Array[int]([9])
ElementalDamageType = 5
Name = "Ferrum Caster"
Description = "Deal Ferrum Damage to all enemies in the room."
Texture = ExtResource("1_xsfvc")
SpawnRate = 0.5
ThrowSpeed = 12.0
HealHPAmount = 0
HealVTAmount = 0
ThrowDamage = 5
ItemTags = Array[int]([])
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"

View File

@@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://bgqu6jsadtqjq"]
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_8v5wn"]
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="1_mj844"]
[resource]
script = ExtResource("1_mj844")
UsableItemTags = Array[int]([9])
ElementalDamageType = 3
Name = "Hydric Caster"
Description = "Deal Hydric Damage to all enemies in the room."
Texture = ExtResource("1_8v5wn")
SpawnRate = 0.5
ThrowSpeed = 12.0
HealHPAmount = 0
HealVTAmount = 0
ThrowDamage = 5
ItemTags = Array[int]([])
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"

View File

@@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://brj7h6tgifa5n"]
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_3iam5"]
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="2_cl8lc"]
[resource]
script = ExtResource("2_cl8lc")
UsableItemTags = Array[int]([9])
ElementalDamageType = 4
Name = "Igneous Caster"
Description = "Deal Igneous Damage to all enemies in the room."
Texture = ExtResource("1_3iam5")
SpawnRate = 0.5
ThrowSpeed = 12.0
HealHPAmount = 0
HealVTAmount = 0
ThrowDamage = 5
ItemTags = Array[int]([])
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"

View File

@@ -0,0 +1,19 @@
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://dw26l3f3hd2sq"]
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_x62ct"]
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="2_38yjb"]
[resource]
script = ExtResource("2_38yjb")
UsableItemTags = Array[int]([9])
ElementalDamageType = 2
Name = "Telluric Caster"
Description = "Deal Telluric Damage to all enemies in the room."
Texture = ExtResource("1_x62ct")
SpawnRate = 0.5
ThrowSpeed = 12.0
HealHPAmount = 0
HealVTAmount = 0
ThrowDamage = 5
ItemTags = Array[int]([])
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"

View File

@@ -19,6 +19,7 @@ public enum UsableItemTag
KillHalfEnemiesInRoom, KillHalfEnemiesInRoom,
AbsorbHPFromAllEnemiesInRoom, AbsorbHPFromAllEnemiesInRoom,
HealsAllInRoomToMaxHP, HealsAllInRoomToMaxHP,
DealElementalDamageToAllEnemiesInRoom,
RandomEffect, RandomEffect,
} }

View File

@@ -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://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="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="PackedScene" uid="uid://d0pl1n1jf77jm" path="res://src/items/effect/EffectItem.tscn" id="16_aqomv"]
[ext_resource type="Resource" uid="uid://bldgbv38yplgk" path="res://src/items/effect/resources/Kyuuketsuki.tres" id="17_ntxe5"] [ext_resource type="Resource" uid="uid://bgqu6jsadtqjq" path="res://src/items/effect/resources/HydricCaster.tres" id="17_ntxe5"]
[ext_resource type="Resource" uid="uid://bptg6eybj5dxk" path="res://src/items/effect/resources/DevicRecall.tres" id="18_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"] [sub_resource type="StandardMaterial3D" id="StandardMaterial3D_3ubi4"]