Log in

View Full Version : Twincast, Sympathetic procs, and TriggerOnCast spells 100% resisting


Hateborne
10-04-2013, 09:59 AM
Ladies/Gents,

I play on EZ Server and we've noticed something strange following a semi-recent source update. All twincast, sympathetic procs, and triggeroncast effects are resisting 100% of the time.

I only did a brief swept of forums, but are we alone in experiencing this or are others noticing similar things? These effects were 100% working before.


-Hate

sorvani
10-04-2013, 10:45 AM
Resists in general have been reported as odd more than once recently on PEQ. Specific example was Cyno in Qvic. no one changed his stats but he was suddenly resisting everything that was not unresistable.

NatedogEZ
10-04-2013, 11:00 AM
Found the issue...




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

if (spells[spell_id].mana <= 10)
{
return;
}

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

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

else
{
uint32 buff_count = GetMaxTotalSlots();
for(int i = 0; i < buff_count; i++)
{
if(IsEffectInSpell(buffs[i].spellid, SE_Twincast))
{
sint32 focus = CalcFocusEffect(focusTwincast, buffs[i].spellid, spell_id);
if(focus > 0)
{
if(MakeRandomInt(0, 100) <= focus)
{
SpellFinished(spell_id, target);
}
}
}
}
}
}





Sending a spell finished for twincast should send the resist adjust because resist adjust is never calculated inside

mob::spellfinished


Does the same thing inside "TrySympatheticProc"


Unless it grabs the resist adjust somewhere else.. but I do not see it.. at all.

Hateborne
10-04-2013, 03:17 PM
One down, is Sympathetic and TriggerOnCast doing the same?

I'll be able to start digging through code tonight, but not before.


-Hate

Hateborne
10-04-2013, 03:36 PM
Hmm.. this could require some pretty significant revisions. Sadness.

I'm flipping through while I'm on hold now. It's looking dirty. Possibly allow an overloaded SpellFinished to handle this, but not sure of the cleanest way to do it.


-Hate

demonstar55
10-04-2013, 04:25 PM
Hmm.. this could require some pretty significant revisions. Sadness.

I'm flipping through while I'm on hold now. It's looking dirty. Possibly allow an overloaded SpellFinished to handle this, but not sure of the cleanest way to do it.


-Hate

Quickly looking through it, I would have to say no. Just need to have TryTwincast and the other to have resist stuff passed to it as well, so it can pass on the resist stuff to SpellFinished

Hateborne
10-04-2013, 04:51 PM
TriggerOnCast

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

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

void Mob::TrySympatheticProc(Mob *target, uint32 spell_id)
{
if(target == nullptr || !IsValidSpell(spell_id))
return;

int focus_spell = CastToClient()->GetSympatheticFocusEffect(focusSympatheticProc,spe ll_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

NatedogEZ
10-04-2013, 05:14 PM
Pretty sure there are other spots where this code would be needed as well... when I was looking earlier I remember seeing them... (TwinProc was one I think)

demonstar55
10-04-2013, 06:22 PM
Pretty sure there are other spots where this code would be needed as well... when I was looking earlier I remember seeing them... (TwinProc was one I think)

TwinProc is fine (SpellOnTarget is called with use_resist_adjust as false so it will get the Resist in the function)

Hateborne
11-06-2013, 09:50 PM
TwinProc is fine (SpellOnTarget is called with use_resist_adjust as false so it will get the Resist in the function)


I am casting an unresistable spell with 25% sympathetic proc spell with -1000 resist diff on a target with ~77 to all resists.

The unresistable spell is doing it's 1dmg (which I am using merely to test the Sympathetic Proc). The Sympathetic Proc'ed spell resists 9/10 casts. If it's not accepting the resistdiff, why is it sometimes landing? It if it is accepting resistdiff, why is there a resist chance at all? I would like to believe that -923 (-1000 + 77 = -923) resist should not be resistable.


-Hate

demonstar55
11-06-2013, 11:36 PM
Well Sympathic Proc is not TwinProc, so what does that have to do with TwinProc being fine?

Hateborne
11-07-2013, 02:42 AM
Well Sympathic Proc is not TwinProc, so what does that have to do with TwinProc being fine?

Oh! Apologies demonstar, I failed to finish my original point. That's what I get for trying to type it out at work. :-\

What I was getting at is how is it that TwinCast and SympatheticProc have nearly similar setups, but TwinCast seems to work while Sympathetic does not?

I've not yet had time to recompile in debug and set a breakpoint or two, but could you shed any light on it?


-Hate

demonstar55
11-07-2013, 03:35 AM
You are right about TryTwincast and TrySympatheticProc, twincast is handled completely differently. I'll try to look into these again and most likely push your changes, but my initial testing I found little evidence that they were getting resisted 100% of the time, it seemed about equal. :/

Hateborne
11-07-2013, 02:49 PM
You are right about TryTwincast and TrySympatheticProc, twincast is handled completely differently. I'll try to look into these again and most likely push your changes, but my initial testing I found little evidence that they were getting resisted 100% of the time, it seemed about equal. :/

Thank you! Let me know if I can help.

SpellTrigger (id 340) is functioning similarly with triggered spells with -1000 resistdiff spells failing to land on creatures with ~150 all resists.


-Hate

Kayen
11-07-2013, 06:13 PM
Wrote/Revised most of this code last summer.

I would have to agree adding the resist diff information to the SpellFinished will likely resolve this.

These spell effects are not common place on most servers so it is not that shocking its only been picked up on now.

Just a fun fact about 'TwicProc'. It is not an actual spell effect and was originally incorrectly given a spell effect ID. I left the code in place, but it isn't actually used (Correct spell effect replaced where TwicProc was). TwinProc effect which is an AA, is actually just TwinCast with a number of limiters.

Kayen
GM Storm Haven

Hateborne
11-09-2013, 07:56 PM
Wrote/Revised most of this code last summer.

I would have to agree adding the resist diff information to the SpellFinished will likely resolve this.

These spell effects are not common place on most servers so it is not that shocking its only been picked up on now.

Just a fun fact about 'TwicProc'. It is not an actual spell effect and was originally incorrectly given a spell effect ID. I left the code in place, but it isn't actually used (Correct spell effect replaced where TwicProc was). TwinProc effect which is an AA, is actually just TwinCast with a number of limiters.

Kayen
GM Storm Haven


Oh, glad to hear it. :D

I'll try to get some tests in over the next two days and submit a diff. Thank you to all in this thread.


-Hate