[7099] Implement some item/enchants mods from 303:

ITEM_MOD_ATTACK_POWER
 ITEM_MOD_RANGED_ATTACK_POWER
 ITEM_MOD_FERAL_ATTACK_POWER
 ITEM_MOD_SPELL_HEALING_DONE
 ITEM_MOD_SPELL_DAMAGE_DONE
 ITEM_MOD_MANA_REGENERATION
 ITEM_MOD_SPELL_POWER

Signed-off-by: DiSlord <dislord@nomail.com>
This commit is contained in:
DiSlord 2009-01-18 01:33:06 +03:00
parent cfde5746cb
commit 4add3d2128
5 changed files with 104 additions and 5 deletions

View file

@ -423,6 +423,11 @@ Player::Player (WorldSession *session): Unit(), m_achievementMgr(this)
for (int i = 0; i < MAX_COMBAT_RATING; i++) for (int i = 0; i < MAX_COMBAT_RATING; i++)
m_baseRatingValue[i] = 0; m_baseRatingValue[i] = 0;
m_baseSpellDamage = 0;
m_baseSpellHealing = 0;
m_baseFeralAP = 0;
m_baseManaRegen = 0;
// Honor System // Honor System
m_lastHonorUpdateTime = time(NULL); m_lastHonorUpdateTime = time(NULL);
@ -6615,9 +6620,31 @@ void Player::_ApplyItemBonuses(ItemPrototype const *proto, uint8 slot, bool appl
case ITEM_MOD_EXPERTISE_RATING: case ITEM_MOD_EXPERTISE_RATING:
ApplyRatingMod(CR_EXPERTISE, int32(val), apply); ApplyRatingMod(CR_EXPERTISE, int32(val), apply);
break; break;
case ITEM_MOD_ATTACK_POWER:
HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(val), apply);
break;
case ITEM_MOD_RANGED_ATTACK_POWER:
HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(val), apply);
break;
case ITEM_MOD_FERAL_ATTACK_POWER:
ApplyFeralAPBonus(int32(val), apply);
break;
case ITEM_MOD_SPELL_HEALING_DONE:
ApplySpellHealingBonus(int32(val), apply);
break;
case ITEM_MOD_SPELL_DAMAGE_DONE:
ApplySpellDamageBonus(int32(val), apply);
break;
case ITEM_MOD_MANA_REGENERATION:
ApplyManaRegenBonus(int32(val), apply);
break;
case ITEM_MOD_ARMOR_PENETRATION_RATING: case ITEM_MOD_ARMOR_PENETRATION_RATING:
ApplyRatingMod(CR_ARMOR_PENETRATION, int32(val), apply); ApplyRatingMod(CR_ARMOR_PENETRATION, int32(val), apply);
break; break;
case ITEM_MOD_SPELL_POWER:
ApplySpellHealingBonus(int32(val), apply);
ApplySpellDamageBonus(int32(val), apply);
break;
} }
} }
@ -11938,10 +11965,39 @@ void Player::ApplyEnchantment(Item *item,EnchantmentSlot slot,bool apply, bool a
((Player*)this)->ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply); ((Player*)this)->ApplyRatingMod(CR_EXPERTISE, enchant_amount, apply);
sLog.outDebug("+ %u EXPERTISE", enchant_amount); sLog.outDebug("+ %u EXPERTISE", enchant_amount);
break; break;
case ITEM_MOD_ATTACK_POWER:
HandleStatModifier(UNIT_MOD_ATTACK_POWER, TOTAL_VALUE, float(enchant_amount), apply);
sLog.outDebug("+ %u ATTACK_POWER", enchant_amount);
break;
case ITEM_MOD_RANGED_ATTACK_POWER:
HandleStatModifier(UNIT_MOD_ATTACK_POWER_RANGED, TOTAL_VALUE, float(enchant_amount), apply);
sLog.outDebug("+ %u RANGED_ATTACK_POWER", enchant_amount);
break;
case ITEM_MOD_FERAL_ATTACK_POWER:
((Player*)this)->ApplyFeralAPBonus(enchant_amount, apply);
sLog.outDebug("+ %u FERAL_ATTACK_POWER", enchant_amount);
break;
case ITEM_MOD_SPELL_HEALING_DONE:
((Player*)this)->ApplySpellHealingBonus(enchant_amount, apply);
sLog.outDebug("+ %u SPELL_HEALING_DONE", enchant_amount);
break;
case ITEM_MOD_SPELL_DAMAGE_DONE:
((Player*)this)->ApplySpellDamageBonus(enchant_amount, apply);
sLog.outDebug("+ %u SPELL_DAMAGE_DONE", enchant_amount);
break;
case ITEM_MOD_MANA_REGENERATION:
((Player*)this)->ApplyManaRegenBonus(enchant_amount, apply);
sLog.outDebug("+ %u MANA_REGENERATION", enchant_amount);
break;
case ITEM_MOD_ARMOR_PENETRATION_RATING: case ITEM_MOD_ARMOR_PENETRATION_RATING:
((Player*)this)->ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply); ((Player*)this)->ApplyRatingMod(CR_ARMOR_PENETRATION, enchant_amount, apply);
sLog.outDebug("+ %u ARMOR PENETRATION", enchant_amount); sLog.outDebug("+ %u ARMOR PENETRATION", enchant_amount);
break; break;
case ITEM_MOD_SPELL_POWER:
((Player*)this)->ApplySpellHealingBonus(enchant_amount, apply);
((Player*)this)->ApplySpellDamageBonus(enchant_amount, apply);
sLog.outDebug("+ %u SPELL_POWER", enchant_amount);
break;
default: default:
break; break;
} }

