mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-02-10 03:59:05 +01:00
Core/Spells: implement SPELLVALUE_CRIT_CHANCE
(cherry picked from commit 546a605bd0)
This commit is contained in:
@@ -503,6 +503,7 @@ SpellValue::SpellValue(SpellInfo const* proto, Unit const* caster)
|
||||
MaxAffectedTargets = proto->MaxAffectedTargets;
|
||||
RadiusMod = 1.0f;
|
||||
AuraStackAmount = 1;
|
||||
CriticalChance = 0.0f;
|
||||
DurationMul = 1;
|
||||
}
|
||||
|
||||
@@ -7485,7 +7486,9 @@ void Spell::DoAllEffectOnLaunchTarget(TargetInfo& targetInfo, float* multiplier)
|
||||
}
|
||||
}
|
||||
|
||||
float critChance = m_caster->SpellCritChanceDone(this, nullptr, m_spellSchoolMask, m_attackType);
|
||||
float critChance = m_spellValue->CriticalChance;
|
||||
if (!critChance)
|
||||
critChance = m_caster->SpellCritChanceDone(this, nullptr, m_spellSchoolMask, m_attackType);
|
||||
targetInfo.crit = roll_chance_f(unit->SpellCritChanceTaken(m_caster, this, nullptr, m_spellSchoolMask, critChance, m_attackType));
|
||||
}
|
||||
|
||||
@@ -7578,6 +7581,9 @@ void Spell::SetSpellValue(SpellValueMod mod, int32 value)
|
||||
case SPELLVALUE_AURA_STACK:
|
||||
m_spellValue->AuraStackAmount = uint8(value);
|
||||
break;
|
||||
case SPELLVALUE_CRIT_CHANCE:
|
||||
m_spellValue->CriticalChance = value / 100.0f; // @todo ugly /100 remove when basepoints are double
|
||||
break;
|
||||
case SPELLVALUE_DURATION_PCT:
|
||||
m_spellValue->DurationMul = float(value) / 100.0f;
|
||||
break;
|
||||
|
||||
@@ -306,6 +306,7 @@ struct SpellValue
|
||||
float RadiusMod;
|
||||
int32 AuraStackAmount;
|
||||
float DurationMul;
|
||||
float CriticalChance;
|
||||
};
|
||||
|
||||
enum SpellState
|
||||
|
||||
@@ -212,6 +212,7 @@ enum SpellValueMod : uint8
|
||||
SPELLVALUE_RADIUS_MOD,
|
||||
SPELLVALUE_MAX_TARGETS,
|
||||
SPELLVALUE_AURA_STACK,
|
||||
SPELLVALUE_CRIT_CHANCE,
|
||||
SPELLVALUE_DURATION_PCT
|
||||
};
|
||||
|
||||
|
||||
@@ -3172,7 +3172,7 @@ void SpellMgr::LoadSpellInfoCustomAttributes()
|
||||
spellInfoMutable->_InitializeExplicitTargetMask();
|
||||
}
|
||||
|
||||
// addition for binary spells, ommit spells triggering other spells
|
||||
// addition for binary spells, omit spells triggering other spells
|
||||
for (SpellInfo const& spellInfo : mSpellInfoMap)
|
||||
{
|
||||
SpellInfo* spellInfoMutable = const_cast<SpellInfo*>(&spellInfo);
|
||||
|
||||
Reference in New Issue
Block a user