Core/Refactor: Part 1
This commit is contained in:
@@ -145,8 +145,6 @@ namespace Game.Entities
|
||||
{
|
||||
if (!GetThreatManager().isThreatListEmpty())
|
||||
{
|
||||
int count = GetThreatManager().getThreatList().Count;
|
||||
|
||||
ThreatUpdate packet = new ThreatUpdate();
|
||||
packet.UnitGUID = GetGUID();
|
||||
var tlist = GetThreatManager().getThreatList();
|
||||
|
||||
@@ -370,30 +370,32 @@ namespace Game.Entities
|
||||
// Set charmed
|
||||
charmer.SetCharm(this, true);
|
||||
|
||||
Player player;
|
||||
if (IsTypeId(TypeId.Unit))
|
||||
{
|
||||
ToCreature().GetAI().OnCharmed(true);
|
||||
GetMotionMaster().MoveIdle();
|
||||
}
|
||||
else if (player = ToPlayer())
|
||||
else
|
||||
{
|
||||
if (player.isAFK())
|
||||
player.ToggleAFK();
|
||||
|
||||
Creature creatureCharmer = charmer.ToCreature();
|
||||
if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature
|
||||
Player player = ToPlayer();
|
||||
if (player)
|
||||
{
|
||||
// change AI to charmed AI on next Update tick
|
||||
NeedChangeAI = true;
|
||||
if (IsAIEnabled)
|
||||
{
|
||||
IsAIEnabled = false;
|
||||
player.GetAI().OnCharmed(true);
|
||||
}
|
||||
}
|
||||
if (player.isAFK())
|
||||
player.ToggleAFK();
|
||||
|
||||
player.SetClientControl(this, false);
|
||||
if (charmer.IsTypeId(TypeId.Unit)) // we are charmed by a creature
|
||||
{
|
||||
// change AI to charmed AI on next Update tick
|
||||
NeedChangeAI = true;
|
||||
if (IsAIEnabled)
|
||||
{
|
||||
IsAIEnabled = false;
|
||||
player.GetAI().OnCharmed(true);
|
||||
}
|
||||
}
|
||||
|
||||
player.SetClientControl(this, false);
|
||||
}
|
||||
}
|
||||
|
||||
// charm is set by aura, and aura effect remove handler was called during apply handler execution
|
||||
|
||||
@@ -3128,9 +3128,9 @@ namespace Game.Entities
|
||||
return null;
|
||||
}
|
||||
|
||||
public List<DispelCharges> GetDispellableAuraList(Unit caster, uint dispelMask)
|
||||
public List<DispelableAura> GetDispellableAuraList(Unit caster, uint dispelMask, bool isReflect = false)
|
||||
{
|
||||
List<DispelCharges> dispelList = new List<DispelCharges>();
|
||||
List<DispelableAura> dispelList = new List<DispelableAura>();
|
||||
|
||||
var auras = GetOwnedAuras();
|
||||
foreach (var pair in auras)
|
||||
@@ -3147,8 +3147,14 @@ namespace Game.Entities
|
||||
if (Convert.ToBoolean(aura.GetSpellInfo().GetDispelMask() & dispelMask))
|
||||
{
|
||||
// do not remove positive auras if friendly target
|
||||
// negative auras if non-friendly target
|
||||
if (aurApp.IsPositive() == IsFriendlyTo(caster))
|
||||
// negative auras if non-friendly
|
||||
// unless we're reflecting (dispeller eliminates one of it's benefitial buffs)
|
||||
if (isReflect != (aurApp.IsPositive() == IsFriendlyTo(caster)))
|
||||
continue;
|
||||
|
||||
// 2.4.3 Patch Notes: "Dispel effects will no longer attempt to remove effects that have 100% dispel resistance."
|
||||
int chance = aura.CalcDispelChance(this, !IsFriendlyTo(caster));
|
||||
if (chance == 0)
|
||||
continue;
|
||||
|
||||
// The charges / stack amounts don't count towards the total number of auras that can be dispelled.
|
||||
@@ -3157,7 +3163,7 @@ namespace Game.Entities
|
||||
bool dispelCharges = aura.GetSpellInfo().HasAttribute(SpellAttr7.DispelCharges);
|
||||
byte charges = dispelCharges ? aura.GetCharges() : aura.GetStackAmount();
|
||||
if (charges > 0)
|
||||
dispelList.Add(new DispelCharges(aura, charges));
|
||||
dispelList.Add(new DispelableAura(aura, chance, charges));
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user