Implement aura use in new version of racial trait 20550. Add unit stat mods for rune/runic powers.

Last change will also prevent corruption armor and holy resistence values.
This commit is contained in:
VladimirMangos 2008-12-04 05:53:02 +03:00
parent a2503162fc
commit e58df484a2
5 changed files with 31 additions and 20 deletions

View file

@ -332,7 +332,7 @@ pAuraHandler AuraHandler[TOTAL_AURAS]=
&Aura::HandleNULL, //279 &Aura::HandleNULL, //279
&Aura::HandleNULL, //280 ignore armor? &Aura::HandleNULL, //280 ignore armor?
&Aura::HandleNULL, //281 increase honor gain? &Aura::HandleNULL, //281 increase honor gain?
&Aura::HandleNULL, //282 &Aura::HandleAuraIncreaseBaseHealthPercent, //282 SPELL_AURA_INCREASE_BASE_HEALTH_PERCENT
&Aura::HandleNULL //283 SPD/heal from AP? &Aura::HandleNULL //283 SPD/heal from AP?
}; };
@ -4718,24 +4718,32 @@ void Aura::HandleAuraModIncreaseEnergy(bool apply, bool Real)
if(int32(powerType) != m_modifier.m_miscvalue) if(int32(powerType) != m_modifier.m_miscvalue)
return; return;
m_target->HandleStatModifier(UnitMods(UNIT_MOD_POWER_START + powerType), TOTAL_VALUE, float(m_modifier.m_amount), apply); UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
m_target->HandleStatModifier(unitMod, TOTAL_VALUE, float(m_modifier.m_amount), apply);
} }
void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool Real) void Aura::HandleAuraModIncreaseEnergyPercent(bool apply, bool /*Real*/)
{ {
Powers powerType = m_target->getPowerType(); Powers powerType = m_target->getPowerType();
if(int32(powerType) != m_modifier.m_miscvalue) if(int32(powerType) != m_modifier.m_miscvalue)
return; return;
m_target->HandleStatModifier(UnitMods(UNIT_MOD_POWER_START + powerType), TOTAL_PCT, float(m_modifier.m_amount), apply); UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + powerType);
m_target->HandleStatModifier(unitMod, TOTAL_PCT, float(m_modifier.m_amount), apply);
} }
void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool Real) void Aura::HandleAuraModIncreaseHealthPercent(bool apply, bool /*Real*/)
{ {
//m_target->ApplyMaxHealthPercentMod(m_modifier.m_amount,apply);
m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply); m_target->HandleStatModifier(UNIT_MOD_HEALTH, TOTAL_PCT, float(m_modifier.m_amount), apply);
} }
void Aura::HandleAuraIncreaseBaseHealthPercent(bool apply, bool /*Real*/)
{
m_target->HandleStatModifier(UNIT_MOD_HEALTH, BASE_PCT, float(m_modifier.m_amount), apply);
}
/********************************/ /********************************/
/*** FIGHT ***/ /*** FIGHT ***/
/********************************/ /********************************/

View file

@ -209,6 +209,7 @@ class MANGOS_DLL_SPEC Aura
void HandleManaShield(bool apply, bool Real); void HandleManaShield(bool apply, bool Real);
void HandleArenaPreparation(bool apply, bool Real); void HandleArenaPreparation(bool apply, bool Real);
void HandleAuraConvertRune(bool apply, bool Real); void HandleAuraConvertRune(bool apply, bool Real);
void HandleAuraIncreaseBaseHealthPercent(bool Apply, bool Real);
virtual ~Aura(); virtual ~Aura();

View file

@ -849,6 +849,7 @@ void Pet::UpdateMaxHealth()
void Pet::UpdateMaxPower(Powers power) void Pet::UpdateMaxPower(Powers power)
{ {
UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power); UnitMods unitMod = UnitMods(UNIT_MOD_POWER_START + power);
float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f; float addValue = (power == POWER_MANA) ? GetStat(STAT_INTELLECT) - GetCreateStat(STAT_INTELLECT) : 0.0f;
float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power); float value = GetModifierValue(unitMod, BASE_VALUE) + GetCreatePowers(power);

View file

