Core/Spells: Fix talent Improved Unholy Presence

Closes #411
This commit is contained in:
DrTenma
2011-07-15 04:58:14 +07:00
committed by tobmaps
parent 5f565709cf
commit ebc1baf684
4 changed files with 27 additions and 7 deletions
+1
View File
@@ -1874,6 +1874,7 @@ class Player : public Unit, public GridObject<Player>
void ApplyManaRegenBonus(int32 amount, bool apply);
void ApplyHealthRegenBonus(int32 amount, bool apply);
void UpdateManaRegen();
void UpdateRuneRegen(RuneType rune);
const uint64& GetLootGUID() const { return m_lootGuid; }
void SetLootGUID(const uint64 &guid) { m_lootGuid = guid; }
@@ -781,6 +781,27 @@ void Player::UpdateManaRegen()
SetStatFloatValue(UNIT_FIELD_POWER_REGEN_FLAT_MODIFIER, power_regen_mp5 + power_regen);
}
void Player::UpdateRuneRegen(RuneType rune)
{
if (rune >= NUM_RUNE_TYPES)
return;
uint32 cooldown = 0;
for (uint32 i = 0; i < MAX_RUNES; ++i)
if (GetBaseRune(i) == rune)
{
cooldown = GetRuneBaseCooldown(i);
break;
}
if (cooldown <= 0)
return;
float regen = float(1 * IN_MILLISECONDS) / float(cooldown);
SetFloatValue(PLAYER_RUNE_REGEN_1 + uint8(rune), regen);
}
void Player::_ApplyAllStatBonuses()
{
SetCanModifyStats(false);
@@ -3897,6 +3897,8 @@ void AuraEffect::HandleModPowerRegen(AuraApplication const* aurApp, uint8 mode,
// Update manaregen value
if (GetMiscValue() == POWER_MANA)
target->ToPlayer()->UpdateManaRegen();
else if (GetMiscValue() == POWER_RUNE)
target->ToPlayer()->UpdateRuneRegen(RuneType(GetMiscValueB()));
// other powers are not immediate effects - implemented in Player::Regenerate, Creature::Regenerate
}
+3 -7
View File
@@ -1645,7 +1645,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
}
uint32 presence=GetId();
uint32 presence = GetId();
if (apply)
{
// Blood Presence bonus
@@ -1653,7 +1653,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
target->CastSpell(target, 63611, true);
else if (bloodPresenceAura)
{
int32 basePoints1=bloodPresenceAura->GetAmount();
int32 basePoints1 = bloodPresenceAura->GetAmount();
target->CastCustomSpell(target, 63611, NULL, &basePoints1, NULL, true, 0, bloodPresenceAura);
}
// Frost Presence bonus
@@ -1672,13 +1672,12 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
// Not listed as any effect, only base points set
int32 basePoints0 = SpellMgr::CalculateSpellEffectAmount(unholyPresenceAura->GetSpellProto(), 1);
target->CastCustomSpell(target, 63622, &basePoints0 , &basePoints0, &basePoints0, true, 0, unholyPresenceAura);
target->CastCustomSpell(target, 65095, &basePoints0 , NULL, NULL, true, 0, unholyPresenceAura);
}
target->CastSpell(target, 49772, true);
}
else if (unholyPresenceAura)
{
int32 basePoints0=unholyPresenceAura->GetAmount();
int32 basePoints0 = unholyPresenceAura->GetAmount();
target->CastCustomSpell(target, 49772, &basePoints0, NULL, NULL, true, 0, unholyPresenceAura);
}
}
@@ -1692,10 +1691,7 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
if (presence == 48265 || unholyPresenceAura)
{
if (presence == 48265 && unholyPresenceAura)
{
target->RemoveAurasDueToSpell(63622);
target->RemoveAurasDueToSpell(65095);
}
target->RemoveAurasDueToSpell(49772);
}
}