Implement Stat Raising items
This commit is contained in:
@@ -35,6 +35,9 @@ public partial class Armor : Node3D, IEquipableItem
|
||||
|
||||
public int Defense => _armorStats.Defense;
|
||||
|
||||
public void IncreaseArmorDefense(int bonus) => _armorStats.Defense += bonus;
|
||||
|
||||
|
||||
public ImmutableList<ItemTag> ItemTags => [.. _armorStats.ItemTags];
|
||||
|
||||
public bool IsEquipped { get; set; }
|
||||
|
||||
@@ -54,6 +54,12 @@ public partial class EffectItem : Node3D, IUsableItem
|
||||
DealElementalDamageToAllEnemiesInRoom(ElementType.Hydric);
|
||||
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.SwapHPAndVT))
|
||||
SwapHPandVT();
|
||||
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.RaiseCurrentWeaponAttack))
|
||||
RaiseCurrentWeaponAttack();
|
||||
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.RaiseCurrentDefenseArmor))
|
||||
RaiseCurrentArmorDefense();
|
||||
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.RaiseLevel))
|
||||
RaiseLevel();
|
||||
|
||||
if (_effectItemStats.UsableItemTags.Contains(UsableItemTag.RandomEffect))
|
||||
RandomEffect();
|
||||
@@ -189,4 +195,27 @@ public partial class EffectItem : Node3D, IUsableItem
|
||||
_effectItemStats.UsableItemTags.Add(randomEffect);
|
||||
Use();
|
||||
}
|
||||
|
||||
private void RaiseCurrentWeaponAttack()
|
||||
{
|
||||
if (Player.EquippedWeapon.Value.ItemName == string.Empty)
|
||||
return;
|
||||
|
||||
var currentWeapon = Player.EquippedWeapon.Value;
|
||||
currentWeapon.IncreaseWeaponAttack(1);
|
||||
}
|
||||
|
||||
private void RaiseCurrentArmorDefense()
|
||||
{
|
||||
if (Player.EquippedArmor.Value.ItemName == string.Empty)
|
||||
return;
|
||||
|
||||
var currentArmor = Player.EquippedArmor.Value;
|
||||
currentArmor.IncreaseArmorDefense(1);
|
||||
}
|
||||
|
||||
private void RaiseLevel()
|
||||
{
|
||||
Player.LevelUp();
|
||||
}
|
||||
}
|
||||
|
||||
19
src/items/effect/resources/ClothResolution.tres
Normal file
19
src/items/effect/resources/ClothResolution.tres
Normal file
@@ -0,0 +1,19 @@
|
||||
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://lx7xkoj6w8gr"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_1mm10"]
|
||||
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="2_53wiy"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_53wiy")
|
||||
UsableItemTags = Array[int]([11])
|
||||
ElementalDamageType = 0
|
||||
Name = "Cloth Resolution"
|
||||
Description = "Raises currently equipped armor's defense by 1."
|
||||
Texture = ExtResource("1_1mm10")
|
||||
SpawnRate = 0.5
|
||||
ThrowSpeed = 12.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTags = Array[int]([])
|
||||
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"
|
||||
19
src/items/effect/resources/Cosmos.tres
Normal file
19
src/items/effect/resources/Cosmos.tres
Normal file
@@ -0,0 +1,19 @@
|
||||
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://bg2fsie2g3j6q"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_dn5pk"]
|
||||
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="2_n1557"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_n1557")
|
||||
UsableItemTags = Array[int]([12])
|
||||
ElementalDamageType = 0
|
||||
Name = "Cosmos"
|
||||
Description = "Raises current Level by 1."
|
||||
Texture = ExtResource("1_dn5pk")
|
||||
SpawnRate = 0.5
|
||||
ThrowSpeed = 12.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTags = Array[int]([])
|
||||
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"
|
||||
19
src/items/effect/resources/FerrousResolution.tres
Normal file
19
src/items/effect/resources/FerrousResolution.tres
Normal file
@@ -0,0 +1,19 @@
|
||||
[gd_resource type="Resource" script_class="EffectItemStats" load_steps=3 format=3 uid="uid://cx8kpmyhl5vkj"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://c7v5pm32sedkg" path="res://src/items/effect/textures/entropic seal.PNG" id="1_6wt4w"]
|
||||
[ext_resource type="Script" uid="uid://b5w4iw4iqmxtn" path="res://src/items/effect/EffectItemStats.cs" id="1_uojwo"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_uojwo")
|
||||
UsableItemTags = Array[int]([10])
|
||||
ElementalDamageType = 0
|
||||
Name = "Ferrous Resolution"
|
||||
Description = "Raises currently equipped weapon's attack by 1."
|
||||
Texture = ExtResource("1_6wt4w")
|
||||
SpawnRate = 0.5
|
||||
ThrowSpeed = 12.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTags = Array[int]([])
|
||||
metadata/_custom_type_script = "uid://b5w4iw4iqmxtn"
|
||||
@@ -20,6 +20,9 @@ public enum UsableItemTag
|
||||
AbsorbHPFromAllEnemiesInRoom,
|
||||
HealsAllInRoomToMaxHP,
|
||||
DealElementalDamageToAllEnemiesInRoom,
|
||||
RaiseCurrentWeaponAttack,
|
||||
RaiseCurrentDefenseArmor,
|
||||
RaiseLevel,
|
||||
RandomEffect,
|
||||
}
|
||||
|
||||
|
||||
@@ -51,6 +51,8 @@ public partial class Weapon : Node3D, IInventoryItem, IEquipableItem
|
||||
|
||||
public double ElementalDamageBonus => _weaponStats.ElementalDamageBonus;
|
||||
|
||||
public void IncreaseWeaponAttack(int bonus) => _weaponStats.Damage += bonus;
|
||||
|
||||
public bool IsEquipped { get; set; }
|
||||
|
||||
public void OnReady()
|
||||
|
||||
Reference in New Issue
Block a user