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)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user