@ -9514,7 +9514,9 @@ bool Unit::HandleStatModifier(UnitMods unitMod, UnitModifierType modifierType, f
case UNIT_MOD_RAGE: case UNIT_MOD_RAGE:
case UNIT_MOD_FOCUS: case UNIT_MOD_FOCUS:
case UNIT_MOD_ENERGY: case UNIT_MOD_ENERGY:
case UNIT_MOD_HAPPINESS: UpdateMaxPower(GetPowerTypeByAuraGroup(unitMod)); break; case UNIT_MOD_HAPPINESS:
case UNIT_MOD_RUNE:
case UNIT_MOD_RUNIC_POWER: UpdateMaxPower(GetPowerTypeByAuraGroup(unitMod)); break;
case UNIT_MOD_RESISTANCE_HOLY: case UNIT_MOD_RESISTANCE_HOLY:
case UNIT_MOD_RESISTANCE_FIRE: case UNIT_MOD_RESISTANCE_FIRE:
@ -9627,21 +9629,18 @@ Stats Unit::GetStatByAuraGroup(UnitMods unitMod) const
Powers Unit::GetPowerTypeByAuraGroup(UnitMods unitMod) const Powers Unit::GetPowerTypeByAuraGroup(UnitMods unitMod) const
{ {
Powers power = POWER_MANA;
switch(unitMod) switch(unitMod)
{ {
case UNIT_MOD_MANA: power = POWER_MANA; break; case UNIT_MOD_MANA: return POWER_MANA;
case UNIT_MOD_RAGE: power = POWER_RAGE; break; case UNIT_MOD_RAGE: return POWER_RAGE;
case UNIT_MOD_FOCUS: power = POWER_FOCUS; break; case UNIT_MOD_FOCUS: return POWER_FOCUS;
case UNIT_MOD_ENERGY: power = POWER_ENERGY; break; case UNIT_MOD_ENERGY: return POWER_ENERGY;
case UNIT_MOD_HAPPINESS: power = POWER_HAPPINESS; break; case UNIT_MOD_HAPPINESS: return POWER_HAPPINESS;
case UNIT_MOD_RUNE: return POWER_RUNE;
default: case UNIT_MOD_RUNIC_POWER:return POWER_RUNIC_POWER;
break;
} }
return power; return POWER_MANA;
} }
float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const float Unit::GetTotalAttackPowerValue(WeaponAttackType attType) const

View file

@ -301,11 +301,13 @@ enum UnitMods
UNIT_MOD_STAT_INTELLECT, UNIT_MOD_STAT_INTELLECT,
UNIT_MOD_STAT_SPIRIT, UNIT_MOD_STAT_SPIRIT,
UNIT_MOD_HEALTH, UNIT_MOD_HEALTH,
UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_HAPPINESS must be in existed order, it's accessed by index values of Powers enum. UNIT_MOD_MANA, // UNIT_MOD_MANA..UNIT_MOD_RUNIC_POWER must be in existed order, it's accessed by index values of Powers enum.
UNIT_MOD_RAGE, UNIT_MOD_RAGE,
UNIT_MOD_FOCUS, UNIT_MOD_FOCUS,
UNIT_MOD_ENERGY, UNIT_MOD_ENERGY,
UNIT_MOD_HAPPINESS, UNIT_MOD_HAPPINESS,
UNIT_MOD_RUNE,
UNIT_MOD_RUNIC_POWER,
UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existed order, it's accessed by index values of SpellSchools enum. UNIT_MOD_ARMOR, // UNIT_MOD_ARMOR..UNIT_MOD_RESISTANCE_ARCANE must be in existed order, it's accessed by index values of SpellSchools enum.
UNIT_MOD_RESISTANCE_HOLY, UNIT_MOD_RESISTANCE_HOLY,
UNIT_MOD_RESISTANCE_FIRE, UNIT_MOD_RESISTANCE_FIRE,
@ -325,7 +327,7 @@ enum UnitMods
UNIT_MOD_RESISTANCE_START = UNIT_MOD_ARMOR, UNIT_MOD_RESISTANCE_START = UNIT_MOD_ARMOR,
UNIT_MOD_RESISTANCE_END = UNIT_MOD_RESISTANCE_ARCANE + 1, UNIT_MOD_RESISTANCE_END = UNIT_MOD_RESISTANCE_ARCANE + 1,
UNIT_MOD_POWER_START = UNIT_MOD_MANA, UNIT_MOD_POWER_START = UNIT_MOD_MANA,
UNIT_MOD_POWER_END = UNIT_MOD_HAPPINESS + 1 UNIT_MOD_POWER_END = UNIT_MOD_RUNIC_POWER + 1
}; };
enum BaseModGroup enum BaseModGroup