diff options
author | Jens Bäckman <jens.backman@gmail.com> | 2015-05-29 12:11:54 +0200 |
---|---|---|
committer | Jens Bäckman <jens.backman@gmail.com> | 2015-05-29 12:11:54 +0200 |
commit | 50d435ff2899258a64c883a12060c29336276b7f (patch) | |
tree | 62222d2a0122aeef76ddc1f18cf6c703e531eb08 /src | |
parent | 62ebd002d990c24be989c33aa60719ed5a9ba761 (diff) |
Core/Spells: Fix DK Death rune selection
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/Spell.cpp | 29 |
1 files changed, 28 insertions, 1 deletions
diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 94bb90487bc..565f3fda8ac 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4439,8 +4439,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); @@ -4452,8 +4455,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) |