Item holy and all element implementation, still need to work out some of the math for it

Fix bonus defense for weapons
This commit is contained in:
2026-02-05 10:48:24 -08:00
parent 8a99771491
commit 8ea881edb3
18 changed files with 88 additions and 28 deletions

View File

@@ -59,6 +59,10 @@ public abstract partial class InventoryItemStats : Resource
[Save("equipment_ferrum_resist")]
public int FerrumResistance { get; set; } = 0;
[Export]
[Save("equipment_holy_resist")]
public int HolyResistance { get; set; } = 0;
[Export(PropertyHint.Range, "0, 25, 0.1")]
[Save("equipment_throw_speed")]
public float ThrowSpeed { get; set; } = 12.0f;
@@ -74,7 +78,4 @@ public abstract partial class InventoryItemStats : Resource
[Export]
[Save("inventory_item_texture")]
public Texture2D Texture { get; set; }
[Export]
public AudioStream AudioStream { get; set; }
}

View File

@@ -36,7 +36,7 @@ public partial class Accessory : EquipableItem
public override int BonusVT => Stats.BonusVT;
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance);
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance);
[Save("accessory_tag")]
public AccessoryTag AccessoryTag => Stats.AccessoryTag;

View File

@@ -34,7 +34,7 @@ public partial class Armor : EquipableItem
[Save("bonus_defense")]
private int _bonusDefense { get; set; } = 0;
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance);
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance);
public void IncreaseArmorDefense(int bonus) => _bonusDefense += bonus;

View File

@@ -29,5 +29,9 @@ public partial class ArmorStats : InventoryItemStats
[Save("armor_ferrum_resistance")]
private double _ferrumResistance { get; set; } = 0;
public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(_aeolicResistance, _hydricResistance, _igneousResistance, _ferrumResistance, _telluricResistance);
[Export]
[Save("armor_holy_resistance")]
private double _holyResistance { get; set; } = 0;
public ElementalResistanceSet ElementalResistanceSet => new ElementalResistanceSet(_aeolicResistance, _hydricResistance, _igneousResistance, _ferrumResistance, _telluricResistance, _holyResistance);
}

View File

@@ -41,17 +41,26 @@ public partial class Weapon : EquipableItem
[Save("weapon_element")]
public ElementType WeaponElement => Stats.WeaponElement;
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance);
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance, Stats.HolyResistance);
public void IncreaseWeaponAttack(int bonus) => _bonusDamage += bonus;
public void SetWeaponAttack(int newBonus) => _bonusDamage = newBonus;
public void IncreaseWeaponDefense(int bonus) => _bonusDefense += bonus;
public void SetWeaponDefense(int newBonus) => _bonusDefense = newBonus;
public override int BonusAttack { get => Stats.BonusAttack + _bonusDamage; }
public override int BonusDefense { get => Stats.BonusDefense + _bonusDefense; }
[Save("weapon_bonus_damage")]
private int _bonusDamage { get; set; } = 0;
[Save("weapon_bonus_damage")]
private int _bonusDefense { get; set; } = 0;
[Export]
[Save("weapon_stats")]
public WeaponStats Stats { get; set; } = new WeaponStats();

View File

@@ -22,5 +22,5 @@ public partial class WeaponStats : InventoryItemStats
public WeaponTag WeaponTag { get; set; } = WeaponTag.None;
[Export]
public SoundEffect SoundEffect { get; set; } = SoundEffect.WeaponSwing;
public SoundEffect SoundEffect { get; set; } = SoundEffect.WeaponQuickSlash;
}

View File

@@ -7,8 +7,9 @@
[resource]
script = ExtResource("1_kbje7")
AttackSpeed = 1.0
WeaponElement = 0
WeaponElement = 5
WeaponTag = 0
SoundEffect = 4
Name = "Kubel"
Description = "+9 ATK
A very powerful spear.

View File

