Changeset 186
- Timestamp:
- 11/19/08 13:44:25 (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 1 removed
- 22 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/bindings/scripts/include/sc_creature.cpp
r153 r186 74 74 void ScriptedAI::MoveInLineOfSight(Unit *who) 75 75 { 76 if (!m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) &&who->isInAccessablePlaceFor(m_creature))77 {78 if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 79 return;80 81 float attackRadius = m_creature->GetAttackDistance(who); 82 if (m_creature->IsWithinDistInMap(who, attackRadius) &&m_creature->IsWithinLOSInMap(who))83 {84 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);85 AttackStart(who);86 }87 }76 if(m_creature->getVictim() || !m_creature->IsHostileTo(who) || !who->isInAccessablePlaceFor(m_creature)) 77 return; 78 79 if(!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) 80 return; 81 82 if(!m_creature->IsWithinDistInMap(who, m_creature->GetAttackDistance(who)) || !m_creature->IsWithinLOSInMap(who)) 83 return; 84 85 if(m_creature->canAttack(who)) 86 //who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 87 AttackStart(who); 88 88 } 89 89 … … 778 778 void Scripted_NoMovementAI::MoveInLineOfSight(Unit *who) 779 779 { 780 if( !m_creature->getVictim() && who->isTargetableForAttack() && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) )780 if( !m_creature->getVictim() && m_creature->canAttack(who) && ( m_creature->IsHostileTo( who )) && who->isInAccessablePlaceFor(m_creature) ) 781 781 { 782 782 if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) -
trunk/src/bindings/scripts/scripts/creature/mob_event_ai.cpp
r109 r186 1196 1196 return; 1197 1197 1198 1199 if (who->isTargetableForAttack() && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who)) 1198 if (m_creature->canAttack(who) && who->isInAccessablePlaceFor(m_creature) && m_creature->IsHostileTo(who)) 1200 1199 { 1201 1200 if (!m_creature->canFly() && m_creature->GetDistanceZ(who) > CREATURE_Z_ATTACK_RANGE) … … 1205 1204 if (m_creature->IsWithinDistInMap(who, attackRadius) && m_creature->IsWithinLOSInMap(who)) 1206 1205 { 1207 if(who->HasStealthAura())1208 who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH);1206 //if(who->HasStealthAura()) 1207 // who->RemoveSpellsCausingAura(SPELL_AURA_MOD_STEALTH); 1209 1208 1210 1209 //Begin melee attack if we are within range -
trunk/src/bindings/scripts/scripts/zone/black_temple/boss_illidan.cpp
r180 r186 414 414 EnterPhase(PHASE_FLIGHT); 415 415 } 416 else 416 else // handle flight sequence 417 417 Timer[EVENT_FLIGHT_SEQUENCE] = 1000; 418 418 } … … 692 692 for(uint32 i = 1; i <= MaxTimer[Phase]; i++) 693 693 { 694 if(Timer[i]) 694 if(Timer[i]) // Event is enabled 695 695 if(Timer[i] <= diff) 696 696 { 697 if(!Event) 697 if(!Event) // No event with higher priority 698 698 Event = (EventIllidan)i; 699 699 } … … 709 709 710 710 case PHASE_NORMAL_2: 711 if( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 30)711 if(HPPCT(m_creature) < 30) 712 712 EnterPhase(PHASE_TALK_SEQUENCE); 713 713 break; 714 714 715 715 case PHASE_NORMAL_MAIEV: 716 if( m_creature->GetHealth()*100 / m_creature->GetMaxHealth() < 1)716 if(HPPCT(m_creature) < 1) 717 717 EnterPhase(PHASE_TALK_SEQUENCE); 718 718 break; … … 759 759 DoPlaySoundToSet(m_creature, soundid); 760 760 } 761 Timer[EVENT_TAUNT] = 32000;761 Timer[EVENT_TAUNT] = 25000 + rand()%10000; 762 762 break; 763 763 … … 834 834 Phase = PHASE_FLIGHT_SEQUENCE; 835 835 Timer[EVENT_FLIGHT_SEQUENCE] = 0;//do not start Event when changing hover point 836 for (uint8 i = 0; i <= rand()%3; i++) 837 { 838 HoverPoint++; 839 if(HoverPoint > 3) 840 HoverPoint = 0; 841 } 836 HoverPoint += (rand()%3 + 1); 837 if(HoverPoint > 3) 838 HoverPoint -= 4; 842 839 m_creature->GetMotionMaster()->MovePoint(0, HoverPosition[HoverPoint].x, HoverPosition[HoverPoint].y, HoverPosition[HoverPoint].z); 843 840 break; … … 2060 2057 final.y = 2 * final.y - initial.y; 2061 2058 2062 for(uint8 i = 0; i < 2; ++i)//core bug, two buff do not coexist 2063 { 2064 Creature* Trigger = NULL; 2065 Trigger = m_creature->SummonCreature(DEMON_FIRE, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000); 2066 if(Trigger) 2067 { 2068 ((demonfireAI*)Trigger->AI())->IsTrigger = true; 2069 Trigger->SetSpeed(MOVE_WALK, 3); 2070 Trigger->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); 2071 Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); 2072 2073 if(!i) 2074 Trigger->CastSpell(Trigger, SPELL_EYE_BLAST_TRIGGER, true); 2075 else 2076 { 2077 Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 2078 m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID()); 2079 DoCast(Trigger, SPELL_EYE_BLAST); 2080 } 2081 } 2082 } 2059 Creature* Trigger = m_creature->SummonCreature(DEMON_FIRE, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000); 2060 if(!Trigger) return; 2061 2062 ((demonfireAI*)Trigger->AI())->IsTrigger = true; 2063 Trigger->SetSpeed(MOVE_WALK, 3); 2064 Trigger->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE); 2065 Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z); 2066 2067 Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 2068 m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID()); 2069 DoCast(Trigger, SPELL_EYE_BLAST); 2083 2070 } 2084 2071 … … 2163 2150 m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); 2164 2151 m_creature->GetMotionMaster()->Clear(false); 2165 //m_creature->GetMotionMaster()->MoveIdle();2166 2152 m_creature->AttackStop(); 2167 2153 break; 2168 2154 case PHASE_FLIGHT_SEQUENCE: 2169 if(Phase == PHASE_FLIGHT) //land 2170 Timer[EVENT_FLIGHT_SEQUENCE] = 2000; 2171 else //lift off 2155 if(Phase == PHASE_NORMAL) //lift off 2172 2156 { 2173 2157 FlightCount = 1; … … 2177 2161 m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE); 2178 2162 m_creature->GetMotionMaster()->Clear(false); 2179 //m_creature->GetMotionMaster()->MoveIdle();2180 2163 m_creature->AttackStop(); 2181 2164 } 2165 else //land 2166 Timer[EVENT_FLIGHT_SEQUENCE] = 2000; 2182 2167 break; 2183 2168 case PHASE_TRANSFORM_SEQUENCE: … … 2192 2177 } 2193 2178 m_creature->GetMotionMaster()->Clear(); 2194 //m_creature->GetMotionMaster()->MoveIdle();2195 2179 m_creature->AttackStop(); 2196 2180 break; -
trunk/src/game/AggressorAI.cpp
r156 r186 50 50 return; 51 51 52 if( !i_creature.getVictim() && !i_creature.hasUnitState(UNIT_STAT_STUNNED) && u->isTargetableForAttack() &&52 if( !i_creature.getVictim() && !i_creature.hasUnitState(UNIT_STAT_STUNNED) && i_creature.canAttack(u) && 53 53 ( i_creature.IsHostileTo( u ) /*|| u->getVictim() && i_creature.IsFriendlyTo( u->getVictim() )*/ ) && 54 54 u->isInAccessablePlaceFor(&i_creature) ) -
trunk/src/game/Creature.cpp
r178 r186 1533 1533 } 1534 1534 1535 bool Creature::IsWithinSightDist(Unit const* u) const 1536 { 1537 return IsWithinDistInMap(u, sWorld.getConfig(CONFIG_SIGHT_MONSTER)); 1538 } 1539 1535 1540 float Creature::GetAttackDistance(Unit const* pl) const 1536 1541 { … … 1867 1872 return true; 1868 1873 1869 if(! pVictim->isTargetableForAttack())1874 if(!canAttack(pVictim)) 1870 1875 return true; 1871 1876 -
trunk/src/game/Creature.h
r178 r186 549 549 550 550 bool canSeeOrDetect(Unit const* u, bool detect, bool inVisibleList) const; 551 bool IsWithinSightDist(Unit const* u) const; 551 552 float GetAttackDistance(Unit const* pl) const; 552 553 -
trunk/src/game/GameEvent.cpp
r111 r186 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 -
trunk/src/game/GlobalEvents.cpp
r102 r186 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 -
trunk/src/game/GridNotifiersImpl.h
r102 r186 75 75 if(!c->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) 76 76 { 77 if( c->AI() && c-> AI()->IsVisible(pl)&& !c->IsInEvadeMode() )77 if( c->AI() && c->IsWithinSightDist(pl) /*c->AI()->IsVisible(pl)*/ && !c->IsInEvadeMode() ) 78 78 c->AI()->MoveInLineOfSight(pl); 79 79 } … … 84 84 if(!c1->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) 85 85 { 86 if( c1->AI() && c1-> AI()->IsVisible(c2)&& !c1->IsInEvadeMode() )86 if( c1->AI() && c1->IsWithinSightDist(c2) /*c1->AI()->IsVisible(c2)*/ && !c1->IsInEvadeMode() ) 87 87 c1->AI()->MoveInLineOfSight(c2); 88 88 } … … 90 90 if(!c2->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) 91 91 { 92 if( c2->AI() && c 2->AI()->IsVisible(c1)&& !c2->IsInEvadeMode() )92 if( c2->AI() && c1->IsWithinSightDist(c2) /*c2->AI()->IsVisible(c1)*/ && !c2->IsInEvadeMode() ) 93 93 c2->AI()->MoveInLineOfSight(c1); 94 94 } -
trunk/src/game/GuardAI.cpp
r156 r186 44 44 return; 45 45 46 if( !i_creature.getVictim() && u->isTargetableForAttack() &&46 if( !i_creature.getVictim() && i_creature.canAttack(u) && 47 47 ( u->IsHostileToPlayers() || i_creature.IsHostileTo(u) /*|| u->getVictim() && i_creature.IsFriendlyTo(u->getVictim())*/ ) && 48 48 u->isInAccessablePlaceFor(&i_creature)) -
trunk/src/game/Map.cpp
r174 r186 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 91 91 if(vmgr->isMapLoadingEnabled()) 92 92 { 93 // x and y are swap ed !! => fixed now93 // x and y are swapped !! => fixed now 94 94 bool exists = vmgr->existsMap((sWorld.GetDataPath()+ "vmaps").c_str(), mapid, x,y); 95 95 if(!exists) … … 107 107 void Map::LoadVMap(int x,int y) 108 108 { 109 // x and y are swap ed !!109 // x and y are swapped !! 110 110 int vmapLoadResult = VMAP::VMapFactory::createOrGetVMapManager()->loadMap((sWorld.GetDataPath()+ "vmaps").c_str(), GetId(), x,y); 111 111 switch(vmapLoadResult) … … 145 145 } 146 146 147 //map already load, delete it before reloading (Is it nec cessary? Do we really need the abilty the reload maps during runtime?)147 //map already load, delete it before reloading (Is it necessary? Do we really need the ability the reload maps during runtime?) 148 148 if(GridMaps[x][y]) 149 149 { … … 335 335 void Map::DeleteFromWorld(T* obj) 336 336 { 337 // Note: In case resurrectable corpse and pet its removed from glo abal lists in own destructors337 // Note: In case resurrectable corpse and pet its removed from global lists in own destructor 338 338 delete obj; 339 339 } … … 442 442 bool Map::Add(Player *player) 443 443 { 444 player->SetInstanceId( this->GetInstanceId());444 player->SetInstanceId(GetInstanceId()); 445 445 446 446 // update player state for other player and visa-versa … … 671 671 672 672 obj->RemoveFromWorld(); 673 674 673 RemoveFromGrid(obj,grid,cell); 675 674 … … 1391 1390 break; 1392 1391 case TYPEID_UNIT: 1393 // in case trigg red sequence some spell can continue casting after prev CleanupsBeforeDelete call1392 // in case triggered sequence some spell can continue casting after prev CleanupsBeforeDelete call 1394 1393 // make sure that like sources auras/etc removed before destructor start 1395 1394 ((Creature*)obj)->CleanupsBeforeDelete (); … … 1470 1469 return false; 1471 1470 } 1472 1473 /*if(!player->isGameMaster() && i_data && i_data->IsEncounterInProgress())1474 {1475 sLog.outDebug("InstanceMap::CanEnter - Player '%s' can't enter instance '%s' while an encounter is in progress.", player->GetName(), GetMapName());1476 player->SendTransferAborted(GetId(), TRANSFER_ABORT_ZONE_IN_COMBAT);1477 return false;1478 }*/1479 1471 1480 1472 return Map::CanEnter(player); … … 1587 1579 void InstanceMap::Update(const uint32& t_diff) 1588 1580 { 1589 1590 1591 1592 1581 Map::Update(t_diff); 1582 1583 if(i_data) 1584 i_data->Update(t_diff); 1593 1585 } 1594 1586 -
trunk/src/game/OutdoorPvPObjectiveAI.cpp
r178 r186 35 35 // IsVisible only passes for players in range, so no need to check again 36 36 // leaving/entering distance will be checked based on go range data 37 sOutdoorPvPMgr.HandleCaptureCreaturePlayerMoveInLos(((Player*)u),&i_creature); 37 if((u->GetTypeId() == TYPEID_PLAYER) && i_creature.IsWithinDistInMap(u, MAX_OUTDOOR_PVP_DISTANCE)) 38 sOutdoorPvPMgr.HandleCaptureCreaturePlayerMoveInLos(((Player*)u),&i_creature); 38 39 } 39 40 -
trunk/src/game/PetAI.cpp
r156 r186 49 49 if( !i_pet.getVictim() && i_pet.GetCharmInfo() && 50 50 i_pet.GetCharmInfo()->HasReactState(REACT_AGGRESSIVE) && 51 u->isTargetableForAttack() && i_pet.IsHostileTo( u) &&51 i_pet.IsHostileTo( u ) && i_pet.canAttack(u) && 52 52 u->isInAccessablePlaceFor(&i_pet)) 53 53 { … … 96 96 return true; 97 97 98 return !i_pet. getVictim()->isTargetableForAttack();98 return !i_pet.canAttack(i_pet.getVictim()); 99 99 } 100 100 -
trunk/src/game/Player.cpp
r183 r186 16547 16547 16548 16548 // prevent stealth flight 16549 Remove InterruptableAura(AURA_INTERRUPT_FLAG_STEALTH);16549 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH); 16550 16550 16551 16551 WorldPacket data(SMSG_ACTIVATETAXIREPLY, 4); -
trunk/src/game/PossessedAI.cpp
r174 r186 46 46 return true; 47 47 48 return !i_pet. getVictim()->isTargetableForAttack();48 return !i_pet.canAttack(i_pet.getVictim()); 49 49 } 50 50 -
trunk/src/game/Spell.cpp
r185 r186 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 1006 1006 { 1007 1007 //do not remove feign death 1008 unit->Remove InterruptableAura(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE);1008 unit->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH + AURA_INTERRUPT_FLAG_DAMAGE); 1009 1009 } 1010 1010 } … … 2148 2148 if ( !m_IsTriggeredSpell && isSpellBreakStealth(m_spellInfo) ) 2149 2149 { 2150 m_caster->Remove InterruptableAura(AURA_INTERRUPT_FLAG_STEALTH);2150 m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH); 2151 2151 } 2152 2152 … … 2207 2207 { 2208 2208 SetExecutedCurrently(true); 2209 2209 2210 2210 uint8 castResult = 0; 2211 2211 … … 2322 2322 handle_immediate(); 2323 2323 } 2324 2324 2325 2325 SetExecutedCurrently(false); 2326 2326 } … … 3083 3083 WorldObject* target = NULL; 3084 3084 3085 // select first not r susted target from target list for _0_ effect3085 // select first not resisted target from target list for _0_ effect 3086 3086 if(!m_UniqueTargetInfo.empty()) 3087 3087 { … … 3341 3341 for(TriggerSpells::iterator si=m_TriggerSpells.begin(); si!=m_TriggerSpells.end(); ++si) 3342 3342 { 3343 Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, this->m_selfContainer);3343 Spell* spell = new Spell(m_caster, (*si), true, m_originalCasterGUID, m_selfContainer); 3344 3344 spell->prepare(&m_targets); // use original spell original targets 3345 3345 } … … 3398 3398 if(m_spellInfo->TargetAuraStateNot && target->HasAuraState(AuraState(m_spellInfo->TargetAuraStateNot))) 3399 3399 return SPELL_FAILED_TARGET_AURASTATE; 3400 3401 3400 3402 3401 if(target != m_caster) … … 4077 4076 return SPELL_FAILED_CASTER_DEAD; 4078 4077 4079 if(m_caster->IsNonMeleeSpellCasted(false)) //prevent spellcast inter uption by another spellcast4078 if(m_caster->IsNonMeleeSpellCasted(false)) //prevent spellcast interruption by another spellcast 4080 4079 return SPELL_FAILED_SPELL_IN_PROGRESS; 4081 4080 if(m_caster->isInCombat() && IsNonCombatSpell(m_spellInfo)) … … 4169 4168 dispel_immune |= GetDispellMask(DispelType(m_spellInfo->EffectMiscValue[i])); 4170 4169 } 4171 //immune movement impair ement and loss of control4170 //immune movement impairment and loss of control 4172 4171 if(m_spellInfo->Id==(uint32)42292) 4173 4172 mechanic_immune = IMMUNE_TO_MOVEMENT_IMPAIRMENT_AND_LOSS_CONTROL_MASK; … … 4651 4650 4652 4651 uint32 item_quality = itemProto->Quality; 4653 // 2.0.x addon: Check player enchanting level agains the item desenchanting requirements4652 // 2.0.x addon: Check player enchanting level against the item disenchanting requirements 4654 4653 uint32 item_disenchantskilllevel = itemProto->RequiredDisenchantSkill; 4655 4654 if (item_disenchantskilllevel == uint32(-1)) -
trunk/src/game/Spell.h
r174 r186 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 … … 579 579 { 580 580 case SPELL_TARGETS_FRIENDLY: 581 if (!itr->getSource()->is TargetableForAttack() || !i_caster->IsFriendlyTo( itr->getSource() ))581 if (!itr->getSource()->isAttackableByAOE() || !i_caster->IsFriendlyTo( itr->getSource() )) 582 582 continue; 583 583 break; … … 586 586 if(itr->getSource()->GetTypeId()==TYPEID_UNIT && ((Creature*)itr->getSource())->isTotem()) 587 587 continue; 588 if(!itr->getSource()->is TargetableForAttack())588 if(!itr->getSource()->isAttackableByAOE()) 589 589 continue; 590 590 -
trunk/src/game/SpellEffects.cpp
r180 r186 3478 3478 { 3479 3479 // Reveal action + get attack 3480 m_caster->Remove InterruptableAura(AURA_INTERRUPT_FLAG_STEALTH);3480 m_caster->RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH); 3481 3481 if (((Creature*)unitTarget)->AI()) 3482 3482 ((Creature*)unitTarget)->AI()->AttackStart(m_caster); -
trunk/src/game/SpellMgr.cpp
r173 r186 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20 -
trunk/src/game/Unit.cpp
r179 r186 464 464 } 465 465 466 void Unit::Remove InterruptableAura(uint32 flag)466 void Unit::RemoveAurasWithInterruptFlags(uint32 flag) 467 467 { 468 468 AuraList::iterator iter, next; … … 510 510 if( damagetype != DOT) 511 511 { 512 Remove InterruptableAura(AURA_INTERRUPT_FLAG_STEALTH);512 RemoveAurasWithInterruptFlags(AURA_INTERRUPT_FLAG_STEALTH); 513 513 514 514 if(pVictim->GetTypeId() == TYPEID_PLAYER && !pVictim->IsStandState() && !pVictim->hasUnitState(UNIT_STAT_STUNNED)) … … 4101 4101 ++iter; 4102 4102 } 4103 }4104 }4105 4106 void Unit::RemoveAurasWithInterruptFlags(uint32 flags)4107 {4108 for (AuraMap::iterator iter = m_Auras.begin(); iter != m_Auras.end(); )4109 {4110 if (iter->second->GetSpellProto()->AuraInterruptFlags & flags)4111 RemoveAura(iter);4112 else4113 ++iter;4114 4103 } 4115 4104 } … … 8507 8496 } 8508 8497 8498 //TODO: remove this function 8509 8499 bool Unit::isTargetableForAttack() const 8510 8500 { 8511 if (GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster()) 8501 return isAttackableByAOE() && !hasUnitState(UNIT_STAT_DIED); 8502 } 8503 8504 bool Unit::canAttack(Unit const* target) const 8505 { 8506 assert(target); 8507 8508 if(!target->isAttackableByAOE() || target->hasUnitState(UNIT_STAT_DIED)) 8509 return false; 8510 8511 if((m_invisibilityMask || target->m_invisibilityMask) && !canDetectInvisibilityOf(target)) 8512 return false; 8513 8514 if(target->GetVisibility() == VISIBILITY_GROUP_STEALTH && !canDetectStealthOf(target, GetDistance(target))) 8515 return false; 8516 8517 return true; 8518 } 8519 8520 bool Unit::isAttackableByAOE() const 8521 { 8522 if(!isAlive()) 8512 8523 return false; 8513 8524 … … 8515 8526 return false; 8516 8527 8517 return isAlive() && !hasUnitState(UNIT_STAT_DIED)&& !isInFlight() /*&& !isStealth()*/; 8528 if(GetTypeId()==TYPEID_PLAYER && ((Player *)this)->isGameMaster()) 8529 return false; 8530 8531 return !isInFlight(); 8518 8532 } 8519 8533 … … 9067 9081 for(AttackerSet::const_iterator itr = m_attackers.begin(); itr != m_attackers.end(); ++itr) 9068 9082 { 9069 if( (*itr)->IsInMap(this) && (*itr)->isTargetableForAttack() && (*itr)->isInAccessablePlaceFor((Creature*)this) )9083 if( (*itr)->IsInMap(this) && canAttack(*itr) && (*itr)->isInAccessablePlaceFor((Creature*)this) ) 9070 9084 return false; 9071 9085 } -
trunk/src/game/Unit.h
r178 r186 923 923 924 924 bool isTargetableForAttack() const; 925 bool isAttackableByAOE() const; 926 bool canAttack(Unit const* target) const; 925 927 virtual bool IsInWater() const; 926 928 virtual bool IsUnderWater() const; … … 1032 1034 1033 1035 void RemoveSpellsCausingAura(AuraType auraType); 1034 void RemoveInterruptableAura(uint32 flag);1035 1036 void RemoveRankAurasDueToSpell(uint32 spellId); 1036 1037 bool RemoveNoStackAurasDueToAura(Aura *Aur); -
trunk/src/game/UnitEvents.h
r102 r186 11 11 * This program is distributed in the hope that it will be useful, 12 12 * but WITHOUT ANY WARRANTY; without even the implied warranty of 13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the13 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 14 14 * GNU General Public License for more details. 15 15 * 16 16 * You should have received a copy of the GNU General Public License 17 17 * along with this program; if not, write to the Free Software 18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307USA18 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA 19 19 */ 20 20