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
+1 -1
View File
@@ -172,7 +172,7 @@ namespace Framework.Constants
YouChangeEnergy = 122,
YoursEnergyChanged = 123,
CurrentEnergy = 124, //Log
CurrentEnergy = 124,
YouChangeRage = 125,
YoursRageChanged = 126,
YouChangeLvl = 127,
+2 -2
View File
@@ -153,9 +153,9 @@ namespace Framework.Constants
Runes,
RunicPower,
SoulShards,
Eclipse,
LunarPower,
HolyPower,
Alternative,
Alternate,
Maelstrom,
Chi,
Insanity,
+2 -2
View File
@@ -2927,7 +2927,7 @@ namespace Game.AI
{
if (me == null || !me.IsInCombat() || me.GetMaxPower(PowerType.Mana) == 0)
return;
uint perc = (uint)(100.0f * me.GetPower(PowerType.Mana) / me.GetMaxPower(PowerType.Mana));
uint perc = (uint)me.GetPowerPct(PowerType.Mana);
if (perc > e.Event.minMaxRepeat.max || perc < e.Event.minMaxRepeat.min)
return;
ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax);
@@ -2937,7 +2937,7 @@ namespace Game.AI
{
if (me == null || !me.IsInCombat() || me.GetVictim() == null || me.GetVictim().GetMaxPower(PowerType.Mana) == 0)
return;
uint perc = (uint)(100.0f * me.GetVictim().GetPower(PowerType.Mana) / me.GetVictim().GetMaxPower(PowerType.Mana));
uint perc = (uint)me.GetVictim().GetPowerPct(PowerType.Mana);
if (perc > e.Event.minMaxRepeat.max || perc < e.Event.minMaxRepeat.min)
return;
ProcessTimedAction(e, e.Event.minMaxRepeat.repeatMin, e.Event.minMaxRepeat.repeatMax, me.GetVictim());
@@ -71,7 +71,6 @@ namespace Game.Chat
NotifyModification(handler, target, CypherStrings.YouChangeEnergy, CypherStrings.YoursEnergyChanged, energy / energyMultiplier, energymax / energyMultiplier);
target.SetMaxPower(PowerType.Energy, energymax);
target.SetPower(PowerType.Energy, energy);
Log.outDebug(LogFilter.Misc, handler.GetCypherString(CypherStrings.CurrentEnergy), target.GetMaxPower(PowerType.Energy));
return true;
}
return false;
+4 -4
View File
@@ -516,7 +516,7 @@ namespace Game.Entities
if (HasFlag(UnitFields.Flags2, UnitFlags2.RegeneratePower))
{
if (getPowerType() == PowerType.Energy)
if (GetPowerType() == PowerType.Energy)
Regenerate(PowerType.Energy);
else
RegenerateMana();
@@ -1133,10 +1133,10 @@ namespace Game.Entities
switch (GetClass())
{
case Class.Warrior:
setPowerType(PowerType.Rage);
SetPowerType(PowerType.Rage);
break;
case Class.Rogue:
setPowerType(PowerType.Energy);
SetPowerType(PowerType.Energy);
break;
default:
SetMaxPower(PowerType.Mana, (int)mana);
@@ -1409,7 +1409,7 @@ namespace Game.Entities
else
{
curhealth = GetMaxHealth();
SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana));
SetFullPower(PowerType.Mana);
}
SetHealth((m_deathState == DeathState.Alive || m_deathState == DeathState.JustRespawned) ? curhealth : 0);
+6 -6
View File
@@ -218,7 +218,7 @@ namespace Game.Entities
SetByteFlag(UnitFields.Bytes2, UnitBytes2Offsets.PetFlags, (result.Read<bool>(9) ? UnitPetFlags.CanBeAbandoned : UnitPetFlags.CanBeRenamed | UnitPetFlags.CanBeAbandoned));
SetUInt32Value(UnitFields.Flags, (uint)UnitFlags.PvpAttackable); // this enables popup window (pet abandon, cancel)
setPowerType(PowerType.Focus);
SetPowerType(PowerType.Focus);
break;
default:
if (!IsPetGhoul())
@@ -247,7 +247,7 @@ namespace Game.Entities
SetCanModifyStats(true);
if (getPetType() == PetType.Summon && !current) //all (?) summon pets come with full health when called, but not when they are current
SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana));
SetFullPower(PowerType.Mana);
else
{
uint savedhealth = result.Read<uint>(10);
@@ -256,8 +256,8 @@ namespace Game.Entities
setDeathState(DeathState.JustDied);
else
{
SetHealth(savedhealth > GetMaxHealth() ? GetMaxHealth() : savedhealth);
SetPower(PowerType.Mana, savedmana > GetMaxPower(PowerType.Mana) ? GetMaxPower(PowerType.Mana) : (int)savedmana);
SetHealth(savedhealth);
SetPower(PowerType.Mana, (int)savedmana);
}
}
@@ -579,7 +579,7 @@ namespace Game.Entities
m_focusRegenTimer -= diff;
else
{
switch (getPowerType())
switch (GetPowerType())
{
case PowerType.Focus:
Regenerate(PowerType.Focus);
@@ -714,7 +714,7 @@ namespace Game.Entities
if (!Create(map.GenerateLowGuid(HighGuid.Pet), map, cinfo.Entry))
return false;
setPowerType(PowerType.Focus);
SetPowerType(PowerType.Focus);
SetUInt32Value(UnitFields.PetNameTimestamp, 0);
SetUInt32Value(UnitFields.PetExperience, 0);
SetUInt32Value(UnitFields.PetNextLevelExp, (uint)(Global.ObjectMgr.GetXPForLevel(getLevel() + 1) * PetXPFactor));
@@ -357,7 +357,7 @@ namespace Game.Entities
SendActionButtons(1);
UpdateDisplayPower();
PowerType pw = getPowerType();
PowerType pw = GetPowerType();
if (pw != PowerType.Mana)
SetPower(PowerType.Mana, 0); // Mana must be 0 even if it isn't the active power type.
+20 -27
View File
@@ -345,8 +345,8 @@ namespace Game.Entities
// apply original stats mods before spell loading or item equipment that call before equip _RemoveStatsMods()
UpdateMaxHealth(); // Update max Health (for add bonus from stamina)
SetFullHealth();
if (getPowerType() == PowerType.Mana)
SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana));
if (GetPowerType() == PowerType.Mana)
SetFullPower(PowerType.Mana);
// original spells
LearnDefaultSkills();
@@ -3573,19 +3573,12 @@ namespace Game.Entities
{
ResurrectPlayer(0.0f, false);
if (GetMaxHealth() > _resurrectionData.Health)
SetHealth(_resurrectionData.Health);
else
SetFullHealth();
if (GetMaxPower(PowerType.Mana) > _resurrectionData.Mana)
SetPower(PowerType.Mana, (int)_resurrectionData.Mana);
else
SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana));
SetHealth(_resurrectionData.Health);
SetPower(PowerType.Mana, (int)_resurrectionData.Mana);
SetPower(PowerType.Rage, 0);
SetPower(PowerType.Energy, GetMaxPower(PowerType.Energy));
SetPower(PowerType.Focus, GetMaxPower(PowerType.Focus));
SetFullPower(PowerType.Energy);
SetFullPower(PowerType.Focus);
SetPower(PowerType.LunarPower, 0);
uint aura = _resurrectionData.Aura;
@@ -3921,17 +3914,17 @@ namespace Game.Entities
}
public void ResetAllPowers()
{
SetHealth(GetMaxHealth());
switch (getPowerType())
SetFullHealth();
switch (GetPowerType())
{
case PowerType.Mana:
SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana));
SetFullPower(PowerType.Mana);
break;
case PowerType.Rage:
SetPower(PowerType.Rage, 0);
break;
case PowerType.Energy:
SetPower(PowerType.Energy, GetMaxPower(PowerType.Energy));
SetFullPower(PowerType.Energy);
break;
case PowerType.RunicPower:
SetPower(PowerType.RunicPower, 0);
@@ -4484,7 +4477,7 @@ namespace Game.Entities
// set health/powers (0- will be set in caller)
if (restore_percent > 0.0f)
{
SetHealth((uint)(GetMaxHealth() * restore_percent));
SetHealth((ulong)(GetMaxHealth() * restore_percent));
SetPower(PowerType.Mana, (int)(GetMaxPower(PowerType.Mana) * restore_percent));
SetPower(PowerType.Rage, 0);
SetPower(PowerType.Energy, (int)(GetMaxPower(PowerType.Energy) * restore_percent));
@@ -4842,7 +4835,7 @@ namespace Game.Entities
pet.SetCreatorGUID(GetGUID());
pet.SetUInt32Value(UnitFields.FactionTemplate, getFaction());
pet.setPowerType(PowerType.Mana);
pet.SetPowerType(PowerType.Mana);
pet.SetUInt64Value(UnitFields.NpcFlags, (uint)NPCFlags.None);
pet.SetUInt32Value(UnitFields.Bytes1, 0);
pet.InitStatsForLevel(getLevel());
@@ -4858,7 +4851,7 @@ namespace Game.Entities
pet.SetUInt32Value(UnitFields.PetExperience, 0);
pet.SetUInt32Value(UnitFields.PetNextLevelExp, 1000);
pet.SetFullHealth();
pet.SetPower(PowerType.Mana, pet.GetMaxPower(PowerType.Mana));
pet.SetFullPower(PowerType.Mana);
pet.SetUInt32Value(UnitFields.PetNameTimestamp, (uint)Time.UnixTime); // cast can't be helped in this case
break;
default:
@@ -5332,10 +5325,10 @@ namespace Game.Entities
// set current level health and mana/energy to maximum after applying all mods.
SetFullHealth();
SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana));
SetPower(PowerType.Energy, GetMaxPower(PowerType.Energy));
SetFullPower(PowerType.Mana);
SetFullPower(PowerType.Energy);
if (GetPower(PowerType.Rage) > GetMaxPower(PowerType.Rage))
SetPower(PowerType.Rage, GetMaxPower(PowerType.Rage));
SetFullPower(PowerType.Rage);
SetPower(PowerType.Focus, 0);
// update level to hunter/summon pet
@@ -5914,11 +5907,11 @@ namespace Game.Entities
// set current level health and mana/energy to maximum after applying all mods.
SetFullHealth();
SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana));
SetPower(PowerType.Energy, GetMaxPower(PowerType.Energy));
SetFullPower(PowerType.Mana);
SetFullPower(PowerType.Energy);
if (GetPower(PowerType.Rage) > GetMaxPower(PowerType.Rage))
SetPower(PowerType.Rage, GetMaxPower(PowerType.Rage));
SetPower(PowerType.Focus, GetMaxPower(PowerType.Focus));
SetFullPower(PowerType.Rage);
SetFullPower(PowerType.Focus);
SetPower(PowerType.RunicPower, 0);
// update level to hunter/summon pet
+22 -20
View File
@@ -79,9 +79,9 @@ namespace Game.Entities
case UnitMods.Runes:
case UnitMods.RunicPower:
case UnitMods.SoulShards:
case UnitMods.Eclipse:
case UnitMods.LunarPower:
case UnitMods.HolyPower:
case UnitMods.Alternative:
case UnitMods.Alternate:
case UnitMods.Maelstrom:
case UnitMods.Chi:
case UnitMods.Insanity:
@@ -413,16 +413,16 @@ namespace Game.Entities
public virtual float GetArmorMultiplierForTarget(WorldObject target) { return 1.0f; }
//Powers
public PowerType getPowerType()
public PowerType GetPowerType()
{
return (PowerType)GetUInt32Value(UnitFields.DisplayPower);
}
public void setPowerType(PowerType newPowerType)
public void SetPowerType(PowerType powerType)
{
if (getPowerType() == newPowerType)
if (GetPowerType() == powerType)
return;
SetUInt32Value(UnitFields.DisplayPower, (uint)newPowerType);
SetUInt32Value(UnitFields.DisplayPower, (uint)powerType);
if (IsTypeId(TypeId.Player))
{
@@ -444,7 +444,7 @@ namespace Game.Entities
powerMultiplier = creature.GetCreatureTemplate().ModMana;
}
switch (newPowerType)
switch (powerType)
{
default:
case PowerType.Mana:
@@ -462,13 +462,13 @@ namespace Game.Entities
break;
}
}
public void SetMaxPower(PowerType power, int val)
public void SetMaxPower(PowerType powerType, int val)
{
uint powerIndex = GetPowerIndex(power);
uint powerIndex = GetPowerIndex(powerType);
if (powerIndex == (int)PowerType.Max || powerIndex >= (int)PowerType.MaxPerClass)
return;
int cur_power = GetPower(power);
int cur_power = GetPower(powerType);
SetInt32Value(UnitFields.MaxPower + (int)powerIndex, val);
// group update
@@ -485,7 +485,7 @@ namespace Game.Entities
}*/
if (val < cur_power)
SetPower(power, val);
SetPower(powerType, val);
}
public void SetPower(PowerType powerType, int val)
{
@@ -521,30 +521,31 @@ namespace Game.Entities
pet.SetGroupUpdateFlag(GROUP_UPDATE_FLAG_PET_CUR_POWER);
}*/
}
public int GetPower(PowerType power)
public void SetFullPower(PowerType powerType) { SetPower(powerType, GetMaxPower(powerType)); }
public int GetPower(PowerType powerType)
{
uint powerIndex = GetPowerIndex(power);
uint powerIndex = GetPowerIndex(powerType);
if (powerIndex == (int)PowerType.Max || powerIndex >= (int)PowerType.MaxPerClass)
return 0;
return GetInt32Value(UnitFields.Power + (int)powerIndex);
}
public int GetMaxPower(PowerType power)
public int GetMaxPower(PowerType powerType)
{
uint powerIndex = GetPowerIndex(power);
uint powerIndex = GetPowerIndex(powerType);
if (powerIndex == (int)PowerType.Max || powerIndex >= (int)PowerType.MaxPerClass)
return 0;
return GetInt32Value(UnitFields.MaxPower + (int)powerIndex);
}
public int GetCreatePowers(PowerType power)
public int GetCreatePowers(PowerType powerType)
{
if (power == PowerType.Mana)
if (powerType == PowerType.Mana)
return (int)GetCreateMana();
PowerTypeRecord powerType = Global.DB2Mgr.GetPowerTypeEntry(power);
if (powerType != null)
return powerType.MaxPower;
PowerTypeRecord powerTypeEntry = Global.DB2Mgr.GetPowerTypeEntry(powerType);
if (powerTypeEntry != null)
return powerTypeEntry.MaxPower;
return 0;
}
@@ -560,6 +561,7 @@ namespace Game.Entities
return Global.DB2Mgr.GetPowerIndexByClass(powerType, _class);
}
public float GetPowerPct(PowerType powerType) { return GetMaxPower(powerType) != 0 ? 100.0f* GetPower(powerType) / GetMaxPower(powerType) : 0.0f; }
public void ApplyResilience(Unit victim, ref uint damage)
{
+1 -1
View File
@@ -629,7 +629,7 @@ namespace Game.Entities
UpdateAllStats();
SetFullHealth();
SetPower(PowerType.Mana, GetMaxPower(PowerType.Mana));
SetFullPower(PowerType.Mana);
return true;
}
+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()
+2 -2
View File
@@ -75,9 +75,9 @@ namespace Game.Entities
{
PowerDisplayRecord powerDisplay = CliDB.PowerDisplayStorage.LookupByKey(_vehicleInfo.PowerDisplayID[0]);
if (powerDisplay != null)
_me.setPowerType((PowerType)powerDisplay.PowerType);
_me.SetPowerType((PowerType)powerDisplay.PowerType);
else if (_me.GetClass() == Class.Rogue)
_me.setPowerType(PowerType.Energy);
_me.SetPowerType(PowerType.Energy);
}
_status = Status.Installed;
+3 -3
View File
@@ -268,10 +268,10 @@ namespace Game.Network.Packets
MemberStats.MaxHealth = (int)player.GetMaxHealth();
// Power
MemberStats.PowerType = (byte)player.getPowerType();
MemberStats.PowerType = (byte)player.GetPowerType();
MemberStats.PowerDisplayID = 0;
MemberStats.CurrentPower = (ushort)player.GetPower(player.getPowerType());
MemberStats.MaxPower = (ushort)player.GetMaxPower(player.getPowerType());
MemberStats.CurrentPower = (ushort)player.GetPower(player.GetPowerType());
MemberStats.MaxPower = (ushort)player.GetMaxPower(player.GetPowerType());
// Position
MemberStats.ZoneID = (ushort)player.GetZoneId();
+2 -2
View File
@@ -1101,7 +1101,7 @@ namespace Game.Network.Packets
Health = (long)unit.GetHealth();
AttackPower = (int)unit.GetTotalAttackPowerValue(unit.GetClass() == Class.Hunter ? WeaponAttackType.RangedAttack : WeaponAttackType.BaseAttack);
SpellPower = unit.SpellBaseDamageBonusDone(SpellSchoolMask.Spell);
PowerData.Add(new SpellLogPowerData((int)unit.getPowerType(), unit.GetPower(unit.getPowerType()), 0));
PowerData.Add(new SpellLogPowerData((int)unit.GetPowerType(), unit.GetPower(unit.GetPowerType()), 0));
}
public void Initialize(Spell spell)
@@ -1109,7 +1109,7 @@ namespace Game.Network.Packets
Health = (long)spell.GetCaster().GetHealth();
AttackPower = (int)spell.GetCaster().GetTotalAttackPowerValue(spell.GetCaster().GetClass() == Class.Hunter ? WeaponAttackType.RangedAttack : WeaponAttackType.BaseAttack);
SpellPower = spell.GetCaster().SpellBaseDamageBonusDone(SpellSchoolMask.Spell);
PowerType primaryPowerType = spell.GetCaster().getPowerType();
PowerType primaryPowerType = spell.GetCaster().GetPowerType();
bool primaryPowerAdded = false;
foreach (SpellPowerCost cost in spell.GetPowerCost())
{
+4 -4
View File
@@ -4820,7 +4820,7 @@ namespace Game.Spells
{
// Converts up to 10 rage per second into health for $d. Each point of rage is converted into ${$m2/10}.1% of max health.
// Should be manauser
if (target.getPowerType() != PowerType.Rage)
if (target.GetPowerType() != PowerType.Rage)
break;
int rage = target.GetPower(PowerType.Rage);
// Nothing todo
@@ -5595,7 +5595,7 @@ namespace Game.Spells
{
PowerType powerType = (PowerType)GetMiscValue();
if (caster == null || !caster.IsAlive() || !target.IsAlive() || target.getPowerType() != powerType)
if (caster == null || !caster.IsAlive() || !target.IsAlive() || target.GetPowerType() != powerType)
return;
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo()))
@@ -5646,7 +5646,7 @@ namespace Game.Spells
{
PowerType powerType;
if (GetMiscValue() == (int)PowerType.All)
powerType = target.getPowerType();
powerType = target.GetPowerType();
else
powerType = (PowerType)GetMiscValue();
@@ -5708,7 +5708,7 @@ namespace Game.Spells
{
PowerType powerType = (PowerType)GetMiscValue();
if (caster == null || !target.IsAlive() || target.getPowerType() != powerType)
if (caster == null || !target.IsAlive() || target.GetPowerType() != powerType)
return;
if (target.HasUnitState(UnitState.Isolated) || target.IsImmunedToDamage(GetSpellInfo()))
+2 -2
View File
@@ -4931,7 +4931,7 @@ namespace Game.Spells
{
Unit target1 = m_targets.GetUnitTarget();
if (target1 != null)
if (target1 != m_caster && unitTarget.getPowerType() != (PowerType)effect.MiscValue)
if (target1 != m_caster && unitTarget.GetPowerType() != (PowerType)effect.MiscValue)
return SpellCastResult.BadTargets;
}
break;
@@ -5378,7 +5378,7 @@ namespace Game.Spells
if (!m_caster.IsTypeId(TypeId.Player) || m_CastItem != null)
break;
if (m_targets.GetUnitTarget().getPowerType() != PowerType.Mana)
if (m_targets.GetUnitTarget().GetPowerType() != PowerType.Mana)
return SpellCastResult.BadTargets;
break;
+3 -3
View File
@@ -823,7 +823,7 @@ namespace Game.Spells
PowerType powerType = (PowerType)effectInfo.MiscValue;
if (unitTarget == null || !unitTarget.IsAlive() || unitTarget.getPowerType() != powerType || damage < 0)
if (unitTarget == null || !unitTarget.IsAlive() || unitTarget.GetPowerType() != powerType || damage < 0)
return;
// add spell damage bonus
@@ -902,7 +902,7 @@ namespace Game.Spells
PowerType powerType = (PowerType)effectInfo.MiscValue;
if (unitTarget == null || !unitTarget.IsAlive() || unitTarget.getPowerType() != powerType || damage < 0)
if (unitTarget == null || !unitTarget.IsAlive() || unitTarget.GetPowerType() != powerType || damage < 0)
return;
int newDamage = -(unitTarget.ModifyPower(powerType, -damage));
@@ -4077,7 +4077,7 @@ namespace Game.Spells
player.SetHealth(health);
player.SetPower(PowerType.Mana, mana);
player.SetPower(PowerType.Rage, 0);
player.SetPower(PowerType.Energy, player.GetMaxPower(PowerType.Energy));
player.SetFullPower(PowerType.Energy);
player.SetPower(PowerType.Focus, 0);
player.SpawnCorpseBones();
@@ -57,8 +57,8 @@ namespace Scripts.EasternKingdoms.Karazhan.Curator
{
_scheduler.Schedule(TimeSpan.FromSeconds(10), task =>
{
//Summon Astral Flare
Creature AstralFlare = DoSpawnCreature(17096, RandomHelper.Rand32() % 37, RandomHelper.Rand32() % 37, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
//Summon Astral Flare
Creature AstralFlare = DoSpawnCreature(17096, RandomHelper.Rand32() % 37, RandomHelper.Rand32() % 37, 0, 0, TempSummonType.TimedDespawnOOC, 5000);
Unit target = SelectTarget(SelectAggroTarget.Random, 0);
if (AstralFlare && target)
@@ -67,23 +67,23 @@ namespace Scripts.EasternKingdoms.Karazhan.Curator
AstralFlare.GetAI().AttackStart(target);
}
//Reduce Mana by 10% of max health
int mana = me.GetMaxPower(PowerType.Mana);
//Reduce Mana by 10% of max health
int mana = me.GetMaxPower(PowerType.Mana);
if (mana != 0)
{
mana /= 10;
me.ModifyPower(PowerType.Mana, -mana);
//if this get's us below 10%, then we evocate (the 10th should be summoned now)
if (me.GetPower(PowerType.Mana) * 100 / me.GetMaxPower(PowerType.Mana) < 10)
//if this get's us below 10%, then we evocate (the 10th should be summoned now)
if (me.GetPower(PowerType.Mana) * 100 / me.GetMaxPower(PowerType.Mana) < 10)
{
Talk(TextIds.SayEvocate);
me.InterruptNonMeleeSpells(false);
DoCast(me, SpellIds.Evocation);
_scheduler.DelayAll(TimeSpan.FromSeconds(20));
//Evocating = true;
//no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected
return;
//Evocating = true;
//no AddTimer cooldown, this will make first flare appear instantly after evocate end, like expected
return;
}
else
{
@@ -421,7 +421,7 @@ namespace Scripts.EasternKingdoms.Karazhan.Moroes
{
Unit target = SelectTarget(SelectAggroTarget.Random, 0, 100, true);
if (target)
if (target.getPowerType() == PowerType.Mana)
if (target.GetPowerType() == PowerType.Mana)
DoCast(target, SpellIds.Manaburn);
ManaBurn_Timer = 5000; // 3 sec cast
}
@@ -464,7 +464,7 @@ namespace Scripts.Northrend.CrusadersColiseum.TrialOfTheCrusader
void FilterTargets(List<WorldObject> targets)
{
// get a list of players with mana
targets.RemoveAll(unit => unit.IsTypeId(TypeId.Player) && unit.ToPlayer().getPowerType() == PowerType.Mana);
targets.RemoveAll(unit => unit.IsTypeId(TypeId.Player) && unit.ToPlayer().GetPowerType() == PowerType.Mana);
if (targets.Empty())
return;
@@ -258,7 +258,7 @@ namespace Scripts.Northrend.FrozenHalls.ForgeOfSouls.Bronjahm
{
void RecalculateDamage()
{
if (GetHitUnit().getPowerType() != PowerType.Mana)
if (GetHitUnit().GetPowerType() != PowerType.Mana)
return;
int maxDamage = GetCaster().GetMap().IsHeroic() ? 15000 : 10000;
@@ -225,7 +225,7 @@ namespace Scripts.Northrend.IcecrownCitadel
public override void Reset()
{
_Reset();
me.SetPower(PowerType.Mana, me.GetMaxPower(PowerType.Mana));
me.SetFullPower(PowerType.Mana);
_events.SetPhase(LadyConst.PhaseOne);
_waveCounter = 0;
_nextVengefulShadeTargetGUID.Clear();
+1 -1
View File
@@ -49,7 +49,7 @@ namespace Scripts.Outlands
player.PlayerTalkClass.ClearMenus();
if (action == eTradeskill.GossipActionInfoDef + 1)
{
creature.setPowerType(PowerType.Mana);
creature.SetPowerType(PowerType.Mana);
creature.SetMaxPower(PowerType.Mana, 200); //set a "fake" mana value, we can't depend on database doing it in this case
creature.SetPower(PowerType.Mana, 200);
+3 -3
View File
@@ -2047,7 +2047,7 @@ namespace Scripts.Spells.Generic
newPet.setDeathState(DeathState.Alive);
newPet.SetFullHealth();
newPet.SetPower(newPet.getPowerType(), newPet.GetMaxPower(newPet.getPowerType()));
newPet.SetFullPower(newPet.GetPowerType());
switch (newPet.GetEntry())
{
@@ -2171,7 +2171,7 @@ namespace Scripts.Spells.Generic
{
var target = obj.ToUnit();
if (target)
return target.getPowerType() != PowerType.Mana;
return target.GetPowerType() != PowerType.Mana;
return true;
});
@@ -3312,7 +3312,7 @@ namespace Scripts.Spells.Generic
{
Unit unit = target.ToUnit();
if (unit)
return unit.getPowerType() != PowerType.Mana;
return unit.GetPowerType() != PowerType.Mana;
return false;
});
}
+1 -1
View File
@@ -1180,7 +1180,7 @@ namespace Scripts.Spells.Items
Unit caster = eventInfo.GetActor();
uint spellId;
switch (caster.getPowerType())
switch (caster.GetPowerType())
{
case PowerType.Mana:
spellId = _manaSpellId;
+1 -1
View File
@@ -496,7 +496,7 @@ namespace Scripts.Spells.Priest
{
Unit target = obj.ToUnit();
if (target)
return target.getPowerType() != PowerType.Mana;
return target.GetPowerType() != PowerType.Mana;
return true;
}));
+6 -18
View File
@@ -49,24 +49,12 @@ namespace Scripts.World
if (_resetHealthMana)
{
player1.SaveHealthBeforeDuel();
player1.SetHealth(player1.GetMaxHealth());
player1.SaveManaBeforeDuel();
player1.ResetAllPowers();
player2.SaveHealthBeforeDuel();
player2.SetHealth(player2.GetMaxHealth());
// check if player1 class uses mana
if (player1.getPowerType() == PowerType.Mana || player1.GetClass() == Class.Druid)
{
player1.SaveManaBeforeDuel();
player1.SetPower(PowerType.Mana, player1.GetMaxPower(PowerType.Mana));
}
// check if player2 class uses mana
if (player2.getPowerType() == PowerType.Mana || player2.GetClass() == Class.Druid)
{
player2.SaveManaBeforeDuel();
player2.SetPower(PowerType.Mana, player2.GetMaxPower(PowerType.Mana));
}
player2.SaveManaBeforeDuel();
player2.ResetAllPowers();
}
}
@@ -92,11 +80,11 @@ namespace Scripts.World
loser.RestoreHealthAfterDuel();
// check if player1 class uses mana
if (winner.getPowerType() == PowerType.Mana || winner.GetClass() == Class.Druid)
if (winner.GetPowerType() == PowerType.Mana || winner.GetClass() == Class.Druid)
winner.RestoreManaAfterDuel();
// check if player2 class uses mana
if (loser.getPowerType() == PowerType.Mana || loser.GetClass() == Class.Druid)
if (loser.GetPowerType() == PowerType.Mana || loser.GetClass() == Class.Druid)
loser.RestoreManaAfterDuel();
}
}