@@ -1,14 +1,14 @@
[gd_resource type="Resource" script_class="WeaponStats" load_steps=4 format=3 uid="uid://ckj1m4iv4m02r"]
[gd_resource type="Resource" script_class="WeaponStats" load_steps=3 format=3 uid="uid://ckj1m4iv4m02r"]
[ext_resource type="AudioStream" uid="uid://ilf2s8ct2stt" path="res://src/audio/sfx/PLAYER_slower_slash.ogg" id="1_eh5k4"]
[ext_resource type="Texture2D" uid="uid://740syoj0w14p" path="res://src/items/weapons/textures/PALM OF HEAVEN.PNG" id="1_hi6xm"]
[ext_resource type="Script" uid="uid://cc7byqeolw5y4" path="res://src/items/weapons/WeaponStats.cs" id="1_pwwg7"]
[resource]
script = ExtResource("1_pwwg7")
AttackSpeed = 1.0
WeaponElement = 0
WeaponElement = 7
WeaponTag = 0
SoundEffect = 22
Name = "Palm of Heaven"
Description = "+10 ATK
Very Powerful.
@@ -24,8 +24,8 @@ TelluricResistance = 0
HydricResistance = 0
IgneousResistance = 0
FerrumResistance = 0
HolyResistance = 0
ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_hi6xm")
AudioStream = ExtResource("1_eh5k4")

View File

@@ -0,0 +1,30 @@
[gd_resource type="Resource" script_class="WeaponStats" load_steps=4 format=3 uid="uid://bdjji8ento6on"]
[ext_resource type="AudioStream" uid="uid://ilf2s8ct2stt" path="res://src/audio/sfx/PLAYER_slower_slash.ogg" id="1_nr6vs"]
[ext_resource type="Texture2D" uid="uid://b8c7kd436tg4" path="res://src/items/weapons/textures/RONDO.PNG" id="2_nr6vs"]
[ext_resource type="Script" uid="uid://cc7byqeolw5y4" path="res://src/items/weapons/WeaponStats.cs" id="3_2ykeu"]
[resource]
script = ExtResource("3_2ykeu")
AttackSpeed = 1.0
WeaponElement = 5
WeaponTag = 6
SoundEffect = 4
Name = "Rusted Blade"
Description = "Small chance to give enemy and self a lethal infection."
SpawnRate = 0.1
BonusAttack = 0
BonusDefense = 0
BonusLuck = 0.05
BonusHP = 0
BonusVT = 0
AeolicResistance = 0
TelluricResistance = 0
HydricResistance = 0
IgneousResistance = 0
FerrumResistance = 0
ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("2_nr6vs")
AudioStream = ExtResource("1_nr6vs")

View File

@@ -1,7 +1,6 @@
[gd_resource type="Resource" script_class="WeaponStats" load_steps=4 format=3 uid="uid://dj6i0em2a3hj8"]
[gd_resource type="Resource" script_class="WeaponStats" load_steps=3 format=3 uid="uid://dj6i0em2a3hj8"]
[ext_resource type="Texture2D" uid="uid://cixq2naufiuhv" path="res://src/items/weapons/textures/spaded staff.PNG" id="1_6tifm"]
[ext_resource type="AudioStream" uid="uid://ilf2s8ct2stt" path="res://src/audio/sfx/PLAYER_slower_slash.ogg" id="1_n7ptf"]
[ext_resource type="Script" uid="uid://cc7byqeolw5y4" path="res://src/items/weapons/WeaponStats.cs" id="2_w4n0u"]
[resource]
@@ -9,6 +8,7 @@ script = ExtResource("2_w4n0u")
AttackSpeed = 0.75
WeaponElement = 0
WeaponTag = 0
SoundEffect = 23
Name = "Monk's Spade"
Description = "+5 ATK, Slow"
SpawnRate = 0.3
@@ -26,4 +26,3 @@ ThrowSpeed = 12.0
ThrowDamage = 5
ItemTag = 0
Texture = ExtResource("1_6tifm")
AudioStream = ExtResource("1_n7ptf")