Core/Unit: don't clear low health aura states on death
Core/Gossip: Fix gossip bug on modify money
Core/Spells: Change the radius of PBAoEs following the feedback received on
Core/Player: update interaction checks, some info taken from client
Core/Spell: abort channeling if no valid targets are found after searching
Core/Creature: fix _DespawnAtEvade saving wrong respawn time
Core/Spell: fixed some problems with per caster aura states
Quickfix a bug introduced by 2f19d97 which prevented GTAoE from being cast.
Core/SmartAI: allow SMART_ACTION_SEND_GOSSIP_MENU to override default gossip
Core/Spell: in case of immunity, check all effects to choose correct procFlags, as none has technically hit
Fix evade issues when a spell hits the target just before evading.
Scripts/Command: implement .debug play music command
Partial revert, Unit::getAttackerForHelper() shouldn't return units that we aren't in combat with (victim can be such a unit for players/player pets, which can startattack from a distance without entering combat).
Fix an issue where CanSpawn would never get invoked on creatures without per-guid script.
Core/Players: fix null dereference crash
This commit is contained in:
hondacrx
2020-06-21 13:01:24 -04:00
parent c1f79334ef
commit 1a2411ae0f
14 changed files with 189 additions and 109 deletions
+27 -6
View File
@@ -376,6 +376,11 @@ namespace Game.Entities
if (IsTypeId(TypeId.Player) && IsMounted())
return false;
Creature creature = ToCreature();
// creatures cannot attack while evading
if (creature != null && creature.IsInEvadeMode())
return false;
if (HasUnitFlag(UnitFlags.Pacified))
return false;
@@ -436,7 +441,7 @@ namespace Game.Entities
if (meleeAttack)
AddUnitState(UnitState.MeleeAttacking);
if (IsTypeId(TypeId.Unit) && !IsPet())
if (creature != null && !IsPet())
{
// should not let player enter combat by right clicking target - doesn't helps
AddThreat(victim, 0.0f);
@@ -445,8 +450,8 @@ namespace Game.Entities
if (victim.IsTypeId(TypeId.Player))
victim.SetInCombatWith(this);
ToCreature().SendAIReaction(AiReaction.Hostile);
ToCreature().CallAssistance();
creature.SendAIReaction(AiReaction.Hostile);
creature.CallAssistance();
// Remove emote state - will be restored on creature reset
SetEmoteState(Emote.OneshotNone);
@@ -536,12 +541,28 @@ namespace Game.Entities
}
public Unit GetAttackerForHelper()
{
if (GetVictim() != null)
return GetVictim();
Unit victim = GetVictim();
if (victim != null)
if (!IsControlledByPlayer() || IsInCombatWith(victim) || victim.IsInCombatWith(this))
return victim;
if (attackerList.Count != 0)
if (!attackerList.Empty())
return attackerList[0];
Player owner = GetCharmerOrOwnerPlayerOrPlayerItself();
if (owner != null)
{
HostileReference refe = owner.GetHostileRefManager().GetFirst();
while (refe != null)
{
Unit hostile = refe.GetSource().GetOwner();
if (hostile != null)
return hostile;
refe = refe.Next();
}
}
return null;
}
public List<Unit> GetAttackers()