Rewrite and simplify Inventory Menu, various fixes for item effects
This commit is contained in:
@@ -1,4 +1,6 @@
|
||||
using Chickensoft.Collections;
|
||||
using Godot;
|
||||
using System;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
using Zennysoft.Ma.Adapter.Entity;
|
||||
|
||||
@@ -17,6 +19,8 @@ public class EquipmentComponent : IEquipmentComponent
|
||||
|
||||
public AutoProp<EquipableItem> _equippedAccessory;
|
||||
|
||||
public event Action<EquipableItem> EquipmentChanged;
|
||||
|
||||
public int BonusAttack => _equippedWeapon.Value.BonusAttack + _equippedArmor.Value.BonusAttack + _equippedAccessory.Value.BonusAttack;
|
||||
|
||||
public int BonusDefense => _equippedWeapon.Value.BonusDefense + _equippedArmor.Value.BonusDefense + _equippedAccessory.Value.BonusDefense;
|
||||
@@ -51,6 +55,7 @@ public class EquipmentComponent : IEquipmentComponent
|
||||
_equippedArmor.OnNext(armor);
|
||||
if (equipable is Accessory accessory)
|
||||
_equippedAccessory.OnNext(accessory);
|
||||
EquipmentChanged?.Invoke(equipable);
|
||||
}
|
||||
|
||||
public void Unequip(EquipableItem equipable)
|
||||
@@ -61,6 +66,7 @@ public class EquipmentComponent : IEquipmentComponent
|
||||
_equippedArmor.OnNext(new Armor());
|
||||
if (equipable is Accessory accessory)
|
||||
_equippedAccessory.OnNext(new Accessory());
|
||||
EquipmentChanged?.Invoke(equipable);
|
||||
}
|
||||
|
||||
public bool IsItemEquipped(InventoryItem item)
|
||||
|
||||
@@ -60,11 +60,15 @@ public class HealthComponent : IHealthComponent
|
||||
public void SetMaximumHealth(int health)
|
||||
{
|
||||
_maximumHP.OnNext(health);
|
||||
|
||||
if (_currentHP.Value > _maximumHP.Value)
|
||||
_currentHP.OnNext(_maximumHP.Value);
|
||||
}
|
||||
|
||||
public void RaiseMaximumHP(int raiseAmount)
|
||||
public void RaiseMaximumHP(int raiseAmount, bool restoreHP = true)
|
||||
{
|
||||
_maximumHP.OnNext(raiseAmount);
|
||||
Heal(raiseAmount);
|
||||
_maximumHP.OnNext(_maximumHP.Value + raiseAmount);
|
||||
if (restoreHP)
|
||||
Heal(raiseAmount);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -49,9 +49,18 @@ public class VTComponent : IVTComponent
|
||||
_currentVT.OnNext(cappedAmount);
|
||||
}
|
||||
|
||||
public void RaiseMaximumVT(int raiseAmount)
|
||||
public void RaiseMaximumVT(int raiseAmount, bool restoreVT = true)
|
||||
{
|
||||
_maximumVT.OnNext(raiseAmount);
|
||||
Restore(raiseAmount);
|
||||
_maximumVT.OnNext(_maximumVT.Value + raiseAmount);
|
||||
if (restoreVT)
|
||||
Restore(raiseAmount);
|
||||
}
|
||||
|
||||
public void SetMaximumVT(int vt)
|
||||
{
|
||||
_maximumVT.OnNext(vt);
|
||||
|
||||
if (_currentVT.Value > _maximumVT.Value)
|
||||
_currentVT.OnNext(_maximumVT.Value);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -127,6 +127,7 @@ public partial class App : Node, IApp
|
||||
{
|
||||
ResourceLoader.LoadThreadedRequest(GAME_SCENE_PATH);
|
||||
_loadingGame = true;
|
||||
MainMenu.ReleaseFocus();
|
||||
MainMenu.Hide();
|
||||
})
|
||||
.Handle((in AppLogic.Output.ShowMainMenu _) =>
|
||||
|
||||
@@ -267,7 +267,7 @@ public partial class Game : Node3D, IGame
|
||||
})
|
||||
.Handle((in GameState.Output.OpenInventoryMenu _) =>
|
||||
{
|
||||
InGameUI.InventoryMenu.RefreshInventoryScreen();
|
||||
//InGameUI.InventoryMenu.RefreshInventoryScreen();
|
||||
InGameUI.InventoryMenu.Show();
|
||||
InGameUI.InventoryMenu.SetProcessInput(true);
|
||||
})
|
||||
@@ -460,7 +460,7 @@ public partial class Game : Node3D, IGame
|
||||
if (item is IStackable stackableItem && stackableItem.Count > 1)
|
||||
stackableItem.SetCount(stackableItem.Count - 1);
|
||||
else
|
||||
GameRepo.RemoveItemFromInventory(item);
|
||||
_player.Inventory.Remove(item);
|
||||
}
|
||||
|
||||
private void MovePlayer(Transform3D spawnPoint) => _player.TeleportPlayer(spawnPoint);
|
||||
|
||||
@@ -19,6 +19,7 @@ public partial class Inventory : Node, IInventory
|
||||
private const int _maxInventorySize = 20;
|
||||
|
||||
public event Action<string> BroadcastMessage;
|
||||
public event Action InventoryChanged;
|
||||
|
||||
public Inventory()
|
||||
{
|
||||
@@ -32,10 +33,7 @@ public partial class Inventory : Node, IInventory
|
||||
{
|
||||
var isAdded = TryAdd(item);
|
||||
if (isAdded)
|
||||
{
|
||||
BroadcastMessage?.Invoke($"{item.ItemName} picked up.");
|
||||
item.QueueFree();
|
||||
}
|
||||
else
|
||||
BroadcastMessage?.Invoke($"Could not pick up {item.ItemName}.");
|
||||
|
||||
@@ -48,6 +46,7 @@ public partial class Inventory : Node, IInventory
|
||||
return false;
|
||||
|
||||
Items.Add(inventoryItem);
|
||||
InventoryChanged?.Invoke();
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -57,11 +56,15 @@ public partial class Inventory : Node, IInventory
|
||||
return false;
|
||||
|
||||
Items.Insert(index, inventoryItem);
|
||||
InventoryChanged?.Invoke();
|
||||
return true;
|
||||
}
|
||||
|
||||
public void Remove(InventoryItem inventoryItem) => Items.Remove(inventoryItem);
|
||||
|
||||
public void Remove(InventoryItem inventoryItem)
|
||||
{
|
||||
Items.Remove(inventoryItem);
|
||||
InventoryChanged?.Invoke();
|
||||
}
|
||||
|
||||
public void Sort(EquipableItem currentWeapon, EquipableItem currentArmor, EquipableItem currentAccessory)
|
||||
{
|
||||
|
||||
@@ -9,9 +9,11 @@ namespace Zennysoft.Game.Ma;
|
||||
public abstract partial class InventoryItemStats : Resource
|
||||
{
|
||||
[Export]
|
||||
[Save("equipment_name")]
|
||||
public string Name { get; set; }
|
||||
|
||||
[Export(PropertyHint.MultilineText)]
|
||||
[Save("equipment_description")]
|
||||
public string Description { get; set; }
|
||||
|
||||
[Export(PropertyHint.Range, "0, 1, 0.01")]
|
||||
@@ -30,33 +32,43 @@ public abstract partial class InventoryItemStats : Resource
|
||||
public double BonusLuck { get; set; } = 0.05;
|
||||
|
||||
[Export]
|
||||
[Save("equipment_bonus_hp")]
|
||||
public int BonusHP { get; set; } = 0;
|
||||
|
||||
[Export]
|
||||
[Save("equipment_bonus_vt")]
|
||||
public int BonusVT { get; set; } = 0;
|
||||
|
||||
[Export]
|
||||
[Save("equipment_aeolic_resist")]
|
||||
public int AeolicResistance { get; set; } = 0;
|
||||
|
||||
[Export]
|
||||
[Save("equipment_telluric_resist")]
|
||||
public int TelluricResistance { get; set; } = 0;
|
||||
|
||||
[Export]
|
||||
[Save("equipment_hydric_resist")]
|
||||
public int HydricResistance { get; set; } = 0;
|
||||
|
||||
[Export]
|
||||
[Save("equipment_igneous_resist")]
|
||||
public int IgneousResistance { get; set; } = 0;
|
||||
|
||||
[Export]
|
||||
[Save("equipment_ferrum_resist")]
|
||||
public int FerrumResistance { get; set; } = 0;
|
||||
|
||||
[Export(PropertyHint.Range, "0, 25, 0.1")]
|
||||
[Save("equipment_throw_speed")]
|
||||
public float ThrowSpeed { get; set; } = 12.0f;
|
||||
|
||||
[Export(PropertyHint.Range, "0, 999, 1")]
|
||||
public int IncreaseMaxHPAmount { get; set; }
|
||||
|
||||
[Export(PropertyHint.Range, "0, 999, 1")]
|
||||
public int IncreaseMaxVTAmount { get; set; }
|
||||
|
||||
[Export(PropertyHint.Range, "0, 999, 1")]
|
||||
[Save("equipment_throw_damage")]
|
||||
public int ThrowDamage { get; set; } = 5;
|
||||
|
||||
[Export]
|
||||
[Save("equipment_item_tag")]
|
||||
public ItemTag ItemTag { get; set; } = ItemTag.None;
|
||||
|
||||
[Export]
|
||||
|
||||
@@ -62,7 +62,6 @@ public class ItemDatabase
|
||||
weaponScene.Stats = weaponInfo;
|
||||
if (!database.Contains(weaponScene))
|
||||
database.Add(weaponScene);
|
||||
database.Add(weaponScene);
|
||||
}
|
||||
|
||||
foreach (var accessory in accessoryResources)
|
||||
@@ -72,7 +71,6 @@ public class ItemDatabase
|
||||
accessoryScene.Stats = accessoryInfo;
|
||||
if (!database.Contains(accessoryScene))
|
||||
database.Add(accessoryScene);
|
||||
database.Add(accessoryScene);
|
||||
}
|
||||
|
||||
foreach (var throwable in throwableResources)
|
||||
@@ -82,7 +80,6 @@ public class ItemDatabase
|
||||
throwableItemScene.Stats = throwableItemInfo;
|
||||
if (!database.Contains(throwableItemScene))
|
||||
database.Add(throwableItemScene);
|
||||
database.Add(throwableItemScene);
|
||||
}
|
||||
|
||||
foreach (var consumable in consumableResources)
|
||||
@@ -92,7 +89,6 @@ public class ItemDatabase
|
||||
consumableItemScene.Stats = consumableItemInfo;
|
||||
if (!database.Contains(consumableItemScene))
|
||||
database.Add(consumableItemScene);
|
||||
database.Add(consumableItemScene);
|
||||
}
|
||||
|
||||
foreach (var effectItem in effectResources)
|
||||
@@ -102,7 +98,6 @@ public class ItemDatabase
|
||||
effectItemScene.Stats = effectItemInfo;
|
||||
if (!database.Contains(effectItemScene))
|
||||
database.Add(effectItemScene);
|
||||
database.Add(effectItemScene);
|
||||
}
|
||||
|
||||
Items = [.. database];
|
||||
|
||||
@@ -28,6 +28,14 @@ public partial class Accessory : EquipableItem
|
||||
|
||||
public override float ThrowSpeed => Stats.ThrowSpeed;
|
||||
|
||||
public override int BonusAttack => Stats.BonusAttack;
|
||||
|
||||
public override int BonusDefense => Stats.BonusDefense;
|
||||
|
||||
public override int BonusHP => Stats.BonusHP;
|
||||
|
||||
public override int BonusVT => Stats.BonusVT;
|
||||
|
||||
public override ElementalResistanceSet ElementalResistance => new ElementalResistanceSet(Stats.AeolicResistance, Stats.HydricResistance, Stats.IgneousResistance, Stats.FerrumResistance, Stats.TelluricResistance);
|
||||
|
||||
[Save("accessory_tag")]
|
||||
|
||||
@@ -5,18 +5,21 @@
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_xqaot")
|
||||
ATKUp = 0
|
||||
DEFUp = 0
|
||||
LuckUp = 0.1
|
||||
MaxHPUp = 0
|
||||
MaxVTUp = 0
|
||||
AccessoryTag = 0
|
||||
Name = "Mask of the Goddess of Avarice"
|
||||
Description = "Raises Luck"
|
||||
Texture = ExtResource("1_q42cv")
|
||||
SpawnRate = 0.1
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.3
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_q42cv")
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
[gd_resource type="Resource" script_class="AccessoryStats" load_steps=3 format=3 uid="uid://d4bcem2nup7ef"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://db7i7iy5gagae" path="res://src/items/accessory/textures/MASK 02.PNG" id="1_0p1ot"]
|
||||
[ext_resource type="Script" path="res://src/items/accessory/AccessoryStats.cs" id="1_vef66"]
|
||||
[ext_resource type="Script" uid="uid://b8arlmivk68b" path="res://src/items/accessory/AccessoryStats.cs" id="1_vef66"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_vef66")
|
||||
ATKUp = 3
|
||||
DEFUp = 0
|
||||
LUCKUp = 0.0
|
||||
MaxHPUp = 0
|
||||
MaxVTUp = 0
|
||||
AccessoryTags = [0]
|
||||
AccessoryTag = 0
|
||||
Name = "Mask of the Goddess of Destruction"
|
||||
Description = "Raises ATK."
|
||||
Texture = ExtResource("1_0p1ot")
|
||||
SpawnRate = 0.1
|
||||
BonusAttack = 3
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_0p1ot")
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
[gd_resource type="Resource" script_class="AccessoryStats" load_steps=3 format=3 uid="uid://bejy3lpudgawg"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://db7i7iy5gagae" path="res://src/items/accessory/textures/MASK 02.PNG" id="1_0k42r"]
|
||||
[ext_resource type="Script" path="res://src/items/accessory/AccessoryStats.cs" id="1_cgxkh"]
|
||||
[ext_resource type="Script" uid="uid://b8arlmivk68b" path="res://src/items/accessory/AccessoryStats.cs" id="1_cgxkh"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_cgxkh")
|
||||
ATKUp = 1
|
||||
DEFUp = 1
|
||||
LUCKUp = 0.0
|
||||
MaxHPUp = 30
|
||||
MaxVTUp = 30
|
||||
AccessoryTags = []
|
||||
AccessoryTag = 0
|
||||
Name = "Mask of the Goddess of Guilt"
|
||||
Description = "Raises MAX HP, MAX VT, ATK, DEF"
|
||||
Texture = ExtResource("1_0k42r")
|
||||
SpawnRate = 0.1
|
||||
BonusAttack = 2
|
||||
BonusDefense = 2
|
||||
BonusLuck = 0.05
|
||||
BonusHP = 25
|
||||
BonusVT = 25
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_0k42r")
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
[gd_resource type="Resource" script_class="AccessoryStats" load_steps=3 format=3 uid="uid://ddwyaxxqvk52h"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://db7i7iy5gagae" path="res://src/items/accessory/textures/MASK 02.PNG" id="1_1uw37"]
|
||||
[ext_resource type="Script" path="res://src/items/accessory/AccessoryStats.cs" id="1_kuyyj"]
|
||||
[ext_resource type="Script" uid="uid://b8arlmivk68b" path="res://src/items/accessory/AccessoryStats.cs" id="1_kuyyj"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_kuyyj")
|
||||
ATKUp = 0
|
||||
DEFUp = 3
|
||||
LUCKUp = 0.0
|
||||
MaxHPUp = 0
|
||||
MaxVTUp = 0
|
||||
AccessoryTags = []
|
||||
AccessoryTag = 0
|
||||
Name = "Mask of the Goddess of Obstinance"
|
||||
Description = "Raises DEF."
|
||||
Texture = ExtResource("1_1uw37")
|
||||
SpawnRate = 0.1
|
||||
BonusAttack = 0
|
||||
BonusDefense = 3
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_1uw37")
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
[gd_resource type="Resource" script_class="AccessoryStats" load_steps=3 format=3 uid="uid://d02kuxaus43mk"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/accessory/AccessoryStats.cs" id="1_3iw2y"]
|
||||
[ext_resource type="Script" uid="uid://b8arlmivk68b" path="res://src/items/accessory/AccessoryStats.cs" id="1_3iw2y"]
|
||||
[ext_resource type="Texture2D" uid="uid://db7i7iy5gagae" path="res://src/items/accessory/textures/MASK 02.PNG" id="1_vc77e"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_3iw2y")
|
||||
ATKUp = 0
|
||||
DEFUp = 0
|
||||
LUCKUp = 0.0
|
||||
MaxHPUp = 0
|
||||
MaxVTUp = 50
|
||||
AccessoryTags = []
|
||||
AccessoryTag = 0
|
||||
Name = "Mask of the Goddess of Suffering"
|
||||
Description = "Raises MAX VT"
|
||||
Texture = ExtResource("1_vc77e")
|
||||
SpawnRate = 0.1
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
BonusHP = 0
|
||||
BonusVT = 50
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_vc77e")
|
||||
|
||||
@@ -1,17 +1,25 @@
|
||||
[gd_resource type="Resource" script_class="AccessoryStats" load_steps=3 format=3 uid="uid://b0bxwp55mcyyp"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/accessory/AccessoryStats.cs" id="1_0u4rq"]
|
||||
[ext_resource type="Script" uid="uid://b8arlmivk68b" path="res://src/items/accessory/AccessoryStats.cs" id="1_0u4rq"]
|
||||
[ext_resource type="Texture2D" uid="uid://db7i7iy5gagae" path="res://src/items/accessory/textures/MASK 02.PNG" id="1_ggv41"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_0u4rq")
|
||||
ATKUp = 0
|
||||
DEFUp = 0
|
||||
LUCKUp = 0.0
|
||||
MaxHPUp = 50
|
||||
MaxVTUp = 0
|
||||
AccessoryTags = []
|
||||
AccessoryTag = 0
|
||||
Name = "Mask of the Goddess of Zeal"
|
||||
Description = "Raises MAX HP"
|
||||
Texture = ExtResource("1_ggv41")
|
||||
SpawnRate = 0.1
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
BonusHP = 50
|
||||
BonusVT = 0
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_ggv41")
|
||||
|
||||
@@ -5,9 +5,6 @@
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_si4wu")
|
||||
Name = "Acceptance"
|
||||
Description = "+9 DEF"
|
||||
Defense = 9
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
@@ -16,9 +13,17 @@ _ferrumResistance = 0.0
|
||||
Name = "Acceptance"
|
||||
Description = "+9 DEF"
|
||||
SpawnRate = 0.01
|
||||
BonusAttack = 0
|
||||
BonusDefense = 9
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_p85jd")
|
||||
|
||||
@@ -5,18 +5,25 @@
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_6r2bl")
|
||||
Defense = 1
|
||||
TelluricResistance = 0.0
|
||||
AeolicResistance = 0.0
|
||||
HydricResistance = 0.0
|
||||
IgneousResistance = 0.0
|
||||
FerrumResistance = 0.0
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
Name = "Atoner's Adornments"
|
||||
Description = "+1 DEF"
|
||||
Texture = ExtResource("1_588l8")
|
||||
SpawnRate = 0.25
|
||||
BonusAttack = 0
|
||||
BonusDefense = 1
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_588l8")
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ArmorStats" load_steps=3 format=3 uid="uid://dnu241lh47oqd"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/armor/ArmorStats.cs" id="1_0qtvf"]
|
||||
[ext_resource type="Script" uid="uid://dqtp6ewvttoyu" path="res://src/items/armor/ArmorStats.cs" id="1_0qtvf"]
|
||||
[ext_resource type="Texture2D" uid="uid://vvhbibkslh57" path="res://src/items/armor/textures/CEREMONIAL.PNG" id="1_s4gpg"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_0qtvf")
|
||||
Defense = 2
|
||||
TelluricResistance = 0.0
|
||||
AeolicResistance = 0.0
|
||||
HydricResistance = 0.0
|
||||
IgneousResistance = 0.0
|
||||
FerrumResistance = 0.0
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
Name = "Ceremonial Vestments"
|
||||
Description = "+2 DEF"
|
||||
Texture = ExtResource("1_s4gpg")
|
||||
SpawnRate = 0.2
|
||||
BonusAttack = 0
|
||||
BonusDefense = 2
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_s4gpg")
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ArmorStats" load_steps=3 format=3 uid="uid://4s7wjsb7eb6e"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://381ddynsa3gc" path="res://src/items/armor/textures/DEVIC.PNG" id="1_5ik54"]
|
||||
[ext_resource type="Script" path="res://src/items/armor/ArmorStats.cs" id="1_w3lql"]
|
||||
[ext_resource type="Script" uid="uid://dqtp6ewvttoyu" path="res://src/items/armor/ArmorStats.cs" id="1_w3lql"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_w3lql")
|
||||
Defense = 7
|
||||
TelluricResistance = 0.0
|
||||
AeolicResistance = 0.0
|
||||
HydricResistance = 0.0
|
||||
IgneousResistance = 0.0
|
||||
FerrumResistance = 0.0
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
Name = "Devic Layers"
|
||||
Description = "+7 DEF"
|
||||
Texture = ExtResource("1_5ik54")
|
||||
SpawnRate = 0.05
|
||||
BonusAttack = 0
|
||||
BonusDefense = 7
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_5ik54")
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ArmorStats" load_steps=3 format=3 uid="uid://dc0qjer88chme"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/armor/ArmorStats.cs" id="1_3mc7x"]
|
||||
[ext_resource type="Script" uid="uid://dqtp6ewvttoyu" path="res://src/items/armor/ArmorStats.cs" id="1_3mc7x"]
|
||||
[ext_resource type="Texture2D" uid="uid://c57kuugsc2lti" path="res://src/items/armor/textures/GODDESS.PNG" id="1_5vleh"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_3mc7x")
|
||||
Defense = 8
|
||||
TelluricResistance = 0.0
|
||||
AeolicResistance = 0.0
|
||||
HydricResistance = 0.0
|
||||
IgneousResistance = 0.0
|
||||
FerrumResistance = 0.0
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
Name = "Goddess' Robe"
|
||||
Description = "+8 DEF"
|
||||
Texture = ExtResource("1_5vleh")
|
||||
SpawnRate = 0.03
|
||||
BonusAttack = 0
|
||||
BonusDefense = 8
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_5vleh")
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ArmorStats" load_steps=3 format=3 uid="uid://ceqnyutl7y7t4"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/armor/ArmorStats.cs" id="1_iqj2w"]
|
||||
[ext_resource type="Script" uid="uid://dqtp6ewvttoyu" path="res://src/items/armor/ArmorStats.cs" id="1_iqj2w"]
|
||||
[ext_resource type="Texture2D" uid="uid://cj5m8qkpqrcx4" path="res://src/items/armor/textures/IRON.PNG" id="1_jyoar"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_iqj2w")
|
||||
Defense = 4
|
||||
TelluricResistance = 0.0
|
||||
AeolicResistance = 0.0
|
||||
HydricResistance = 0.0
|
||||
IgneousResistance = 0.0
|
||||
FerrumResistance = 0.0
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
Name = "Iron Cage"
|
||||
Description = "+4 DEF"
|
||||
Texture = ExtResource("1_jyoar")
|
||||
SpawnRate = 0.15
|
||||
BonusAttack = 0
|
||||
BonusDefense = 4
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_jyoar")
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ArmorStats" load_steps=3 format=3 uid="uid://chhxktntl4k8r"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/armor/ArmorStats.cs" id="1_frqfh"]
|
||||
[ext_resource type="Script" uid="uid://dqtp6ewvttoyu" path="res://src/items/armor/ArmorStats.cs" id="1_frqfh"]
|
||||
[ext_resource type="Texture2D" uid="uid://2qvbtq2obsac" path="res://src/items/armor/textures/LOGISTIAN.PNG" id="1_kh3n2"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_frqfh")
|
||||
Defense = 5
|
||||
TelluricResistance = 0.0
|
||||
AeolicResistance = 0.0
|
||||
HydricResistance = 0.0
|
||||
IgneousResistance = 0.0
|
||||
FerrumResistance = 0.0
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
Name = "Logistician's Garb"
|
||||
Description = "+5 DEF"
|
||||
Texture = ExtResource("1_kh3n2")
|
||||
SpawnRate = 0.08
|
||||
BonusAttack = 0
|
||||
BonusDefense = 5
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_kh3n2")
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ArmorStats" load_steps=3 format=3 uid="uid://d3l8aa87tevgt"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/armor/ArmorStats.cs" id="1_dh6tr"]
|
||||
[ext_resource type="Script" uid="uid://dqtp6ewvttoyu" path="res://src/items/armor/ArmorStats.cs" id="1_dh6tr"]
|
||||
[ext_resource type="Texture2D" uid="uid://ddtscpfj6nf6i" path="res://src/items/armor/textures/STOIC.PNG" id="1_xpphu"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_dh6tr")
|
||||
Defense = 6
|
||||
TelluricResistance = 0.0
|
||||
AeolicResistance = 0.0
|
||||
HydricResistance = 0.0
|
||||
IgneousResistance = 0.0
|
||||
FerrumResistance = 0.0
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
Name = "Stoic"
|
||||
Description = "+6 DEF"
|
||||
Texture = ExtResource("1_xpphu")
|
||||
SpawnRate = 0.05
|
||||
BonusAttack = 0
|
||||
BonusDefense = 6
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_xpphu")
|
||||
|
||||
@@ -1,17 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ArmorStats" load_steps=3 format=3 uid="uid://dq4c6an78qa4q"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/armor/ArmorStats.cs" id="1_bkpin"]
|
||||
[ext_resource type="Script" uid="uid://dqtp6ewvttoyu" path="res://src/items/armor/ArmorStats.cs" id="1_bkpin"]
|
||||
[ext_resource type="Texture2D" uid="uid://dghvd33w32q63" path="res://src/items/armor/textures/WOODEN.PNG" id="1_vs6ua"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_bkpin")
|
||||
Defense = 3
|
||||
TelluricResistance = 0.0
|
||||
AeolicResistance = 0.0
|
||||
HydricResistance = 0.0
|
||||
IgneousResistance = 0.0
|
||||
FerrumResistance = 0.0
|
||||
_telluricResistance = 0.0
|
||||
_aeolicResistance = 0.0
|
||||
_hydricResistance = 0.0
|
||||
_igneousResistance = 0.0
|
||||
_ferrumResistance = 0.0
|
||||
Name = "Wooden Armament"
|
||||
Description = "+3 DEF"
|
||||
Texture = ExtResource("1_vs6ua")
|
||||
SpawnRate = 0.3
|
||||
BonusAttack = 0
|
||||
BonusDefense = 3
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 12.0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_vs6ua")
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://d0cxrf0nldona"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://ttmu3vttq8yo" path="res://src/items/consumable/textures/amrit shard.PNG" id="1_f1n30"]
|
||||
[ext_resource type="Script" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_riwik"]
|
||||
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_riwik"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_riwik")
|
||||
HealHPAmount = 60
|
||||
RaiseHPAmount = 16
|
||||
HealVTAmount = 0
|
||||
RaiseVTAmount = 0
|
||||
PermanentRaiseHPAmount = 16
|
||||
PermanentRaiseVTAmount = 0
|
||||
Name = "Amrit Shard"
|
||||
Description = "A droplet of the heavenly elixir, frozen in time.
|
||||
Restores 60 HP. If HP full, raises MAX HP by 16."
|
||||
Texture = ExtResource("1_f1n30")
|
||||
SpawnRate = 0.05
|
||||
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("1_f1n30")
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://dns281deffo6q"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bg47n2tmintm0" path="res://src/items/consumable/textures/past self remnant.PNG" id="1_rc8t1"]
|
||||
[ext_resource type="Script" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_e61q8"]
|
||||
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_e61q8"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_e61q8")
|
||||
HealHPAmount = 1000
|
||||
RaiseHPAmount = 25
|
||||
HealHPAmount = 999
|
||||
HealVTAmount = 0
|
||||
RaiseVTAmount = 0
|
||||
PermanentRaiseHPAmount = 25
|
||||
PermanentRaiseVTAmount = 0
|
||||
Name = "Past Self's Fragment"
|
||||
Description = "Restores all HP. If HP full, raises MAX HP by 25."
|
||||
Texture = ExtResource("1_rc8t1")
|
||||
SpawnRate = 0.05
|
||||
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("1_rc8t1")
|
||||
|
||||
@@ -1,15 +1,28 @@
|
||||
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://bnec53frgyue8"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://cj0x1u7rknrvy" path="res://src/items/consumable/textures/past self spirit.PNG" id="1_jx43p"]
|
||||
[ext_resource type="Script" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_wmtl1"]
|
||||
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_wmtl1"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_wmtl1")
|
||||
HealHPAmount = 0
|
||||
RaiseHPAmount = 0
|
||||
HealVTAmount = 1000
|
||||
RaiseVTAmount = 20
|
||||
PermanentRaiseHPAmount = 0
|
||||
PermanentRaiseVTAmount = 20
|
||||
Name = "Past Self's Spirit"
|
||||
Description = "Restores all VT. If VT full, raises MAX VT by 20."
|
||||
Texture = ExtResource("1_jx43p")
|
||||
SpawnRate = 0.05
|
||||
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("1_jx43p")
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://75fpkwfp0t0k"]
|
||||
|
||||
[ext_resource type="Script" path="res://src/items/consumable/ConsumableItemStats.cs" id="1_f8ogj"]
|
||||
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="1_f8ogj"]
|
||||
[ext_resource type="Texture2D" uid="uid://dbl5v5i1s3m2u" path="res://src/items/consumable/textures/stelo fragment.PNG" id="1_ic5xm"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_f8ogj")
|
||||
HealHPAmount = 0
|
||||
RaiseHPAmount = 0
|
||||
HealVTAmount = 30
|
||||
RaiseVTAmount = 10
|
||||
PermanentRaiseHPAmount = 0
|
||||
PermanentRaiseVTAmount = 10
|
||||
Name = "Stelo Fragment"
|
||||
Description = "A small gathered piece of the former heavens.
|
||||
Restores 30 VT. If VT full, raises MAX VT by 10."
|
||||
Texture = ExtResource("1_ic5xm")
|
||||
SpawnRate = 0.5
|
||||
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("1_ic5xm")
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://ypw2yg10430p"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://bqyjjdgub6iem" path="res://src/items/consumable/textures/suna fragment.PNG" id="1_ldd10"]
|
||||
[ext_resource type="Script" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_41hue"]
|
||||
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_41hue"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_41hue")
|
||||
HealHPAmount = 0
|
||||
RaiseHPAmount = 0
|
||||
HealVTAmount = 60
|
||||
RaiseVTAmount = 20
|
||||
PermanentRaiseHPAmount = 0
|
||||
PermanentRaiseVTAmount = 20
|
||||
Name = "Suna Fragment"
|
||||
Description = "A large gathered piece of the former heavens.
|
||||
Restores 60 VT. If VT full, raises MAX VT by 20."
|
||||
Texture = ExtResource("1_ldd10")
|
||||
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("1_ldd10")
|
||||
|
||||
@@ -1,16 +1,29 @@
|
||||
[gd_resource type="Resource" script_class="ConsumableItemStats" load_steps=3 format=3 uid="uid://lu0ddu3538p6"]
|
||||
|
||||
[ext_resource type="Texture2D" uid="uid://dw06kkltgk3sv" path="res://src/items/consumable/textures/ydunic fragment.PNG" id="1_4llax"]
|
||||
[ext_resource type="Script" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_q4pyq"]
|
||||
[ext_resource type="Script" uid="uid://cymeea1n4f04i" path="res://src/items/consumable/ConsumableItemStats.cs" id="2_q4pyq"]
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_q4pyq")
|
||||
HealHPAmount = 30
|
||||
RaiseHPAmount = 8
|
||||
HealVTAmount = 0
|
||||
RaiseVTAmount = 0
|
||||
HealVTAmount = 8
|
||||
PermanentRaiseHPAmount = 0
|
||||
PermanentRaiseVTAmount = 0
|
||||
Name = "Ydunic Shard"
|
||||
Description = "A fragment of the divine fruit, frozen in time.
|
||||
Restores 30 HP. If HP full, raises MAX HP by 8."
|
||||
Texture = ExtResource("1_4llax")
|
||||
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("1_4llax")
|
||||
|
||||
@@ -5,9 +5,8 @@
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_ewck5")
|
||||
Name = "Geomantic Dice"
|
||||
Description = "Inflicts base damage when thrown.
|
||||
Use item to change Affinity."
|
||||
HealHPAmount = 10
|
||||
HealVTAmount = 5
|
||||
ThrowableItemTag = 3
|
||||
ElementType = 0
|
||||
UsableItemTag = 0
|
||||
@@ -17,9 +16,17 @@ Name = "Geomantic Dice"
|
||||
Description = "Inflicts base damage when thrown.
|
||||
Use item to change Affinity."
|
||||
SpawnRate = 1.0
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
BonusHP = 0
|
||||
BonusVT = 0
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 20.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
ThrowDamage = 20
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_jhits")
|
||||
|
||||
@@ -5,9 +5,9 @@
|
||||
|
||||
[resource]
|
||||
script = ExtResource("2_m680r")
|
||||
Name = "Gospel of Dimension"
|
||||
Description = "Teleports target to a random location."
|
||||
ThrowableItemTag = 0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
ThrowableItemTag = 4
|
||||
ElementType = 0
|
||||
UsableItemTag = 0
|
||||
MinimumCount = 1
|
||||
@@ -15,9 +15,17 @@ MaximumCount = 8
|
||||
Name = "Gospel of Dimension"
|
||||
Description = "Teleports target to a random location."
|
||||
SpawnRate = 0.1
|
||||
BonusAttack = 0
|
||||
BonusDefense = 0
|
||||
BonusLuck = 0.05
|
||||
AeolicResistance = 0
|
||||
TelluricResistance = 0
|
||||
HydricResistance = 0
|
||||
IgneousResistance = 0
|
||||
FerrumResistance = 0
|
||||
ThrowSpeed = 20.0
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
IncreaseMaxHPAmount = 0
|
||||
IncreaseMaxVTAmount = 0
|
||||
ThrowDamage = 20
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_xt2mp")
|
||||
|
||||
@@ -5,17 +5,27 @@
|
||||
|
||||
[resource]
|
||||
script = ExtResource("1_s3pq7")
|
||||
Name = "Spell Sign: Knowledge"
|
||||
Description = "Doubles experience points earned. Effect is temporary."
|
||||
HealHPAmount = 8
|
||||
HealVTAmount = 3
|
||||
ThrowableItemTag = 1
|
||||
ElementType = 0
|
||||
UsableItemTag = 0
|
||||
MinimumCount = 1
|
||||
MaximumCount = 8
|
||||
Name = "Spell Sign: Knowledge"
|
||||
Description = "Doubles experience points earned. Effect is temporary."
|
||||
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
|
||||
HealHPAmount = 0
|
||||
HealVTAmount = 0
|
||||
ThrowDamage = 5
|
||||
ItemTag = 0
|
||||
Texture = ExtResource("1_3605p")
|
||||
|
||||
@@ -89,10 +89,16 @@ public partial class OptionsMenu : Control
|
||||
Controller.MoveForwardKeyboard.GrabFocus();
|
||||
}
|
||||
|
||||
private void OptionsMenu_VisibilityChanged() => CanvasLayer.Visible = !CanvasLayer.Visible;
|
||||
private void OptionsMenu_VisibilityChanged()
|
||||
{
|
||||
CanvasLayer.Visible = !CanvasLayer.Visible;
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (!Visible)
|
||||
return;
|
||||
|
||||
var interactInputs = InputHelper.GetKeyboardOrJoypadInputsForAction(GameInputs.Interact);
|
||||
if (interactInputs.Any(x => x.IsMatch(@event)))
|
||||
{
|
||||
|
||||
@@ -99,173 +99,179 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
|
||||
public void Initialize()
|
||||
{
|
||||
var container = new SimpleInjector.Container();
|
||||
container.Register<IPlayerLogic, PlayerLogic>(Lifestyle.Singleton);
|
||||
var container = new SimpleInjector.Container();
|
||||
container.Register<IPlayerLogic, PlayerLogic>(Lifestyle.Singleton);
|
||||
|
||||
PlayerLogic = container.GetInstance<IPlayerLogic>();
|
||||
PlayerLogic.Set(this as IPlayer);
|
||||
PlayerLogic.Set(Settings);
|
||||
PlayerLogic = container.GetInstance<IPlayerLogic>();
|
||||
PlayerLogic.Set(this as IPlayer);
|
||||
PlayerLogic.Set(Settings);
|
||||
|
||||
Inventory = new Inventory();
|
||||
HealthComponent = new HealthComponent(InitialHP);
|
||||
VTComponent = new VTComponent(InitialVT);
|
||||
AttackComponent = new AttackComponent(InitialAttack);
|
||||
DefenseComponent = new DefenseComponent(InitialDefense);
|
||||
ExperiencePointsComponent = new ExperiencePointsComponent();
|
||||
LuckComponent = new LuckComponent(InitialLuck);
|
||||
EquipmentComponent = new EquipmentComponent();
|
||||
Inventory = new Inventory();
|
||||
HealthComponent = new HealthComponent(InitialHP);
|
||||
VTComponent = new VTComponent(InitialVT);
|
||||
AttackComponent = new AttackComponent(InitialAttack);
|
||||
DefenseComponent = new DefenseComponent(InitialDefense);
|
||||
ExperiencePointsComponent = new ExperiencePointsComponent();
|
||||
LuckComponent = new LuckComponent(InitialLuck);
|
||||
EquipmentComponent = new EquipmentComponent();
|
||||
|
||||
_itemReroller = new ItemReroller(ItemDatabase.Instance);
|
||||
_itemReroller = new ItemReroller(ItemDatabase.Instance);
|
||||
|
||||
Settings = new PlayerLogic.Settings() { RotationSpeed = RotationSpeed, MoveSpeed = MoveSpeed, Acceleration = Acceleration };
|
||||
Settings = new PlayerLogic.Settings() { RotationSpeed = RotationSpeed, MoveSpeed = MoveSpeed, Acceleration = Acceleration };
|
||||
|
||||
PlayerBinding = PlayerLogic.Bind();
|
||||
PlayerBinding = PlayerLogic.Bind();
|
||||
|
||||
PlayerBinding
|
||||
.Handle((in PlayerLogic.Output.ThrowItem output) =>
|
||||
{
|
||||
})
|
||||
.Handle((in PlayerLogic.Output.Move output) =>
|
||||
{
|
||||
Move(output.delta);
|
||||
});
|
||||
PlayerBinding
|
||||
.Handle((in PlayerLogic.Output.ThrowItem output) =>
|
||||
{
|
||||
})
|
||||
.Handle((in PlayerLogic.Output.Move output) =>
|
||||
{
|
||||
Move(output.delta);
|
||||
});
|
||||
|
||||
PlayerLogic.Start();
|
||||
this.Provide();
|
||||
PlayerLogic.Start();
|
||||
this.Provide();
|
||||
}
|
||||
|
||||
public void ResetPlayerData()
|
||||
{
|
||||
foreach (var item in Inventory.Items)
|
||||
Inventory.Remove(item);
|
||||
foreach (var item in Inventory.Items)
|
||||
Inventory.Remove(item);
|
||||
|
||||
HealthComponent.Reset();
|
||||
VTComponent.Reset();
|
||||
AttackComponent.Reset();
|
||||
DefenseComponent.Reset();
|
||||
ExperiencePointsComponent.Reset();
|
||||
LuckComponent.Reset();
|
||||
EquipmentComponent.Reset();
|
||||
HealthComponent.Reset();
|
||||
VTComponent.Reset();
|
||||
AttackComponent.Reset();
|
||||
DefenseComponent.Reset();
|
||||
ExperiencePointsComponent.Reset();
|
||||
LuckComponent.Reset();
|
||||
EquipmentComponent.Reset();
|
||||
|
||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||
HealthTimer.Timeout += OnHealthTimerTimeout;
|
||||
}
|
||||
|
||||
#region Initialization
|
||||
public void OnReady()
|
||||
{
|
||||
Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
CollisionDetector.AreaEntered += CollisionDetector_AreaEntered;
|
||||
SwordSlashAnimation.Position = GetViewport().GetVisibleRect().Size / 2;
|
||||
HealthComponent.HealthReachedZero += Die;
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
Hitbox.AreaEntered += Hitbox_AreaEntered;
|
||||
CollisionDetector.AreaEntered += CollisionDetector_AreaEntered;
|
||||
SwordSlashAnimation.Position = GetViewport().GetVisibleRect().Size / 2;
|
||||
HealthComponent.HealthReachedZero += Die;
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
}
|
||||
#endregion
|
||||
|
||||
public void Activate()
|
||||
{
|
||||
SetProcessInput(true);
|
||||
SetPhysicsProcess(true);
|
||||
SetHealthTimerStatus(HealthTimerIsActive);
|
||||
SetProcessInput(true);
|
||||
SetPhysicsProcess(true);
|
||||
SetHealthTimerStatus(HealthTimerIsActive);
|
||||
}
|
||||
|
||||
public void Deactivate()
|
||||
{
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
SetHealthTimerStatus(false);
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
SetHealthTimerStatus(false);
|
||||
}
|
||||
|
||||
private void SetHealthTimerStatus(bool isActive)
|
||||
{
|
||||
if (isActive)
|
||||
HealthTimer.Start();
|
||||
else
|
||||
HealthTimer.Stop();
|
||||
if (isActive)
|
||||
HealthTimer.Start();
|
||||
else
|
||||
HealthTimer.Stop();
|
||||
}
|
||||
|
||||
public void TeleportPlayer(Transform3D newTransform)
|
||||
{
|
||||
Transform = newTransform;
|
||||
Transform = newTransform;
|
||||
}
|
||||
|
||||
public void TakeDamage(AttackData damage)
|
||||
{
|
||||
var damageReceived = DamageCalculator.CalculateDamage(damage, DefenseComponent.CurrentDefense.Value + EquipmentComponent.BonusDefense, EquipmentComponent.ElementalResistance);
|
||||
HealthComponent.Damage(damageReceived);
|
||||
var damageReceived = DamageCalculator.CalculateDamage(damage, DefenseComponent.CurrentDefense.Value + EquipmentComponent.BonusDefense, EquipmentComponent.ElementalResistance);
|
||||
HealthComponent.Damage(damageReceived);
|
||||
}
|
||||
|
||||
public void Knockback(float impulse)
|
||||
{
|
||||
_knockbackStrength = impulse;
|
||||
_knockbackDirection = GlobalBasis.Z.Normalized();
|
||||
_knockbackStrength = impulse;
|
||||
_knockbackDirection = GlobalBasis.Z.Normalized();
|
||||
}
|
||||
|
||||
public void LevelUp()
|
||||
{
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var hpIncrease = rng.RandiRange(3, 6);
|
||||
HealthComponent.RaiseMaximumHP(hpIncrease);
|
||||
ExperiencePointsComponent.LevelUp();
|
||||
var rng = new RandomNumberGenerator();
|
||||
rng.Randomize();
|
||||
var hpIncrease = rng.RandiRange(3, 6);
|
||||
HealthComponent.RaiseMaximumHP(hpIncrease);
|
||||
ExperiencePointsComponent.LevelUp();
|
||||
}
|
||||
|
||||
public void Die()
|
||||
{
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
HealthTimer.Timeout -= OnHealthTimerTimeout;
|
||||
SwordSlashAnimation.Stop();
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
PlayerDied?.Invoke();
|
||||
HealthTimer.WaitTime = _healthTimerWaitTime;
|
||||
HealthTimer.Timeout -= OnHealthTimerTimeout;
|
||||
SwordSlashAnimation.Stop();
|
||||
SetProcessInput(false);
|
||||
SetPhysicsProcess(false);
|
||||
PlayerDied?.Invoke();
|
||||
}
|
||||
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (@event.IsActionPressed(GameInputs.Attack))
|
||||
Attack();
|
||||
if (@event.IsActionPressed(GameInputs.Sprint))
|
||||
Settings.MoveSpeed *= 2;
|
||||
if (@event.IsActionReleased(GameInputs.Sprint))
|
||||
Settings.MoveSpeed /= 2;
|
||||
if (@event.IsActionPressed(GameInputs.Attack))
|
||||
Attack();
|
||||
if (@event.IsActionPressed(GameInputs.Sprint))
|
||||
Settings.MoveSpeed *= 2;
|
||||
if (@event.IsActionReleased(GameInputs.Sprint))
|
||||
Settings.MoveSpeed /= 2;
|
||||
}
|
||||
|
||||
public void OnPhysicsProcess(double delta)
|
||||
{
|
||||
PlayerLogic.Input(new PlayerLogic.Input.PhysicsTick(delta));
|
||||
PlayerLogic.Input(new PlayerLogic.Input.Moved(GlobalPosition, GlobalTransform));
|
||||
PlayerLogic.Input(new PlayerLogic.Input.PhysicsTick(delta));
|
||||
PlayerLogic.Input(new PlayerLogic.Input.Moved(GlobalPosition, GlobalTransform));
|
||||
}
|
||||
|
||||
public void Equip(EquipableItem equipable)
|
||||
{
|
||||
if (equipable.ItemTag == ItemTag.MysteryItem)
|
||||
{
|
||||
var rerolledItem = _itemReroller.RerollItem(equipable, Inventory);
|
||||
Equip(rerolledItem);
|
||||
return;
|
||||
}
|
||||
if (equipable.ItemTag == ItemTag.MysteryItem)
|
||||
{
|
||||
var rerolledItem = _itemReroller.RerollItem(equipable, Inventory);
|
||||
Equip(rerolledItem);
|
||||
return;
|
||||
}
|
||||
|
||||
EquipmentComponent.Equip(equipable);
|
||||
HealthComponent.RaiseMaximumHP(equipable.BonusHP, false);
|
||||
VTComponent.RaiseMaximumVT(equipable.BonusVT, false);
|
||||
|
||||
EquipmentComponent.Equip(equipable);
|
||||
}
|
||||
|
||||
public void Unequip(EquipableItem equipable)
|
||||
{
|
||||
EquipmentComponent.Unequip(equipable);
|
||||
HealthComponent.SetMaximumHealth(HealthComponent.MaximumHP.Value - equipable.BonusHP);
|
||||
VTComponent.SetMaximumVT(VTComponent.MaximumVT.Value - equipable.BonusVT);
|
||||
|
||||
EquipmentComponent.Unequip(equipable);
|
||||
}
|
||||
|
||||
private static Vector3 GlobalInputVector
|
||||
{
|
||||
get
|
||||
{
|
||||
var rawInput = Input.GetVector(GameInputs.MoveLeft, GameInputs.MoveRight, GameInputs.MoveUp, GameInputs.MoveDown);
|
||||
var input = new Vector3
|
||||
{
|
||||
X = rawInput.X,
|
||||
Z = rawInput.Y
|
||||
};
|
||||
return input with { Y = 0f };
|
||||
}
|
||||
get
|
||||
{
|
||||
var rawInput = Input.GetVector(GameInputs.MoveLeft, GameInputs.MoveRight, GameInputs.MoveUp, GameInputs.MoveDown);
|
||||
var input = new Vector3
|
||||
{
|
||||
X = rawInput.X,
|
||||
Z = rawInput.Y
|
||||
};
|
||||
return input with { Y = 0f };
|
||||
}
|
||||
}
|
||||
|
||||
private static float LeftStrafeInputVector => Input.GetActionStrength(GameInputs.StrafeLeft);
|
||||
@@ -274,140 +280,140 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
|
||||
|
||||
private void Attack()
|
||||
{
|
||||
if (PlayerIsHittingGeometry())
|
||||
{
|
||||
AnimationPlayer.Play("hit_wall");
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayAttackAnimation();
|
||||
}
|
||||
if (PlayerIsHittingGeometry())
|
||||
{
|
||||
AnimationPlayer.Play("hit_wall");
|
||||
}
|
||||
else
|
||||
{
|
||||
PlayAttackAnimation();
|
||||
}
|
||||
}
|
||||
|
||||
private void ThrowItem()
|
||||
{
|
||||
var itemScene = GD.Load<PackedScene>("res://src/items/throwable/ThrowableItem.tscn");
|
||||
var throwItem = itemScene.Instantiate<ThrowableItem>();
|
||||
GetTree().Root.AddChildEx(throwItem);
|
||||
throwItem.GlobalPosition = CurrentPosition + new Vector3(0, 3.5f, 0);
|
||||
throwItem.GlobalRotation = GlobalRotation;
|
||||
var itemScene = GD.Load<PackedScene>("res://src/items/throwable/ThrowableItem.tscn");
|
||||
var throwItem = itemScene.Instantiate<ThrowableItem>();
|
||||
GetTree().Root.AddChildEx(throwItem);
|
||||
throwItem.GlobalPosition = CurrentPosition + new Vector3(0, 3.5f, 0);
|
||||
throwItem.GlobalRotation = GlobalRotation;
|
||||
}
|
||||
|
||||
private void PlayAttackAnimation()
|
||||
{
|
||||
var attackSpeed = ((Weapon)EquipmentComponent.EquippedWeapon.Value).AttackSpeed;
|
||||
AnimationPlayer.SetSpeedScale((float)attackSpeed);
|
||||
AnimationPlayer.Play("attack");
|
||||
var attackSpeed = ((Weapon)EquipmentComponent.EquippedWeapon.Value).AttackSpeed;
|
||||
AnimationPlayer.SetSpeedScale((float)attackSpeed);
|
||||
AnimationPlayer.Play("attack");
|
||||
}
|
||||
|
||||
private void OnExitTree()
|
||||
{
|
||||
PlayerLogic.Stop();
|
||||
PlayerBinding.Dispose();
|
||||
Hitbox.AreaEntered -= Hitbox_AreaEntered;
|
||||
CollisionDetector.AreaEntered -= CollisionDetector_AreaEntered;
|
||||
HealthComponent.HealthReachedZero -= Die;
|
||||
HealthTimer.Timeout -= OnHealthTimerTimeout;
|
||||
PlayerLogic.Stop();
|
||||
PlayerBinding.Dispose();
|
||||
Hitbox.AreaEntered -= Hitbox_AreaEntered;
|
||||
CollisionDetector.AreaEntered -= CollisionDetector_AreaEntered;
|
||||
HealthComponent.HealthReachedZero -= Die;
|
||||
HealthTimer.Timeout -= OnHealthTimerTimeout;
|
||||
}
|
||||
|
||||
private void Move(float delta)
|
||||
{
|
||||
var rawInput = GlobalInputVector;
|
||||
var strafeLeftInput = LeftStrafeInputVector;
|
||||
var strafeRightInput = RightStrafeInputVector;
|
||||
var rawInput = GlobalInputVector;
|
||||
var strafeLeftInput = LeftStrafeInputVector;
|
||||
var strafeRightInput = RightStrafeInputVector;
|
||||
|
||||
var transform = Transform;
|
||||
transform.Basis = new Basis(Vector3.Up, Settings.RotationSpeed * -rawInput.X * delta) * transform.Basis;
|
||||
var moveDirection = new Vector3(strafeRightInput - strafeLeftInput, 0, rawInput.Z).Normalized();
|
||||
var velocity = Basis * moveDirection * Settings.MoveSpeed * Settings.Acceleration;
|
||||
_knockbackStrength *= 0.9f;
|
||||
Transform = Transform with { Basis = transform.Basis };
|
||||
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
|
||||
MoveAndSlide();
|
||||
var transform = Transform;
|
||||
transform.Basis = new Basis(Vector3.Up, Settings.RotationSpeed * -rawInput.X * delta) * transform.Basis;
|
||||
var moveDirection = new Vector3(strafeRightInput - strafeLeftInput, 0, rawInput.Z).Normalized();
|
||||
var velocity = Basis * moveDirection * Settings.MoveSpeed * Settings.Acceleration;
|
||||
_knockbackStrength *= 0.9f;
|
||||
Transform = Transform with { Basis = transform.Basis };
|
||||
Velocity = velocity + (_knockbackDirection * _knockbackStrength);
|
||||
MoveAndSlide();
|
||||
}
|
||||
|
||||
private void OnPlayerPositionUpdated(Vector3 globalPosition) => GlobalPosition = globalPosition;
|
||||
|
||||
private void OnHealthTimerTimeout()
|
||||
{
|
||||
if (VTComponent.CurrentVT.Value > 0)
|
||||
{
|
||||
if (((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag == AccessoryTag.HalfVTConsumption)
|
||||
reduceOnTick = !reduceOnTick;
|
||||
if (VTComponent.CurrentVT.Value > 0)
|
||||
{
|
||||
if (((Accessory)EquipmentComponent.EquippedAccessory.Value).AccessoryTag == AccessoryTag.HalfVTConsumption)
|
||||
reduceOnTick = !reduceOnTick;
|
||||
|
||||
HealthComponent.Heal(1);
|
||||
HealthComponent.Heal(1);
|
||||
|
||||
if (reduceOnTick)
|
||||
VTComponent.Reduce(1);
|
||||
}
|
||||
else
|
||||
HealthComponent.Damage(1);
|
||||
if (reduceOnTick)
|
||||
VTComponent.Reduce(1);
|
||||
}
|
||||
else
|
||||
HealthComponent.Damage(1);
|
||||
}
|
||||
|
||||
private void Hitbox_AreaEntered(Area3D area)
|
||||
{
|
||||
var target = area.GetOwner();
|
||||
if (target is IEnemy enemy)
|
||||
HitEnemy(enemy);
|
||||
var target = area.GetOwner();
|
||||
if (target is IEnemy enemy)
|
||||
HitEnemy(enemy);
|
||||
}
|
||||
|
||||
private void HitEnemy(IEnemy enemy)
|
||||
{
|
||||
var ignoreElementalResistance = (EquipmentComponent.EquippedWeapon.Value as Weapon).WeaponTag == WeaponTag.IgnoreAffinity;
|
||||
var ignoreDefense = (EquipmentComponent.EquippedWeapon.Value as Weapon).WeaponTag == WeaponTag.IgnoreDefense;
|
||||
var isCriticalHit = BattleExtensions.IsCriticalHit(LuckComponent.Luck.Value + EquipmentComponent.BonusLuck);
|
||||
var totalDamage = AttackComponent.CurrentAttack.Value + EquipmentComponent.BonusAttack;
|
||||
var element = (EquipmentComponent.EquippedWeapon.Value as Weapon).WeaponElement;
|
||||
var ignoreElementalResistance = (EquipmentComponent.EquippedWeapon.Value as Weapon).WeaponTag == WeaponTag.IgnoreAffinity;
|
||||
var ignoreDefense = (EquipmentComponent.EquippedWeapon.Value as Weapon).WeaponTag == WeaponTag.IgnoreDefense;
|
||||
var isCriticalHit = BattleExtensions.IsCriticalHit(LuckComponent.Luck.Value + EquipmentComponent.BonusLuck);
|
||||
var totalDamage = AttackComponent.CurrentAttack.Value + EquipmentComponent.BonusAttack;
|
||||
var element = (EquipmentComponent.EquippedWeapon.Value as Weapon).WeaponElement;
|
||||
|
||||
if (isCriticalHit)
|
||||
totalDamage += (int)(totalDamage * 0.5f);
|
||||
if (isCriticalHit)
|
||||
totalDamage += (int)(totalDamage * 0.5f);
|
||||
|
||||
var baseAttack = new AttackData(totalDamage, element, ignoreDefense, ignoreElementalResistance);
|
||||
var damageDealt = DamageCalculator.CalculateDamage(baseAttack, enemy.DefenseComponent.CurrentDefense.Value, ElementalResistanceSet.None);
|
||||
enemy.HealthComponent.Damage(damageDealt);
|
||||
var baseAttack = new AttackData(totalDamage, element, ignoreDefense, ignoreElementalResistance);
|
||||
var damageDealt = DamageCalculator.CalculateDamage(baseAttack, enemy.DefenseComponent.CurrentDefense.Value, ElementalResistanceSet.None);
|
||||
enemy.HealthComponent.Damage(damageDealt);
|
||||
|
||||
if (((Weapon)EquipmentComponent.EquippedWeapon.Value).WeaponTag == WeaponTag.Knockback && enemy is IKnockbackable knockbackable)
|
||||
knockbackable.Knockback(0.3f, -CurrentBasis.Z.Normalized());
|
||||
if (((Weapon)EquipmentComponent.EquippedWeapon.Value).WeaponTag == WeaponTag.SelfDamage)
|
||||
HealthComponent.Damage(5);
|
||||
if (((Weapon)EquipmentComponent.EquippedWeapon.Value).WeaponTag == WeaponTag.Knockback && enemy is IKnockbackable knockbackable)
|
||||
knockbackable.Knockback(0.3f, -CurrentBasis.Z.Normalized());
|
||||
if (((Weapon)EquipmentComponent.EquippedWeapon.Value).WeaponTag == WeaponTag.SelfDamage)
|
||||
HealthComponent.Damage(5);
|
||||
}
|
||||
|
||||
private void CollisionDetector_AreaEntered(Area3D area)
|
||||
{
|
||||
if (area.GetParent() is InventoryItem inventoryItem)
|
||||
{
|
||||
var isAdded = Inventory.PickUpItem(inventoryItem);
|
||||
if (isAdded)
|
||||
inventoryItem.QueueFree();
|
||||
}
|
||||
if (area.GetParent() is DroppedItem droppedItem)
|
||||
{
|
||||
var isAdded = Inventory.PickUpItem(droppedItem.Item);
|
||||
if (isAdded)
|
||||
droppedItem.QueueFree();
|
||||
}
|
||||
if (area.GetParent() is ThrownItem thrownItem)
|
||||
{
|
||||
var isAdded = Inventory.PickUpItem(thrownItem.ItemThatIsThrown);
|
||||
if (isAdded)
|
||||
thrownItem.QueueFree();
|
||||
}
|
||||
if (area.GetParent() is Restorative restorative)
|
||||
{
|
||||
//_gameRepo.OnRestorativePickedUp(restorative);
|
||||
restorative.QueueFree();
|
||||
}
|
||||
if (area.GetParent() is InventoryItem inventoryItem)
|
||||
{
|
||||
var isAdded = Inventory.PickUpItem(inventoryItem);
|
||||
if (isAdded)
|
||||
inventoryItem.QueueFree();
|
||||
}
|
||||
if (area.GetParent() is DroppedItem droppedItem)
|
||||
{
|
||||
var isAdded = Inventory.PickUpItem(droppedItem.Item);
|
||||
if (isAdded)
|
||||
droppedItem.QueueFree();
|
||||
}
|
||||
if (area.GetParent() is ThrownItem thrownItem)
|
||||
{
|
||||
var isAdded = Inventory.PickUpItem(thrownItem.ItemThatIsThrown);
|
||||
if (isAdded)
|
||||
thrownItem.QueueFree();
|
||||
}
|
||||
if (area.GetParent() is Restorative restorative)
|
||||
{
|
||||
//_gameRepo.OnRestorativePickedUp(restorative);
|
||||
restorative.QueueFree();
|
||||
}
|
||||
}
|
||||
|
||||
private bool PlayerIsHittingGeometry()
|
||||
{
|
||||
var collisions = WallCheck.GetCollidingBodies();
|
||||
return collisions.Count > 0;
|
||||
var collisions = WallCheck.GetCollidingBodies();
|
||||
return collisions.Count > 0;
|
||||
}
|
||||
|
||||
private void WallCheck_BodyEntered(Node body)
|
||||
{
|
||||
GD.Print("Hit wall");
|
||||
AnimationPlayer.Stop();
|
||||
GD.Print("Hit wall");
|
||||
AnimationPlayer.Stop();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -44,9 +44,9 @@ public partial class InGameUI : Control, IInGameUI
|
||||
|
||||
InGameUILogicBinding
|
||||
.Handle((in InGameUILogic.Output.AnnounceMessageOnMainScreen output) => { InventoryMessageUI.DisplayMessage(output.Message); })
|
||||
.Handle((in InGameUILogic.Output.AnnounceMessageInInventory output) => { InventoryMenu.DisplayMessage(output.Message); })
|
||||
.Handle((in InGameUILogic.Output.RemoveItemFromInventory output) => { InventoryMenu.RemoveItem(output.Item); })
|
||||
.Handle((in InGameUILogic.Output.ShowInventory _) => { InventoryMenu.RefreshInventoryScreen(); InventoryMenu.Show(); InventoryMenu.SetProcessInput(true); })
|
||||
.Handle((in InGameUILogic.Output.AnnounceMessageInInventory output) => { })
|
||||
.Handle((in InGameUILogic.Output.RemoveItemFromInventory output) => { })
|
||||
.Handle((in InGameUILogic.Output.ShowInventory _) => { InventoryMenu.Show(); InventoryMenu.SetProcessInput(true); })
|
||||
.Handle((in InGameUILogic.Output.HideInventory _) => { CloseInventory(); });
|
||||
|
||||
InGameUILogic.Start();
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IInventoryMenu : IControl
|
||||
{
|
||||
}
|
||||
@@ -0,0 +1 @@
|
||||
uid://nhhwcce8ma3a
|
||||
@@ -1,18 +1,19 @@
|
||||
using Chickensoft.Collections;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Zennysoft.Game.Implementation;
|
||||
using System;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IItemSlot : IHBoxContainer
|
||||
public interface IItemSlot : IButton
|
||||
{
|
||||
public InventoryItem Item { get; set; }
|
||||
public AutoProp<InventoryItem> Item { get; }
|
||||
|
||||
public bool IsSelected { get; set; }
|
||||
|
||||
public void SetItemStyle();
|
||||
|
||||
public void SetSelectedItemStyle();
|
||||
|
||||
public void SetEquippedItemStyle();
|
||||
|
||||
public void SetEquippedSelectedItemStyle();
|
||||
public event Action<InventoryItem> ItemPressed;
|
||||
public event Action<IItemSlot> ItemEnterFocus;
|
||||
public event Action<IItemSlot> ItemExitFocus;
|
||||
}
|
||||
|
||||
@@ -1,32 +1,52 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.GodotNodeInterfaces;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Threading.Tasks;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
public interface IInventoryMenu : IControl
|
||||
{
|
||||
public Task RefreshInventoryScreen();
|
||||
|
||||
public Task DisplayMessage(string message);
|
||||
|
||||
public void RemoveItem(InventoryItem item);
|
||||
}
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class InventoryMenu : Control, IInventoryMenu
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Node] public VBoxContainer ItemsPage { get; set; }
|
||||
|
||||
[Node] public Label ATKValue { get; set; }
|
||||
[Node] public Label ATKBonusLabel { get; set; }
|
||||
[Node] public Label DEFValue { get; set; }
|
||||
[Node] public Label DEFBonusLabel { get; set; }
|
||||
|
||||
[Node] public Button UseButton { get; set; }
|
||||
[Node] public Button ThrowButton { get; set; }
|
||||
[Node] public Button DropButton { get; set; }
|
||||
|
||||
[Node] public Label ItemDescriptionTitle { get; set; }
|
||||
[Node] public Label UseItemPrompt { get; set; }
|
||||
[Node] public Label ItemEffectLabel { get; set; }
|
||||
|
||||
[Node] public Label BackArrow { get; set; } = default!;
|
||||
[Node] public Label ForwardArrow { get; set; } = default!;
|
||||
|
||||
[Node] public ItemSlot ItemSlot1 { get; set; }
|
||||
[Node] public ItemSlot ItemSlot2 { get; set; }
|
||||
[Node] public ItemSlot ItemSlot3 { get; set; }
|
||||
[Node] public ItemSlot ItemSlot4 { get; set; }
|
||||
[Node] public ItemSlot ItemSlot5 { get; set; }
|
||||
[Node] public ItemSlot ItemSlot6 { get; set; }
|
||||
[Node] public ItemSlot ItemSlot7 { get; set; }
|
||||
[Node] public ItemSlot ItemSlot8 { get; set; }
|
||||
[Node] public ItemSlot ItemSlot9 { get; set; }
|
||||
[Node] public ItemSlot ItemSlot10 { get; set; }
|
||||
|
||||
[Dependency] private IPlayer _player => this.DependOn<IPlayer>();
|
||||
[Dependency] private IGame _game => this.DependOn<IGame>();
|
||||
[Dependency] private IGameRepo _gameRepo => this.DependOn<IGameRepo>();
|
||||
|
||||
[Dependency] public IGame Game => this.DependOn<IGame>();
|
||||
|
||||
[Dependency] public IPlayer Player => this.DependOn<IPlayer>();
|
||||
private List<IItemSlot> ItemSlots;
|
||||
|
||||
private InventoryPageNumber _currentPageNumber = InventoryPageNumber.FirstPage;
|
||||
|
||||
@@ -34,204 +54,208 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
|
||||
private const int _itemsPerPage = 10;
|
||||
|
||||
private int _currentIndex = 0;
|
||||
private IItemSlot _currentlySelectedItem = null;
|
||||
|
||||
private IItemSlot[] ItemSlots => [.. ItemsPage.GetChildren().OfType<IItemSlot>()];
|
||||
|
||||
#region Control Nodes
|
||||
[Node] public Label ATKValue { get; set; } = default!;
|
||||
[Node] public Label ATKBonusLabel { get; set; } = default!;
|
||||
[Node] public Label DEFValue { get; set; } = default!;
|
||||
[Node] public Label DEFBonusLabel { get; set; } = default!;
|
||||
[Node] public Label ItemDescriptionTitle { get; set; } = default!;
|
||||
[Node] public Label ItemEffectLabel { get; set; } = default!;
|
||||
|
||||
// Item Menu
|
||||
[Node] public Label BackArrow { get; set; } = default!;
|
||||
[Node] public Label ForwardArrow { get; set; } = default!;
|
||||
[Node] public Control ItemsPage { get; set; } = default!;
|
||||
|
||||
// User Prompt Menu
|
||||
[Node] public Label UseItemPrompt { get; set; } = default!;
|
||||
[Node] public Button UseButton { get; set; } = default!;
|
||||
[Node] public Button ThrowButton { get; set; } = default!;
|
||||
[Node] public Button DropButton { get; set; } = default!;
|
||||
|
||||
[Node] public AnimationPlayer AnimationPlayer { get; set; } = default!;
|
||||
#endregion
|
||||
|
||||
public InventoryMenu()
|
||||
public override void _EnterTree()
|
||||
{
|
||||
SetProcessInput(false);
|
||||
SetProcess(false);
|
||||
}
|
||||
|
||||
public void OnResolved()
|
||||
{
|
||||
ItemSlots = [ItemSlot1, ItemSlot2, ItemSlot3, ItemSlot4, ItemSlot5, ItemSlot6, ItemSlot7, ItemSlot8, ItemSlot9, ItemSlot10];
|
||||
_currentlySelectedItem = ItemSlot1;
|
||||
foreach (var item in ItemSlots)
|
||||
{
|
||||
item.ItemPressed += Item_Pressed;
|
||||
item.ItemEnterFocus += Item_FocusEntered;
|
||||
item.ItemExitFocus += Item_ItemExitFocus;
|
||||
}
|
||||
|
||||
_player.AttackComponent.CurrentAttack.Sync += Attack_Sync;
|
||||
_player.AttackComponent.MaximumAttack.Sync += Attack_Sync;
|
||||
_player.DefenseComponent.CurrentDefense.Sync += Defense_Sync;
|
||||
_player.DefenseComponent.MaximumDefense.Sync += Defense_Sync;
|
||||
_player.EquipmentComponent.EquipmentChanged += EquipmentComponent_EquipmentChanged;
|
||||
_player.Inventory.InventoryChanged += Inventory_InventoryChanged;
|
||||
|
||||
UseButton.Pressed += UseButtonPressed;
|
||||
ThrowButton.Pressed += ThrowButtonPressed;
|
||||
DropButton.Pressed += DropButtonPressed;
|
||||
Player.AttackComponent.CurrentAttack.Sync += AttackSync;
|
||||
Player.AttackComponent.MaximumAttack.Sync += AttackSync;
|
||||
Player.EquipmentComponent.EquippedWeapon.Sync += BonusSync;
|
||||
Player.EquipmentComponent.EquippedArmor.Sync += BonusSync;
|
||||
Player.EquipmentComponent.EquippedAccessory.Sync += BonusSync;
|
||||
Player.DefenseComponent.CurrentDefense.Sync += DefenseSync;
|
||||
Player.DefenseComponent.MaximumDefense.Sync += DefenseSync;
|
||||
|
||||
VisibilityChanged += InventoryMenu2_VisibilityChanged;
|
||||
}
|
||||
|
||||
public void OnExitTree()
|
||||
{
|
||||
Player.AttackComponent.CurrentAttack.Sync -= AttackSync;
|
||||
Player.AttackComponent.MaximumAttack.Sync -= AttackSync;
|
||||
Player.EquipmentComponent.EquippedWeapon.Sync -= BonusSync;
|
||||
Player.EquipmentComponent.EquippedArmor.Sync -= BonusSync;
|
||||
Player.EquipmentComponent.EquippedAccessory.Sync -= BonusSync;
|
||||
Player.DefenseComponent.CurrentDefense.Sync -= DefenseSync;
|
||||
Player.DefenseComponent.MaximumDefense.Sync -= DefenseSync;
|
||||
}
|
||||
|
||||
public async Task DisplayMessage(string message)
|
||||
{
|
||||
SetProcessInput(false);
|
||||
await HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
ItemEffectLabel.Text = message;
|
||||
await ToSignal(GetTree().CreateTimer(1f), "timeout");
|
||||
await RefreshInventoryScreen();
|
||||
SetProcessInput(true);
|
||||
}
|
||||
|
||||
private void AttackSync(int obj) => ATKValue.Text = $"{Player.AttackComponent.CurrentAttack.Value}/{Player.AttackComponent.MaximumAttack.Value}";
|
||||
|
||||
private void BonusSync(EquipableItem equip)
|
||||
{
|
||||
ATKBonusLabel.Text = $"{Player.EquipmentComponent.BonusAttack:+0;-#;\\.\\.\\.}";
|
||||
DEFBonusLabel.Text = $"{Player.EquipmentComponent.BonusDefense:+0;-#;\\.\\.\\.}";
|
||||
}
|
||||
|
||||
private void DefenseSync(int obj) => DEFValue.Text = $"{Player.DefenseComponent.CurrentDefense.Value}/{Player.DefenseComponent.MaximumDefense.Value}";
|
||||
|
||||
public async Task RefreshInventoryScreen()
|
||||
{
|
||||
await ClearItems();
|
||||
PopulateInventory();
|
||||
PopulatePlayerInfo();
|
||||
await HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
}
|
||||
|
||||
#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
public override void _Input(InputEvent @event)
|
||||
{
|
||||
if (Visible && @event.IsActionPressed(GameInputs.Inventory))
|
||||
{
|
||||
if (UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus())
|
||||
{
|
||||
HideUserActionPrompt();
|
||||
ShowInventoryInfo();
|
||||
Autoload.AudioManager.Play(SoundEffect.Cancel);
|
||||
}
|
||||
else
|
||||
{
|
||||
AcceptEvent();
|
||||
Autoload.AudioManager.Play(SoundEffect.Cancel);
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
}
|
||||
|
||||
if (ItemSlots.Length == 0 || UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus())
|
||||
if (!Visible)
|
||||
return;
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.MoveRight) && _currentPageNumber == InventoryPageNumber.FirstPage)
|
||||
if (Input.IsActionJustPressed(GameInputs.Inventory) && !(UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus()))
|
||||
{
|
||||
var inventory = Player.Inventory;
|
||||
if (inventory.Items.Count > _itemsPerPage)
|
||||
ChangeInventoryPage(InventoryPageNumber.SecondPage);
|
||||
AcceptEvent();
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
if (Input.IsActionJustPressed(GameInputs.UiCancel) && (UseButton.HasFocus() || DropButton.HasFocus() || ThrowButton.HasFocus()))
|
||||
{
|
||||
AcceptEvent();
|
||||
HideUserActionPrompt();
|
||||
}
|
||||
else if (Input.IsActionJustPressed(GameInputs.UiCancel))
|
||||
{
|
||||
AcceptEvent();
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
if (_currentPageNumber == InventoryPageNumber.FirstPage && _player.Inventory.Items.Count > 10 && Input.IsActionJustPressed(GameInputs.MoveRight))
|
||||
{
|
||||
_currentPageNumber = InventoryPageNumber.SecondPage;
|
||||
Inventory_InventoryChanged();
|
||||
_currentlySelectedItem = ItemSlot1;
|
||||
ItemSlot1.GrabFocus();
|
||||
}
|
||||
else if (_currentPageNumber == InventoryPageNumber.SecondPage && Input.IsActionJustPressed(GameInputs.MoveLeft))
|
||||
{
|
||||
_currentPageNumber = InventoryPageNumber.FirstPage;
|
||||
Inventory_InventoryChanged();
|
||||
_currentlySelectedItem = ItemSlot1;
|
||||
ItemSlot1.GrabFocus();
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.MoveLeft) && _currentPageNumber == InventoryPageNumber.SecondPage)
|
||||
ChangeInventoryPage(InventoryPageNumber.FirstPage);
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.MoveDown))
|
||||
if (Input.IsActionJustPressed(GameInputs.InventorySort))
|
||||
{
|
||||
var oldIndex = _currentIndex;
|
||||
var newIndex = new[] { _currentIndex + 1, _itemsPerPage - 1, ItemSlots.Length - 1 }.Min();
|
||||
if (oldIndex == newIndex)
|
||||
return;
|
||||
|
||||
SetToUnselectedStyle(ItemSlots.ElementAt(oldIndex));
|
||||
SetToSelectedStyle(ItemSlots.ElementAt(newIndex));
|
||||
Autoload.AudioManager.Play(SoundEffect.MoveThroughOptions);
|
||||
_currentIndex = newIndex;
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.MoveUp))
|
||||
{
|
||||
var oldIndex = _currentIndex;
|
||||
var newIndex = new[] { _currentIndex - 1, 0 }.Max();
|
||||
|
||||
if (oldIndex == newIndex)
|
||||
return;
|
||||
|
||||
SetToUnselectedStyle(ItemSlots.ElementAt(oldIndex));
|
||||
SetToSelectedStyle(ItemSlots.ElementAt(newIndex));
|
||||
Autoload.AudioManager.Play(SoundEffect.MoveThroughOptions);
|
||||
_currentIndex = newIndex;
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.Attack))
|
||||
{
|
||||
DisplayUserActionPrompt();
|
||||
Autoload.AudioManager.Play(SoundEffect.Select);
|
||||
}
|
||||
|
||||
if (@event.IsActionPressed(GameInputs.InventorySort))
|
||||
{
|
||||
var inventory = Player.Inventory;
|
||||
inventory.Sort(Player.EquipmentComponent.EquippedWeapon.Value, Player.EquipmentComponent.EquippedArmor.Value, Player.EquipmentComponent.EquippedAccessory.Value);
|
||||
if (_currentIndex > inventory.Items.Count - 1)
|
||||
_currentIndex = inventory.Items.Count - 1;
|
||||
RefreshInventoryScreen();
|
||||
_player.Inventory.Sort(_player.EquipmentComponent.EquippedWeapon.Value, _player.EquipmentComponent.EquippedArmor.Value, _player.EquipmentComponent.EquippedAccessory.Value);
|
||||
Inventory_InventoryChanged();
|
||||
foreach (var slot in ItemSlots)
|
||||
slot.SetItemStyle();
|
||||
Item_ItemExitFocus(_currentlySelectedItem);
|
||||
_currentlySelectedItem = ItemSlot1;
|
||||
_currentlySelectedItem.GrabFocus();
|
||||
}
|
||||
}
|
||||
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
|
||||
|
||||
public async void RemoveItem(InventoryItem item)
|
||||
private void InventoryMenu2_VisibilityChanged()
|
||||
{
|
||||
Player.Inventory.Remove(item);
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
if (_currentIndex <= 0)
|
||||
_currentIndex = 0;
|
||||
_currentlySelectedItem.GrabFocus();
|
||||
}
|
||||
|
||||
private void PopulateItems()
|
||||
private void Item_ItemExitFocus(IItemSlot itemSlot)
|
||||
{
|
||||
PopulateInventory();
|
||||
PopulatePlayerInfo();
|
||||
}
|
||||
|
||||
private async Task ClearItems()
|
||||
{
|
||||
foreach (var item in ItemSlots)
|
||||
ItemsPage.RemoveChildEx(item);
|
||||
|
||||
ItemDescriptionTitle.Text = string.Empty;
|
||||
ItemEffectLabel.Text = string.Empty;
|
||||
itemSlot.IsSelected = false;
|
||||
itemSlot.SetItemStyle();
|
||||
}
|
||||
|
||||
private void PopulatePlayerInfo()
|
||||
private void Item_FocusEntered(IItemSlot itemSlot)
|
||||
{
|
||||
if (ItemSlots.Length != 0)
|
||||
if (itemSlot.Item.Value == null)
|
||||
return;
|
||||
|
||||
ItemDescriptionTitle.Text = $"{itemSlot.Item.Value.ItemName}";
|
||||
ItemEffectLabel.Text = $"{itemSlot.Item.Value.Description}";
|
||||
_currentlySelectedItem = itemSlot;
|
||||
itemSlot.IsSelected = true;
|
||||
itemSlot.SetItemStyle();
|
||||
}
|
||||
|
||||
private void Item_Pressed(InventoryItem item) => DisplayUserActionPrompt(item);
|
||||
|
||||
private async void Inventory_InventoryChanged()
|
||||
{
|
||||
foreach (var slot in ItemSlots)
|
||||
{
|
||||
var item = ItemSlots.ElementAt(_currentIndex).Item;
|
||||
ItemDescriptionTitle.Text = $"{item.ItemName}";
|
||||
ItemEffectLabel.Text = $"{item.Description}";
|
||||
slot.Visible = false;
|
||||
slot.SetItemStyle();
|
||||
}
|
||||
|
||||
if (_currentPageNumber == InventoryPageNumber.SecondPage && _player.Inventory.Items.Count <= 10)
|
||||
{
|
||||
_currentPageNumber = InventoryPageNumber.FirstPage;
|
||||
var elementToSelect = _player.Inventory.Items.IndexOf(_player.Inventory.Items.Last());
|
||||
_currentlySelectedItem = ItemSlots.ElementAt(elementToSelect);
|
||||
_currentlySelectedItem.GrabFocus();
|
||||
}
|
||||
|
||||
var itemsToDisplay = new List<InventoryItem>();
|
||||
if (_currentPageNumber == InventoryPageNumber.FirstPage)
|
||||
itemsToDisplay = [.. _player.Inventory.Items.Take(_itemsPerPage)];
|
||||
else
|
||||
itemsToDisplay = [.. _player.Inventory.Items.TakeLast(_player.Inventory.Items.Count - _itemsPerPage)];
|
||||
|
||||
for (var i = 0; i < itemsToDisplay.Count; i++)
|
||||
{
|
||||
ItemSlots[i].Item.OnNext(itemsToDisplay[i]);
|
||||
ItemSlots[i].Visible = true;
|
||||
}
|
||||
|
||||
SetPageIndicators();
|
||||
|
||||
if (!_player.Inventory.Items.Contains(_currentlySelectedItem.Item.Value))
|
||||
{
|
||||
_currentlySelectedItem.Item.OnNext(null);
|
||||
var elementToSelect = Mathf.Max(0, ItemSlots.IndexOf(_currentlySelectedItem) - 1);
|
||||
_currentlySelectedItem = ItemSlots.ElementAt(elementToSelect);
|
||||
_currentlySelectedItem.GrabFocus();
|
||||
}
|
||||
}
|
||||
|
||||
private void DisplayUserActionPrompt()
|
||||
private void SetPageIndicators()
|
||||
{
|
||||
if (_player.Inventory.Items.Count > 10 && _currentPageNumber == InventoryPageNumber.FirstPage)
|
||||
{
|
||||
ForwardArrow.Text = "►";
|
||||
BackArrow.Text = "";
|
||||
}
|
||||
else if (_player.Inventory.Items.Count > 10 && _currentPageNumber == InventoryPageNumber.SecondPage)
|
||||
{
|
||||
ForwardArrow.Text = "";
|
||||
BackArrow.Text = "◄";
|
||||
}
|
||||
}
|
||||
|
||||
private void Attack_Sync(int obj) => ATKValue.Text = $"{_player.AttackComponent.CurrentAttack.Value}/{_player.AttackComponent.MaximumAttack.Value}";
|
||||
private void Defense_Sync(int obj) => DEFValue.Text = $"{_player.DefenseComponent.CurrentDefense.Value}/{_player.DefenseComponent.MaximumDefense.Value}";
|
||||
|
||||
private void EquipmentComponent_EquipmentChanged(EquipableItem equipableItem)
|
||||
{
|
||||
ATKBonusLabel.Text = $"{_player.EquipmentComponent.BonusAttack:+0;-#;\\.\\.\\.}";
|
||||
DEFBonusLabel.Text = $"{_player.EquipmentComponent.BonusDefense:+0;-#;\\.\\.\\.}";
|
||||
}
|
||||
|
||||
private async void UseButtonPressed()
|
||||
{
|
||||
UseButton.Disabled = true;
|
||||
if (_currentlySelectedItem.Item.Value is EquipableItem equipable)
|
||||
await EquipOrUnequipItem(equipable);
|
||||
else
|
||||
await _game.UseItem(_currentlySelectedItem.Item.Value);
|
||||
UseButton.Disabled = false;
|
||||
|
||||
|
||||
HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
await ToSignal(GetTree().CreateTimer(1f), "timeout");
|
||||
}
|
||||
|
||||
private async void ThrowButtonPressed()
|
||||
{
|
||||
_game.ThrowItem(_currentlySelectedItem.Item.Value);
|
||||
_player.Inventory.Remove(_currentlySelectedItem.Item.Value);
|
||||
HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
|
||||
private async void DropButtonPressed()
|
||||
{
|
||||
_game.DropItem(_currentlySelectedItem.Item.Value);
|
||||
_player.Inventory.Remove(_currentlySelectedItem.Item.Value);
|
||||
HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
|
||||
private void DisplayUserActionPrompt(InventoryItem item)
|
||||
{
|
||||
ItemDescriptionTitle.Hide();
|
||||
ItemEffectLabel.Hide();
|
||||
@@ -240,11 +264,9 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
ThrowButton.Show();
|
||||
DropButton.Show();
|
||||
|
||||
var currentItem = ItemSlots.ElementAt(_currentIndex).Item;
|
||||
|
||||
if (currentItem is EquipableItem equipable)
|
||||
if (item is EquipableItem equipable)
|
||||
{
|
||||
var isItemEquipped = Player.EquipmentComponent.IsItemEquipped(equipable);
|
||||
var isItemEquipped = _player.EquipmentComponent.IsItemEquipped(equipable);
|
||||
UseButton.Text = isItemEquipped ? "Unequip" : "Equip";
|
||||
ThrowButton.Disabled = isItemEquipped;
|
||||
ThrowButton.FocusMode = isItemEquipped ? FocusModeEnum.None : FocusModeEnum.All;
|
||||
@@ -259,7 +281,7 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
UseButton.CallDeferred(MethodName.GrabFocus);
|
||||
}
|
||||
|
||||
private async Task HideUserActionPrompt()
|
||||
private void HideUserActionPrompt()
|
||||
{
|
||||
UseItemPrompt.Hide();
|
||||
UseButton.Hide();
|
||||
@@ -268,6 +290,23 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
UseButton.ReleaseFocus();
|
||||
ThrowButton.ReleaseFocus();
|
||||
DropButton.ReleaseFocus();
|
||||
_currentlySelectedItem.GrabFocus();
|
||||
}
|
||||
|
||||
private async Task EquipOrUnequipItem(EquipableItem equipable)
|
||||
{
|
||||
if (_player.EquipmentComponent.IsItemEquipped(equipable))
|
||||
{
|
||||
ItemEffectLabel.Text = $"{equipable.GetType().Name} unequipped.";
|
||||
_player.Unequip(equipable);
|
||||
}
|
||||
else
|
||||
{
|
||||
var itemSlot = _currentlySelectedItem;
|
||||
ItemEffectLabel.Text = $"{equipable.GetType().Name} equipped.";
|
||||
_player.Equip(equipable);
|
||||
_currentlySelectedItem = itemSlot;
|
||||
}
|
||||
}
|
||||
|
||||
private async Task ShowInventoryInfo()
|
||||
@@ -276,149 +315,6 @@ public partial class InventoryMenu : Control, IInventoryMenu
|
||||
ItemEffectLabel.Show();
|
||||
}
|
||||
|
||||
private async Task ChangeInventoryPage(InventoryPageNumber pageToChangeTo)
|
||||
{
|
||||
await ClearItems();
|
||||
await ToSignal(GetTree().CreateTimer(0.1f), "timeout");
|
||||
_currentIndex = 0;
|
||||
_currentPageNumber = pageToChangeTo;
|
||||
await RefreshInventoryScreen();
|
||||
Autoload.AudioManager.Play(SoundEffect.MoveThroughOptions);
|
||||
}
|
||||
|
||||
private async void PopulateInventory()
|
||||
{
|
||||
var inventory = Player.Inventory;
|
||||
var numberOfItemsToDisplay = _currentPageNumber == InventoryPageNumber.FirstPage ? Mathf.Min(inventory.Items.Count, _itemsPerPage) : Mathf.Min(inventory.Items.Count - _itemsPerPage, _itemsPerPage);
|
||||
var indexToStart = _currentPageNumber == InventoryPageNumber.FirstPage ? 0 : _itemsPerPage;
|
||||
|
||||
ForwardArrow.Text = "";
|
||||
BackArrow.Text = "";
|
||||
|
||||
if (_currentPageNumber == InventoryPageNumber.FirstPage && inventory.Items.Count > _itemsPerPage)
|
||||
{
|
||||
ForwardArrow.Text = "►";
|
||||
BackArrow.Text = "";
|
||||
}
|
||||
if (_currentPageNumber == InventoryPageNumber.SecondPage)
|
||||
{
|
||||
ForwardArrow.Text = "";
|
||||
BackArrow.Text = "◄";
|
||||
}
|
||||
|
||||
|
||||
for (var i = 0; i < numberOfItemsToDisplay; i++)
|
||||
{
|
||||
var item = inventory.Items.ElementAt(i + indexToStart);
|
||||
var itemScene = GD.Load<PackedScene>(ITEM_SLOT_SCENE);
|
||||
var itemSlot = itemScene.Instantiate<IItemSlot>();
|
||||
itemSlot.Item = item;
|
||||
ItemsPage.AddChildEx(itemSlot);
|
||||
|
||||
if (Player.EquipmentComponent.IsItemEquipped(itemSlot.Item))
|
||||
itemSlot.SetEquippedItemStyle();
|
||||
}
|
||||
|
||||
if (ItemSlots.Length != 0)
|
||||
{
|
||||
ItemSlots.ElementAt(_currentIndex).SetSelectedItemStyle();
|
||||
if (Player.EquipmentComponent.IsItemEquipped(ItemSlots.ElementAt(_currentIndex).Item))
|
||||
ItemSlots.ElementAt(_currentIndex).SetEquippedSelectedItemStyle();
|
||||
}
|
||||
}
|
||||
|
||||
private async Task SetToUnselectedStyle(IItemSlot itemSlot)
|
||||
{
|
||||
await ToSignal(GetTree().CreateTimer(0.1f), "timeout");
|
||||
itemSlot.SetItemStyle();
|
||||
if (Player.EquipmentComponent.IsItemEquipped(itemSlot.Item))
|
||||
itemSlot.SetEquippedItemStyle();
|
||||
}
|
||||
|
||||
private async Task SetToSelectedStyle(IItemSlot itemSlot)
|
||||
{
|
||||
await ToSignal(GetTree().CreateTimer(0.1f), "timeout");
|
||||
itemSlot.SetSelectedItemStyle();
|
||||
ItemDescriptionTitle.Text = $"{itemSlot.Item.ItemName}";
|
||||
ItemEffectLabel.Text = $"{itemSlot.Item.Description}";
|
||||
}
|
||||
|
||||
private async Task EquipOrUnequipItem()
|
||||
{
|
||||
var itemSlot = ItemSlots[_currentIndex];
|
||||
if (itemSlot.Item is not EquipableItem)
|
||||
return;
|
||||
var equippableItem = (EquipableItem)itemSlot.Item;
|
||||
if (Player.EquipmentComponent.IsItemEquipped(equippableItem))
|
||||
{
|
||||
ItemEffectLabel.Text = $"{equippableItem.GetType().Name} unequipped.";
|
||||
Player.EquipmentComponent.Unequip(equippableItem);
|
||||
itemSlot.SetSelectedItemStyle();
|
||||
if (itemSlot.Item.ItemTag == ItemTag.BreaksOnChange)
|
||||
Player.Inventory.Remove(equippableItem);
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemEffectLabel.Text = $"{equippableItem.GetType().Name} equipped.";
|
||||
Player.Equip(equippableItem);
|
||||
itemSlot.SetEquippedSelectedItemStyle();
|
||||
}
|
||||
|
||||
RefreshUIAfterUserSelection();
|
||||
}
|
||||
|
||||
private async void UseButtonPressed()
|
||||
{
|
||||
UseButton.Disabled = true;
|
||||
var currentItem = ItemSlots[_currentIndex].Item;
|
||||
if (currentItem is EquipableItem)
|
||||
await EquipOrUnequipItem();
|
||||
else
|
||||
await Game.UseItem(currentItem);
|
||||
|
||||
RefreshUIAfterUserSelection();
|
||||
UseButton.Disabled = false;
|
||||
}
|
||||
|
||||
private async void ThrowButtonPressed()
|
||||
{
|
||||
var currentItem = ItemSlots[_currentIndex].Item;
|
||||
|
||||
Game.ThrowItem(currentItem);
|
||||
Player.Inventory.Remove(currentItem);
|
||||
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
if (_currentIndex <= 0)
|
||||
_currentIndex = 0;
|
||||
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
|
||||
private async void DropButtonPressed()
|
||||
{
|
||||
var currentItem = ItemSlots[_currentIndex].Item;
|
||||
Game.DropItem(currentItem);
|
||||
Player.Inventory.Remove(currentItem);
|
||||
|
||||
if (_currentIndex >= ItemSlots.Length - 1)
|
||||
_currentIndex--;
|
||||
if (_currentIndex <= 0)
|
||||
_currentIndex = 0;
|
||||
|
||||
_gameRepo.CloseInventory();
|
||||
}
|
||||
|
||||
private async void RefreshUIAfterUserSelection()
|
||||
{
|
||||
SetProcessInput(false);
|
||||
await HideUserActionPrompt();
|
||||
await ShowInventoryInfo();
|
||||
await RefreshInventoryScreen();
|
||||
await ToSignal(GetTree().CreateTimer(1f), "timeout");
|
||||
SetProcessInput(true);
|
||||
}
|
||||
|
||||
private enum InventoryPageNumber
|
||||
{
|
||||
FirstPage,
|
||||
|
||||
@@ -1 +1 @@
|
||||
uid://cmtet15hi5oiy
|
||||
uid://bi1xopts68paw
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
[gd_scene load_steps=30 format=3 uid="uid://dlj8qdg1c5048"]
|
||||
[gd_scene load_steps=27 format=3 uid="uid://dlj8qdg1c5048"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cmtet15hi5oiy" path="res://src/ui/inventory_menu/InventoryMenu.cs" id="1_l64wl"]
|
||||
[ext_resource type="Script" uid="uid://bi1xopts68paw" path="res://src/ui/inventory_menu/InventoryMenu.cs" id="1_b6rkr"]
|
||||
[ext_resource type="Shader" uid="uid://cnphwvmr05hp1" path="res://src/ui/inventory_menu/InventoryMenu.gdshader" id="2_0fvsh"]
|
||||
[ext_resource type="FontFile" uid="uid://cm8j5vcdop5x0" path="res://src/ui/fonts/Mrs-Eaves-OT-Roman_31443.ttf" id="3_lm4o1"]
|
||||
[ext_resource type="PackedScene" uid="uid://c005nd0m2eim" path="res://src/ui/inventory_menu/ItemSlot.tscn" id="4_aiji3"]
|
||||
[ext_resource type="FontFile" uid="uid://cb41qqmxqurj8" path="res://src/ui/fonts/FT88-Bold.ttf" id="4_rg5yb"]
|
||||
[ext_resource type="FontFile" uid="uid://dit3vylt7hmmx" path="res://src/ui/fonts/FT88-Regular.ttf" id="5_2qnnx"]
|
||||
[ext_resource type="LabelSettings" uid="uid://ca1q6yu8blwxf" path="res://src/ui/label_settings/InventoryMainTextBold.tres" id="6_tmdno"]
|
||||
[ext_resource type="LabelSettings" uid="uid://cuuo43x72xcsc" path="res://src/ui/label_settings/MainTextBold.tres" id="7_vyrxm"]
|
||||
[ext_resource type="Theme" uid="uid://daxuhpmyxwxck" path="res://src/ui/inventory_menu/InventoryDialogueSelectionStyle.tres" id="8_khyvo"]
|
||||
[ext_resource type="Shortcut" uid="uid://dumkrjur22k2a" path="res://src/ui/ButtonShortcut.tres" id="9_b6rkr"]
|
||||
|
||||
[sub_resource type="ShaderMaterial" id="ShaderMaterial_i55tv"]
|
||||
shader = ExtResource("2_0fvsh")
|
||||
@@ -72,67 +72,6 @@ font_color = Color(0.737255, 0.705882, 0.690196, 1)
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_ct6ql"]
|
||||
|
||||
[sub_resource type="Animation" id="Animation_dg155"]
|
||||
length = 0.001
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [true]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:text")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(0),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [""]
|
||||
}
|
||||
|
||||
[sub_resource type="Animation" id="Animation_7by7u"]
|
||||
resource_name = "status_up"
|
||||
length = 2.5
|
||||
tracks/0/type = "value"
|
||||
tracks/0/imported = false
|
||||
tracks/0/enabled = true
|
||||
tracks/0/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:visible")
|
||||
tracks/0/interp = 1
|
||||
tracks/0/loop_wrap = true
|
||||
tracks/0/keys = {
|
||||
"times": PackedFloat32Array(0, 2.5),
|
||||
"transitions": PackedFloat32Array(1, 1),
|
||||
"update": 1,
|
||||
"values": [true, false]
|
||||
}
|
||||
tracks/1/type = "value"
|
||||
tracks/1/imported = false
|
||||
tracks/1/enabled = true
|
||||
tracks/1/path = NodePath("InventoryInfo/HBoxContainer/PlayerInfo/HBoxContainer/VBoxContainer/ItemEffectLabel:text")
|
||||
tracks/1/interp = 1
|
||||
tracks/1/loop_wrap = true
|
||||
tracks/1/keys = {
|
||||
"times": PackedFloat32Array(2.5),
|
||||
"transitions": PackedFloat32Array(1),
|
||||
"update": 1,
|
||||
"values": [""]
|
||||
}
|
||||
|
||||
[sub_resource type="AnimationLibrary" id="AnimationLibrary_eivo2"]
|
||||
_data = {
|
||||
&"RESET": SubResource("Animation_dg155"),
|
||||
&"status_up": SubResource("Animation_7by7u")
|
||||
}
|
||||
|
||||
[node name="InventoryMenu" type="Control"]
|
||||
custom_minimum_size = Vector2(1440, 1080)
|
||||
layout_mode = 3
|
||||
@@ -141,7 +80,8 @@ offset_right = 1440.0
|
||||
offset_bottom = 1080.0
|
||||
size_flags_horizontal = 3
|
||||
size_flags_vertical = 3
|
||||
script = ExtResource("1_l64wl")
|
||||
mouse_filter = 2
|
||||
script = ExtResource("1_b6rkr")
|
||||
|
||||
[node name="BG" type="TextureRect" parent="."]
|
||||
material = SubResource("ShaderMaterial_i55tv")
|
||||
@@ -151,6 +91,7 @@ anchor_right = 1.0
|
||||
anchor_bottom = 1.0
|
||||
grow_horizontal = 2
|
||||
grow_vertical = 2
|
||||
mouse_filter = 2
|
||||
texture = SubResource("PlaceholderTexture2D_3ynpe")
|
||||
expand_mode = 2
|
||||
|
||||
@@ -206,7 +147,6 @@ horizontal_alignment = 2
|
||||
[node name="ItemsPage" type="VBoxContainer" parent="InventoryInfo/HBoxContainer/ItemInfo"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
size_flags_vertical = 0
|
||||
theme_override_constants/separation = 15
|
||||
alignment = 1
|
||||
|
||||
@@ -214,8 +154,59 @@ alignment = 1
|
||||
custom_minimum_size = Vector2(0, 14)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot1" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot2" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot3" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot4" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot5" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot6" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot7" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot8" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot9" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemSlot10" parent="InventoryInfo/HBoxContainer/ItemInfo/ItemsPage" instance=ExtResource("4_aiji3")]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
[node name="PlayerInfo" type="VBoxContainer" parent="InventoryInfo/HBoxContainer"]
|
||||
layout_mode = 2
|
||||
mouse_filter = 2
|
||||
theme_override_constants/separation = 20
|
||||
|
||||
[node name="VTBox" type="HBoxContainer" parent="InventoryInfo/HBoxContainer/PlayerInfo"]
|
||||
@@ -382,7 +373,6 @@ theme_override_styles/disabled = SubResource("StyleBoxEmpty_fu7o2")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_nkvce")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_545ij")
|
||||
button_mask = 0
|
||||
shortcut = ExtResource("9_b6rkr")
|
||||
text = "Use"
|
||||
alignment = 0
|
||||
|
||||
@@ -407,7 +397,6 @@ theme_override_styles/disabled = SubResource("StyleBoxEmpty_ascpt")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_abpb1")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_545ij")
|
||||
button_mask = 0
|
||||
shortcut = ExtResource("9_b6rkr")
|
||||
text = "Throw"
|
||||
alignment = 0
|
||||
|
||||
@@ -432,12 +421,5 @@ theme_override_styles/disabled = SubResource("StyleBoxEmpty_uerb4")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_lvcf8")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_ct6ql")
|
||||
button_mask = 0
|
||||
shortcut = ExtResource("9_b6rkr")
|
||||
text = "Drop"
|
||||
alignment = 0
|
||||
|
||||
[node name="AnimationPlayer" type="AnimationPlayer" parent="."]
|
||||
unique_name_in_owner = true
|
||||
libraries = {
|
||||
&"": SubResource("AnimationLibrary_eivo2")
|
||||
}
|
||||
|
||||
@@ -1,18 +1,19 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Collections;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Game.Implementation;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
[Meta(typeof(IAutoNode))]
|
||||
public partial class ItemSlot : HBoxContainer, IItemSlot
|
||||
public partial class ItemSlot : Button, IItemSlot
|
||||
{
|
||||
public override void _Notification(int what) => this.Notify(what);
|
||||
|
||||
[Dependency] public IPlayer Player => this.DependOn<IPlayer>();
|
||||
[Dependency] private IPlayer _player => this.DependOn<IPlayer>();
|
||||
|
||||
[Node] public TextureRect ItemTexture { get; set; } = default!;
|
||||
|
||||
@@ -20,6 +21,8 @@ public partial class ItemSlot : HBoxContainer, IItemSlot
|
||||
|
||||
[Node] public Label ItemCount { get; set; } = default!;
|
||||
|
||||
public AutoProp<InventoryItem> Item { get; } = new AutoProp<InventoryItem>(default);
|
||||
|
||||
private static LabelSettings ItemFont => GD.Load<LabelSettings>("res://src/ui/label_settings/MainTextBold.tres");
|
||||
|
||||
private static LabelSettings SelectedItemFont => GD.Load<LabelSettings>("res://src/ui/label_settings/MainTextFontItalicized.tres");
|
||||
@@ -28,53 +31,89 @@ public partial class ItemSlot : HBoxContainer, IItemSlot
|
||||
|
||||
private static LabelSettings SelectedEquippedItemFont => GD.Load<LabelSettings>("res://src/ui/label_settings/MainTextFontSelectedEquipped.tres");
|
||||
|
||||
public void OnReady()
|
||||
{
|
||||
ItemName.Text = Item.ItemName;
|
||||
ItemTexture.Texture = Item.GetTexture();
|
||||
Player.EquipmentComponent.EquippedWeapon.Sync += EquipableItem_Sync;
|
||||
Player.EquipmentComponent.EquippedArmor.Sync += EquipableItem_Sync;
|
||||
Player.EquipmentComponent.EquippedAccessory.Sync += EquipableItem_Sync;
|
||||
public event Action<InventoryItem> ItemPressed;
|
||||
public event Action<IItemSlot> ItemEnterFocus;
|
||||
public event Action<IItemSlot> ItemExitFocus;
|
||||
|
||||
if (Item is IStackable stackableItem)
|
||||
{
|
||||
ItemCount.Text = $"{stackableItem.Count:D2}";
|
||||
ItemCount.Visible = true;
|
||||
}
|
||||
}
|
||||
public bool IsSelected { get; set; } = false;
|
||||
|
||||
private void EquipableItem_Sync(EquipableItem obj)
|
||||
public void OnResolved()
|
||||
{
|
||||
if (Item is EquipableItem equipableItem && equipableItem == obj)
|
||||
{
|
||||
SetEquippedSelectedItemStyle();
|
||||
}
|
||||
if (Item is EquipableItem unequippedItem && unequippedItem != obj)
|
||||
{
|
||||
SetItemStyle();
|
||||
}
|
||||
Item.Changed += Item_Changed;
|
||||
_player.EquipmentComponent.EquippedWeapon.Sync += EquipableItem_Sync;
|
||||
_player.EquipmentComponent.EquippedArmor.Sync += EquipableItem_Sync;
|
||||
_player.EquipmentComponent.EquippedAccessory.Sync += EquipableItem_Sync;
|
||||
|
||||
FocusEntered += ItemSlot_FocusEntered;
|
||||
FocusExited += ItemSlot_FocusExited;
|
||||
|
||||
Pressed += ItemSlot_Pressed;
|
||||
}
|
||||
|
||||
public void SetItemStyle()
|
||||
{
|
||||
ItemName.LabelSettings = ItemFont;
|
||||
if (_player.EquipmentComponent.IsItemEquipped(Item.Value) && IsSelected)
|
||||
SetEquippedSelectedItemStyle();
|
||||
else if (_player.EquipmentComponent.IsItemEquipped(Item.Value))
|
||||
SetEquippedItemStyle();
|
||||
else if (IsSelected)
|
||||
SetSelectedItemStyle();
|
||||
else
|
||||
SetToUnselectedStyle();
|
||||
}
|
||||
public void SetSelectedItemStyle()
|
||||
|
||||
public void SetToUnselectedStyle()
|
||||
{
|
||||
if (Player.EquipmentComponent.IsItemEquipped(Item))
|
||||
SetItemFont();
|
||||
if (_player.EquipmentComponent.IsItemEquipped(Item.Value))
|
||||
SetEquippedItemStyle();
|
||||
}
|
||||
|
||||
private void EquipableItem_Sync(EquipableItem item) => SetItemStyle();
|
||||
|
||||
private void ItemSlot_Pressed()
|
||||
{
|
||||
if (Item.Value == null)
|
||||
return;
|
||||
|
||||
ItemPressed?.Invoke(Item.Value);
|
||||
}
|
||||
|
||||
private void ItemSlot_FocusExited() => ItemExitFocus?.Invoke(this);
|
||||
|
||||
private void ItemSlot_FocusEntered() => ItemEnterFocus?.Invoke(this);
|
||||
|
||||
private void Item_Changed(InventoryItem obj)
|
||||
{
|
||||
if (obj == null)
|
||||
return;
|
||||
|
||||
ItemName.Text = obj.ItemName;
|
||||
ItemTexture.Texture = obj.GetTexture();
|
||||
if (obj is IStackable stackableItem)
|
||||
{
|
||||
ItemCount.Text = $"{stackableItem.Count:D2}";
|
||||
ItemCount.Visible = true;
|
||||
}
|
||||
else
|
||||
{
|
||||
ItemCount.Text = string.Empty;
|
||||
ItemCount.Visible = false;
|
||||
}
|
||||
}
|
||||
|
||||
private void SetToSelectedStyle() => SetSelectedItemStyle();
|
||||
|
||||
private void SetSelectedItemStyle()
|
||||
{
|
||||
if (_player.EquipmentComponent.IsItemEquipped(Item.Value))
|
||||
ItemName.LabelSettings = SelectedEquippedItemFont;
|
||||
else
|
||||
ItemName.LabelSettings = SelectedItemFont;
|
||||
}
|
||||
public void SetEquippedItemStyle()
|
||||
{
|
||||
ItemName.LabelSettings = EquippedItemFont;
|
||||
}
|
||||
private void SetItemFont() => ItemName.LabelSettings = ItemFont;
|
||||
|
||||
public void SetEquippedSelectedItemStyle()
|
||||
{
|
||||
ItemName.LabelSettings = SelectedEquippedItemFont;
|
||||
}
|
||||
private void SetEquippedItemStyle() => ItemName.LabelSettings = EquippedItemFont;
|
||||
|
||||
public InventoryItem Item { get; set; } = default!;
|
||||
private void SetEquippedSelectedItemStyle() => ItemName.LabelSettings = SelectedEquippedItemFont;
|
||||
}
|
||||
|
||||
@@ -1,4 +1,4 @@
|
||||
[gd_scene load_steps=7 format=3 uid="uid://c005nd0m2eim"]
|
||||
[gd_scene load_steps=8 format=3 uid="uid://c005nd0m2eim"]
|
||||
|
||||
[ext_resource type="Script" uid="uid://cglxk7v8hpesn" path="res://src/ui/inventory_menu/ItemSlot.cs" id="1_yttxt"]
|
||||
[ext_resource type="Texture2D" uid="uid://0r1dws4ajhdx" path="res://src/items/accessory/textures/MASK 01.PNG" id="2_7kdbd"]
|
||||
@@ -6,42 +6,65 @@
|
||||
[ext_resource type="FontFile" uid="uid://bohbd123672ea" path="res://src/ui/fonts/FT88-Italic.ttf" id="4_vcxwm"]
|
||||
[ext_resource type="LabelSettings" uid="uid://bl5xpqyq8vjtv" path="res://src/ui/inventory_menu/InventoryLabelSettings.tres" id="5_a7hko"]
|
||||
|
||||
[sub_resource type="StyleBoxEmpty" id="StyleBoxEmpty_lt1pw"]
|
||||
|
||||
[sub_resource type="LabelSettings" id="LabelSettings_lgjx0"]
|
||||
font = ExtResource("4_vcxwm")
|
||||
font_size = 30
|
||||
font_color = Color(0, 0.682353, 0.937255, 1)
|
||||
|
||||
[node name="ItemSlot" type="HBoxContainer"]
|
||||
[node name="ItemSlot" type="Button"]
|
||||
custom_minimum_size = Vector2(100, 60)
|
||||
offset_right = 1748.0
|
||||
offset_bottom = 85.0
|
||||
anchors_preset = -1
|
||||
anchor_right = 0.885
|
||||
anchor_bottom = 0.093
|
||||
offset_right = 0.799927
|
||||
offset_bottom = -0.440002
|
||||
theme_override_styles/focus = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/disabled_mirrored = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/disabled = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/hover_pressed_mirrored = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/hover_pressed = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/hover_mirrored = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/hover = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/pressed_mirrored = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/pressed = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/normal_mirrored = SubResource("StyleBoxEmpty_lt1pw")
|
||||
theme_override_styles/normal = SubResource("StyleBoxEmpty_lt1pw")
|
||||
flat = true
|
||||
alignment = 0
|
||||
script = ExtResource("1_yttxt")
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="."]
|
||||
[node name="HBox" type="HBoxContainer" parent="."]
|
||||
custom_minimum_size = Vector2(100, 60)
|
||||
layout_mode = 0
|
||||
offset_right = 1700.0
|
||||
offset_bottom = 100.0
|
||||
|
||||
[node name="ReferenceRect" type="ReferenceRect" parent="HBox"]
|
||||
custom_minimum_size = Vector2(100, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemTexture" type="TextureRect" parent="."]
|
||||
[node name="ItemTexture" type="TextureRect" parent="HBox"]
|
||||
unique_name_in_owner = true
|
||||
layout_mode = 2
|
||||
texture = ExtResource("2_7kdbd")
|
||||
expand_mode = 2
|
||||
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="."]
|
||||
[node name="ReferenceRect2" type="ReferenceRect" parent="HBox"]
|
||||
custom_minimum_size = Vector2(40, 0)
|
||||
layout_mode = 2
|
||||
|
||||
[node name="ItemName" type="Label" parent="."]
|
||||
[node name="ItemName" type="Label" parent="HBox"]
|
||||
unique_name_in_owner = true
|
||||
custom_minimum_size = Vector2(550, 50)
|
||||
layout_mode = 2
|
||||
text = "Mask of the Goddess of Destruction"
|
||||
label_settings = SubResource("LabelSettings_lgjx0")
|
||||
vertical_alignment = 1
|
||||
autowrap_mode = 2
|
||||
script = ExtResource("3_xlgl0")
|
||||
|
||||
[node name="ItemCount" type="Label" parent="."]
|
||||
[node name="ItemCount" type="Label" parent="HBox"]
|
||||
unique_name_in_owner = true
|
||||
visible = false
|
||||
layout_mode = 2
|
||||
|
||||
@@ -1,10 +1,8 @@
|
||||
using Chickensoft.AutoInject;
|
||||
using Chickensoft.Introspection;
|
||||
using Godot;
|
||||
using System;
|
||||
using System.Collections.Immutable;
|
||||
using System.Linq;
|
||||
using Zennysoft.Game.Implementation;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
|
||||
Reference in New Issue
Block a user