Break item on floor change whether its equipped or not
This commit is contained in:
@@ -421,25 +421,14 @@ public partial class Game : Node3D, IGame
|
|||||||
.Handle((in GameState.Output.LoadNextFloor _) =>
|
.Handle((in GameState.Output.LoadNextFloor _) =>
|
||||||
{
|
{
|
||||||
EmitSignal(SignalName.OnLoadLevelRequest);
|
EmitSignal(SignalName.OnLoadLevelRequest);
|
||||||
|
var breakableItems = _player.Inventory.Items.Where(x => x.ItemTag == ItemTag.BreaksOnFloorExit).ToList();
|
||||||
|
foreach (IEquipableItem breakableItem in breakableItems)
|
||||||
|
{
|
||||||
|
if (_player.EquipmentComponent.IsItemEquipped(breakableItem))
|
||||||
|
_player.Unequip(breakableItem);
|
||||||
|
_player.Inventory.Remove(breakableItem);
|
||||||
|
}
|
||||||
Task.Run(() => Save());
|
Task.Run(() => Save());
|
||||||
if (_player.EquipmentComponent.EquippedWeapon.Value.ItemTag == ItemTag.BreaksOnFloorExit)
|
|
||||||
{
|
|
||||||
var itemToDestroy = _player.EquipmentComponent.EquippedWeapon.Value;
|
|
||||||
_player.Unequip(itemToDestroy);
|
|
||||||
_player.Inventory.Remove(itemToDestroy);
|
|
||||||
}
|
|
||||||
if (_player.EquipmentComponent.EquippedArmor.Value.ItemTag == ItemTag.BreaksOnFloorExit)
|
|
||||||
{
|
|
||||||
var itemToDestroy = _player.EquipmentComponent.EquippedArmor.Value;
|
|
||||||
_player.Unequip(itemToDestroy);
|
|
||||||
_player.Inventory.Remove(itemToDestroy);
|
|
||||||
}
|
|
||||||
if (_player.EquipmentComponent.EquippedAccessory.Value.ItemTag == ItemTag.BreaksOnFloorExit)
|
|
||||||
{
|
|
||||||
var itemToDestroy = _player.EquipmentComponent.EquippedAccessory.Value;
|
|
||||||
_player.Unequip(itemToDestroy);
|
|
||||||
_player.Inventory.Remove(itemToDestroy);
|
|
||||||
}
|
|
||||||
LoadNextLevel.FadeOut();
|
LoadNextLevel.FadeOut();
|
||||||
})
|
})
|
||||||
.Handle((in GameState.Output.ReturnToOverworld _) =>
|
.Handle((in GameState.Output.ReturnToOverworld _) =>
|
||||||
|
|||||||
@@ -76,10 +76,13 @@ public partial class Stele : Node3D
|
|||||||
}
|
}
|
||||||
|
|
||||||
public async Task EndDialogue()
|
public async Task EndDialogue()
|
||||||
|
{
|
||||||
|
if (!_game.NpcData.SteleDiscovered.Contains(ID))
|
||||||
{
|
{
|
||||||
await _game.IncrementSteleCount(ID);
|
await _game.IncrementSteleCount(ID);
|
||||||
AnimationPlayer.Play("fade_in");
|
AnimationPlayer.Play("fade_in");
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public override int GetHashCode() => GetPath().GetHashCode();
|
public override int GetHashCode() => GetPath().GetHashCode();
|
||||||
|
|
||||||
|
|||||||
@@ -53,9 +53,9 @@ public partial class ItemSlot : Control, IItemSlot
|
|||||||
if (item is IStackable stackable)
|
if (item is IStackable stackable)
|
||||||
SetItemCount(stackable.Count.Value);
|
SetItemCount(stackable.Count.Value);
|
||||||
else if (item is IWeapon weapon)
|
else if (item is IWeapon weapon)
|
||||||
SetEquipmentStat($"ATK {weapon.BonusAttack:D2}");
|
SetEquipmentStat(item.ItemTag == ItemTag.MysteryItem ? "ATK ??" : $"ATK {weapon.BonusAttack:D2}");
|
||||||
else if (item is IArmor armor)
|
else if (item is IArmor armor)
|
||||||
SetEquipmentStat($"DEF {armor.BonusDefense:D2}");
|
SetEquipmentStat(item.ItemTag == ItemTag.MysteryItem ? "DEF ??" : $"DEF {armor.BonusDefense:D2}");
|
||||||
|
|
||||||
if (item is IEquipableItem equipableItem)
|
if (item is IEquipableItem equipableItem)
|
||||||
{
|
{
|
||||||
|
|||||||
Reference in New Issue
Block a user