wish we could edit longer... there was a slight error in that you could trigger bark at the moon type spells twice if lucky... this should fix that while allowing spells like annhilate to proc twice.
Code:
void Mob::TrySpellTrigger(Mob *target, uint32 spell_id)
{
if(target == NULL || !IsValidSpell(spell_id))
{
return;
}
int spell_trig = 100;
int triggered = 0;
for(int i = 0; i < EFFECT_COUNT; i++)
{
if (spells[spell_id].effectid[i] == SE_SpellTrigger)
{
// If we have failed a check already, the spell_trig variable will be set lower than 100, so if they add to 100 then the second chance is guaranteed.
if (spells[spell_id].base[i] + spell_trig == 100)
{
SpellOnTarget(spells[spell_id].base2[i], target);
break;
}
// if we have successfully cast a spell that has 2 chances that add to 100% then stop here
else if (triggered == 1 && spells[spell_id].base[i] + spell_trig == 100) {
break;
}
if(MakeRandomInt(0, 100) <= spells[spell_id].base[i])
{
SpellOnTarget(spells[spell_id].base2[i], target);
int triggered = 1;
}
else {
spell_trig = spells[spell_id].base[i];
}
}
}
}