Core/Spells: do not reduce runic power gain when affected by cost modifiers

This commit is contained in:
Ovahlord
2018-06-17 13:45:05 +02:00
parent ea26094b66
commit 0fd206c537
2 changed files with 19 additions and 10 deletions

View File

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

View File

@@ -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<Spell*>(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<Spell*>(this));
player->ModifyPower(POWER_RUNIC_POWER, std::max(0, runicPowerGain));
}
}
}
void Spell::TakeReagents()