- Timestamp:
- 11/21/08 08:48:46 (17 years ago)
- Location:
- trunk/src/game
- Files:
-
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/Creature.cpp
r260 r265 123 123 m_lootMoney(0), m_lootRecipient(0), 124 124 m_deathTimer(0), m_respawnTime(0), m_respawnDelay(25), m_corpseDelay(60), m_respawnradius(0.0f), 125 m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false), 125 m_gossipOptionLoaded(false), m_emoteState(0), m_isPet(false), m_isTotem(false), m_isAggressive(true), 126 126 m_regenTimer(2000), m_defaultMovementType(IDLE_MOTION_TYPE), m_equipmentId(0), 127 127 m_AlreadyCallAssistence(false), m_regenHealth(true), m_AI_locked(false), m_isDeadByDefault(false), … … 294 294 SetUInt32Value(UNIT_DYNAMIC_FLAGS,GetCreatureInfo()->dynamicflags); 295 295 296 SetMeleeDamageSchool(SpellSchools(GetCreatureInfo()->dmgschool)); 296 297 SetModifierValue(UNIT_MOD_ARMOR, BASE_VALUE, float(GetCreatureInfo()->armor)); 297 298 SetModifierValue(UNIT_MOD_RESISTANCE_HOLY, BASE_VALUE, float(GetCreatureInfo()->resistance1)); … … 323 324 if(GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER) 324 325 SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); 326 327 if(isTotem() || isCivilian() || GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER 328 || GetCreatureType() == CREATURE_TYPE_CRITTER) 329 m_isAggressive = false; 330 else 331 m_isAggressive = true; 325 332 326 333 return true; … … 1411 1418 SetPower(POWER_MANA,data->curmana); 1412 1419 1413 SetMeleeDamageSchool(SpellSchools(GetCreatureInfo()->dmgschool));1414 1415 1420 // checked at creature_template loading 1416 1421 m_defaultMovementType = MovementGeneratorType(data->movementType); -
trunk/src/game/Creature.h
r260 r265 427 427 bool canSwim() const { return GetCreatureInfo()->InhabitType & INHABIT_WATER; } 428 428 bool canFly() const { return GetCreatureInfo()->InhabitType & INHABIT_AIR; } 429 bool isAggressive() const { return m_isAggressive; } 430 void SetAggressive(bool agg) { m_isAggressive = agg; } 429 431 ///// TODO RENAME THIS!!!!! 430 432 bool isCanTrainingOf(Player* player, bool msg) const; … … 637 639 bool m_isPet; // set only in Pet::Pet 638 640 bool m_isTotem; // set only in Totem::Totem 641 bool m_isAggressive; 639 642 void RegenerateMana(); 640 643 void RegenerateHealth(); -
trunk/src/game/GridNotifiersImpl.h
r186 r265 73 73 74 74 // Creature AI reaction 75 if( !c->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))75 if(c->isAggressive() && !c->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) 76 76 { 77 77 if( c->AI() && c->IsWithinSightDist(pl) /*c->AI()->IsVisible(pl)*/ && !c->IsInEvadeMode() ) … … 82 82 inline void CreatureCreatureRelocationWorker(Creature* c1, Creature* c2) 83 83 { 84 if( !c1->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))84 if(c1->isAggressive() && !c1->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) 85 85 { 86 86 if( c1->AI() && c1->IsWithinSightDist(c2) /*c1->AI()->IsVisible(c2)*/ && !c1->IsInEvadeMode() ) … … 88 88 } 89 89 90 if( !c2->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING))90 if(c2->isAggressive() && !c2->hasUnitState(UNIT_STAT_CHASE | UNIT_STAT_SEARCHING | UNIT_STAT_FLEEING)) 91 91 { 92 92 if( c2->AI() && c1->IsWithinSightDist(c2) /*c2->AI()->IsVisible(c1)*/ && !c2->IsInEvadeMode() ) -
trunk/src/game/Pet.cpp
r262 r265 1467 1467 1468 1468 // same spells don't have autocast option 1469 if (spellInfo->AttributesEx & SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET) active = ACT_CAST; 1469 if (spellInfo->AttributesEx & SPELL_ATTR_EX_UNAUTOCASTABLE_BY_PET) 1470 active = ACT_CAST; 1470 1471 1471 1472 PetSpellMap::iterator itr = m_spells.find(spell_id); … … 1543 1544 CastSpell(this, spell_id, true); 1544 1545 else if(state == PETSPELL_NEW) 1545 m_charmInfo->AddSpellToAB(oldspell_id, spell_id, active);1546 m_charmInfo->AddSpellToAB(oldspell_id, spell_id, (ActiveStates)active); 1546 1547 1547 1548 if(newspell->active == ACT_ENABLED) -
trunk/src/game/SpellMgr.cpp
r264 r265 1073 1073 else if(spellInfo_1->SpellFamilyName == SPELLFAMILY_POTION) 1074 1074 { 1075 if(spellId_spec_1 || spellId_spec_2) )1075 if(spellId_spec_1 || spellId_spec_2) 1076 1076 return false; 1077 1077 } -
trunk/src/game/Totem.cpp
r126 r265 98 98 default: break; 99 99 } 100 101 if(GetEntry() == SENTRY_TOTEM_ENTRY) 102 SetAggressive(true); 100 103 } 101 104 -
trunk/src/game/Unit.cpp
r264 r265 8492 8492 target->SetStandState(PLAYER_STATE_NONE); 8493 8493 8494 if(!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER && ((Creature*)target)->AI()) 8494 if(!target->isInCombat() && target->GetTypeId() != TYPEID_PLAYER 8495 && ((Creature*)target)->isAggressive() && ((Creature*)target)->AI()) 8495 8496 ((Creature*)target)->AI()->AttackStart(this); 8496 8497