Page 1 of 1
Physical Mitigation Bonus
Posted: Thu Mar 23, 2017 7:43 am
by Gangrenous
So armor is working well, the bonus is accurate enough I am happy with it. It is now handled in code. Spells are not though. How so I get the stat for ...
Code: Select all
AddSpellBonus(Target, 200, PhysMitBonus) -- vs Physical Damage
Searching the source I see no reference for PhysMitBonus? In the calculations for mitigation, spell mitigation needs to be handled in.
Re: Physical Mitigation Bonus
Posted: Thu Mar 23, 2017 7:58 am
by Gangrenous
So it looks like we are using the ITEM_STAT_VS_PHYSICAL bonus, if I am right?
Re: Physical Mitigation Bonus
Posted: Thu Mar 23, 2017 2:48 pm
by Jabantiz
PhysMitBonus should be the value to change the stat by, so it is likely a lua variable. 200 would be the stat id which is ITEM_STAT_VS_PHYSICAL.
Re: Physical Mitigation Bonus
Posted: Fri Mar 24, 2017 6:13 am
by Gangrenous
Okay, pretty close here Jabantiz. I have the spell mitigation applying, it shows after the next server tic. It is calculated into the mitigation bonus and even makes a nice difference in combat. My issue is that something like Magi Shield is not removing the mitigation bonus when it is canceled. If I change a piece of armor, it does change it.
Re: Physical Mitigation Bonus
Posted: Fri Mar 24, 2017 6:38 am
by Gangrenous
Okay, figured it out.
Jabantiz is this in any way bad coding?
Code: Select all
void Entity::RemoveSpellBonus(LuaSpell* spell){
MutexList<BonusValues*>::iterator itr = bonus_list.begin();
while(itr.Next()){
if(itr.value->luaspell == spell)
bonus_list.Remove(itr.value, true);
}
CalculateBonuses();
}
The way I see it, we need to calculate bonuses after the bonus is removed, there is no call other than maybe when you change items.
Re: Physical Mitigation Bonus
Posted: Fri Mar 24, 2017 3:47 pm
by Jabantiz
Do you have the remove function in the spell script and is that removing the spell bonus?
Re: Physical Mitigation Bonus
Posted: Fri Mar 24, 2017 4:39 pm
by Gangrenous
Yes, but it was not removing it until I added CalculateBonuses() to the source.