Merge pull request #14797 from czw/3.3.5

Core/Spells: Fix DK Death rune selection
This commit is contained in:
mik1893
2015-07-02 14:23:33 +02:00

View File

@@ -4443,8 +4443,11 @@ void Spell::TakeRunePower(bool didHit)
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this);
}
// Let's say we use a skill that requires a Frost rune. This is the order:
// - Frost rune
// - Death rune, originally a Frost rune
// - Death rune, any kind
runeCost[RUNE_DEATH] = 0; // calculated later
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType rune = player->GetCurrentRune(i);
@@ -4456,8 +4459,32 @@ void Spell::TakeRunePower(bool didHit)
}
}
// Find a Death rune where the base rune matches the one we need
runeCost[RUNE_DEATH] = runeCost[RUNE_BLOOD] + runeCost[RUNE_UNHOLY] + runeCost[RUNE_FROST];
if (runeCost[RUNE_DEATH] > 0)
{
for (uint32 i = 0; i < MAX_RUNES; ++i)
{
RuneType rune = player->GetCurrentRune(i);
RuneType baseRune = player->GetBaseRune(i);
if (!player->GetRuneCooldown(i) && rune == RUNE_DEATH && runeCost[baseRune] > 0)
{
player->SetRuneCooldown(i, didHit ? player->GetRuneBaseCooldown(i) : uint32(RUNE_MISS_COOLDOWN), true);
player->SetLastUsedRune(rune);
runeCost[baseRune]--;
runeCost[rune]--;
// keep Death Rune type if missed
if (didHit)
player->RestoreBaseRune(i);
if (runeCost[RUNE_DEATH] == 0)
break;
}
}
}
// Grab any Death rune
if (runeCost[RUNE_DEATH] > 0)
{
for (uint32 i = 0; i < MAX_RUNES; ++i)