Hello, I'm trying to implement Power Strike skill like in Warband. When spawning an agent, I'd like to increase its weapon damage depending on how much power strike the character has. I noticed that in an EquipmentElement you can specify an ItemModifier which has method ModifyDamage which looks like what I'm looking for.
So I tried creating an ItemModifier but the only public constructor doesn't allow to set the _damage field. So here I used reflection:
After setting a breakpoint on the ModifyDamage method, it is correctly called with the expected values when spawning the agent but when hitting some bots the damage stay the same. Is the ItemModifier not completely implemented or did I miss something?
Also, the ItemModifier API is very restrictive, how to:
C#:
public EquipmentElement(ItemObject item, ItemModifier itemModifier = null) { /* ... */ }
public int ModifyDamage(int baseDamage) => baseDamage + _damage;
C#:
var itemModifier = new ItemModifier();
typeof(ItemModifier)
.GetField("_damage", BindingFlags.Instance | BindingFlags.NonPublic)
.SetValue(itemModifier, 500); // supposed to add 500 to the weapon damage
Also, the ItemModifier API is very restrictive, how to:
- Increase swing damage but not thrust damage?
- Increase Pila (polearm that can be thrown) melee damage but not ranged damage?