View Single Post
  #7  
Old 10-04-2013, 04:51 PM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Default

TriggerOnCast
Code:
void Mob::TriggerOnCast(uint32 focus_spell, uint32 spell_id, bool aa_trigger)
{
	if(!IsValidSpell(focus_spell) || !IsValidSpell(spell_id))
		return;

	uint32 trigger_spell_id = 0;

	if (aa_trigger && IsClient()){
		//focus_spell = aaid
		trigger_spell_id = CastToClient()->CalcAAFocus(focusTriggerOnCast, focus_spell, spell_id);

		if(IsValidSpell(trigger_spell_id) && GetTarget())
			SpellFinished(trigger_spell_id, GetTarget(), 10, 0, -1, spells[trigger_spell_id].ResistDiff);
	}

	else{
		trigger_spell_id = CalcFocusEffect(focusTriggerOnCast, focus_spell, spell_id);

		if(IsValidSpell(trigger_spell_id) && GetTarget()){
			SpellFinished(trigger_spell_id, GetTarget(), 10, 0, -1, spells[trigger_spell_id].ResistDiff);
			CheckHitsRemaining(0, false,false, 0, focus_spell);
		}
	}
}

Twincast
Code:
void Mob::TryTwincast(Mob *caster, Mob *target, uint32 spell_id)
{
	if(!IsValidSpell(spell_id))
		return;

	if(IsClient())
	{
		int32 focus = CastToClient()->GetFocusEffect(focusTwincast, spell_id);

		if (focus > 0)
		{
			if(MakeRandomInt(0, 100) <= focus)
			{
				Message(MT_Spells,"You twincast %s!",spells[spell_id].name);
				SpellFinished(spell_id, target, 10, 0, -1, spells[spell_id].ResistDiff);
			}
		}
	}

	//Retains function for non clients
	else if (spellbonuses.FocusEffects[focusTwincast] || itembonuses.FocusEffects[focusTwincast])
	{
		int buff_count = GetMaxTotalSlots();
		for(int i = 0; i < buff_count; i++)
		{
			if(IsEffectInSpell(buffs[i].spellid, SE_Twincast))
			{
				int32 focus = CalcFocusEffect(focusTwincast, buffs[i].spellid, spell_id);
				if(focus > 0)
				{
					if(MakeRandomInt(0, 100) <= focus)
					{
						SpellFinished(spell_id, target, 10, 0, -1, spells[spell_id].ResistDiff);
					}
				}
			}
		}
	}
}
SympatheticProc
Code:
void Mob::TrySympatheticProc(Mob *target, uint32 spell_id)
{
	if(target == nullptr || !IsValidSpell(spell_id))
		return;

	int focus_spell = CastToClient()->GetSympatheticFocusEffect(focusSympatheticProc,spell_id);

		if(IsValidSpell(focus_spell)){
			int focus_trigger = spells[focus_spell].base2[0];
			// For beneficial spells, if the triggered spell is also beneficial then proc it on the target
			// if the triggered spell is detrimental, then it will trigger on the caster(ie cursed items)
			if(IsBeneficialSpell(spell_id))
			{
				if(IsBeneficialSpell(focus_trigger))
					SpellFinished(focus_trigger, target);

				else
					SpellFinished(focus_trigger, this);
			}
			// For detrimental spells, if the triggered spell is beneficial, then it will land on the caster
			// if the triggered spell is also detrimental, then it will land on the target
			else
			{
				if(IsBeneficialSpell(focus_trigger))
					SpellFinished(focus_trigger, this);

				else
					SpellFinished(focus_trigger, target, 10, 0, -1, spells[focus_trigger].ResistDiff);
			}
			CheckHitsRemaining(0, false,false, 0, focus_spell);
		}
}



Ok, does that look usable? I am following code the best I can using dinky browser windows in-between calls at work.


-Hate

Last edited by Hateborne; 10-04-2013 at 05:19 PM.. Reason: copy/paste error
Reply With Quote