Some refactoring of code. and some cleanups
This commit is contained in:
@@ -294,7 +294,7 @@ namespace Game.Spells
|
||||
m_owner = owner;
|
||||
m_timeCla = 0;
|
||||
m_updateTargetMapInterval = 0;
|
||||
m_casterLevel = caster != null ? caster.getLevel() : m_spellInfo.SpellLevel;
|
||||
m_casterLevel = caster != null ? caster.GetLevel() : m_spellInfo.SpellLevel;
|
||||
m_procCharges = 0;
|
||||
m_stackAmount = 1;
|
||||
m_isRemoved = false;
|
||||
@@ -1800,8 +1800,8 @@ namespace Game.Spells
|
||||
}
|
||||
|
||||
// proc chance is reduced by an additional 3.333% per level past 60
|
||||
if (procEntry.AttributesMask.HasAnyFlag(ProcAttributes.ReduceProc60) && eventInfo.GetActor().getLevel() > 60)
|
||||
chance = Math.Max(0.0f, (1.0f - ((eventInfo.GetActor().getLevel() - 60) * 1.0f / 30.0f)) * chance);
|
||||
if (procEntry.AttributesMask.HasAnyFlag(ProcAttributes.ReduceProc60) && eventInfo.GetActor().GetLevel() > 60)
|
||||
chance = Math.Max(0.0f, (1.0f - ((eventInfo.GetActor().GetLevel() - 60) * 1.0f / 30.0f)) * chance);
|
||||
|
||||
return chance;
|
||||
}
|
||||
@@ -2388,12 +2388,12 @@ namespace Game.Spells
|
||||
}
|
||||
return (effMask & availableEffectMask);
|
||||
}
|
||||
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1)
|
||||
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount = null, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, int castItemLevel = -1)
|
||||
{
|
||||
bool throwway;
|
||||
return TryRefreshStackOrCreate(spellproto, castId, tryEffMask, owner, caster, out throwway, baseAmount, castItem, casterGUID, resetPeriodicTimer, castItemGuid, castItemLevel);
|
||||
}
|
||||
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, out bool refresh, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1)
|
||||
public static Aura TryRefreshStackOrCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, out bool refresh, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default, bool resetPeriodicTimer = true, ObjectGuid castItemGuid = default, int castItemLevel = -1)
|
||||
{
|
||||
Cypher.Assert(spellproto != null);
|
||||
Cypher.Assert(owner != null);
|
||||
@@ -2418,7 +2418,7 @@ namespace Game.Spells
|
||||
else
|
||||
return Create(spellproto, castId, effMask, owner, caster, baseAmount, castItem, casterGUID, castItemGuid, castItemLevel);
|
||||
}
|
||||
public static Aura TryCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default(ObjectGuid), ObjectGuid castItemGuid = default(ObjectGuid), int castItemLevel = -1)
|
||||
public static Aura TryCreate(SpellInfo spellproto, ObjectGuid castId, uint tryEffMask, WorldObject owner, Unit caster, int[] baseAmount, Item castItem = null, ObjectGuid casterGUID = default, ObjectGuid castItemGuid = default, int castItemLevel = -1)
|
||||
{
|
||||
Cypher.Assert(spellproto != null);
|
||||
Cypher.Assert(owner != null);
|
||||
@@ -2448,7 +2448,7 @@ namespace Game.Spells
|
||||
casterGUID = caster.GetGUID();
|
||||
|
||||
// check if aura can be owned by owner
|
||||
if (owner.isTypeMask(TypeMask.Unit))
|
||||
if (owner.IsTypeMask(TypeMask.Unit))
|
||||
if (!owner.IsInWorld || owner.ToUnit().IsDuringRemoveFromWorld())
|
||||
// owner not in world so don't allow to own not self casted single target auras
|
||||
if (casterGUID != owner.GetGUID() && spellproto.IsSingleTarget())
|
||||
|
||||
@@ -690,7 +690,7 @@ namespace Game.Spells
|
||||
uint triggerSpellId = GetSpellEffectInfo().TriggerSpell;
|
||||
SpellInfo triggeredSpellInfo = Global.SpellMgr.GetSpellInfo(triggerSpellId);
|
||||
if (triggeredSpellInfo != null)
|
||||
if (aurApp.GetTarget().m_extraAttacks != 0 && triggeredSpellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
|
||||
if (aurApp.GetTarget().ExtraAttacks != 0 && triggeredSpellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
|
||||
return false;
|
||||
break;
|
||||
}
|
||||
@@ -1216,7 +1216,7 @@ namespace Game.Spells
|
||||
// die at aura end
|
||||
else if (target.IsAlive())
|
||||
// call functions which may have additional effects after chainging state of unit
|
||||
target.setDeathState(DeathState.JustDied);
|
||||
target.SetDeathState(DeathState.JustDied);
|
||||
}
|
||||
|
||||
[AuraEffectHandler(AuraType.Ghost)]
|
||||
@@ -1443,10 +1443,10 @@ namespace Game.Spells
|
||||
if (apply)
|
||||
{
|
||||
// update active transform spell only when transform not set or not overwriting negative by positive case
|
||||
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.getTransForm());
|
||||
SpellInfo transformSpellInfo = Global.SpellMgr.GetSpellInfo(target.GetTransForm());
|
||||
if (transformSpellInfo == null || !GetSpellInfo().IsPositive() || transformSpellInfo.IsPositive())
|
||||
{
|
||||
target.setTransForm(GetId());
|
||||
target.SetTransForm(GetId());
|
||||
// special case (spell specific functionality)
|
||||
if (GetMiscValue() == 0)
|
||||
{
|
||||
@@ -1615,7 +1615,7 @@ namespace Game.Spells
|
||||
// for players, start regeneration after 1s (in polymorph fast regeneration case)
|
||||
// only if caster is Player (after patch 2.4.2)
|
||||
if (GetCasterGUID().IsPlayer())
|
||||
target.ToPlayer().setRegenTimerCount(1 * Time.InMilliseconds);
|
||||
target.ToPlayer().SetRegenTimerCount(1 * Time.InMilliseconds);
|
||||
|
||||
//dismount polymorphed target (after patch 2.4.2)
|
||||
if (target.IsMounted())
|
||||
@@ -1625,7 +1625,7 @@ namespace Game.Spells
|
||||
else
|
||||
{
|
||||
if (target.GetTransForm() == GetId())
|
||||
target.setTransForm(0);
|
||||
target.SetTransForm(0);
|
||||
|
||||
target.RestoreDisplayId(target.IsMounted());
|
||||
|
||||
@@ -1727,7 +1727,7 @@ namespace Game.Spells
|
||||
if (GetCasterGUID() == target.GetGUID() && target.GetCurrentSpell(CurrentSpellTypes.Generic) != null)
|
||||
target.FinishSpell(CurrentSpellTypes.Generic, false);
|
||||
target.InterruptNonMeleeSpells(true);
|
||||
target.getHostileRefManager().deleteReferences();
|
||||
target.GetHostileRefManager().deleteReferences();
|
||||
|
||||
// stop handling the effect if it was removed by linked event
|
||||
if (aurApp.HasRemoveMode())
|
||||
@@ -2375,7 +2375,7 @@ namespace Game.Spells
|
||||
|
||||
Unit caster = GetCaster();
|
||||
if (caster != null && caster.IsAlive())
|
||||
target.getHostileRefManager().addTempThreat(GetAmount(), apply);
|
||||
target.GetHostileRefManager().addTempThreat(GetAmount(), apply);
|
||||
}
|
||||
|
||||
[AuraEffectHandler(AuraType.ModTaunt)]
|
||||
@@ -3162,7 +3162,7 @@ namespace Game.Spells
|
||||
// players in corpse state may mean two different states:
|
||||
/// 1. player just died but did not release (in this case health == 0)
|
||||
/// 2. player is corpse running (ie ghost) (in this case health == 1)
|
||||
if (target.getDeathState() == DeathState.Corpse)
|
||||
if (target.GetDeathState() == DeathState.Corpse)
|
||||
zeroHealth = target.GetHealth() == 0;
|
||||
|
||||
for (int i = (int)Stats.Strength; i < (int)Stats.Max; i++)
|
||||
@@ -3640,8 +3640,8 @@ namespace Game.Spells
|
||||
}
|
||||
else
|
||||
{
|
||||
target.m_modMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
|
||||
target.m_modRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
|
||||
target.ModMeleeHitChance += (apply) ? GetAmount() : (-GetAmount());
|
||||
target.ModRangedHitChance += (apply) ? GetAmount() : (-GetAmount());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -3656,7 +3656,7 @@ namespace Game.Spells
|
||||
if (target.IsTypeId(TypeId.Player))
|
||||
target.ToPlayer().UpdateSpellHitChances();
|
||||
else
|
||||
target.m_modSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
|
||||
target.ModSpellHitChance += (apply) ? GetAmount() : (-GetAmount());
|
||||
}
|
||||
|
||||
[AuraEffectHandler(AuraType.ModSpellCritChance)]
|
||||
@@ -3670,7 +3670,7 @@ namespace Game.Spells
|
||||
if (target.IsTypeId(TypeId.Player))
|
||||
target.ToPlayer().UpdateSpellCritChance();
|
||||
else
|
||||
target.m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
|
||||
target.BaseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
|
||||
}
|
||||
|
||||
[AuraEffectHandler(AuraType.ModCritPct)]
|
||||
@@ -3683,7 +3683,7 @@ namespace Game.Spells
|
||||
|
||||
if (!target.IsTypeId(TypeId.Player))
|
||||
{
|
||||
target.m_baseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
|
||||
target.BaseSpellCritChance += (apply) ? GetAmount() : -GetAmount();
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -3874,7 +3874,7 @@ namespace Game.Spells
|
||||
|
||||
Unit target = aurApp.GetTarget();
|
||||
|
||||
if ((target.getClassMask() & (uint)Class.ClassMaskWandUsers) != 0)
|
||||
if ((target.GetClassMask() & (uint)Class.ClassMaskWandUsers) != 0)
|
||||
return;
|
||||
|
||||
target.HandleStatModifier(UnitMods.AttackPowerRanged, UnitModifierType.TotalValue, GetAmount(), apply);
|
||||
@@ -3900,7 +3900,7 @@ namespace Game.Spells
|
||||
|
||||
Unit target = aurApp.GetTarget();
|
||||
|
||||
if ((target.getClassMask() & (uint)Class.ClassMaskWandUsers) != 0)
|
||||
if ((target.GetClassMask() & (uint)Class.ClassMaskWandUsers) != 0)
|
||||
return;
|
||||
|
||||
//UNIT_FIELD_RANGED_ATTACK_POWER_MULTIPLIER = multiplier - 1
|
||||
@@ -4485,8 +4485,8 @@ namespace Game.Spells
|
||||
if (GetSpellEffectInfo().ItemType == 6265)
|
||||
{
|
||||
// Soul Shard only from units that grant XP or honor
|
||||
if (!plCaster.isHonorOrXPTarget(target) ||
|
||||
(target.IsTypeId(TypeId.Unit) && !target.ToCreature().isTappedBy(plCaster)))
|
||||
if (!plCaster.IsHonorOrXPTarget(target) ||
|
||||
(target.IsTypeId(TypeId.Unit) && !target.ToCreature().IsTappedBy(plCaster)))
|
||||
return;
|
||||
}
|
||||
|
||||
@@ -5338,7 +5338,7 @@ namespace Game.Spells
|
||||
// There is a Chance to make a Soul Shard when Drain soul does damage
|
||||
if (GetSpellInfo().SpellFamilyName == SpellFamilyNames.Warlock && GetSpellInfo().SpellFamilyFlags[0].HasAnyFlag(0x00004000u))
|
||||
{
|
||||
if (caster.IsTypeId(TypeId.Player) && caster.ToPlayer().isHonorOrXPTarget(target))
|
||||
if (caster.IsTypeId(TypeId.Player) && caster.ToPlayer().IsHonorOrXPTarget(target))
|
||||
caster.CastSpell(caster, 95810, true, null, this);
|
||||
}
|
||||
if (GetSpellInfo().SpellFamilyName == SpellFamilyNames.Generic)
|
||||
@@ -5511,7 +5511,7 @@ namespace Game.Spells
|
||||
HealInfo healInfo = new HealInfo(caster, caster, heal, GetSpellInfo(), GetSpellInfo().GetSchoolMask());
|
||||
caster.HealBySpell(healInfo);
|
||||
|
||||
caster.getHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
|
||||
caster.GetHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
|
||||
caster.ProcSkillsAndAuras(caster, ProcFlags.DonePeriodic, ProcFlags.TakenPeriodic, ProcFlagsSpellType.Heal, ProcFlagsSpellPhase.None, hitMask, null, null, healInfo);
|
||||
}
|
||||
|
||||
@@ -5634,7 +5634,7 @@ namespace Game.Spells
|
||||
SpellPeriodicAuraLogInfo pInfo = new SpellPeriodicAuraLogInfo(this, heal, (uint)damage, heal - healInfo.GetEffectiveHeal(), healInfo.GetAbsorb(), 0, 0.0f, crit);
|
||||
target.SendPeriodicAuraLog(pInfo);
|
||||
|
||||
target.getHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
|
||||
target.GetHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, GetSpellInfo());
|
||||
|
||||
// %-based heal - does not proc auras
|
||||
if (GetAuraType() == AuraType.ObsModHealth)
|
||||
@@ -5728,7 +5728,7 @@ namespace Game.Spells
|
||||
int gain = target.ModifyPower(powerType, amount);
|
||||
|
||||
if (caster != null)
|
||||
target.getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
|
||||
target.GetHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
|
||||
|
||||
target.SendPeriodicAuraLog(pInfo);
|
||||
}
|
||||
@@ -5756,7 +5756,7 @@ namespace Game.Spells
|
||||
int gain = target.ModifyPower(powerType, amount);
|
||||
|
||||
if (caster != null)
|
||||
target.getHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
|
||||
target.GetHostileRefManager().threatAssist(caster, gain * 0.5f, GetSpellInfo());
|
||||
|
||||
target.SendPeriodicAuraLog(pInfo);
|
||||
}
|
||||
@@ -5792,7 +5792,7 @@ namespace Game.Spells
|
||||
// Set trigger flag
|
||||
ProcFlags procAttacker = ProcFlags.DonePeriodic;
|
||||
ProcFlags procVictim = ProcFlags.TakenPeriodic;
|
||||
ProcFlagsHit hitMask = Unit.createProcHitMask(damageInfo, SpellMissInfo.None);
|
||||
ProcFlagsHit hitMask = Unit.CreateProcHitMask(damageInfo, SpellMissInfo.None);
|
||||
ProcFlagsSpellType spellTypeMask = ProcFlagsSpellType.NoDmgHeal;
|
||||
if (damageInfo.damage != 0)
|
||||
{
|
||||
|
||||
+28
-29
@@ -31,13 +31,12 @@ using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using System.Runtime.InteropServices;
|
||||
using Game.AI;
|
||||
|
||||
namespace Game.Spells
|
||||
{
|
||||
public partial class Spell : IDisposable
|
||||
{
|
||||
public Spell(Unit caster, SpellInfo info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = default(ObjectGuid), bool skipcheck = false)
|
||||
public Spell(Unit caster, SpellInfo info, TriggerCastFlags triggerFlags, ObjectGuid originalCasterGUID = default, bool skipcheck = false)
|
||||
{
|
||||
m_spellInfo = info;
|
||||
m_caster = (info.HasAttribute(SpellAttr6.CastByCharmer) && caster.GetCharmerOrOwner() != null ? caster.GetCharmerOrOwner() : caster);
|
||||
@@ -60,7 +59,7 @@ namespace Game.Spells
|
||||
|
||||
if (m_attackType == WeaponAttackType.RangedAttack)
|
||||
{
|
||||
if ((m_caster.getClassMask() & (uint)Class.ClassMaskWandUsers) != 0 && m_caster.IsTypeId(TypeId.Player))
|
||||
if ((m_caster.GetClassMask() & (uint)Class.ClassMaskWandUsers) != 0 && m_caster.IsTypeId(TypeId.Player))
|
||||
{
|
||||
Item pItem = m_caster.ToPlayer().GetWeaponForAttack(WeaponAttackType.RangedAttack);
|
||||
if (pItem != null)
|
||||
@@ -1734,7 +1733,7 @@ namespace Game.Spells
|
||||
if (unit.IsAlive() != target.alive)
|
||||
return;
|
||||
|
||||
if (getState() == SpellState.Delayed && !m_spellInfo.IsPositive() && (GameTime.GetGameTimeMS() - target.timeDelay) <= unit.m_lastSanctuaryTime)
|
||||
if (getState() == SpellState.Delayed && !m_spellInfo.IsPositive() && (GameTime.GetGameTimeMS() - target.timeDelay) <= unit.LastSanctuaryTime)
|
||||
return; // No missinfo in that case
|
||||
|
||||
// Get original caster (if exist) and calculate damage/healing from him data
|
||||
@@ -1870,7 +1869,7 @@ namespace Game.Spells
|
||||
|
||||
HealInfo healInfo = new HealInfo(caster, unitTarget, addhealth, m_spellInfo, m_spellInfo.GetSchoolMask());
|
||||
caster.HealBySpell(healInfo, crit);
|
||||
unitTarget.getHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, m_spellInfo);
|
||||
unitTarget.GetHostileRefManager().threatAssist(caster, healInfo.GetEffectiveHeal() * 0.5f, m_spellInfo);
|
||||
m_healing = (int)healInfo.GetEffectiveHeal();
|
||||
|
||||
// Do triggers for unit
|
||||
@@ -1896,7 +1895,7 @@ namespace Game.Spells
|
||||
caster.CalculateSpellDamageTaken(damageInfo, m_damage, m_spellInfo, m_attackType, target.crit);
|
||||
caster.DealDamageMods(damageInfo.target, ref damageInfo.damage, ref damageInfo.absorb);
|
||||
|
||||
hitMask |= Unit.createProcHitMask(damageInfo, missInfo);
|
||||
hitMask |= Unit.CreateProcHitMask(damageInfo, missInfo);
|
||||
procVictim |= ProcFlags.TakenDamage;
|
||||
|
||||
m_damage = (int)damageInfo.damage;
|
||||
@@ -1923,7 +1922,7 @@ namespace Game.Spells
|
||||
{
|
||||
// Fill base damage struct (unitTarget - is real spell target)
|
||||
SpellNonMeleeDamage damageInfo = new SpellNonMeleeDamage(caster, unitTarget, m_spellInfo.Id, m_SpellVisual, m_spellSchoolMask);
|
||||
hitMask |= Unit.createProcHitMask(damageInfo, missInfo);
|
||||
hitMask |= Unit.CreateProcHitMask(damageInfo, missInfo);
|
||||
// Do triggers for unit
|
||||
if (canEffectTrigger)
|
||||
{
|
||||
@@ -2041,7 +2040,7 @@ namespace Game.Spells
|
||||
if (unit.IsInCombat() && m_spellInfo.HasInitialAggro())
|
||||
{
|
||||
m_caster.SetInCombatState(unit.GetCombatTimer() > 0, unit);
|
||||
unit.getHostileRefManager().threatAssist(m_caster, 0.0f);
|
||||
unit.GetHostileRefManager().threatAssist(m_caster, 0.0f);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -2417,13 +2416,13 @@ namespace Game.Spells
|
||||
if (!m_caster.ToPlayer().GetCommandStatus(PlayerCommandStates.Casttime))
|
||||
{
|
||||
// calculate cast time (calculated after first CheckCast check to prevent charge counting for first CheckCast fail)
|
||||
m_casttime = m_spellInfo.CalcCastTime(m_caster.getLevel(), this);
|
||||
m_casttime = m_spellInfo.CalcCastTime(m_caster.GetLevel(), this);
|
||||
}
|
||||
else
|
||||
m_casttime = 0;
|
||||
}
|
||||
else
|
||||
m_casttime = m_spellInfo.CalcCastTime(m_caster.getLevel(), this);
|
||||
m_casttime = m_spellInfo.CalcCastTime(m_caster.GetLevel(), this);
|
||||
|
||||
if (m_caster.IsTypeId(TypeId.Unit) && !m_caster.HasUnitFlag(UnitFlags.PlayerControlled)) // _UNIT actually means creature. for some reason.
|
||||
{
|
||||
@@ -2440,7 +2439,7 @@ namespace Game.Spells
|
||||
// exception are only channeled spells that have no casttime and SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING
|
||||
// (even if they are interrupted on moving, spells with almost immediate effect get to have their effect processed before movement interrupter kicks in)
|
||||
// don't cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect
|
||||
if (((m_spellInfo.IsChanneled() || m_casttime != 0) && m_caster.IsTypeId(TypeId.Player) && !(m_caster.IsCharmed() && m_caster.GetCharmerGUID().IsCreature()) && m_caster.isMoving() &&
|
||||
if (((m_spellInfo.IsChanneled() || m_casttime != 0) && m_caster.IsTypeId(TypeId.Player) && !(m_caster.IsCharmed() && m_caster.GetCharmerGUID().IsCreature()) && m_caster.IsMoving() &&
|
||||
m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) && !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo)))
|
||||
{
|
||||
// 1. Has casttime, 2. Or doesn't have flag to allow movement during channel
|
||||
@@ -2598,7 +2597,7 @@ namespace Game.Spells
|
||||
{
|
||||
Pet playerPet = playerCaster.GetPet();
|
||||
if (playerPet != null)
|
||||
if (playerPet.IsAlive() && playerPet.isControlled() && Convert.ToBoolean(m_targets.GetTargetMask() & SpellCastTargetFlags.Unit))
|
||||
if (playerPet.IsAlive() && playerPet.IsControlled() && Convert.ToBoolean(m_targets.GetTargetMask() & SpellCastTargetFlags.Unit))
|
||||
playerPet.GetAI().OwnerAttacked(m_targets.GetUnitTarget());
|
||||
}
|
||||
}
|
||||
@@ -3017,13 +3016,13 @@ namespace Game.Spells
|
||||
m_caster.m_playerMovingMe.GainSpellComboPoints(m_comboPointGain);
|
||||
}
|
||||
|
||||
if (m_caster.m_extraAttacks != 0 && m_spellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
|
||||
if (m_caster.ExtraAttacks != 0 && m_spellInfo.HasEffect(SpellEffectName.AddExtraAttacks))
|
||||
{
|
||||
Unit victim = Global.ObjAccessor.GetUnit(m_caster, m_targets.GetOrigUnitTargetGUID());
|
||||
if (victim)
|
||||
m_caster.HandleProcExtraAttackFor(victim);
|
||||
else
|
||||
m_caster.m_extraAttacks = 0;
|
||||
m_caster.ExtraAttacks = 0;
|
||||
}
|
||||
|
||||
// Handle procs on finish
|
||||
@@ -3070,7 +3069,7 @@ namespace Game.Spells
|
||||
// with the exception of spells affected with SPELL_AURA_CAST_WHILE_WALKING effect
|
||||
SpellEffectInfo effect = GetEffect(0);
|
||||
if ((m_caster.IsTypeId(TypeId.Player) && m_timer != 0) &&
|
||||
m_caster.isMoving() && m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) &&
|
||||
m_caster.IsMoving() && m_spellInfo.InterruptFlags.HasAnyFlag(SpellInterruptFlags.Movement) &&
|
||||
((effect != null && effect.Effect != SpellEffectName.Stuck) || !m_caster.HasUnitMovementFlag(MovementFlag.FallingFar)) &&
|
||||
!m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo))
|
||||
{
|
||||
@@ -3181,7 +3180,7 @@ namespace Game.Spells
|
||||
if (spellInfo != null && spellInfo.IconFileDataId == 134230)
|
||||
{
|
||||
Log.outDebug(LogFilter.Spells, "Statue {0} is unsummoned in spell {1} finish", m_caster.GetGUID().ToString(), m_spellInfo.Id);
|
||||
m_caster.setDeathState(DeathState.JustDied);
|
||||
m_caster.SetDeathState(DeathState.JustDied);
|
||||
return;
|
||||
}
|
||||
}
|
||||
@@ -3200,10 +3199,10 @@ namespace Game.Spells
|
||||
}
|
||||
if (!found && !m_spellInfo.HasAttribute(SpellAttr2.NotResetAutoActions))
|
||||
{
|
||||
m_caster.resetAttackTimer(WeaponAttackType.BaseAttack);
|
||||
if (m_caster.haveOffhandWeapon())
|
||||
m_caster.resetAttackTimer(WeaponAttackType.OffAttack);
|
||||
m_caster.resetAttackTimer(WeaponAttackType.RangedAttack);
|
||||
m_caster.ResetAttackTimer(WeaponAttackType.BaseAttack);
|
||||
if (m_caster.HaveOffhandWeapon())
|
||||
m_caster.ResetAttackTimer(WeaponAttackType.OffAttack);
|
||||
m_caster.ResetAttackTimer(WeaponAttackType.RangedAttack);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4259,7 +4258,7 @@ namespace Game.Spells
|
||||
|
||||
// positive spells distribute threat among all units that are in combat with target, like healing
|
||||
if (m_spellInfo.IsPositive())
|
||||
target.getHostileRefManager().threatAssist(m_caster, threatToAdd, m_spellInfo);
|
||||
target.GetHostileRefManager().threatAssist(m_caster, threatToAdd, m_spellInfo);
|
||||
// for negative spells threat gets distributed among affected targets
|
||||
else
|
||||
{
|
||||
@@ -4432,7 +4431,7 @@ namespace Game.Spells
|
||||
// cancel autorepeat spells if cast start when moving
|
||||
// (not wand currently autorepeat cast delayed to moving stop anyway in spell update code)
|
||||
// Do not cancel spells which are affected by a SPELL_AURA_CAST_WHILE_WALKING effect
|
||||
if (m_caster.IsTypeId(TypeId.Player) && m_caster.ToPlayer().isMoving() && (!m_caster.IsCharmed() || !m_caster.GetCharmerGUID().IsCreature()) && !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo))
|
||||
if (m_caster.IsTypeId(TypeId.Player) && m_caster.ToPlayer().IsMoving() && (!m_caster.IsCharmed() || !m_caster.GetCharmerGUID().IsCreature()) && !m_caster.HasAuraTypeWithAffectMask(AuraType.CastWhileWalking, m_spellInfo))
|
||||
{
|
||||
// skip stuck spell to allow use it in falling case and apply spell limitations at movement
|
||||
SpellEffectInfo effect = GetEffect(0);
|
||||
@@ -4670,7 +4669,7 @@ namespace Game.Spells
|
||||
return SpellCastResult.DontReport;
|
||||
|
||||
Unit target = m_targets.GetUnitTarget();
|
||||
if (target == null || !target.IsFriendlyTo(m_caster) || target.getAttackers().Empty())
|
||||
if (target == null || !target.IsFriendlyTo(m_caster) || target.GetAttackers().Empty())
|
||||
return SpellCastResult.BadTargets;
|
||||
|
||||
}
|
||||
@@ -4694,7 +4693,7 @@ namespace Game.Spells
|
||||
if (learn_spellproto == null)
|
||||
return SpellCastResult.NotKnown;
|
||||
|
||||
if (m_spellInfo.SpellLevel > pet.getLevel())
|
||||
if (m_spellInfo.SpellLevel > pet.GetLevel())
|
||||
return SpellCastResult.Lowlevel;
|
||||
|
||||
break;
|
||||
@@ -4726,7 +4725,7 @@ namespace Game.Spells
|
||||
if (learn_spellproto == null)
|
||||
return SpellCastResult.NotKnown;
|
||||
|
||||
if (m_spellInfo.SpellLevel > pet.getLevel())
|
||||
if (m_spellInfo.SpellLevel > pet.GetLevel())
|
||||
return SpellCastResult.Lowlevel;
|
||||
}
|
||||
break;
|
||||
@@ -5136,7 +5135,7 @@ namespace Game.Spells
|
||||
if (spec.IsPetSpecialization())
|
||||
{
|
||||
Pet pet = player.GetPet();
|
||||
if (!pet || pet.getPetType() != PetType.Hunter || pet.GetCharmInfo() == null)
|
||||
if (!pet || pet.GetPetType() != PetType.Hunter || pet.GetCharmInfo() == null)
|
||||
return SpellCastResult.NoPet;
|
||||
}
|
||||
|
||||
@@ -5734,7 +5733,7 @@ namespace Game.Spells
|
||||
}
|
||||
}
|
||||
|
||||
if (target && m_caster.isMoving() && target.isMoving() && !m_caster.IsWalking() && !target.IsWalking() &&
|
||||
if (target && m_caster.IsMoving() && target.IsMoving() && !m_caster.IsWalking() && !target.IsWalking() &&
|
||||
(m_spellInfo.RangeEntry.Flags.HasAnyFlag(SpellRangeFlag.Melee) || target.IsTypeId(TypeId.Player)))
|
||||
rangeMod += 8.0f / 3.0f;
|
||||
}
|
||||
@@ -6715,7 +6714,7 @@ namespace Game.Spells
|
||||
if (!m_CastItem && m_caster.IsTypeId(TypeId.Player))
|
||||
skillValue = m_caster.ToPlayer().GetSkillValue(skillId);
|
||||
else if (lockInfo.Index[j] == (uint)LockType.Lockpicking)
|
||||
skillValue = (int)m_caster.getLevel() * 5;
|
||||
skillValue = (int)m_caster.GetLevel() * 5;
|
||||
|
||||
// skill bonus provided by casting spell (mostly item spells)
|
||||
// add the effect base points modifier from the spell cast (cheat lock / skeleton key etc.)
|
||||
@@ -7745,7 +7744,7 @@ namespace Game.Spells
|
||||
{
|
||||
if (_spellInfo.HasAttribute(SpellCustomAttributes.ConeBack))
|
||||
{
|
||||
if (!_caster.isInBack(target, _coneAngle))
|
||||
if (!_caster.IsInBack(target, _coneAngle))
|
||||
return false;
|
||||
}
|
||||
else if (_spellInfo.HasAttribute(SpellCustomAttributes.ConeLine))
|
||||
|
||||
@@ -193,7 +193,7 @@ namespace Game.Spells
|
||||
case 51963:
|
||||
{
|
||||
// about +4 base spell dmg per level
|
||||
damage = (int)(m_caster.getLevel() - 60) * 4 + 60;
|
||||
damage = (int)(m_caster.GetLevel() - 60) * 4 + 60;
|
||||
break;
|
||||
}
|
||||
}
|
||||
@@ -282,7 +282,7 @@ namespace Game.Spells
|
||||
hit.effectMask &= ~Convert.ToUInt32(1 << 1);
|
||||
|
||||
// not empty (checked), copy
|
||||
var attackers = unitTarget.getAttackers();
|
||||
var attackers = unitTarget.GetAttackers();
|
||||
|
||||
// remove invalid attackers
|
||||
foreach (var att in attackers)
|
||||
@@ -1281,11 +1281,11 @@ namespace Game.Spells
|
||||
{
|
||||
case 24571: // Blood Fury
|
||||
// Instantly increases your rage by ${(300-10*$max(0,$PL-60))/10}.
|
||||
damage -= 10 * (int)Math.Max(0, Math.Min(30, m_caster.getLevel() - 60));
|
||||
damage -= 10 * (int)Math.Max(0, Math.Min(30, m_caster.GetLevel() - 60));
|
||||
break;
|
||||
case 24532: // Burst of Energy
|
||||
// Instantly increases your energy by ${60-4*$max(0,$min(15,$PL-60))}.
|
||||
damage -= 4 * (int)Math.Max(0, Math.Min(15, m_caster.getLevel() - 60));
|
||||
damage -= 4 * (int)Math.Max(0, Math.Min(15, m_caster.GetLevel() - 60));
|
||||
break;
|
||||
case 67490: // Runic Mana Injector (mana gain increased by 25% for engineers - 3.2.0 patch change)
|
||||
{
|
||||
@@ -1334,7 +1334,7 @@ namespace Game.Spells
|
||||
if (gameObjTarget != null)
|
||||
{
|
||||
// Players shouldn't be able to loot gameobjects that are currently despawned
|
||||
if (!gameObjTarget.isSpawned() && !player.IsGameMaster())
|
||||
if (!gameObjTarget.IsSpawned() && !player.IsGameMaster())
|
||||
{
|
||||
Log.outError(LogFilter.Spells, "Possible hacking attempt: Player {0} [{1}] tried to loot a gameobject [{2}] which is on respawn time without being in GM mode!",
|
||||
player.GetName(), player.GetGUID().ToString(), gameObjTarget.GetGUID().ToString());
|
||||
@@ -2408,14 +2408,14 @@ namespace Game.Spells
|
||||
|
||||
OldSummon.NearTeleportTo(px, py, pz, OldSummon.GetOrientation());
|
||||
|
||||
if (owner.IsTypeId(TypeId.Player) && OldSummon.isControlled())
|
||||
if (owner.IsTypeId(TypeId.Player) && OldSummon.IsControlled())
|
||||
owner.ToPlayer().PetSpellInitialize();
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
if (owner.IsTypeId(TypeId.Player))
|
||||
owner.ToPlayer().RemovePet(OldSummon, (OldSummon.getPetType() == PetType.Hunter ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot), false);
|
||||
owner.ToPlayer().RemovePet(OldSummon, (OldSummon.GetPetType() == PetType.Hunter ? PetSaveMode.AsDeleted : PetSaveMode.NotInSlot), false);
|
||||
else
|
||||
return;
|
||||
}
|
||||
@@ -2466,7 +2466,7 @@ namespace Game.Spells
|
||||
if (learn_spellproto == null)
|
||||
return;
|
||||
|
||||
pet.learnSpell(learn_spellproto.Id);
|
||||
pet.LearnSpell(learn_spellproto.Id);
|
||||
pet.SavePetToDB(PetSaveMode.AsCurrent);
|
||||
pet.GetOwner().PetSpellInitialize();
|
||||
}
|
||||
@@ -3391,16 +3391,16 @@ namespace Game.Spells
|
||||
if (unitTarget == null)
|
||||
return;
|
||||
|
||||
unitTarget.getHostileRefManager().UpdateVisibility();
|
||||
unitTarget.GetHostileRefManager().UpdateVisibility();
|
||||
|
||||
var attackers = unitTarget.getAttackers();
|
||||
var attackers = unitTarget.GetAttackers();
|
||||
foreach (var unit in attackers)
|
||||
{
|
||||
if (!unit.CanSeeOrDetect(unitTarget))
|
||||
unit.AttackStop();
|
||||
}
|
||||
|
||||
unitTarget.m_lastSanctuaryTime = GameTime.GetGameTimeMS();
|
||||
unitTarget.LastSanctuaryTime = GameTime.GetGameTimeMS();
|
||||
|
||||
// Vanish allows to remove all threat and cast regular stealth so other spells can be used
|
||||
if (m_caster.IsTypeId(TypeId.Player)
|
||||
@@ -3481,7 +3481,7 @@ namespace Game.Spells
|
||||
PhasingHandler.InheritPhaseShift(go, m_caster);
|
||||
|
||||
go.SetFaction(m_caster.GetFaction());
|
||||
go.SetLevel(m_caster.getLevel() + 1);
|
||||
go.SetLevel(m_caster.GetLevel() + 1);
|
||||
int duration = m_spellInfo.CalcDuration(m_caster);
|
||||
go.SetRespawnTime(duration > 0 ? duration / Time.InMilliseconds : 0);
|
||||
go.SetSpellId(m_spellInfo.Id);
|
||||
@@ -3867,10 +3867,10 @@ namespace Game.Spells
|
||||
if (!unitTarget || !unitTarget.IsAlive())
|
||||
return;
|
||||
|
||||
if (unitTarget.m_extraAttacks != 0)
|
||||
if (unitTarget.ExtraAttacks != 0)
|
||||
return;
|
||||
|
||||
unitTarget.m_extraAttacks = (uint)damage;
|
||||
unitTarget.ExtraAttacks = (uint)damage;
|
||||
|
||||
ExecuteLogEffectExtraAttacks(effIndex, unitTarget, (uint)damage);
|
||||
}
|
||||
@@ -3983,7 +3983,7 @@ namespace Game.Spells
|
||||
|
||||
// we should also force pets to remove us from current target
|
||||
List<Unit> attackerSet = new List<Unit>();
|
||||
foreach (var unit in m_caster.getAttackers())
|
||||
foreach (var unit in m_caster.GetAttackers())
|
||||
if (unit.GetTypeId() == TypeId.Unit && !unit.CanHaveThreatList())
|
||||
attackerSet.Add(unit);
|
||||
|
||||
@@ -4086,7 +4086,7 @@ namespace Game.Spells
|
||||
// tied to one of existing expansion fields in creature_template?
|
||||
|
||||
// Double chances for elites
|
||||
m_caster.ToPlayer().UpdateGatherSkill(skill, (uint)damage, (uint)reqValue, (uint)(creature.isElite() ? 2 : 1));
|
||||
m_caster.ToPlayer().UpdateGatherSkill(skill, (uint)damage, (uint)reqValue, (uint)(creature.IsElite() ? 2 : 1));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -4176,7 +4176,7 @@ namespace Game.Spells
|
||||
|
||||
Creature creatureTarget = unitTarget.ToCreature();
|
||||
if (creatureTarget)
|
||||
if (creatureTarget.isWorldBoss() || creatureTarget.IsDungeonBoss())
|
||||
if (creatureTarget.IsWorldBoss() || creatureTarget.IsDungeonBoss())
|
||||
return;
|
||||
|
||||
// Spells with SPELL_EFFECT_KNOCK_BACK (like Thunderstorm) can't knockback target if target has ROOT/STUN
|
||||
@@ -4401,7 +4401,7 @@ namespace Game.Spells
|
||||
|
||||
pet.SetDynamicFlags(UnitDynFlags.HideModel);
|
||||
pet.RemoveUnitFlag(UnitFlags.Skinnable);
|
||||
pet.setDeathState(DeathState.Alive);
|
||||
pet.SetDeathState(DeathState.Alive);
|
||||
pet.ClearUnitState(UnitState.AllState);
|
||||
pet.SetHealth(pet.CountPctFromMaxHealth(damage));
|
||||
|
||||
@@ -5061,7 +5061,7 @@ namespace Game.Spells
|
||||
caster = caster.ToTotem().GetOwner();
|
||||
|
||||
// in another case summon new
|
||||
uint level = caster.getLevel();
|
||||
uint level = caster.GetLevel();
|
||||
|
||||
// level of pet summoned using engineering item based at engineering skill level
|
||||
if (m_CastItem != null && caster.IsTypeId(TypeId.Player))
|
||||
@@ -5128,7 +5128,7 @@ namespace Game.Spells
|
||||
return;
|
||||
|
||||
if (unitTarget == null || !unitTarget.IsTypeId(TypeId.Unit) ||
|
||||
!unitTarget.IsPet() || unitTarget.ToPet().getPetType() != PetType.Hunter)
|
||||
!unitTarget.IsPet() || unitTarget.ToPet().GetPetType() != PetType.Hunter)
|
||||
return;
|
||||
|
||||
unitTarget.AddPetFlag(UnitPetFlags.CanBeRenamed);
|
||||
|
||||
@@ -1083,7 +1083,7 @@ namespace Game.Spells
|
||||
{
|
||||
Creature targetCreature = unitTarget.ToCreature();
|
||||
if (targetCreature != null)
|
||||
if (targetCreature.hasLootRecipient() && !targetCreature.isTappedBy(caster.ToPlayer()))
|
||||
if (targetCreature.HasLootRecipient() && !targetCreature.IsTappedBy(caster.ToPlayer()))
|
||||
return SpellCastResult.CantCastOnTapped;
|
||||
}
|
||||
|
||||
@@ -2681,7 +2681,7 @@ namespace Game.Spells
|
||||
int castTime = 0;
|
||||
if (CastTimeEntry != null)
|
||||
{
|
||||
int calcLevel = spell != null ? (int)spell.GetCaster().getLevel() : 0;
|
||||
int calcLevel = spell != null ? (int)spell.GetCaster().GetLevel() : 0;
|
||||
if (MaxLevel != 0 && calcLevel > MaxLevel)
|
||||
calcLevel = (int)MaxLevel;
|
||||
|
||||
@@ -2873,7 +2873,7 @@ namespace Game.Spells
|
||||
if (HasAttribute(SpellAttr0.LevelDamageCalculation))
|
||||
{
|
||||
GtNpcManaCostScalerRecord spellScaler = CliDB.NpcManaCostScalerGameTable.GetRow(SpellLevel);
|
||||
GtNpcManaCostScalerRecord casterScaler = CliDB.NpcManaCostScalerGameTable.GetRow(caster.getLevel());
|
||||
GtNpcManaCostScalerRecord casterScaler = CliDB.NpcManaCostScalerGameTable.GetRow(caster.GetLevel());
|
||||
if (spellScaler != null && casterScaler != null)
|
||||
powerCost *= (int)(casterScaler.Scaler / spellScaler.Scaler);
|
||||
}
|
||||
@@ -3023,7 +3023,7 @@ namespace Game.Spells
|
||||
}
|
||||
case SpellProcsPerMinuteModType.Class:
|
||||
{
|
||||
if (caster.getClassMask().HasAnyFlag(mod.Param))
|
||||
if (caster.GetClassMask().HasAnyFlag(mod.Param))
|
||||
ppm *= 1.0f + mod.Coeff;
|
||||
break;
|
||||
}
|
||||
@@ -3037,7 +3037,7 @@ namespace Game.Spells
|
||||
}
|
||||
case SpellProcsPerMinuteModType.Race:
|
||||
{
|
||||
if (caster.getRaceMask().HasAnyFlag(mod.Param))
|
||||
if (caster.GetRaceMask().HasAnyFlag(mod.Param))
|
||||
ppm *= 1.0f + mod.Coeff;
|
||||
break;
|
||||
}
|
||||
@@ -3938,7 +3938,7 @@ namespace Game.Spells
|
||||
{
|
||||
if (GetScalingExpectedStat() == ExpectedStatType.None)
|
||||
{
|
||||
int level = caster ? (int)caster.getLevel() : 0;
|
||||
int level = caster ? (int)caster.GetLevel() : 0;
|
||||
if (level > (int)_spellInfo.MaxLevel && _spellInfo.MaxLevel > 0)
|
||||
level = (int)_spellInfo.MaxLevel;
|
||||
level -= (int)_spellInfo.BaseLevel;
|
||||
@@ -3970,9 +3970,9 @@ namespace Game.Spells
|
||||
{
|
||||
uint level = _spellInfo.SpellLevel;
|
||||
if (target && _spellInfo.IsPositiveEffect(EffectIndex) && (Effect == SpellEffectName.ApplyAura))
|
||||
level = target.getLevel();
|
||||
level = target.GetLevel();
|
||||
else if (caster)
|
||||
level = caster.getLevel();
|
||||
level = caster.GetLevel();
|
||||
|
||||
if (_spellInfo.BaseLevel != 0 && !_spellInfo.HasAttribute(SpellAttr11.ScalesWithItemLevel) && _spellInfo.HasAttribute(SpellAttr10.UseSpellBaseLevelForScaling))
|
||||
level = _spellInfo.BaseLevel;
|
||||
@@ -4040,7 +4040,7 @@ namespace Game.Spells
|
||||
if (contentTuning != null)
|
||||
expansion = contentTuning.ExpansionID;
|
||||
|
||||
uint level = caster ? caster.getLevel() : 1;
|
||||
uint level = caster ? caster.GetLevel() : 1;
|
||||
tempValue = Global.DB2Mgr.EvaluateExpectedStat(stat, level, expansion, 0, Class.None) * BasePoints / 100.0f;
|
||||
}
|
||||
|
||||
@@ -4093,7 +4093,7 @@ namespace Game.Spells
|
||||
|
||||
if (caster != null)
|
||||
{
|
||||
radius += entry.RadiusPerLevel * caster.getLevel();
|
||||
radius += entry.RadiusPerLevel * caster.GetLevel();
|
||||
radius = Math.Min(radius, entry.RadiusMax);
|
||||
Player modOwner = caster.GetSpellModOwner();
|
||||
if (modOwner != null)
|
||||
|
||||
@@ -460,7 +460,7 @@ namespace Game.Entities
|
||||
{
|
||||
Player actor = eventInfo.GetActor().ToPlayer();
|
||||
if (actor)
|
||||
if (eventInfo.GetActionTarget() && !actor.isHonorOrXPTarget(eventInfo.GetActionTarget()))
|
||||
if (eventInfo.GetActionTarget() && !actor.IsHonorOrXPTarget(eventInfo.GetActionTarget()))
|
||||
return false;
|
||||
}
|
||||
|
||||
@@ -3485,7 +3485,7 @@ namespace Game.Entities
|
||||
return false;
|
||||
|
||||
if (raceMask != 0) // not in expected race
|
||||
if (player == null || !Convert.ToBoolean(raceMask & player.getRaceMask()))
|
||||
if (player == null || !Convert.ToBoolean(raceMask & player.GetRaceMask()))
|
||||
return false;
|
||||
|
||||
if (areaId != 0) // not in expected zone
|
||||
|
||||
Reference in New Issue
Block a user