Changeset 145
- Timestamp:
- 11/19/08 13:40:25 (17 years ago)
- Location:
- trunk
- Files:
-
- 1 added
- 7 modified
Legend:
- Unmodified
- Added
- Removed
-
trunk/src/game/CreatureAIRegistry.cpp
r102 r145 38 38 void Initialize() 39 39 { 40 (new CreatureAIFactory<NullCreatureAI>("Null AI"))->RegisterSelf();40 (new CreatureAIFactory<NullCreatureAI>("NullCreatureAI"))->RegisterSelf(); 41 41 (new CreatureAIFactory<AggressorAI>("AggressorAI"))->RegisterSelf(); 42 42 (new CreatureAIFactory<ReactorAI>("ReactorAI"))->RegisterSelf(); -
trunk/src/game/GameObject.cpp
r120 r145 342 342 if (ok) 343 343 { 344 Unit *caster = owner ? owner : ok; 345 346 caster->CastSpell(ok, goInfo->trap.spellId, true); 344 //Unit *caster = owner ? owner : ok; 345 346 //caster->CastSpell(ok, goInfo->trap.spellId, true); 347 CastSpell(ok, goInfo->trap.spellId); 347 348 m_cooldownTime = time(NULL) + 4; // 4 seconds 348 349 … … 1264 1265 spell->prepare(&targets); 1265 1266 } 1267 1268 void GameObject::CastSpell(Unit* target, uint32 spell) 1269 { 1270 //summon world trigger 1271 Creature *trigger = SummonCreature(12999, GetPositionX(), GetPositionY(), GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN, 1); 1272 if(!trigger) return; 1273 1274 Unit *owner = GetOwner(); 1275 if(owner) trigger->setFaction(owner->getFaction()); 1276 else trigger->setFaction(14); 1277 trigger->SetVisibility(VISIBILITY_OFF); //should this be true? 1278 trigger->CastSpell(target, spell, true, 0, 0, owner->GetGUID()); 1279 } -
trunk/src/game/GameObject.h
r102 r145 573 573 574 574 GridReference<GameObject> &GetGridRef() { return m_gridRef; } 575 576 void CastSpell(Unit *target, uint32 spell); 575 577 protected: 576 578 uint32 m_charges; // Spell charges for GAMEOBJECT_TYPE_SPELLCASTER (22) -
trunk/src/game/Object.cpp
r141 r145 1484 1484 1485 1485 if(pCreature->GetCreatureInfo()->flags_extra & CREATURE_FLAG_EXTRA_TRIGGER && pCreature->m_spells[0]) 1486 { 1487 if(GetTypeId() == TYPEID_UNIT || GetTypeId() == TYPEID_PLAYER) 1488 pCreature->setFaction(((Unit*)this)->getFaction()); 1486 1489 pCreature->CastSpell(pCreature, pCreature->m_spells[0], true, 0, 0, GetGUID()); 1490 } 1487 1491 1488 1492 //return the creature therewith the summoner has access to it -
trunk/src/game/Spell.cpp
r142 r145 95 95 } 96 96 97 void SpellCastTargets::setDestination(float x, float y, float z, bool send, uint32 mapId)97 void SpellCastTargets::setDestination(float x, float y, float z, bool send, int32 mapId) 98 98 { 99 99 m_destX = x; … … 103 103 if(send) 104 104 m_targetMask |= TARGET_FLAG_DEST_LOCATION; 105 if(mapId )105 if(mapId >= 0) 106 106 m_mapId = mapId; 107 107 } … … 416 416 std::list<Unit*> tmpUnitMap; 417 417 418 // Note: this hack with search required until GO casting not implemented 419 // environment damage spells already have around enemies targeting but this not help in case not existed GO casting support 420 // currently each enemy selected explicitly and self cast damage 421 if(m_spellInfo->EffectImplicitTargetA[i] == TARGET_ALL_AROUND_CASTER 422 && m_spellInfo->EffectImplicitTargetB[i]==TARGET_ALL_ENEMY_IN_AREA 423 && m_spellInfo->Effect[i]==SPELL_EFFECT_ENVIRONMENTAL_DAMAGE) 424 { 425 tmpUnitMap.push_back(m_targets.getUnitTarget()); 426 } 427 else 428 { 429 SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); 430 SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); 431 } 418 SetTargetMap(i,m_spellInfo->EffectImplicitTargetA[i],tmpUnitMap); 419 SetTargetMap(i,m_spellInfo->EffectImplicitTargetB[i],tmpUnitMap); 432 420 433 421 if(m_targets.HasDest()) … … 717 705 718 706 // Calculate hit result 719 target.missCondition = m_caster->SpellHitResult(pVictim, m_spellInfo, m_canReflect); 707 if(m_originalCaster) 708 target.missCondition = m_originalCaster->SpellHitResult(pVictim, m_spellInfo, m_canReflect); 709 else 710 target.missCondition = SPELL_MISS_NONE; 720 711 if (target.missCondition == SPELL_MISS_NONE) 721 712 ++m_countOfHit; … … 1455 1446 || m_spellInfo->Effect[1] == SPELL_EFFECT_TELEPORT_UNITS 1456 1447 || m_spellInfo->Effect[2] == SPELL_EFFECT_TELEPORT_UNITS) 1457 m_targets.setDestination(st->target_X, st->target_Y, st->target_Z, true, st->target_mapId);1448 m_targets.setDestination(st->target_X, st->target_Y, st->target_Z, true, (int32)st->target_mapId); 1458 1449 else if(st->target_mapId == m_caster->GetMapId()) 1459 1450 m_targets.setDestination(st->target_X, st->target_Y, st->target_Z); -
trunk/src/game/Spell.h
r142 r145 112 112 //m_srcZ = target.m_srcZ; 113 113 114 m_mapId = 0;114 m_mapId = -1; 115 115 m_destX = target.m_destX; 116 116 m_destY = target.m_destY; … … 128 128 Unit *getUnitTarget() const { return m_unitTarget; } 129 129 void setUnitTarget(Unit *target); 130 void setDestination(float x, float y, float z, bool send = true, uint32 mapId = 0);130 void setDestination(float x, float y, float z, bool send = true, int32 mapId = -1); 131 131 void setDestination(Unit *target, bool send = true); 132 132 … … 156 156 157 157 float m_srcX, m_srcY, m_srcZ; 158 uint32 m_mapId;158 int32 m_mapId; 159 159 float m_destX, m_destY, m_destZ; 160 160 bool m_hasDest; -
trunk/src/game/SpellEffects.cpp
r144 r145 1979 1979 } 1980 1980 // Init dest coordinates 1981 uint32 mapid = m_targets.m_mapId; 1981 int32 mapid = m_targets.m_mapId; 1982 if(mapid < 0) mapid = (int32)unitTarget->GetMapId(); 1982 1983 float x = m_targets.m_destX; 1983 1984 float y = m_targets.m_destY;