Working on fixing crafted items

This commit is contained in:
dingo
2026-01-17 15:39:00 -05:00
parent 6edd6ae6df
commit 1b0c1c64a5
3 changed files with 252 additions and 71 deletions
+66 -14
View File
@@ -16,11 +16,54 @@ public static class DungeonCharacterStats
public static float GetMoveSpeed(DungeonCharacter c) => Math.Min(MaxSpeed, BaseSpeed + (c.Dexterity * DexSpeedModifier));
public static float GetAttackSpeed(DungeonCharacter c) => 1.0f + (c.Dexterity * 0.02f);
public static float GetRegenRate(DungeonCharacter c) => 1.0f + (c.Endurance * 0.1f);
/// <summary>
/// Calculate combat stats including equipment bonuses
/// </summary>
public static DungeonCharacterCombatStats GetCombatStats(DungeonCharacter c, List<DungeonItemDefinition>? equippedItems = null)
//public static DungeonCharacterCombatStats GetCombatStats(DungeonCharacter c, List<DungeonItemDefinition>? equippedItems = null)
//{
// var stats = new DungeonCharacterCombatStats
// {
// Strength = c.Strength,
// Intelligence = c.Intelligence,
// Wisdom = c.Wisdom,
// Endurance = c.Endurance,
// Dexterity = c.Dexterity
// };
// if (equippedItems != null)
// {
// foreach (var item in equippedItems)
// {
// stats.Strength += item.BonusStrength;
// stats.Intelligence += item.BonusIntelligence;
// stats.Wisdom += item.BonusWisdom;
// stats.Endurance += item.BonusEndurance;
// stats.Dexterity += item.BonusDexterity;
// stats.BonusHealth += item.BonusHealth;
// stats.BonusMana += item.BonusMana;
// stats.Armor += item.Armor;
// }
// }
// stats.MaxHealth = 50 + (stats.Endurance * 10) + stats.BonusHealth;
// stats.MaxMana = 20 + (stats.Wisdom * 8) + stats.BonusMana;
// stats.MaxStamina = 50 + (stats.Endurance * 5);
// stats.MoveSpeed = Math.Min(MaxSpeed, BaseSpeed + (stats.Dexterity * DexSpeedModifier));
// stats.AttackSpeed = 1.0f + (stats.Dexterity * 0.02f);
// stats.RegenRate = 1.0f + (stats.Endurance * 0.1f);
// stats.PhysicalDamageMultiplier = 1.0f + (stats.Strength * 0.05f);
// stats.SpellDamageMultiplier = 1.0f + (stats.Intelligence * 0.05f);
// stats.XpBonus = 1.0f + (stats.Wisdom * 0.02f);
// return stats;
//}
/// <summary>
/// Calculate combat stats including equipment bonuses (base + crafted)
/// </summary>
public static DungeonCharacterCombatStats GetCombatStats(
DungeonCharacter c,
List<DungeonCharacterItem>? equippedItems = null)
{
var stats = new DungeonCharacterCombatStats
{
@@ -30,22 +73,31 @@ public static class DungeonCharacterStats
Endurance = c.Endurance,
Dexterity = c.Dexterity
};
if (equippedItems != null)
{
foreach (var item in equippedItems)
foreach (var charItem in equippedItems)
{
stats.Strength += item.BonusStrength;
stats.Intelligence += item.BonusIntelligence;
stats.Wisdom += item.BonusWisdom;
stats.Endurance += item.BonusEndurance;
stats.Dexterity += item.BonusDexterity;
stats.BonusHealth += item.BonusHealth;
stats.BonusMana += item.BonusMana;
stats.Armor += item.Armor;
var item = charItem.ItemDefinition;
if (item == null) continue;
// Calculate total stats (base + crafted)
var (totalStr, totalInt, totalWis, totalEnd, totalDex, totalHealth, totalMana) =
charItem.GetTotalStats(item);
stats.Strength += totalStr;
stats.Intelligence += totalInt;
stats.Wisdom += totalWis;
stats.Endurance += totalEnd;
stats.Dexterity += totalDex;
stats.BonusHealth += totalHealth;
stats.BonusMana += totalMana;
// Add armor and damage
stats.Armor += item.Armor + (charItem.CraftedItem?.RolledBonusArmor ?? 0);
}
}
stats.MaxHealth = 50 + (stats.Endurance * 10) + stats.BonusHealth;
stats.MaxMana = 20 + (stats.Wisdom * 8) + stats.BonusMana;
stats.MaxStamina = 50 + (stats.Endurance * 5);
@@ -55,7 +107,7 @@ public static class DungeonCharacterStats
stats.PhysicalDamageMultiplier = 1.0f + (stats.Strength * 0.05f);
stats.SpellDamageMultiplier = 1.0f + (stats.Intelligence * 0.05f);
stats.XpBonus = 1.0f + (stats.Wisdom * 0.02f);
return stats;
}
}