Core/Misc: Added helper function Unit::SetFullPower * Also renamed Unit::getPowerType and Unit::setPowerType to follow style guidelines

This commit is contained in:
hondacrx
2018-01-03 13:57:16 -05:00
parent 8b43b08f6f
commit 9d3e87fd87
30 changed files with 106 additions and 124 deletions
+2 -2
View File
@@ -33,8 +33,8 @@ namespace Game.Entities
{
Unit a = objA.ToUnit();
Unit b = objB.ToUnit();
float rA = a.GetMaxPower(m_power) != 0 ? a.GetPower(m_power) / (float)a.GetMaxPower(m_power) : 0.0f;
float rB = b.GetMaxPower(m_power) != 0 ? b.GetPower(m_power) / (float)b.GetMaxPower(m_power) : 0.0f;
float rA = a != null ? a.GetPowerPct(m_power) : 0.0f;
float rB = b != null ? b.GetPowerPct(m_power) : 0.0f;
return Convert.ToInt32(m_ascending ? rA < rB : rA > rB);
}
+1 -1
View File
@@ -944,7 +944,7 @@ namespace Game.Entities
}
// Rage from Damage made (only from direct weapon damage)
if (cleanDamage != null && (cleanDamage.attackType == WeaponAttackType.BaseAttack || cleanDamage.attackType == WeaponAttackType.OffAttack) && damagetype == DamageEffectType.Direct && this != victim && getPowerType() == PowerType.Rage)
if (cleanDamage != null && (cleanDamage.attackType == WeaponAttackType.BaseAttack || cleanDamage.attackType == WeaponAttackType.OffAttack) && damagetype == DamageEffectType.Direct && this != victim && GetPowerType() == PowerType.Rage)
{
uint rage = (uint)(GetBaseAttackTime(cleanDamage.attackType) / 1000.0f * 1.75f);
if (cleanDamage.attackType == WeaponAttackType.OffAttack)
+1 -1
View File
@@ -215,7 +215,7 @@ namespace Game.Entities
// Ghoul pets have energy instead of mana (is anywhere better place for this code?)
if (minion.IsPetGhoul())
minion.setPowerType(PowerType.Energy);
minion.SetPowerType(PowerType.Energy);
// Send infinity cooldown - client does that automatically but after relog cooldown needs to be set again
SpellInfo spellInfo = Global.SpellMgr.GetSpellInfo(minion.GetUInt32Value(UnitFields.CreatedBySpell));
+2 -2
View File
@@ -1651,7 +1651,7 @@ namespace Game.Entities
// without this when removing IncreaseMaxHealth aura player may stuck with 1 hp
// do not why since in IncreaseMaxHealth currenthealth is checked
SetHealth(0);
SetPower(getPowerType(), 0);
SetPower(GetPowerType(), 0);
SetUInt32Value(UnitFields.NpcEmotestate, 0);
// players in instance don't have ZoneScript, but they have InstanceScript
@@ -1969,7 +1969,7 @@ namespace Game.Entities
}
}
setPowerType(displayPower);
SetPowerType(displayPower);
}
public FactionTemplateRecord GetFactionTemplateEntry()