[svn] Fix hunter's trap (let original caster summon dynamic object).

Fix black temple boss 1's hurl spine.

--HG--
branch : trunk
This commit is contained in:
megamage
2008-11-06 12:24:56 -06:00
parent 31be467b2e
commit 0aada07187
3 changed files with 44 additions and 36 deletions

View File

@@ -384,19 +384,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
void Reset();
void JustSummoned(Creature* summon)
{
if(summon->GetCreatureInfo()->Entry == SHADOW_DEMON)
{
Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0);
if(target && target->GetTypeId() == TYPEID_PLAYER) // only on players.
{
summon->AddThreat(target, 5000000.0f);
summon->AI()->AttackStart(target);
}
DoZoneInCombat(summon);
}
}
void JustSummoned(Creature* summon);
void SummonedCreatureDespawn(Creature* summon)
{
@@ -780,7 +768,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
case EVENT_FLAME_CRASH:
DoCast(m_creature->getVictim(), SPELL_FLAME_CRASH);
Timer[EVENT_FLAME_CRASH] = 35000;
Timer[EVENT_FLAME_CRASH] = 30000 + rand()%10000;
break;
case EVENT_PARASITIC_SHADOWFIEND:
@@ -789,6 +777,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
if(!target) target = m_creature->getVictim();
if(target)
m_creature->CastSpell(target, SPELL_PARASITIC_SHADOWFIEND, true);
Timer[EVENT_PARASITIC_SHADOWFIEND] = 35000 + rand()%10000;
}break;
case EVENT_PARASITE_CHECK:
@@ -797,7 +786,7 @@ struct TRINITY_DLL_DECL boss_illidan_stormrageAI : public ScriptedAI
case EVENT_DRAW_SOUL:
DoCast(m_creature->getVictim(), SPELL_DRAW_SOUL);
Timer[EVENT_DRAW_SOUL] = 55000;
Timer[EVENT_DRAW_SOUL] = 50000 + rand()%10000;
break;
//PHASE_NORMAL_2
@@ -1059,6 +1048,7 @@ struct TRINITY_DLL_DECL npc_akama_illidanAI : public ScriptedAI
}
void Aggro(Unit *who) {}
void MoveInLineOfSight(Unit *) {}
void MovementInform(uint32 MovementType, uint32 Data) {Timer = 1;}
@@ -1690,24 +1680,23 @@ struct TRINITY_DLL_DECL shadow_demonAI : public ScriptedAI
uint64 TargetGUID;
void Aggro(Unit *who) {}
void Aggro(Unit *who) {DoZoneInCombat();}
void Reset()
{
TargetGUID = 0;
DoCast(m_creature, SPELL_SHADOW_DEMON_PASSIVE, true);
m_creature->CastSpell(m_creature, SPELL_SHADOW_DEMON_PASSIVE, true);
}
void JustDied(Unit *killer)
{
Unit* target = Unit::GetUnit((*m_creature), TargetGUID);
if(target)
if(Unit* target = Unit::GetUnit((*m_creature), TargetGUID))
target->RemoveAurasDueToSpell(SPELL_PARALYZE);
}
void UpdateAI(const uint32 diff)
{
if(!m_creature->SelectHostilTarget() || !m_creature->getVictim()) return;
if(!m_creature->SelectHostilTarget() && !m_creature->getVictim()) return;
if(m_creature->getVictim()->GetTypeId() != TYPEID_PLAYER) return; // Only cast the below on players.
@@ -1936,6 +1925,31 @@ void boss_illidan_stormrageAI::Reset()
m_creature->setActive(false);
}
void boss_illidan_stormrageAI::JustSummoned(Creature* summon)
{
switch(summon->GetEntry())
{
case SHADOW_DEMON:
{
if(Unit *target = SelectUnit(SELECT_TARGET_RANDOM, 0, 999, true)) // only on players.
{
summon->AddThreat(target, 5000000.0f);
summon->AI()->AttackStart(target);
}
}break;
case MAIEV_SHADOWSONG:
{
summon->SetVisibility(VISIBILITY_OFF); // Leave her invisible until she has to talk
summon->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
MaievGUID = summon->GetGUID();
((boss_maievAI*)summon->AI())->GetIllidanGUID(m_creature->GetGUID());
((boss_maievAI*)summon->AI())->EnterPhase(PHASE_TALK_SEQUENCE);
}break;
default:
break;
}
}
void boss_illidan_stormrageAI::HandleTalkSequence()
{
switch(TalkCount)
@@ -2094,17 +2108,9 @@ void boss_illidan_stormrageAI::SummonFlamesOfAzzinoth()
void boss_illidan_stormrageAI::SummonMaiev()
{
DoCast(m_creature, SPELL_SHADOW_PRISON, true);
Creature* Maiev = m_creature->SummonCreature(MAIEV_SHADOWSONG, m_creature->GetPositionX() + 10, m_creature->GetPositionY() + 5, m_creature->GetPositionZ(), 0, TEMPSUMMON_CORPSE_DESPAWN, 0);
if(Maiev)
{
Maiev->SetVisibility(VISIBILITY_OFF); // Leave her invisible until she has to talk
Maiev->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
MaievGUID = Maiev->GetGUID();
((boss_maievAI*)Maiev->AI())->GetIllidanGUID(m_creature->GetGUID());
((boss_maievAI*)Maiev->AI())->EnterPhase(PHASE_TALK_SEQUENCE);
}
else // If Maiev cannot be summoned, reset the encounter and post some errors to the console.
m_creature->CastSpell(m_creature, SPELL_SHADOW_PRISON, true);
m_creature->CastSpell(m_creature, 40403, true);
if(!MaievGUID) // If Maiev cannot be summoned, reset the encounter and post some errors to the console.
{
EnterEvadeMode();
DoTextEmote("is unable to summon Maiev Shadowsong and enter Phase 4. Resetting Encounter.", NULL);

View File

@@ -981,8 +981,9 @@ void Spell::DoSpellHitOnUnit(Unit *unit, const uint32 effectMask)
}
// Recheck immune (only for delayed spells)
if( m_spellInfo->speed && (
unit->IsImmunedToDamage(GetSpellSchoolMask(m_spellInfo),true) ||
if( m_spellInfo->speed &&
!(m_spellInfo->Attributes & SPELL_ATTR_UNAFFECTED_BY_INVULNERABILITY)
&& (unit->IsImmunedToDamage(GetSpellSchoolMask(m_spellInfo),true) ||
unit->IsImmunedToSpell(m_spellInfo,true) ))
{
m_caster->SendSpellMiss(unit, m_spellInfo->Id, SPELL_MISS_IMMUNE);

View File

@@ -2633,13 +2633,14 @@ void Spell::EffectCreateItem(uint32 i)
void Spell::EffectPersistentAA(uint32 i)
{
float radius = GetSpellRadius(sSpellRadiusStore.LookupEntry(m_spellInfo->EffectRadiusIndex[i]));
Unit *caster = m_originalCasterGUID ? m_originalCaster : m_caster;
if(Player* modOwner = m_caster->GetSpellModOwner())
if(Player* modOwner = caster->GetSpellModOwner())
modOwner->ApplySpellMod(m_spellInfo->Id, SPELLMOD_RADIUS, radius);
int32 duration = GetSpellDuration(m_spellInfo);
DynamicObject* dynObj = new DynamicObject;
if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), m_caster, m_spellInfo->Id, i, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, radius))
if(!dynObj->Create(objmgr.GenerateLowGuid(HIGHGUID_DYNAMICOBJECT), caster, m_spellInfo->Id, i, m_targets.m_destX, m_targets.m_destY, m_targets.m_destZ, duration, radius))
{
delete dynObj;
return;
@@ -2647,7 +2648,7 @@ void Spell::EffectPersistentAA(uint32 i)
dynObj->SetUInt32Value(OBJECT_FIELD_TYPE, 65);
dynObj->SetUInt32Value(GAMEOBJECT_DISPLAYID, 368003);
dynObj->SetUInt32Value(DYNAMICOBJECT_BYTES, 0x01eeeeee);
m_caster->AddDynObject(dynObj);
caster->AddDynObject(dynObj);
MapManager::Instance().GetMap(dynObj->GetMapId(), dynObj)->Add(dynObj);
}