TC Ports:

Core/Misc: 522f537048 followup (https://github.com/TrinityCore/TrinityCore/commit/9a57e95f102a9d35ac8416d02e24c0dddbc755ed)
Core/CreatureAI: b6b0353bff followup (https://github.com/TrinityCore/TrinityCore/commit/5d411e0b21b1f1a4653d274d9b1cc7fef17f232b)
Core/Spell: move creature focus (https://github.com/TrinityCore/TrinityCore/commit/8c12f36915b2fddd48a5e4c9244c2b0498a64ae9)
Core/Unit: 2170541a51 followup (https://github.com/TrinityCore/TrinityCore/commit/2d4549023a6655d19671f7f7e6b4f7c9b71ae632)
Core/Misc: cleanup SetInFront uses (https://github.com/TrinityCore/TrinityCore/commit/104e745edfb89f95e34cad7840eae0b6e183bf94)
Core/Unit: 229444b74a follow-up (https://github.com/TrinityCore/TrinityCore/commit/6a96addadd5dea633b3066b8d0427302ba514364)
Core/Unit: revert 3ea46e57af (https://github.com/TrinityCore/TrinityCore/commit/a46286a803b41b375ed9352858c742626bb85720)
Core/Scripts: remove OnDummyEffect hook/sOnDummyEffect ai hook (https://github.com/TrinityCore/TrinityCore/commit/1929ca3aa14f6cd83ea3ac9d7e8c0e2ed0e87a26)
Core/Entities: moved PetAura handling to Player where it belongs (https://github.com/TrinityCore/TrinityCore/commit/4f6d38fe9d5c07e6e8eb88e517af71b6cdc4f9f8)
Core/Spells: Fixed Chilled to the Bone (https://github.com/TrinityCore/TrinityCore/commit/08635c740a7ee04da9b0cd5045075a9432121b06)
Core/Spell: implement pvp trinket immunity against Judgement of Justice (https://github.com/TrinityCore/TrinityCore/commit/05ba662d5daaa3428cc01cdaa3794bf5a073ef17)
This commit is contained in:
hondacrx
2020-05-19 14:49:37 -04:00
parent efe2cb66e7
commit 2fc4e3e71f
27 changed files with 139 additions and 166 deletions
+27 -6
View File
@@ -930,6 +930,27 @@ namespace Game.Entities
&& !GetCreatureTemplate().FlagsExtra.HasAnyFlag(CreatureFlagsExtra.NoXpAtKill);
}
public override bool IsMovementPreventedByCasting()
{
// first check if currently a movement allowed channel is active and we're not casting
Spell spell = GetCurrentSpell(CurrentSpellTypes.Channeled);
if (spell != null)
{
if (spell.GetState() != SpellState.Finished && spell.IsChannelActive())
if (spell.GetSpellInfo().IsMoveAllowedChannel())
if (HasUnitState(UnitState.Casting))
return true;
}
if (IsFocusing(null, true))
return true;
if (HasUnitState(UnitState.Casting))
return true;
return false;
}
public void StartPickPocketRefillTimer()
{
_pickpocketLootRestore = Time.UnixTime + WorldConfig.GetIntValue(WorldCfg.CreaturePickpocketRefill);
@@ -2768,19 +2789,19 @@ namespace Game.Entities
bool canTurnDuringCast = !focusSpell.GetSpellInfo().HasAttribute(SpellAttr5.DontTurnDuringCast);
// Face the target - we need to do this before the unit state is modified for no-turn spells
if (target)
SetFacingToObject(target);
SetFacingToObject(target, false);
else if (!canTurnDuringCast)
{
Unit victim = GetVictim();
if (victim)
SetFacingToObject(victim); // ensure server-side orientation is correct at beginning of cast
SetFacingToObject(victim, false); // ensure server-side orientation is correct at beginning of cast
}
if (!canTurnDuringCast)
AddUnitState(UnitState.CannotTurn);
}
public override bool IsFocusing(Spell focusSpell = null, bool withDelay = false)
public bool IsFocusing(Spell focusSpell = null, bool withDelay = false)
{
if (!IsAlive()) // dead creatures cannot focus
{
@@ -2821,10 +2842,10 @@ namespace Game.Entities
{
WorldObject objTarget = Global.ObjAccessor.GetWorldObject(this, m_suppressedTarget);
if (objTarget)
SetFacingToObject(objTarget);
SetFacingToObject(objTarget, false);
}
else
SetFacingTo(m_suppressedOrientation);
SetFacingTo(m_suppressedOrientation, false);
}
else
// tell the creature that it should reacquire its actual target after the delay expires (this is handled in ::Update)
@@ -3156,7 +3177,7 @@ namespace Game.Entities
if (target != null && _IsTargetAcceptable(target) && CanCreatureAttack(target))
{
if (!IsFocusing())
if (!IsFocusing(null, true))
SetInFront(target);
return target;
}
+3 -8
View File
@@ -1386,11 +1386,9 @@ namespace Game.Entities
void CastPetAuras(bool current)
{
Unit owner = GetOwner();
if (!owner || !owner.IsTypeId(TypeId.Player))
return;
Player owner = GetOwner();
if (!IsPermanentPetFor(owner.ToPlayer()))
if (!IsPermanentPetFor(owner))
return;
foreach (var pa in owner.m_petAuras)
@@ -1419,10 +1417,7 @@ namespace Game.Entities
bool IsPetAura(Aura aura)
{
Unit owner = GetOwner();
if (!owner || !owner.IsTypeId(TypeId.Player))
return false;
Player owner = GetOwner();
// if the owner has that pet aura, return true
foreach (var petAura in owner.m_petAuras)
@@ -129,6 +129,7 @@ namespace Game.Entities
public bool m_mailsUpdated;
//Pets
public List<PetAura> m_petAuras = new List<PetAura>();
public uint m_stableSlots;
uint m_temporaryUnsummonedPetNumber;
uint m_lastpetnumber;
+18
View File
@@ -4995,6 +4995,24 @@ namespace Game.Entities
}
}
public void AddPetAura(PetAura petSpell)
{
m_petAuras.Add(petSpell);
Pet pet = GetPet();
if (pet != null)
pet.CastPetAura(petSpell);
}
public void RemovePetAura(PetAura petSpell)
{
m_petAuras.Remove(petSpell);
Pet pet = GetPet();
if (pet != null)
pet.RemoveAurasDueToSpell(petSpell.GetAura(pet.GetEntry()));
}
public bool InArena()
{
Battleground bg = GetBattleground();
+7 -4
View File
@@ -184,7 +184,9 @@ namespace Game.Entities
if (target && target == taunter)
return;
SetInFront(taunter);
if (!IsFocusing(null, true))
SetInFront(taunter);
if (creature.IsAIEnabled)
creature.GetAI().AttackStart(taunter);
}
@@ -219,7 +221,8 @@ namespace Game.Entities
if (target && target != taunter)
{
SetInFront(target);
if (!IsFocusing(null, true))
SetInFront(target);
if (creature.IsAIEnabled)
creature.GetAI().AttackStart(target);
}
@@ -597,7 +600,7 @@ namespace Game.Entities
return;
if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled))
SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
// melee attack spell casted at main hand attack only - no normal melee dmg dealt
if (attType == WeaponAttackType.BaseAttack && GetCurrentSpell(CurrentSpellTypes.Melee) != null && !extra)
@@ -678,7 +681,7 @@ namespace Game.Entities
return; // ignore ranged case
if (IsTypeId(TypeId.Unit) && !HasUnitFlag(UnitFlags.PlayerControlled))
SetFacingToObject(victim); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
SetFacingToObject(victim, false); // update client side facing to face the target (prevents visual glitches when casting untargeted spells)
CalcDamageInfo damageInfo = new CalcDamageInfo();
damageInfo.attacker = this;
-1
View File
@@ -92,7 +92,6 @@ namespace Game.Entities
SpellHistory _spellHistory;
//Auras
public List<PetAura> m_petAuras = new List<PetAura>();
List<AuraEffect> AuraEffectList = new List<AuraEffect>();
MultiMap<AuraType, AuraEffect> m_modAuras = new MultiMap<AuraType, AuraEffect>();
List<Aura> m_removedAuras = new List<Aura>();
+5 -4
View File
@@ -164,9 +164,10 @@ namespace Game.Entities
Orientation = GetAngle(target.GetPosition());
}
public void SetFacingTo(float ori, bool force = false)
public void SetFacingTo(float ori, bool force = true)
{
if (!force && !IsStopped())
// do not face when already moving
if (!force && (!IsStopped() || !MoveSpline.Finalized()))
return;
MoveSplineInit init = new MoveSplineInit(this);
@@ -175,10 +176,10 @@ namespace Game.Entities
init.Launch();
}
public void SetFacingToObject(WorldObject obj, bool force = false)
public void SetFacingToObject(WorldObject obj, bool force = true)
{
// do not face when already moving
if (!force && !IsStopped())
if (!force && (!IsStopped() || !MoveSpline.Finalized()))
return;
// @todo figure out under what conditions creature will move towards object instead of facing it where it currently is.
-22
View File
@@ -26,28 +26,6 @@ namespace Game.Entities
{
public partial class Unit
{
public void AddPetAura(PetAura petSpell)
{
if (!IsTypeId(TypeId.Player))
return;
m_petAuras.Add(petSpell);
Pet pet = ToPlayer().GetPet();
if (pet)
pet.CastPetAura(petSpell);
}
public void RemovePetAura(PetAura petSpell)
{
if (!IsTypeId(TypeId.Player))
return;
m_petAuras.Remove(petSpell);
Pet pet = ToPlayer().GetPet();
if (pet)
pet.RemoveAurasDueToSpell(petSpell.GetAura(pet.GetEntry()));
}
public CharmInfo GetCharmInfo() { return m_charmInfo; }
public CharmInfo InitCharmInfo()
+6 -9
View File
@@ -30,11 +30,6 @@ namespace Game.Entities
{
public virtual bool HasSpell(uint spellId) { return false; }
public virtual bool IsFocusing(Spell focusSpell = null, bool withDelay = false)
{
return false;
}
public void SetInstantCast(bool set) { _instantCast = set; }
public bool CanInstantCast() { return _instantCast; }
@@ -1388,7 +1383,12 @@ namespace Game.Entities
return 0;
}
public bool IsMovementPreventedByCasting()
public virtual bool IsFocusing(Spell focusSpell = null, bool withDelay = false) { return false; }
/// <summary>
/// Check if our current channel spell has attribute SPELL_ATTR5_CAN_CHANNEL_WHEN_MOVING
/// </summary>
public virtual bool IsMovementPreventedByCasting()
{
// can always move when not casting
if (!HasUnitState(UnitState.Casting))
@@ -1401,9 +1401,6 @@ namespace Game.Entities
if (spell.GetSpellInfo().IsMoveAllowedChannel())
return false;
if (IsFocusing(null, true))
return false;
// prohibit movement for all other spell casts
return true;
}