Skip to content

Commit

Permalink
Fixing Stacking Buffs, added more buff types (#151)
Browse files Browse the repository at this point in the history
Added a few more buff types that mobs and pets weren't checking for.

LivingHasEffect() was checking for both matching spell effect group and spell type, which is incorrect.  Offensive procs should stack, as should pulsed damage adds and damage buffs.  Spell effect group exists specifically to allow those combinations, so it's odd to not use it exclusively.
  • Loading branch information
tegstewart authored and Graveen committed Jul 8, 2018
1 parent 97e8399 commit 5706b8f
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 12 deletions.
16 changes: 10 additions & 6 deletions GameServer/ai/brain/ControlledNpcBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -594,11 +594,15 @@ protected override bool CheckDefensiveSpells(Spell spell)
case "SUPERIORCOURAGEBUFF":
case "TOHITBUFF":
case "WEAPONSKILLBUFF":
{
case "DAMAGEADD":
case "OFFENSIVEPROC":
case "DEFENSIVEPROC":
case "DAMAGESHIELD":
{
//Buff self
if (!LivingHasEffect(Body, spell))
{
Body.TargetObject = Body;
Body.TargetObject = Body;
break;
}

Expand All @@ -609,7 +613,7 @@ protected override bool CheckDefensiveSpells(Spell spell)
//Buff owner
if (!LivingHasEffect(owner, spell))
{
Body.TargetObject = owner;
Body.TargetObject = owner;
break;
}

Expand All @@ -622,7 +626,7 @@ protected override bool CheckDefensiveSpells(Spell spell)
continue;
if (!LivingHasEffect(icb.Body, spell))
{
Body.TargetObject = icb.Body;
Body.TargetObject = icb.Body;
break;
}
}
Expand All @@ -635,7 +639,7 @@ protected override bool CheckDefensiveSpells(Spell spell)
{
if (!LivingHasEffect(player, spell))
{
Body.TargetObject = player;
Body.TargetObject = player;
break;
}

Expand All @@ -645,7 +649,7 @@ protected override bool CheckDefensiveSpells(Spell spell)
{
if (!LivingHasEffect(p, spell) && Body.GetDistanceTo(p) <= spell.Range)
{
Body.TargetObject = p;
Body.TargetObject = p;
break;
}
}
Expand Down
11 changes: 5 additions & 6 deletions GameServer/ai/brain/StandardMobBrain.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1214,6 +1214,10 @@ protected virtual bool CheckDefensiveSpells(Spell spell)
case "SUPERIORCOURAGEBUFF":
case "TOHITBUFF":
case "WEAPONSKILLBUFF":
case "DAMAGEADD":
case "OFFENSIVEPROC":
case "DEFENSIVEPROC":
case "DAMAGESHIELD":
{
// Buff self, if not in melee, but not each and every mob
// at the same time, because it looks silly.
Expand All @@ -1224,7 +1228,7 @@ protected virtual bool CheckDefensiveSpells(Spell spell)
}
if (Body.ControlledBrain != null && Body.ControlledBrain.Body != null && Util.Chance(40) && Body.GetDistanceTo(Body.ControlledBrain.Body) <= spell.Range && !LivingHasEffect(Body.ControlledBrain.Body, spell) && spell.Target.ToLower() != "self")
{
Body.TargetObject = Body.ControlledBrain.Body;
Body.TargetObject = Body.ControlledBrain.Body;
break;
}
break;
Expand Down Expand Up @@ -1480,11 +1484,6 @@ protected bool LivingHasEffect(GameLiving target, Spell spell)
//if the effect effectgroup is the same as the checking spells effectgroup then these are considered the same
if (speffect.Spell.EffectGroup == spell.EffectGroup)
return true;

//otherwise continue unless the SpellType is the same
if (speffect.Spell.SpellType == spell.SpellType)
return true;

}
}

Expand Down

0 comments on commit 5706b8f

Please sign in to comment.