[svn] Remove isVisible function. Check stealth and invisible in canAttack();
Use new remove aura by interrupt flag function. --HG-- branch : trunk
This commit is contained in:
@@ -2,8 +2,10 @@ DELETE FROM spell_linked_spell WHERE `spell_trigger` IN (39992, 39835, 42052, -4
|
||||
-- INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39992, 39835, 1, 'Needle Spine');
|
||||
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39835, 39968, 1, 'Needle Spine');
|
||||
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41376, 41377, 0, 'Spite');
|
||||
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41914, 41915, 0, 'Summon Parasitic Shadowfiend');
|
||||
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (41126, 41131, 1, 'Flame Crash');
|
||||
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (-41914, 41915, 0, 'Summon Parasitic Shadowfiend');
|
||||
INSERT INTO spell_linked_spell (`spell_trigger`, `spell_effect`, `type`, `comment`) VALUES (39908, 40017, 1, 'Eye Blast');
|
||||
|
||||
|
||||
-- molten_flame
|
||||
UPDATE creature_template SET flags_extra = 128, speed = 1.0 WHERE entry = 23095;
|
||||
@@ -12,4 +14,6 @@ UPDATE creature_template SET spell1 = 40117, flags_extra = 128, scriptname = ''
|
||||
-- flame crash
|
||||
update creature_template set spell1 = 40836, flags_extra = 128, scriptname = '' where entry = 23336;
|
||||
-- blaze
|
||||
update creature_template set spell1 = 40610, flags_extra = 128, scriptname = '' where entry = 23259;
|
||||
update creature_template set spell1 = 40610, flags_extra = 128, scriptname = '' where entry = 23259;
|
||||
-- glaive
|
||||
update creature_template set scriptname = 'mob_blade_of_azzinoth' where entry = 22996;
|
||||
@@ -73,18 +73,18 @@ bool ScriptedAI::IsVisible(Unit* who) const
|
||||
|
||||
void ScriptedAI::MoveInLineOfSight(Unit *who)
|
||||
{
|
||||
if (!m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature))
|
||||
{
|
||||
if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
if(m_creature->getVictim() || !m_creature->IsHostileTo(who) || !who->isInAccessablePlaceFor(m_creature))
|
||||
return;
|
||||
|
||||
float attackRadius = m_creature->GetAttackDistance(who);
|
||||
if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who))
|
||||
{
|
||||
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
|
||||
AttackStart(who);
|
||||
}
|
||||
}
|
||||
if(!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
|
||||
if(!m_creature->IsWithinDistInMap(who, m_creature->GetAttackDistance(who)) || !m_creature->IsWithinLOSInMap(who))
|
||||
return;
|
||||
|
||||
if(m_creature->canAttack(who))
|
||||
//who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
|
||||
AttackStart(who);
|
||||
}
|
||||
|
||||
void ScriptedAI::AttackStart(Unit* who, bool melee)
|
||||
@@ -777,7 +777,7 @@ std::list<Creature*> ScriptedAI::DoFindFriendlyMissingBuff(float range, uint32 s
|
||||
|
||||
void Scripted_NoMovementAI::MoveInLineOfSight(Unit *who)
|
||||
{
|
||||
if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) )
|
||||
if( !m_creature->getVictim() && m_creature->canAttack(who) && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) )
|
||||
{
|
||||
if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
|
||||
@@ -1195,8 +1195,7 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
|
||||
if (m_creature->isCivilian() && m_creature->IsNeutralToAll())
|
||||
return;
|
||||
|
||||
|
||||
if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
|
||||
if (m_creature->canAttack(who) && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who))
|
||||
{
|
||||
if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE)
|
||||
return;
|
||||
@@ -1204,8 +1203,8 @@ struct TRINITY_DLL_DECL Mob_EventAI : public ScriptedAI
|
||||
float attackRadius = m_creature->GetAttackDistance(who);
|
||||
if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who))
|
||||
{
|
||||
if(who->HasStealthAura())
|
||||
who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
|
||||
//if(who->HasStealthAura())
|
||||
// who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);
|
||||
|
||||
//Begin melee attack if we are within range
|
||||
AttackStart(who);
|
||||
|
||||
@@ -413,7 +413,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
|
||||
}
|
||||
EnterPhase(PHASE_FLIGHT);
|
||||
}
|
||||
else
|
||||
else // handle flight sequence
|
||||
Timer[EVENT_FLIGHT_SEQUENCE] = 1000;
|
||||
}
|
||||
|
||||
@@ -691,10 +691,10 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
|
||||
Event = EVENT_NULL;
|
||||
for(uint32 i = 1; i <= MaxTimer[Phase]; i++)
|
||||
{
|
||||
if(Timer[i])
|
||||
if(Timer[i]) // Event is enabled
|
||||
if(Timer[i] <= diff)
|
||||
{
|
||||
if(!Event)
|
||||
if(!Event) // No event with higher priority
|
||||
Event = (EventIllidan)i;
|
||||
}
|
||||
else Timer[i] -= diff;
|
||||
@@ -708,12 +708,12 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
|
||||
break;
|
||||
|
||||
case PHASE_NORMAL_2:
|
||||
if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30)
|
||||
if(HPPCT(m_creature) < 30)
|
||||
EnterPhase(PHASE_TALK_SEQUENCE);
|
||||
break;
|
||||
|
||||
case PHASE_NORMAL_MAIEV:
|
||||
if(m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 1)
|
||||
if(HPPCT(m_creature) < 1)
|
||||
EnterPhase(PHASE_TALK_SEQUENCE);
|
||||
break;
|
||||
|
||||
@@ -758,7 +758,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
|
||||
if(soundid)
|
||||
DoPlaySoundToSet(m_creature, soundid);
|
||||
}
|
||||
Timer[EVENT_TAUNT] = 32000;
|
||||
Timer[EVENT_TAUNT] = 25000 + rand()%10000;
|
||||
break;
|
||||
|
||||
case EVENT_SHEAR:
|
||||
@@ -833,12 +833,9 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
|
||||
case EVENT_MOVE_POINT:
|
||||
Phase = PHASE_FLIGHT_SEQUENCE;
|
||||
Timer[EVENT_FLIGHT_SEQUENCE] = 0;//do not start Event when changing hover point
|
||||
for (uint8 i = 0; i <= rand()%3; i++)
|
||||
{
|
||||
HoverPoint++;
|
||||
if(HoverPoint > 3)
|
||||
HoverPoint = 0;
|
||||
}
|
||||
HoverPoint += (rand()%3 + 1);
|
||||
if(HoverPoint > 3)
|
||||
HoverPoint -= 4;
|
||||
m_creature->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z);
|
||||
break;
|
||||
|
||||
@@ -2059,27 +2056,17 @@ void boss_illidan_stormrageAI::CastEyeBlast()
|
||||
final.x = 2 * final.x - initial.x;
|
||||
final.y = 2 * final.y - initial.y;
|
||||
|
||||
for(uint8 i = 0; i < 2; ++i)//core bug, two buff do not coexist
|
||||
{
|
||||
Creature* Trigger = NULL;
|
||||
Trigger = m_creature->SummonCreature(DEMON_FIRE, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000);
|
||||
if(Trigger)
|
||||
{
|
||||
((demonfireAI*)Trigger->AI())->IsTrigger = true;
|
||||
Trigger->SetSpeed(MOVE_WALK, 3);
|
||||
Trigger->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);
|
||||
Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z);
|
||||
Creature* Trigger = m_creature->SummonCreature(DEMON_FIRE, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000);
|
||||
if(!Trigger) return;
|
||||
|
||||
if(!i)
|
||||
Trigger->CastSpell(Trigger, SPELL_EYE_BLAST_TRIGGER, true);
|
||||
else
|
||||
{
|
||||
Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID());
|
||||
DoCast(Trigger, SPELL_EYE_BLAST);
|
||||
}
|
||||
}
|
||||
}
|
||||
((demonfireAI*)Trigger->AI())->IsTrigger = true;
|
||||
Trigger->SetSpeed(MOVE_WALK, 3);
|
||||
Trigger->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);
|
||||
Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z);
|
||||
|
||||
Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID());
|
||||
DoCast(Trigger, SPELL_EYE_BLAST);
|
||||
}
|
||||
|
||||
void boss_illidan_stormrageAI::SummonFlamesOfAzzinoth()
|
||||
@@ -2162,13 +2149,10 @@ void boss_illidan_stormrageAI::EnterPhase(PhaseIllidan NextPhase)
|
||||
m_creature->InterruptNonMeleeSpells(false);
|
||||
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
|
||||
m_creature->GetMotionMaster()->Clear(false);
|
||||
//m_creature->GetMotionMaster()->MoveIdle();
|
||||
m_creature->AttackStop();
|
||||
break;
|
||||
case PHASE_FLIGHT_SEQUENCE:
|
||||
if(Phase == PHASE_FLIGHT) //land
|
||||
Timer[EVENT_FLIGHT_SEQUENCE] = 2000;
|
||||
else //lift off
|
||||
if(Phase == PHASE_NORMAL) //lift off
|
||||
{
|
||||
FlightCount = 1;
|
||||
Timer[EVENT_FLIGHT_SEQUENCE] = 1;
|
||||
@@ -2176,9 +2160,10 @@ void boss_illidan_stormrageAI::EnterPhase(PhaseIllidan NextPhase)
|
||||
m_creature->InterruptNonMeleeSpells(false);
|
||||
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
|
||||
m_creature->GetMotionMaster()->Clear(false);
|
||||
//m_creature->GetMotionMaster()->MoveIdle();
|
||||
m_creature->AttackStop();
|
||||
}
|
||||
else //land
|
||||
Timer[EVENT_FLIGHT_SEQUENCE] = 2000;
|
||||
break;
|
||||
case PHASE_TRANSFORM_SEQUENCE:
|
||||
if(Phase == PHASE_DEMON)
|
||||
@@ -2191,7 +2176,6 @@ void boss_illidan_stormrageAI::EnterPhase(PhaseIllidan NextPhase)
|
||||
DoPlaySoundToSet(m_creature, SOUND_MORPH);
|
||||
}
|
||||
m_creature->GetMotionMaster()->Clear();
|
||||
//m_creature->GetMotionMaster()->MoveIdle();
|
||||
m_creature->AttackStop();
|
||||
break;
|
||||
default:
|
||||
|
||||
@@ -49,7 +49,7 @@ AggressorAI::MoveInLineOfSight(Unit *u)
|
||||
if( !i_creature.canFly() && i_creature.GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
|
||||
return;
|
||||
|
||||
if( !i_creature.getVictim() && !i_creature.hasUnitState(UNIT_STAT_STUNNED) && u->isTargetableForAttack() &&
|
||||
if( !i_creature.getVictim() && !i_creature.hasUnitState(UNIT_STAT_STUNNED) && i_creature.canAttack(u) &&
|
||||
( i_creature.IsHostileTo( u ) /*|| u->getVictim() && i_creature.IsFriendlyTo( u->getVictim() )*/ ) &&
|
||||
u->isInAccessablePlaceFor(&i_creature) )
|
||||
{
|
||||
|
||||
@@ -1532,6 +1532,11 @@ bool Creature::canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) co
|
||||
return u->IsWithinLOS(GetPositionX(),GetPositionY(),GetPositionZ());
|
||||
}
|
||||
|
||||
bool Creature::IsWithinSightDist(Unit const* u) const
|
||||
{
|
||||
return IsWithinDistInMap(u, sWorld.getConfig(CONFIG_SIGHT_MONSTER));
|
||||
}
|
||||
|
||||
float Creature::GetAttackDistance(Unit const* pl) const
|
||||
{
|
||||
float aggroRate = sWorld.getRate(RATE_CREATURE_AGGRO);
|
||||
@@ -1866,7 +1871,7 @@ bool Creature::IsOutOfThreatArea(Unit* pVictim) const
|
||||
if(!pVictim->IsInMap(this))
|
||||
return true;
|
||||
|
||||
if(!pVictim->isTargetableForAttack())
|
||||
if(!canAttack(pVictim))
|
||||
return true;
|
||||
|
||||
if(!pVictim->isInAccessablePlaceFor(this))
|
||||
|
||||
@@ -548,6 +548,7 @@ class TRINITY_DLL_SPEC Creature : public Unit
|
||||
uint32 m_GlobalCooldown;
|
||||
|
||||
bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const;
|
||||
bool IsWithinSightDist(Unit const* u) const;
|
||||
float GetAttackDistance(Unit const* pl) const;
|
||||
|
||||
void CallAssistence();
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "GameEvent.h"
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
/** \file
|
||||
|
||||
@@ -74,7 +74,7 @@ inline void PlayerCreatureRelocationWorker(Player* pl, Creature* c)
|
||||
// Creature AI reaction
|
||||
if(!c->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))
|
||||
{
|
||||
if( c->AI() && c->AI()->IsVisible(pl) && !c->IsInEvadeMode() )
|
||||
if( c->AI() && c->IsWithinSightDist(pl) /*c->AI()->IsVisible(pl)*/ && !c->IsInEvadeMode() )
|
||||
c->AI()->MoveInLineOfSight(pl);
|
||||
}
|
||||
}
|
||||
@@ -83,13 +83,13 @@ inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2)
|
||||
{
|
||||
if(!c1->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))
|
||||
{
|
||||
if( c1->AI() && c1->AI()->IsVisible(c2) && !c1->IsInEvadeMode() )
|
||||
if( c1->AI() && c1->IsWithinSightDist(c2) /*c1->AI()->IsVisible(c2)*/ && !c1->IsInEvadeMode() )
|
||||
c1->AI()->MoveInLineOfSight(c2);
|
||||
}
|
||||
|
||||
if(!c2->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))
|
||||
{
|
||||
if( c2->AI() && c2->AI()->IsVisible(c1) && !c2->IsInEvadeMode() )
|
||||
if( c2->AI() && c1->IsWithinSightDist(c2) /*c2->AI()->IsVisible(c1)*/ && !c2->IsInEvadeMode() )
|
||||
c2->AI()->MoveInLineOfSight(c1);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -43,7 +43,7 @@ void GuardAI::MoveInLineOfSight(Unit *u)
|
||||
if ( !i_creature.canFly() && i_creature.GetDistanceZ(u) > CREATURE_Z_ATTACK_RANGE )
|
||||
return;
|
||||
|
||||
if( !i_creature.getVictim() && u->isTargetableForAttack() &&
|
||||
if( !i_creature.getVictim() && i_creature.canAttack(u) &&
|
||||
( u->IsHostileToPlayers() || i_creature.IsHostileTo(u) /*|| u->getVictim() && i_creature.IsFriendlyTo(u->getVictim())*/ ) &&
|
||||
u->isInAccessablePlaceFor(&i_creature))
|
||||
{
|
||||
|
||||
+11
-19
@@ -10,12 +10,12 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "MapManager.h"
|
||||
@@ -90,7 +90,7 @@ bool Map::ExistVMap(uint32 mapid,int x,int y)
|
||||
{
|
||||
if(vmgr->isMapLoadingEnabled())
|
||||
{
|
||||
// x and y are swaped !! => fixed now
|
||||
// x and y are swapped !! => fixed now
|
||||
bool exists = vmgr->existsMap((sWorld.GetDataPath()+ "vmaps").c_str(), mapid, x,y);
|
||||
if(!exists)
|
||||
{
|
||||
@@ -106,7 +106,7 @@ bool Map::ExistVMap(uint32 mapid,int x,int y)
|
||||
|
||||
void Map::LoadVMap(int x,int y)
|
||||
{
|
||||
// x and y are swaped !!
|
||||
// x and y are swapped !!
|
||||
int vmapLoadResult = VMAP::VMapFactory::createOrGetVMapManager()->loadMap((sWorld.GetDataPath()+ "vmaps").c_str(), GetId(), x,y);
|
||||
switch(vmapLoadResult)
|
||||
{
|
||||
@@ -144,7 +144,7 @@ void Map::LoadMap(uint32 mapid, uint32 instanceid, int x,int y)
|
||||
return;
|
||||
}
|
||||
|
||||
//map already load, delete it before reloading (Is it neccessary? Do we really need the abilty the reload maps during runtime?)
|
||||
//map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?)
|
||||
if(GridMaps[x][y])
|
||||
{
|
||||
sLog.outDetail("Unloading already loaded map %u before reloading.",mapid);
|
||||
@@ -334,7 +334,7 @@ template void Map::SwitchGridContainers(Corpse *, bool);
|
||||
template<class T>
|
||||
void Map::DeleteFromWorld(T* obj)
|
||||
{
|
||||
// Note: In case resurrectable corpse and pet its removed from gloabal lists in own destructors
|
||||
// Note: In case resurrectable corpse and pet its removed from global lists in own destructor
|
||||
delete obj;
|
||||
}
|
||||
|
||||
@@ -441,7 +441,7 @@ Map::LoadGrid(const Cell& cell, bool no_unload)
|
||||
|
||||
bool Map::Add(Player *player)
|
||||
{
|
||||
player->SetInstanceId(this->GetInstanceId());
|
||||
player->SetInstanceId(GetInstanceId());
|
||||
|
||||
// update player state for other player and visa-versa
|
||||
CellPair p = Trinity::ComputeCellPair(player->GetPositionX(), player->GetPositionY());
|
||||
@@ -670,7 +670,6 @@ Map::Remove(T *obj, bool remove)
|
||||
assert( grid != NULL );
|
||||
|
||||
obj->RemoveFromWorld();
|
||||
|
||||
RemoveFromGrid(obj,grid,cell);
|
||||
|
||||
UpdateObjectVisibility(obj,cell,p);
|
||||
@@ -1390,7 +1389,7 @@ void Map::RemoveAllObjectsInRemoveList()
|
||||
Remove((GameObject*)obj,true);
|
||||
break;
|
||||
case TYPEID_UNIT:
|
||||
// in case triggred sequence some spell can continue casting after prev CleanupsBeforeDelete call
|
||||
// in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call
|
||||
// make sure that like sources auras/etc removed before destructor start
|
||||
((Creature*)obj)->CleanupsBeforeDelete ();
|
||||
Remove((Creature*)obj,true);
|
||||
@@ -1470,13 +1469,6 @@ bool InstanceMap::CanEnter(Player *player)
|
||||
return false;
|
||||
}
|
||||
|
||||
/*if(!player->isGameMaster() && i_data && i_data->IsEncounterInProgress())
|
||||
{
|
||||
sLog.outDebug("InstanceMap::CanEnter - Player '%s' can't enter instance '%s' while an encounter is in progress.", player->GetName(), GetMapName());
|
||||
player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);
|
||||
return false;
|
||||
}*/
|
||||
|
||||
return Map::CanEnter(player);
|
||||
}
|
||||
|
||||
@@ -1586,10 +1578,10 @@ bool InstanceMap::Add(Player *player)
|
||||
|
||||
void InstanceMap::Update(const uint32& t_diff)
|
||||
{
|
||||
Map::Update(t_diff);
|
||||
Map::Update(t_diff);
|
||||
|
||||
if(i_data)
|
||||
i_data->Update(t_diff);
|
||||
if(i_data)
|
||||
i_data->Update(t_diff);
|
||||
}
|
||||
|
||||
void InstanceMap::Remove(Player *player, bool remove)
|
||||
|
||||
@@ -34,7 +34,8 @@ void OutdoorPvPObjectiveAI::MoveInLineOfSight(Unit *u)
|
||||
{
|
||||
// IsVisible only passes for players in range, so no need to check again
|
||||
// leaving/entering distance will be checked based on go range data
|
||||
sOutdoorPvPMgr.HandleCaptureCreaturePlayerMoveInLos(((Player*)u),&i_creature);
|
||||
if((u->GetTypeId() == TYPEID_PLAYER) && i_creature.IsWithinDistInMap(u, MAX_OUTDOOR_PVP_DISTANCE))
|
||||
sOutdoorPvPMgr.HandleCaptureCreaturePlayerMoveInLos(((Player*)u),&i_creature);
|
||||
}
|
||||
|
||||
int OutdoorPvPObjectiveAI::Permissible(const Creature * c)
|
||||
|
||||
+2
-2
@@ -48,7 +48,7 @@ void PetAI::MoveInLineOfSight(Unit *u)
|
||||
{
|
||||
if( !i_pet.getVictim() && i_pet.GetCharmInfo() &&
|
||||
i_pet.GetCharmInfo()->HasReactState(REACT_AGGRESSIVE) &&
|
||||
u->isTargetableForAttack() && i_pet.IsHostileTo( u ) &&
|
||||
i_pet.IsHostileTo( u ) && i_pet.canAttack(u) &&
|
||||
u->isInAccessablePlaceFor(&i_pet))
|
||||
{
|
||||
float attackRadius = i_pet.GetAttackDistance(u);
|
||||
@@ -95,7 +95,7 @@ bool PetAI::_needToStop() const
|
||||
if(i_pet.isCharmed() && i_pet.getVictim() == i_pet.GetCharmer())
|
||||
return true;
|
||||
|
||||
return !i_pet.getVictim()->isTargetableForAttack();
|
||||
return !i_pet.canAttack(i_pet.getVictim());
|
||||
}
|
||||
|
||||
void PetAI::_stopAttack()
|
||||
|
||||
+1
-1
@@ -16546,7 +16546,7 @@ bool Player::ActivateTaxiPathTo(std::vector<uint32> const& nodes, uint32 mount_i
|
||||
ModifyMoney(-(int32)totalcost);
|
||||
|
||||
// prevent stealth flight
|
||||
RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH);
|
||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH);
|
||||
|
||||
WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4);
|
||||
data << uint32(ERR_TAXIOK);
|
||||
|
||||
@@ -45,7 +45,7 @@ bool PossessedAI::_needToStop() const
|
||||
if(i_pet.getVictim() == i_pet.GetCharmer())
|
||||
return true;
|
||||
|
||||
return !i_pet.getVictim()->isTargetableForAttack();
|
||||
return !i_pet.canAttack(i_pet.getVictim());
|
||||
}
|
||||
|
||||
void PossessedAI::_stopAttack()
|
||||
|
||||
+11
-12
@@ -10,12 +10,12 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "Common.h"
|
||||
@@ -1005,7 +1005,7 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
|
||||
//if(!IsPositiveSpell(m_spellInfo->Id))
|
||||
{
|
||||
//do not remove feign death
|
||||
unit->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE);
|
||||
unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE);
|
||||
}
|
||||
}
|
||||
else
|
||||
@@ -2147,7 +2147,7 @@ void Spell::prepare(SpellCastTargets * targets, Aura* triggeredByAura)
|
||||
// skip triggered spell (item equip spell casting and other not explicit character casts/item uses)
|
||||
if ( !m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) )
|
||||
{
|
||||
m_caster->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH);
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH);
|
||||
}
|
||||
|
||||
if(m_IsTriggeredSpell)
|
||||
@@ -2206,7 +2206,7 @@ void Spell::cancel()
|
||||
void Spell::cast(bool skipCheck)
|
||||
{
|
||||
SetExecutedCurrently(true);
|
||||
|
||||
|
||||
uint8 castResult = 0;
|
||||
|
||||
// update pointers base at GUIDs to prevent access to non-existed already object
|
||||
@@ -2321,7 +2321,7 @@ void Spell::cast(bool skipCheck)
|
||||
// Immediate spell, no big deal
|
||||
handle_immediate();
|
||||
}
|
||||
|
||||
|
||||
SetExecutedCurrently(false);
|
||||
}
|
||||
|
||||
@@ -3082,7 +3082,7 @@ void Spell::SendChannelStart(uint32 duration)
|
||||
{
|
||||
WorldObject* target = NULL;
|
||||
|
||||
// select first not rsusted target from target list for _0_ effect
|
||||
// select first not resisted target from target list for _0_ effect
|
||||
if(!m_UniqueTargetInfo.empty())
|
||||
{
|
||||
for(std::list<TargetInfo>::iterator itr= m_UniqueTargetInfo.begin();itr != m_UniqueTargetInfo.end();++itr)
|
||||
@@ -3340,7 +3340,7 @@ void Spell::TriggerSpell()
|
||||
{
|
||||
for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si)
|
||||
{
|
||||
Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, this->m_selfContainer);
|
||||
Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer);
|
||||
spell->prepare(&m_targets); // use original spell original targets
|
||||
}
|
||||
}
|
||||
@@ -3398,7 +3398,6 @@ uint8 Spell::CanCast(bool strict)
|
||||
if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot)))
|
||||
return SPELL_FAILED_TARGET_AURASTATE;
|
||||
|
||||
|
||||
if(target != m_caster)
|
||||
{
|
||||
// target state requirements (apply to non-self only), to allow cast affects to self like Dirty Deeds
|
||||
@@ -4076,7 +4075,7 @@ int16 Spell::PetCanCast(Unit* target)
|
||||
if(!m_caster->isAlive())
|
||||
return SPELL_FAILED_CASTER_DEAD;
|
||||
|
||||
if(m_caster->IsNonMeleeSpellCasted(false)) //prevent spellcast interuption by another spellcast
|
||||
if(m_caster->IsNonMeleeSpellCasted(false)) //prevent spellcast interruption by another spellcast
|
||||
return SPELL_FAILED_SPELL_IN_PROGRESS;
|
||||
if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo))
|
||||
return SPELL_FAILED_AFFECTING_COMBAT;
|
||||
@@ -4168,7 +4167,7 @@ uint8 Spell::CheckCasterAuras() const
|
||||
else if(m_spellInfo->EffectApplyAuraName[i] == SPELL_AURA_DISPEL_IMMUNITY)
|
||||
dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i]));
|
||||
}
|
||||
//immune movement impairement and loss of control
|
||||
//immune movement impairment and loss of control
|
||||
if(m_spellInfo->Id==(uint32)42292)
|
||||
mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK;
|
||||
}
|
||||
@@ -4650,7 +4649,7 @@ uint8 Spell::CheckItems()
|
||||
return SPELL_FAILED_CANT_BE_DISENCHANTED;
|
||||
|
||||
uint32 item_quality = itemProto->Quality;
|
||||
// 2.0.x addon: Check player enchanting level agains the item desenchanting requirements
|
||||
// 2.0.x addon: Check player enchanting level against the item disenchanting requirements
|
||||
uint32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill;
|
||||
if (item_disenchantskilllevel == uint32(-1))
|
||||
return SPELL_FAILED_CANT_BE_DISENCHANTED;
|
||||
|
||||
+4
-4
@@ -10,12 +10,12 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef __SPELL_H
|
||||
@@ -578,14 +578,14 @@ namespace Trinity
|
||||
switch (i_TargetType)
|
||||
{
|
||||
case SPELL_TARGETS_FRIENDLY:
|
||||
if (!itr->getSource()->isTargetableForAttack() || !i_caster->IsFriendlyTo( itr->getSource() ))
|
||||
if (!itr->getSource()->isAttackableByAOE() || !i_caster->IsFriendlyTo( itr->getSource() ))
|
||||
continue;
|
||||
break;
|
||||
case SPELL_TARGETS_AOE_DAMAGE:
|
||||
{
|
||||
if(itr->getSource()->GetTypeId()==TYPEID_UNIT && ((Creature*)itr->getSource())->isTotem())
|
||||
continue;
|
||||
if(!itr->getSource()->isTargetableForAttack())
|
||||
if(!itr->getSource()->isAttackableByAOE())
|
||||
continue;
|
||||
|
||||
Unit* check = i_caster->GetCharmerOrOwnerOrSelf();
|
||||
|
||||
@@ -3477,7 +3477,7 @@ void Spell::EffectPickPocket(uint32 /*i*/)
|
||||
else
|
||||
{
|
||||
// Reveal action + get attack
|
||||
m_caster->RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH);
|
||||
m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH);
|
||||
if (((Creature*)unitTarget)->AI())
|
||||
((Creature*)unitTarget)->AI()->AttackStart(m_caster);
|
||||
}
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#include "SpellMgr.h"
|
||||
|
||||
+30
-16
@@ -463,7 +463,7 @@ void Unit::RemoveSpellsCausingAura(AuraType auraType)
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveInterruptableAura(uint32 flag)
|
||||
void Unit::RemoveAurasWithInterruptFlags(uint32 flag)
|
||||
{
|
||||
AuraList::iterator iter, next;
|
||||
for (iter = m_interruptableAuras.begin(); iter != m_interruptableAuras.end(); iter = next)
|
||||
@@ -509,7 +509,7 @@ uint32 Unit::DealDamage(Unit *pVictim, uint32 damage, CleanDamage const* cleanDa
|
||||
// remove affects from attacker at any non-DoT damage (including 0 damage)
|
||||
if( damagetype != DOT)
|
||||
{
|
||||
RemoveInterruptableAura(AURA_INTERRUPT_FLAG_STEALTH);
|
||||
RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH);
|
||||
|
||||
if(pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandState() && !pVictim->hasUnitState(UNIT_STAT_STUNNED))
|
||||
pVictim->SetStandState(PLAYER_STATE_NONE);
|
||||
@@ -4103,17 +4103,6 @@ void Unit::RemoveAurasDueToItemSpell(Item* castItem,uint32 spellId)
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveAurasWithInterruptFlags(uint32 flags)
|
||||
{
|
||||
for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )
|
||||
{
|
||||
if (iter->second->GetSpellProto()->AuraInterruptFlags & flags)
|
||||
RemoveAura(iter);
|
||||
else
|
||||
++iter;
|
||||
}
|
||||
}
|
||||
|
||||
void Unit::RemoveNotOwnSingleTargetAuras()
|
||||
{
|
||||
// single target auras from other casters
|
||||
@@ -8506,15 +8495,40 @@ void Unit::ClearInCombat()
|
||||
clearUnitState(UNIT_STAT_ATTACK_PLAYER);
|
||||
}
|
||||
|
||||
//TODO: remove this function
|
||||
bool Unit::isTargetableForAttack() const
|
||||
{
|
||||
if (GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster())
|
||||
return isAttackableByAOE() && !hasUnitState(UNIT_STAT_DIED);
|
||||
}
|
||||
|
||||
bool Unit::canAttack(Unit const* target) const
|
||||
{
|
||||
assert(target);
|
||||
|
||||
if(!target->isAttackableByAOE() || target->hasUnitState(UNIT_STAT_DIED))
|
||||
return false;
|
||||
|
||||
if((m_invisibilityMask || target->m_invisibilityMask) && !canDetectInvisibilityOf(target))
|
||||
return false;
|
||||
|
||||
if(target->GetVisibility() == VISIBILITY_GROUP_STEALTH && !canDetectStealthOf(target, GetDistance(target)))
|
||||
return false;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Unit::isAttackableByAOE() const
|
||||
{
|
||||
if(!isAlive())
|
||||
return false;
|
||||
|
||||
if(HasFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE))
|
||||
return false;
|
||||
|
||||
return isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/;
|
||||
if(GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster())
|
||||
return false;
|
||||
|
||||
return !isInFlight();
|
||||
}
|
||||
|
||||
int32 Unit::ModifyHealth(int32 dVal)
|
||||
@@ -9066,7 +9080,7 @@ bool Unit::SelectHostilTarget()
|
||||
{
|
||||
for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr)
|
||||
{
|
||||
if( (*itr)->IsInMap(this) && (*itr)->isTargetableForAttack() && (*itr)->isInAccessablePlaceFor((Creature*)this) )
|
||||
if( (*itr)->IsInMap(this) && canAttack(*itr) && (*itr)->isInAccessablePlaceFor((Creature*)this) )
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
+2
-1
@@ -922,6 +922,8 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
bool isFrozen() const;
|
||||
|
||||
bool isTargetableForAttack() const;
|
||||
bool isAttackableByAOE() const;
|
||||
bool canAttack(Unit const* target) const;
|
||||
virtual bool IsInWater() const;
|
||||
virtual bool IsUnderWater() const;
|
||||
bool isInAccessablePlaceFor(Creature const* c) const;
|
||||
@@ -1031,7 +1033,6 @@ class TRINITY_DLL_SPEC Unit : public WorldObject
|
||||
void RemoveNotOwnSingleTargetAuras();
|
||||
|
||||
void RemoveSpellsCausingAura(AuraType auraType);
|
||||
void RemoveInterruptableAura(uint32 flag);
|
||||
void RemoveRankAurasDueToSpell(uint32 spellId);
|
||||
bool RemoveNoStackAurasDueToAura(Aura *Aur);
|
||||
void RemoveAurasWithInterruptFlags(uint32 flags);
|
||||
|
||||
@@ -10,12 +10,12 @@
|
||||
*
|
||||
* This program is distributed in the hope that it will be useful,
|
||||
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
* GNU General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU General Public License
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*/
|
||||
|
||||
#ifndef _UNITEVENTS
|
||||
|
||||
Reference in New Issue
Block a user