Changeset 186 for trunk/src/game
- Timestamp:
- 11/19/08 13:44:25 (17 years ago)
- Location:
- trunk/src/game
- Files:
-
- 19 modified
Legend:
- Unmodified
- Added
- Removed
-
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