Working on fixing crafted items
This commit is contained in:
@@ -18,6 +18,8 @@ public class DungeonCharacterItem
|
||||
public int Quantity { get; set; } = 1;
|
||||
public int SlotIndex { get; set; } // Inventory position (0-29), or -1 if equipped
|
||||
|
||||
public DungeonCraftedItem? CraftedItem { get; set; }
|
||||
|
||||
public bool IsEquipped { get; set; } = false;
|
||||
public DungeonEquipmentSlot? EquipSlot { get; set; }
|
||||
|
||||
@@ -28,4 +30,31 @@ public class DungeonCharacterItem
|
||||
|
||||
[ForeignKey(nameof(ItemDefinitionId))]
|
||||
public virtual DungeonItemDefinition? ItemDefinition { get; set; }
|
||||
|
||||
/// <summary>
|
||||
/// Gets total stats including base item definition stats + crafted bonuses
|
||||
/// </summary>
|
||||
public (int str, int intel, int wis, int end, int dex, int health, int mana) GetTotalStats(DungeonItemDefinition baseItem)
|
||||
{
|
||||
int totalStr = baseItem.BonusStrength;
|
||||
int totalInt = baseItem.BonusIntelligence;
|
||||
int totalWis = baseItem.BonusWisdom;
|
||||
int totalEnd = baseItem.BonusEndurance;
|
||||
int totalDex = baseItem.BonusDexterity;
|
||||
int totalHealth = baseItem.BonusHealth;
|
||||
int totalMana = baseItem.BonusMana;
|
||||
|
||||
if (CraftedItem != null)
|
||||
{
|
||||
totalStr += CraftedItem.RolledBonusStrength;
|
||||
totalInt += CraftedItem.RolledBonusIntelligence;
|
||||
totalWis += CraftedItem.RolledBonusWisdom;
|
||||
totalEnd += CraftedItem.RolledBonusEndurance;
|
||||
totalDex += CraftedItem.RolledBonusDexterity;
|
||||
totalHealth += CraftedItem.RolledBonusHealth;
|
||||
totalMana += CraftedItem.RolledBonusMana;
|
||||
}
|
||||
|
||||
return (totalStr, totalInt, totalWis, totalEnd, totalDex, totalHealth, totalMana);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user