View file

@ -1644,9 +1644,12 @@ class MANGOS_DLL_SPEC Player : public Unit
void UpdateArmor(); void UpdateArmor();
void UpdateMaxHealth(); void UpdateMaxHealth();
void UpdateMaxPower(Powers power); void UpdateMaxPower(Powers power);
void ApplyFeralAPBonus(int32 amount, bool apply);
void UpdateAttackPowerAndDamage(bool ranged = false); void UpdateAttackPowerAndDamage(bool ranged = false);
void UpdateShieldBlockValue(); void UpdateShieldBlockValue();
void UpdateDamagePhysical(WeaponAttackType attType); void UpdateDamagePhysical(WeaponAttackType attType);
void ApplySpellDamageBonus(int32 amount, bool apply);
void ApplySpellHealingBonus(int32 amount, bool apply);
void UpdateSpellDamageAndHealingBonus(); void UpdateSpellDamageAndHealingBonus();
void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, float& min_damage, float& max_damage); void CalculateMinMaxDamage(WeaponAttackType attType, bool normalized, float& min_damage, float& max_damage);
@ -1664,6 +1667,8 @@ class MANGOS_DLL_SPEC Player : public Unit
uint32 GetRangedCritDamageReduction(uint32 damage) const; uint32 GetRangedCritDamageReduction(uint32 damage) const;
uint32 GetSpellCritDamageReduction(uint32 damage) const; uint32 GetSpellCritDamageReduction(uint32 damage) const;
uint32 GetDotDamageReduction(uint32 damage) const; uint32 GetDotDamageReduction(uint32 damage) const;
uint32 GetBaseSpellDamageBonus() { return m_baseSpellDamage;}
uint32 GetBaseSpellHealingBonus() { return m_baseSpellHealing;}
float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const; float GetExpertiseDodgeOrParryReduction(WeaponAttackType attType) const;
void UpdateBlockPercentage(); void UpdateBlockPercentage();
@ -1678,6 +1683,7 @@ class MANGOS_DLL_SPEC Player : public Unit
void UpdateAllSpellCritChances(); void UpdateAllSpellCritChances();
void UpdateSpellCritChance(uint32 school); void UpdateSpellCritChance(uint32 school);
void UpdateExpertise(WeaponAttackType attType); void UpdateExpertise(WeaponAttackType attType);
void ApplyManaRegenBonus(int32 amount, bool apply);
void UpdateManaRegen(); void UpdateManaRegen();
const uint64& GetLootGUID() const { return m_lootGuid; } const uint64& GetLootGUID() const { return m_lootGuid; }
@ -2315,6 +2321,10 @@ class MANGOS_DLL_SPEC Player : public Unit
float m_auraBaseMod[BASEMOD_END][MOD_END]; float m_auraBaseMod[BASEMOD_END][MOD_END];
int16 m_baseRatingValue[MAX_COMBAT_RATING]; int16 m_baseRatingValue[MAX_COMBAT_RATING];
uint16 m_baseSpellDamage;
uint16 m_baseSpellHealing;
uint16 m_baseFeralAP;
uint16 m_baseManaRegen;
SpellModList m_spellMods[MAX_SPELLMOD]; SpellModList m_spellMods[MAX_SPELLMOD];
int32 m_SpellModRemoveCount; int32 m_SpellModRemoveCount;

