diff --git a/src/game/Player.cpp b/src/game/Player.cpp index e62fc0861..564298e0e 100644 --- a/src/game/Player.cpp +++ b/src/game/Player.cpp @@ -2173,18 +2173,21 @@ void Player::Regenerate(Powers power, uint32 diff) if (getClass() != CLASS_DEATH_KNIGHT) break; - for (uint32 rune = 0; rune < MAX_RUNES; ++rune) + for (uint8 rune = 0; rune < MAX_RUNES; rune += 2) { - if (uint16 cd = GetRuneCooldown(rune)) // if we have cooldown, reduce it... + uint32 cd_diff = diff; + uint8 runeToRegen = rune; + uint32 cd = GetRuneCooldown(rune); + uint32 secondRuneCd = GetRuneCooldown(rune + 1); + // Regenerate second rune of the same type only after first rune is off the cooldown + if (secondRuneCd && (cd > secondRuneCd || !cd)) { - uint32 cd_diff = diff; - AuraList const& ModPowerRegenPCTAuras = GetAurasByType(SPELL_AURA_MOD_POWER_REGEN_PERCENT); - for (AuraList::const_iterator i = ModPowerRegenPCTAuras.begin(); i != ModPowerRegenPCTAuras.end(); ++i) - if ((*i)->GetModifier()->m_miscvalue == int32(power) && (*i)->GetMiscBValue() == GetCurrentRune(rune)) - cd_diff = cd_diff * ((*i)->GetModifier()->m_amount + 100) / 100; - - SetRuneCooldown(rune, (cd < cd_diff) ? 0 : cd - cd_diff); + ++runeToRegen; + cd = secondRuneCd; } + + if (cd) + SetRuneCooldown(rune, (cd < cd_diff) ? 0 : cd - cd_diff); } break; } @@ -22072,7 +22075,7 @@ void Player::ResyncRunes() for (uint32 i = 0; i < MAX_RUNES; ++i) { data << uint8(GetCurrentRune(i)); // rune type - data << uint8(255 - ((GetRuneCooldown(i) / REGEN_TIME_FULL) * 51)); // passed cooldown time (0-255) + data << uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255) } GetSession()->SendPacket(&data); } diff --git a/src/game/Spell.cpp b/src/game/Spell.cpp index 6244d5da8..7f1071e2e 100644 --- a/src/game/Spell.cpp +++ b/src/game/Spell.cpp @@ -4724,80 +4724,61 @@ SpellCastResult Spell::CheckOrTakeRunePower(bool take) return SPELL_CAST_OK; SpellRuneCostEntry const* src = sSpellRuneCostStore.LookupEntry(m_spellInfo->runeCostID); - - if (!src) - return SPELL_CAST_OK; - - if (src->NoRuneCost() && (!take || src->NoRunicPowerGain())) + if (!src || (src->NoRuneCost() && (!take || src->NoRunicPowerGain()))) return SPELL_CAST_OK; if (take) m_runesState = plr->GetRunesState(); // store previous state - // at this moment for rune cost exist only no cost mods, and no percent mods - int32 runeCostMod = 10000; - if (Player* modOwner = plr->GetSpellModOwner()) - modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCostMod, this); + int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death - if (runeCostMod > 0) + // init cost data and apply mods + for (uint32 i = 0; i < RUNE_DEATH; ++i) { - int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death + runeCost[i] = src->RuneCost[i]; + if (Player* modOwner = plr->GetSpellModOwner()) + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this); + } + - // init cost data and apply mods - for (uint32 i = 0; i < RUNE_DEATH; ++i) - runeCost[i] = runeCostMod > 0 ? src->RuneCost[i] : 0; + runeCost[RUNE_DEATH] = 0; // calculated later - runeCost[RUNE_DEATH] = 0; // calculated later + // scan non-death runes (death rune not used explicitly in rune costs) + for (uint32 i = 0; i < MAX_RUNES; ++i) + { + RuneType rune = plr->GetCurrentRune(i); + if (!plr->GetRuneCooldown(i) && runeCost[rune] > 0) + { + plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec + --runeCost[rune]; + } + } - // scan non-death runes (death rune not used explicitly in rune costs) + // collect all not counted rune costs to death runes cost + for (uint32 i = 0; i < RUNE_DEATH; ++i) + if (runeCost[i] > 0) + runeCost[RUNE_DEATH] += runeCost[i]; + + // scan death runes + if (runeCost[RUNE_DEATH] > 0) + { for (uint32 i = 0; i < MAX_RUNES; ++i) { RuneType rune = plr->GetCurrentRune(i); - if (runeCost[rune] <= 0) - continue; - - // already used - if (plr->GetRuneCooldown(i) != 0) - continue; - - if (take) - plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec - - --runeCost[rune]; - } - - // collect all not counted rune costs to death runes cost - for (uint32 i = 0; i < RUNE_DEATH; ++i) - if (runeCost[i] > 0) - runeCost[RUNE_DEATH] += runeCost[i]; - - // scan death runes - if (runeCost[RUNE_DEATH] > 0) - { - for (uint32 i = 0; i < MAX_RUNES && runeCost[RUNE_DEATH]; ++i) + if (plr->GetRuneCooldown(i) && rune == RUNE_DEATH) { - RuneType rune = plr->GetCurrentRune(i); - if (rune != RUNE_DEATH) - continue; - - // already used - if (plr->GetRuneCooldown(i) != 0) - continue; - - if (take) - plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec - - --runeCost[rune]; + plr->SetRuneCooldown(i, RUNE_COOLDOWN); // 5*2=10 sec + runeCost[rune]--; if (take) plr->ConvertRune(i, plr->GetBaseRune(i)); } } - - if (!take && runeCost[RUNE_DEATH] > 0) - return SPELL_FAILED_NO_POWER; // not sure if result code is correct } + if (runeCost[RUNE_DEATH] == 0) + return SPELL_FAILED_NO_POWER; // not sure if result code is correct + if (take) { // you can gain some runic power when use runes diff --git a/src/shared/revision_nr.h b/src/shared/revision_nr.h index 6eecc4064..2dc5fc8f6 100644 --- a/src/shared/revision_nr.h +++ b/src/shared/revision_nr.h @@ -1,4 +1,4 @@ #ifndef __REVISION_NR_H__ #define __REVISION_NR_H__ - #define REVISION_NR "12751" + #define REVISION_NR "12752" #endif // __REVISION_NR_H__