View Single Post
  #1  
Old 12-21-2012, 09:39 AM
Hateborne
Hill Giant
 
Join Date: May 2010
Posts: 125
Question Divine Intervention Code Question

It seems that the Divine Intervention buff works if the limit value is set to Touch of the Divine. If it is set to limit value 0 (or what seems like a non-existent spell), it seems to fail infinitely. I checked a variety of working effects and then checked code.

There seems to be a bit of a copy-paste issue. From current trunk:
Code:
bool Mob::TryDivineSave() {

	/*
	How Touch of the Divine AA works:
	-Gives chance to avoid death when client is killed.
	-Chance is determined by the AA value. (base1)
	-Spell can be triggered from divine save (base2) in this case a Heal
	Note: Heal value does not and should not increase from more levels of this AA.
	-If chance is met, a heal is done and a divine aura like effect 'Touch of the Divine'
	is applied to the client. Determintal spell effects are removed.
	*/
	sint16 SuccessChance = aabonuses.DivineSaveChance[0] + itembonuses.DivineSaveChance[0] + spellbonuses.DivineSaveChance[0];

	if (SuccessChance)
	{
		if (MakeRandomInt(0, 100) <= SuccessChance)
		{
			int32 HealAmt = 0;
			BuffFadeByEffect(SE_DivineSave);
			//Touch of the Divine=4789, an Invulnerability/HoT/Purify effect hard coded to trigger if spell effect is defined from base2.
			if (aabonuses.DivineSaveChance[1] || itembonuses.DivineSaveChance[1] || spellbonuses.DivineSaveChance[1]) {

				SetHP(1);

				if (aabonuses.DivineSaveChance[1])
					SpellOnTarget(aabonuses.DivineSaveChance[1], this);

				if (itembonuses.DivineSaveChance[1])
					SpellOnTarget(aabonuses.DivineSaveChance[1], this);

				if (spellbonuses.DivineSaveChance[1])
					SpellOnTarget(aabonuses.DivineSaveChance[1], this);

				SpellOnTarget(4789, this);
				SendHPUpdate();
				return true;
			}
		}
	}
	return false;
}

I'm guessing those should be set to match the check (i.e. itembonuses = SpellOnTarget(itembonuses.Div...)). This would allow it to proc other effects in addition to the hard coded value. The only immediate problem that I saw were the ability to proc from all checks, netting up to 4 casts of the Touch of the Divine. I do not know how to approach this in the way that is consistent with the EQEMU practices. Example adjustments below.


Code:
bool Mob::TryDivineSave() {

	/*
	How Touch of the Divine AA works:
	-Gives chance to avoid death when client is killed.
	-Chance is determined by the AA value. (base1)
	-Spell can be triggered from divine save (base2) in this case a Heal
	Note: Heal value does not and should not increase from more levels of this AA.
	-If chance is met, a heal is done and a divine aura like effect 'Touch of the Divine'
	is applied to the client. Determintal spell effects are removed.
	*/
	sint16 SuccessChance = aabonuses.DivineSaveChance[0] + itembonuses.DivineSaveChance[0] + spellbonuses.DivineSaveChance[0];

	if (SuccessChance)
	{
		if (MakeRandomInt(0, 100) <= SuccessChance)
		{
			int32 HealAmt = 0;
			BuffFadeByEffect(SE_DivineSave);
			//Touch of the Divine=4789, an Invulnerability/HoT/Purify effect hard coded to trigger if spell effect is defined from base2.
			if (aabonuses.DivineSaveChance[1] || itembonuses.DivineSaveChance[1] || spellbonuses.DivineSaveChance[1]) {

				SetHP(1);

				if (aabonuses.DivineSaveChance[1])
					SpellOnTarget(aabonuses.DivineSaveChance[1], this);

				if (itembonuses.DivineSaveChance[1])
					SpellOnTarget(itembonuses.DivineSaveChance[1], this);

				if (spellbonuses.DivineSaveChance[1])
					SpellOnTarget(spellbonuses.DivineSaveChance[1], this);

				SpellOnTarget(4789, this);
				SendHPUpdate();
				return true;
			}
		}
	}
	return false;
}

To actually lock out other effects, is there some specific way that this should be handled or adjusted? I could see that ability to trigger 4 effects max might be...interesting.


-Hate
Reply With Quote