Item holy and all element implementation, still need to work out some of the math for it

Fix bonus defense for weapons
This commit is contained in:
2026-02-05 10:48:24 -08:00
parent 8a99771491
commit 8ea881edb3
18 changed files with 88 additions and 28 deletions

View File

@@ -12,7 +12,6 @@ namespace Zennysoft.Ma.Adapter
calculatedDamage = CalculateDefenseResistance(calculatedDamage, defense);
if (!damage.IgnoreElementalResistance)
calculatedDamage = CalculateElementalResistance(calculatedDamage, elementalResistanceSet.ElementalResistance[damage.ElementType]);
return Mathf.Max(1, calculatedDamage);
}

View File

@@ -7,5 +7,7 @@ public enum ElementType
Telluric,
Hydric,
Igneous,
Ferrum
Ferrum,
Holy,
All
}

View File

@@ -7,9 +7,9 @@ namespace Zennysoft.Ma.Adapter.Entity
[Save("elemental_resist_set")]
public Dictionary<ElementType, double> ElementalResistance { get; }
public static ElementalResistanceSet None => new ElementalResistanceSet(0, 0, 0, 0, 0);
public static ElementalResistanceSet None => new ElementalResistanceSet(0, 0, 0, 0, 0, 0);
public ElementalResistanceSet(double aeolicResistance, double hydricResistance, double igneousResistance, double ferrumResistance, double telluricResistance)
public ElementalResistanceSet(double aeolicResistance, double hydricResistance, double igneousResistance, double ferrumResistance, double telluricResistance, double holyResistance)
{
ElementalResistance = new Dictionary<ElementType, double>
{
@@ -19,6 +19,8 @@ namespace Zennysoft.Ma.Adapter.Entity
{ ElementType.Igneous, igneousResistance },
{ ElementType.Ferrum, ferrumResistance },
{ ElementType.Telluric, telluricResistance },
{ ElementType.Holy, holyResistance },
{ ElementType.All, aeolicResistance + hydricResistance + igneousResistance + ferrumResistance + telluricResistance + holyResistance },
};
}
@@ -29,7 +31,8 @@ namespace Zennysoft.Ma.Adapter.Entity
left.ElementalResistance[ElementType.Hydric] + right.ElementalResistance[ElementType.Hydric],
left.ElementalResistance[ElementType.Igneous] + right.ElementalResistance[ElementType.Igneous],
left.ElementalResistance[ElementType.Ferrum] + right.ElementalResistance[ElementType.Ferrum],
left.ElementalResistance[ElementType.Telluric] + right.ElementalResistance[ElementType.Telluric]);
left.ElementalResistance[ElementType.Telluric] + right.ElementalResistance[ElementType.Telluric],
left.ElementalResistance[ElementType.Holy] + right.ElementalResistance[ElementType.Holy]);
}
}
}

View File

@@ -18,5 +18,5 @@ public abstract partial class EquipableItem : InventoryItem
[Save("bonus_luck_stats")]
public virtual int BonusLuck { get; }
[Save("bonus_elemental_resist_stats")]
public virtual ElementalResistanceSet ElementalResistance { get; } = new ElementalResistanceSet(0, 0, 0, 0, 0);
public virtual ElementalResistanceSet ElementalResistance { get; } = new ElementalResistanceSet(0, 0, 0, 0, 0, 0);
}

View File

@@ -8,4 +8,5 @@ public enum WeaponTag
IgnoreDefense,
Knockback,
InverseHPAttackPower,
RustChanceSelfAndEnemy
}