From 0fd206c53725d720af71f1fce2385541c2d01e44 Mon Sep 17 00:00:00 2001 From: Ovahlord Date: Sun, 17 Jun 2018 13:45:05 +0200 Subject: [PATCH] Core/Spells: do not reduce runic power gain when affected by cost modifiers --- src/server/game/Entities/Player/Player.cpp | 8 ++++---- src/server/game/Spells/Spell.cpp | 21 +++++++++++++++------ 2 files changed, 19 insertions(+), 10 deletions(-) diff --git a/src/server/game/Entities/Player/Player.cpp b/src/server/game/Entities/Player/Player.cpp index b09caf73ea6..eb18ef6bff8 100644 --- a/src/server/game/Entities/Player/Player.cpp +++ b/src/server/game/Entities/Player/Player.cpp @@ -25631,7 +25631,7 @@ void Player::ConvertRune(uint8 index, RuneType newType) WorldPacket data(SMSG_CONVERT_RUNE, 2); data << uint8(index); data << uint8(newType); - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::ResyncRunes(uint8 count) @@ -25643,14 +25643,14 @@ void Player::ResyncRunes(uint8 count) data << uint8(GetCurrentRune(i)); // rune type data << uint8(255 - (GetRuneCooldown(i) * 51)); // passed cooldown time (0-255) } - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } void Player::AddRunePower(uint8 mask) { WorldPacket data(SMSG_ADD_RUNE_POWER, 4); data << uint32(mask); // mask (0x00-0x3F probably) - GetSession()->SendPacket(&data); + SendDirectMessage(&data); } static RuneType runeSlotTypes[MAX_RUNES] = @@ -25679,7 +25679,7 @@ void Player::InitRunes() SetBaseRune(i, runeSlotTypes[i]); // init base types SetCurrentRune(i, runeSlotTypes[i]); // init current types SetRuneCooldown(i, 0); // reset cooldowns - SetRuneConvertAura(i, NULL, SPELL_AURA_NONE, NULL); + SetRuneConvertAura(i, nullptr, SPELL_AURA_NONE, nullptr); m_runes->SetRuneState(i); } diff --git a/src/server/game/Spells/Spell.cpp b/src/server/game/Spells/Spell.cpp index 8fcc9183001..6969a707c8f 100644 --- a/src/server/game/Spells/Spell.cpp +++ b/src/server/game/Spells/Spell.cpp @@ -4803,12 +4803,14 @@ void Spell::TakeRunePower(bool didHit) player->ClearLastUsedRuneMask(); int32 runeCost[NUM_RUNE_TYPES]; // blood, frost, unholy, death + int32 runicPowerGain = runeCostData->runePowerGain * sWorld->getRate(RATE_POWER_RUNICPOWER_INCOME); + // Apply rune cost modifiers for (uint32 i = 0; i < RUNE_DEATH; ++i) { runeCost[i] = runeCostData->RuneCost[i]; if (Player* modOwner = m_caster->GetSpellModOwner()) - modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], this); + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runeCost[i], const_cast(this)); } // Let's say we use a skill that requires a Frost rune. This is the order: @@ -4856,24 +4858,31 @@ void Spell::TakeRunePower(bool didHit) // you can gain some runic power when use runes if (didHit) - if (int32 rp = int32(runeCostData->runePowerGain * sWorld->getRate(RATE_POWER_RUNICPOWER_INCOME))) + { + if (runicPowerGain) { Unit::AuraEffectList const& bonusPct = m_caster->GetAuraEffectsByType(SPELL_AURA_MOD_RUNE_REGEN_SPEED); - for (Unit::AuraEffectList::const_iterator i = bonusPct.begin(); i != bonusPct.end(); ++i) + for (auto i = bonusPct.begin(); i != bonusPct.end(); ++i) { // Improved Frost Presence if ((*i)->GetId() == 63621) { // Apply bonus when in Unholy or Blood Presence if (player->HasAura(48265) || player->HasAura(48263)) - AddPct(rp, (*i)->GetAmount()); + AddPct(runicPowerGain, (*i)->GetAmount()); continue; } else - AddPct(rp, (*i)->GetAmount()); + AddPct(runicPowerGain, (*i)->GetAmount()); } - player->ModifyPower(POWER_RUNIC_POWER, rp); + + // Apply runic power gain modifiers + if (Player* modOwner = m_caster->GetSpellModOwner()) + modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_COST, runicPowerGain, const_cast(this)); + + player->ModifyPower(POWER_RUNIC_POWER, std::max(0, runicPowerGain)); } + } } void Spell::TakeReagents()