Core/Spells: implement SPELLVALUE_CRIT_CHANCE

Port From (https://github.com/TrinityCore/TrinityCore/commit/13be704cb4619ef585ae0043580e2534f62e64aa)
This commit is contained in:
hondacrx
2021-06-23 22:09:38 -04:00
parent 9e23ca4b04
commit 1b87be93be
3 changed files with 10 additions and 2 deletions
+1
View File
@@ -395,6 +395,7 @@ namespace Framework.Constants
RadiusMod,
MaxTargets,
AuraStack,
CritChance,
DurationPct
}
+8 -1
View File
@@ -6872,7 +6872,9 @@ namespace Game.Spells
}
}
float critChance = m_caster.SpellCritChanceDone(this, null, m_spellSchoolMask, m_attackType);
float critChance = m_spellValue.CriticalChance;
if (critChance == 0.0f)
critChance = m_caster.SpellCritChanceDone(this, null, m_spellSchoolMask, m_attackType);
targetInfo.crit = RandomHelper.randChance(unit.SpellCritChanceTaken(m_caster, this, null, m_spellSchoolMask, critChance, m_attackType));
}
@@ -6965,6 +6967,9 @@ namespace Game.Spells
case SpellValueMod.AuraStack:
m_spellValue.AuraStackAmount = value;
break;
case SpellValueMod.CritChance:
m_spellValue.CriticalChance = value / 100.0f; // @todo ugly /100 remove when basepoints are double
break;
case SpellValueMod.DurationPct:
m_spellValue.DurationMul = (float)value / 100.0f;
break;
@@ -7771,6 +7776,7 @@ namespace Game.Spells
MaxAffectedTargets = proto.MaxAffectedTargets;
RadiusMod = 1.0f;
AuraStackAmount = 1;
CriticalChance = 0.0f;
DurationMul = 1;
}
@@ -7780,6 +7786,7 @@ namespace Game.Spells
public float RadiusMod;
public int AuraStackAmount;
public float DurationMul;
public float CriticalChance;
}
// Spell modifier (used for modify other spells)
+1 -1
View File
@@ -2860,7 +2860,7 @@ namespace Game.Entities
spellInfo._InitializeExplicitTargetMask();
}
// addition for binary spells, ommit spells triggering other spells
// addition for binary spells, omit spells triggering other spells
foreach (var spellInfo in mSpellInfoMap.Values)
{
if (!spellInfo.HasAttribute(SpellCustomAttributes.BinarySpell))