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