Additional refactoring and fixing of equipment data
Add attack data to enemy attacks (might need to rework a little bit for primary/secondary attacks)
This commit is contained in:
@@ -5,7 +5,6 @@ using Godot;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Zennysoft.Game.Abstractions;
|
||||
using Zennysoft.Game.Implementation;
|
||||
using Zennysoft.Ma.Adapter;
|
||||
|
||||
namespace Zennysoft.Game.Ma;
|
||||
@@ -47,11 +46,11 @@ public partial class Inventory : Node, IInventory
|
||||
public void Remove(InventoryItem inventoryItem) => Items.Remove(inventoryItem);
|
||||
|
||||
|
||||
public void Sort()
|
||||
public void Sort(EquipableItem currentWeapon, EquipableItem currentArmor, EquipableItem currentAccessory)
|
||||
{
|
||||
var equippedWeapon = Items.OfType<Weapon>().Where(x => x.IsEquipped);
|
||||
var equippedArmor = Items.OfType<Armor>().Where(x => x.IsEquipped);
|
||||
var equippedAccessory = Items.OfType<Accessory>().Where(x => x.IsEquipped);
|
||||
var equippedWeapon = Items.OfType<Weapon>().Where(x => x == currentWeapon);
|
||||
var equippedArmor = Items.OfType<Armor>().Where(x => x == currentArmor);
|
||||
var equippedAccessory = Items.OfType<Accessory>().Where(x => x == currentAccessory);
|
||||
var equippedItems = new List<InventoryItem>();
|
||||
equippedItems.AddRange(equippedWeapon);
|
||||
equippedItems.AddRange(equippedArmor);
|
||||
@@ -80,10 +79,10 @@ public partial class Inventory : Node, IInventory
|
||||
{
|
||||
public int Compare(Weapon x, Weapon y)
|
||||
{
|
||||
if (x.Damage == y.Damage)
|
||||
if (x.BonusAttack == y.BonusAttack)
|
||||
return x.ItemName.CompareTo(y.ItemName);
|
||||
|
||||
return x.Damage < y.Damage ? 1 : -1;
|
||||
return x.BonusAttack < y.BonusAttack ? 1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -91,10 +90,10 @@ public partial class Inventory : Node, IInventory
|
||||
{
|
||||
public int Compare(Armor x, Armor y)
|
||||
{
|
||||
if (x.Defense == y.Defense)
|
||||
if (x.BonusDefense == y.BonusDefense)
|
||||
return x.ItemName.CompareTo(y.ItemName);
|
||||
|
||||
return x.Defense < y.Defense ? 1 : -1;
|
||||
return x.BonusDefense < y.BonusDefense ? 1 : -1;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user