View Single Post
  #1  
Old 07-06-2010, 08:58 PM
Caryatis
Dragon
 
Join Date: May 2009
Location: Milky Way
Posts: 539
Default COMMITTED: SE_SpellTrigger(formerly SE_LifeshardChance)

Spell Effect 340, incorrectly labeled LifeshardChance from when lucy reported all the effects that way is actually very similiar to TriggerOnCast however they don't rely on a buff.

Mana Reiterate(upgraded flare line) has a 100% chance to proc Mana Reiterate Strike on cast, and then Mana Reiterate Strike has a 10% chance to proc Mana Re-Reiterate strike which in turn has 10% chance to proc Mana Re-Re-Reiterate Strike, etc. (incidently KLS this is why I believe the TriggerOnCast code should be 100, not 1000, as Mana Flares always proc, they have a proc limit but they proc every time... ie Pyromancy vs Mana Flare ... Pyromancy is 5% chance to proc(base1) vs 100 for mana flare.)

Anyway, the code...

edit.. changed the mob.cpp function to align with these 2 spells... Bark at the Moon which has a 95% chance to proc 1 pet however if that fails then you get the 5% proc of 4 pets. Previous code didnt allow that, you could miss both checks. However a spell like Annihilate the Unnatural has 2 chances to proc but you arent guaranteed the second proc if the first fails. New code should address this.

spdat.h - line 478 - alter this

Code:
#define SE_LifeshardChance     		340	//chance to create lifeshard
to

Code:
#define SE_SpellTrigger     		340	//chance to trigger spell
spell_effects.cpp - Line 2814 - add this
Code:
case SE_SpellTrigger:
spells.cpp - line 3048 - add this
Code:
TrySpellTrigger(spelltar, spell_id);
mob.h - line 781 - add this
Code:
void TrySpellTrigger(Mob *target, uint32 spell_id);
mob.cpp - line 3041 - add this
Code:
void Mob::TrySpellTrigger(Mob *target, uint32 spell_id)
{
	if(target == NULL || !IsValidSpell(spell_id))
	{
		return;
	}
	int spell_trig = 100;
	for(int i = 0; i < EFFECT_COUNT; i++)
	{
		if (spells[spell_id].effectid[i] == SE_SpellTrigger)
		{
			if (spells[spell_id].base[i] + spell_trig == 100) 
			{
				spell_trig = 1;
			}
			else {
				spell_trig = 100;
			}
			if(MakeRandomInt(0, spell_trig) <= spells[spell_id].base[i]) 
			{
				SpellOnTarget(spells[spell_id].base2[i], target);
			}
			else {
				spell_trig = spells[spell_id].base[i];
			}
		}
	}
}
Reply With Quote