Core/Spells: implement SPELLVALUE_CRIT_CHANCE

(cherry picked from commit 546a605bd0)
This commit is contained in:
ariel-
2018-02-11 22:52:28 -03:00
committed by Shauren
parent 85e5509e91
commit 13be704cb4
4 changed files with 10 additions and 2 deletions

View File

@@ -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;

View File

@@ -306,6 +306,7 @@ struct SpellValue
float RadiusMod;
int32 AuraStackAmount;
float DurationMul;
float CriticalChance;
};
enum SpellState

View File

@@ -212,6 +212,7 @@ enum SpellValueMod : uint8
SPELLVALUE_RADIUS_MOD,
SPELLVALUE_MAX_TARGETS,
SPELLVALUE_AURA_STACK,
SPELLVALUE_CRIT_CHANCE,
SPELLVALUE_DURATION_PCT
};

View File

@@ -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);