View file

@ -91,6 +91,21 @@ bool Player::UpdateStats(Stats stat)
return true; return true;
} }
void Player::ApplySpellDamageBonus(int32 amount, bool apply)
{
m_baseSpellDamage+=apply?amount:-amount;
// For speed just update for client
ApplyModUInt32Value(PLAYER_FIELD_MOD_HEALING_DONE_POS, amount, apply);
}
void Player::ApplySpellHealingBonus(int32 amount, bool apply)
{
m_baseSpellHealing+=apply?amount:-amount;
// For speed just update for client
for(int i = SPELL_SCHOOL_HOLY; i < MAX_SPELL_SCHOOL; i++)
ApplyModUInt32Value(PLAYER_FIELD_MOD_DAMAGE_DONE_POS+i, amount, apply);;
}
void Player::UpdateSpellDamageAndHealingBonus() void Player::UpdateSpellDamageAndHealingBonus()
{ {
// Magic damage modifiers implemented in Unit::SpellDamageBonus // Magic damage modifiers implemented in Unit::SpellDamageBonus
@ -221,6 +236,12 @@ void Player::UpdateMaxPower(Powers power)
SetMaxPower(power, uint32(value)); SetMaxPower(power, uint32(value));
} }
void Player::ApplyFeralAPBonus(int32 amount, bool apply)
{
m_baseFeralAP+= apply ? amount:-amount;
UpdateAttackPowerAndDamage();
}
void Player::UpdateAttackPowerAndDamage(bool ranged ) void Player::UpdateAttackPowerAndDamage(bool ranged )
{ {
float val2 = 0.0f; float val2 = 0.0f;
@ -295,12 +316,12 @@ void Player::UpdateAttackPowerAndDamage(bool ranged )
switch(m_form) switch(m_form)
{ {
case FORM_CAT: case FORM_CAT:
val2 = getLevel()*(mLevelMult+2.0f) + GetStat(STAT_STRENGTH)*2.0f + GetStat(STAT_AGILITY) - 20.0f; break; val2 = getLevel()*(mLevelMult+2.0f) + GetStat(STAT_STRENGTH)*2.0f + GetStat(STAT_AGILITY) - 20.0f + m_baseFeralAP; break;
case FORM_BEAR: case FORM_BEAR:
case FORM_DIREBEAR: case FORM_DIREBEAR:
val2 = getLevel()*(mLevelMult+3.0f) + GetStat(STAT_STRENGTH)*2.0f - 20.0f; break; val2 = getLevel()*(mLevelMult+3.0f) + GetStat(STAT_STRENGTH)*2.0f - 20.0f + m_baseFeralAP; break;
case FORM_MOONKIN: case FORM_MOONKIN:
val2 = getLevel()*(mLevelMult+1.5f) + GetStat(STAT_STRENGTH)*2.0f - 20.0f; break; val2 = getLevel()*(mLevelMult+1.5f) + GetStat(STAT_STRENGTH)*2.0f - 20.0f + m_baseFeralAP; break;
default: default:
val2 = GetStat(STAT_STRENGTH)*2.0f - 20.0f; break; val2 = GetStat(STAT_STRENGTH)*2.0f - 20.0f; break;
} }
@ -625,6 +646,12 @@ void Player::UpdateExpertise(WeaponAttackType attack)
} }
} }
void Player::ApplyManaRegenBonus(int32 amount, bool apply)
{
m_baseManaRegen+= apply ? amount : -amount;
UpdateManaRegen();
}
void Player::UpdateManaRegen() void Player::UpdateManaRegen()
{ {
float Intellect = GetStat(STAT_INTELLECT); float Intellect = GetStat(STAT_INTELLECT);
@ -634,7 +661,7 @@ void Player::UpdateManaRegen()
power_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA); power_regen *= GetTotalAuraMultiplierByMiscValue(SPELL_AURA_MOD_POWER_REGEN_PERCENT, POWER_MANA);
// Mana regen from SPELL_AURA_MOD_POWER_REGEN aura // Mana regen from SPELL_AURA_MOD_POWER_REGEN aura
float power_regen_mp5 = GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) / 5.0f; float power_regen_mp5 = (GetTotalAuraModifierByMiscValue(SPELL_AURA_MOD_POWER_REGEN, POWER_MANA) + m_baseManaRegen) / 5.0f;
// Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura // Get bonus from SPELL_AURA_MOD_MANA_REGEN_FROM_STAT aura
AuraList const& regenAura = GetAurasByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT); AuraList const& regenAura = GetAurasByType(SPELL_AURA_MOD_MANA_REGEN_FROM_STAT);

