diff options
| author | Shauren <shauren.trinity@gmail.com> | 2011-05-25 15:55:14 +0200 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2011-05-25 15:55:14 +0200 |
| commit | 64adce7b8b62d648a89e7319036d1474780f3533 (patch) | |
| tree | da2c732d0afe7b0d168a5f09d0b11671ef199c4d /src/server/scripts/Kalimdor | |
| parent | 0ea721e25af10e19044e7feefad02d6be124d1b7 (diff) | |
Scripts: Removed CAST_SUM define
Diffstat (limited to 'src/server/scripts/Kalimdor')
| -rw-r--r-- | src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp | 8 | ||||
| -rw-r--r-- | src/server/scripts/Kalimdor/durotar.cpp | 29 |
2 files changed, 24 insertions, 13 deletions
diff --git a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp index 801a4b078b5..69db789e87d 100644 --- a/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp +++ b/src/server/scripts/Kalimdor/TempleOfAhnQiraj/boss_cthun.cpp @@ -1312,10 +1312,10 @@ public: void JustDied(Unit* /*killer*/) { - if (CAST_SUM(me)) - if (Creature* pSummoner = CAST_CRE(CAST_SUM(me)->GetSummoner())) - if (pSummoner->AI()) - pSummoner->AI()->DoAction(ACTION_FLESH_TENTACLE_KILLED); + if (TempSummon* summon = me->ToTempSummon()) + if (Unit* summoner = summon->GetSummoner()) + if (summoner->IsAIEnabled) + summoner->GetAI()->DoAction(ACTION_FLESH_TENTACLE_KILLED); } }; diff --git a/src/server/scripts/Kalimdor/durotar.cpp b/src/server/scripts/Kalimdor/durotar.cpp index d0186840228..d32eed17fcd 100644 --- a/src/server/scripts/Kalimdor/durotar.cpp +++ b/src/server/scripts/Kalimdor/durotar.cpp @@ -190,7 +190,10 @@ class npc_tiger_matriarch_credit : public CreatureScript { for (std::list<Creature*>::iterator itr = tigers.begin(); itr != tigers.end(); ++itr) { - if (Unit* summoner = CAST_SUM(*itr)->GetSummoner()) + if (!(*itr)->isSummon()) + continue; + + if (Unit* summoner = (*itr)->ToTempSummon()->GetSummoner()) if (!summoner->HasAura(SPELL_NO_SUMMON_AURA) && !summoner->HasAura(SPELL_SUMMON_ZENTABRA_TRIGGER) && !summoner->isInCombat()) { @@ -223,7 +226,10 @@ class npc_tiger_matriarch : public CreatureScript struct npc_tiger_matriarchAI : public ScriptedAI { - npc_tiger_matriarchAI(Creature* creature) : ScriptedAI(creature) {} + npc_tiger_matriarchAI(Creature* creature) : ScriptedAI(creature), + _tiger(NULL) + { + } void IsSummonedBy(Unit* summoner) { @@ -242,10 +248,10 @@ class npc_tiger_matriarch : public CreatureScript void KilledUnit(Unit* victim) { - if (victim->GetTypeId() != TYPEID_UNIT) + if (victim->GetTypeId() != TYPEID_UNIT || !victim->isSummon()) return; - if (Unit* vehSummoner = CAST_SUM(victim)->GetSummoner()) + if (Unit* vehSummoner = victim->ToTempSummon()->GetSummoner()) { vehSummoner->RemoveAurasDueToSpell(SPELL_NO_SUMMON_AURA); vehSummoner->RemoveAurasDueToSpell(SPELL_DETECT_INVIS); @@ -257,11 +263,14 @@ class npc_tiger_matriarch : public CreatureScript void DamageTaken(Unit* attacker, uint32& damage) { - if (HealthBelowPct(20)) - { + if (!attacker->isSummon()) + return; + + if (HealthBelowPct(20)) + { damage = 0; me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); - if (Unit* vehSummoner = CAST_SUM(attacker)->GetSummoner()) + if (Unit* vehSummoner = attacker->ToTempSummon()->GetSummoner()) { vehSummoner->AddAura(SPELL_SUMMON_ZENTABRA_TRIGGER, vehSummoner); vehSummoner->CastSpell(vehSummoner, SPELL_SUMMON_ZENTABRA, true); @@ -271,6 +280,7 @@ class npc_tiger_matriarch : public CreatureScript vehSummoner->RemoveAurasDueToSpell(SPELL_SPIRIT_OF_THE_TIGER_RIDER); vehSummoner->RemoveAurasDueToSpell(SPELL_SUMMON_ZENTABRA_TRIGGER); } + me->ForcedDespawn(); } } @@ -294,8 +304,9 @@ class npc_tiger_matriarch : public CreatureScript events.ScheduleEvent(EVENT_POUNCE, 30000); break; case EVENT_NOSUMMON: // Reapply SPELL_NO_SUMMON_AURA - if (Unit* vehSummoner = CAST_SUM(_tiger)->GetSummoner()) - me->AddAura(SPELL_NO_SUMMON_AURA, vehSummoner); + if (_tiger && _tiger->isSummon()) + if (Unit* vehSummoner = _tiger->ToTempSummon()->GetSummoner()) + me->AddAura(SPELL_NO_SUMMON_AURA, vehSummoner); events.ScheduleEvent(EVENT_NOSUMMON, 50000); break; default: |
