Re: [MOD] Roleplay & Realism mod pack
Posted: Mon Mar 09, 2020 4:24 am
I think I may have found a bug in your code, or maybe it's intentional?
The Override formula for "ApplyConditionDamageThroughPhysicalHit" seems to not allow weapons to degrade from attacking an entity, it seems like armor is the only thing that takes condition damage the way this method is written.
RoleplayRealism.cs:
Whereas the "vanilla" formula is.
FormulaHelper.cs:
Which does not have an if-statement that is discriminating between armor and non-armor items. So is this an intentional design or just a mistake? If it is intentional, what other things in the code would make weapons take durability damage, like does bashing locked doors count as attacking an entity?
The Override formula for "ApplyConditionDamageThroughPhysicalHit" seems to not allow weapons to degrade from attacking an entity, it seems like armor is the only thing that takes condition damage the way this method is written.
RoleplayRealism.cs:
Code: Select all
private static bool ApplyConditionDamageThroughPhysicalHit(DaggerfallUnityItem item, DaggerfallEntity owner, int damage)
{
if (item.ItemGroup == ItemGroups.Armor)
{
int amount = item.IsShield ? damage : damage * 4;
item.LowerCondition(amount, owner);
if (owner == GameManager.Instance.PlayerEntity)
Debug.LogFormat("Damaged {0} by {1} from dmg {3}, cond={2}", item.ItemName, amount, item.currentCondition, damage);
return true;
}
return false;
}
FormulaHelper.cs:
Code: Select all
private static void ApplyConditionDamageThroughPhysicalHit(DaggerfallUnityItem item, DaggerfallEntity owner, int damage)
{
Func<DaggerfallUnityItem, DaggerfallEntity, int, bool> del;
if (TryGetOverride("ApplyConditionDamageThroughPhysicalHit", out del))
if (del(item, owner, damage))
return; // Only return if override returns true
int amount = (10 * damage + 50) / 100;
if ((amount == 0) && Dice100.SuccessRoll(20))
amount = 1;
item.LowerCondition(amount, owner);
}