View file

@ -7702,6 +7702,9 @@ int32 Unit::SpellBaseDamageBonus(SpellSchoolMask schoolMask)
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
{ {
// Base value
DoneAdvertisedBenefit +=((Player*)this)->GetBaseSpellDamageBonus();
// Damage bonus from stats // Damage bonus from stats
AuraList const& mDamageDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT); AuraList const& mDamageDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_DAMAGE_OF_STAT_PERCENT);
for(AuraList::const_iterator i = mDamageDoneOfStatPercent.begin();i != mDamageDoneOfStatPercent.end(); ++i) for(AuraList::const_iterator i = mDamageDoneOfStatPercent.begin();i != mDamageDoneOfStatPercent.end(); ++i)
@ -8067,6 +8070,9 @@ int32 Unit::SpellBaseHealingBonus(SpellSchoolMask schoolMask)
// Healing bonus of spirit, intellect and strength // Healing bonus of spirit, intellect and strength
if (GetTypeId() == TYPEID_PLAYER) if (GetTypeId() == TYPEID_PLAYER)
{ {
// Base value
AdvertisedBenefit +=((Player*)this)->GetBaseSpellHealingBonus();
// Healing bonus from stats // Healing bonus from stats
AuraList const& mHealingDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT); AuraList const& mHealingDoneOfStatPercent = GetAurasByType(SPELL_AURA_MOD_SPELL_HEALING_OF_STAT_PERCENT);
for(AuraList::const_iterator i = mHealingDoneOfStatPercent.begin();i != mHealingDoneOfStatPercent.end(); ++i) for(AuraList::const_iterator i = mHealingDoneOfStatPercent.begin();i != mHealingDoneOfStatPercent.end(); ++i)

View file

@ -1,4 +1,4 @@
#ifndef __REVISION_NR_H__ #ifndef __REVISION_NR_H__
#define __REVISION_NR_H__ #define __REVISION_NR_H__
#define REVISION_NR "7098" #define REVISION_NR "7099"
#endif // __REVISION_NR_H__ #endif // __REVISION_NR_H__