mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-28 04:42:10 +01:00
*Add function SummonTrigger and allow to override its AI.
*Remove some trigger scripts. Use default trigger AI and db data instead. *Small fix on eagle boss' electrical storm. --HG-- branch : trunk
This commit is contained in:
@@ -220,10 +220,10 @@ void ScriptedAI::DoStopAttack()
|
||||
|
||||
void ScriptedAI::DoCast(Unit* victim, uint32 spellId, bool triggered)
|
||||
{
|
||||
if (!victim || m_creature->IsNonMeleeSpellCasted(false))
|
||||
if (!victim || m_creature->hasUnitState(UNIT_STAT_CASTING))
|
||||
return;
|
||||
|
||||
m_creature->StopMoving();
|
||||
//m_creature->StopMoving();
|
||||
m_creature->CastSpell(victim, spellId, triggered);
|
||||
}
|
||||
|
||||
|
||||
@@ -183,13 +183,13 @@ struct TRINITY_DLL_DECL Scripted_NoMovementAI : public ScriptedAI
|
||||
void AttackStart(Unit *);
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL NullCreatureAI : public CreatureAI
|
||||
struct TRINITY_DLL_DECL NullCreatureAI : public ScriptedAI
|
||||
{
|
||||
NullCreatureAI(Creature* c) : m_creature(c) {}
|
||||
NullCreatureAI(Creature* c) : ScriptedAI(c) {}
|
||||
~NullCreatureAI() {}
|
||||
|
||||
Creature *m_creature;
|
||||
|
||||
void Reset() {}
|
||||
void Aggro(Unit*) {}
|
||||
void MoveInLineOfSight(Unit *) {}
|
||||
void AttackStart(Unit *) {}
|
||||
void EnterEvadeMode() {}
|
||||
|
||||
@@ -1780,73 +1780,9 @@ struct TRINITY_DLL_DECL mob_parasitic_shadowfiendAI : public ScriptedAI
|
||||
}
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL demonfireAI : public ScriptedAI
|
||||
struct TRINITY_DLL_DECL blade_of_azzinothAI : public NullCreatureAI
|
||||
{
|
||||
demonfireAI(Creature *c) : ScriptedAI(c)
|
||||
{
|
||||
pInstance = ((ScriptedInstance*)c->GetInstanceData());
|
||||
Reset();
|
||||
}
|
||||
|
||||
ScriptedInstance* pInstance;
|
||||
uint64 IllidanGUID;
|
||||
bool IsTrigger;
|
||||
bool DemonFire;
|
||||
uint32 CheckTimer;
|
||||
uint32 DespawnTimer;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
if(pInstance)
|
||||
IllidanGUID = pInstance->GetData64(DATA_ILLIDANSTORMRAGE);
|
||||
else
|
||||
IllidanGUID = 0;
|
||||
|
||||
IsTrigger = false;
|
||||
DemonFire = false;
|
||||
|
||||
CheckTimer = 5000;
|
||||
DespawnTimer = 78000; //spell duration, core bug, cannot despawn self
|
||||
}
|
||||
|
||||
void Aggro(Unit *who) {}
|
||||
void AttackStart(Unit* who) {}
|
||||
void MoveInLineOfSight(Unit *who){}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if(IsTrigger)
|
||||
return;
|
||||
|
||||
if(!DemonFire)
|
||||
DoCast(m_creature, SPELL_DEMON_FIRE); //duration 60s
|
||||
|
||||
if(CheckTimer < diff)
|
||||
{
|
||||
GETUNIT(Illidan, IllidanGUID);
|
||||
if(!Illidan || !Illidan->HasUnitMovementFlag(MOVEMENTFLAG_LEVITATING))
|
||||
{
|
||||
m_creature->SetVisibility(VISIBILITY_OFF);
|
||||
m_creature->setDeathState(JUST_DIED);
|
||||
return;
|
||||
}else CheckTimer = 5000;
|
||||
}else CheckTimer -= diff;
|
||||
|
||||
if(DespawnTimer < diff)
|
||||
{
|
||||
m_creature->SetVisibility(VISIBILITY_OFF);
|
||||
m_creature->setDeathState(JUST_DIED);
|
||||
}else DespawnTimer -= diff;
|
||||
}
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL blade_of_azzinothAI : public ScriptedAI
|
||||
{
|
||||
blade_of_azzinothAI(Creature* c) : ScriptedAI(c) {}
|
||||
void Reset() {}
|
||||
void Aggro(Unit *who) {}
|
||||
void AttackStart(Unit* who) { }
|
||||
void MoveInLineOfSight(Unit* who) { }
|
||||
blade_of_azzinothAI(Creature* c) : NullCreatureAI(c) {}
|
||||
|
||||
void SpellHit(Unit *caster, const SpellEntry *spell)
|
||||
{
|
||||
@@ -2060,15 +1996,14 @@ void boss_illidan_stormrageAI::CastEyeBlast()
|
||||
final.x = 2 * final.x - initial.x;
|
||||
final.y = 2 * final.y - initial.y;
|
||||
|
||||
Creature* Trigger = m_creature->SummonCreature(DEMON_FIRE, initial.x, initial.y, initial.z, 0, TEMPSUMMON_TIMED_DESPAWN, 13000);
|
||||
Creature* Trigger = m_creature->SummonTrigger(initial.x, initial.y, initial.z, 0, 13000);
|
||||
if(!Trigger) return;
|
||||
|
||||
((demonfireAI*)Trigger->AI())->IsTrigger = true;
|
||||
Trigger->SetSpeed(MOVE_WALK, 3);
|
||||
Trigger->SetUnitMovementFlags(MOVEMENTFLAG_WALK_MODE);
|
||||
Trigger->GetMotionMaster()->MovePoint(0, final.x, final.y, final.z);
|
||||
|
||||
Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
//Trigger->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
m_creature->SetUInt64Value(UNIT_FIELD_TARGET, Trigger->GetGUID());
|
||||
DoCast(Trigger, SPELL_EYE_BLAST);
|
||||
}
|
||||
@@ -2225,11 +2160,6 @@ CreatureAI* GetAI_shadow_demon(Creature *_Creature)
|
||||
return new shadow_demonAI (_Creature);
|
||||
}
|
||||
|
||||
CreatureAI* GetAI_demonfire(Creature *_Creature)
|
||||
{
|
||||
return new demonfireAI (_Creature);
|
||||
}
|
||||
|
||||
CreatureAI* GetAI_blade_of_azzinoth(Creature *_Creature)
|
||||
{
|
||||
return new blade_of_azzinothAI (_Creature);
|
||||
@@ -2286,11 +2216,6 @@ void AddSC_boss_illidan()
|
||||
newscript->GetAI = GetAI_shadow_demon;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name="mob_demon_fire";
|
||||
newscript->GetAI = GetAI_demonfire;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name = "mob_parasitic_shadowfiend";
|
||||
newscript->GetAI = GetAI_parasitic_shadowfiend;
|
||||
|
||||
@@ -79,44 +79,11 @@ struct TRINITY_DLL_DECL boss_broggokAI : public ScriptedAI
|
||||
}
|
||||
};
|
||||
|
||||
struct TRINITY_DLL_DECL mob_broggok_poisoncloudAI : public ScriptedAI
|
||||
{
|
||||
mob_broggok_poisoncloudAI(Creature *c) : ScriptedAI(c) {Reset();}
|
||||
|
||||
bool Start;
|
||||
|
||||
void Reset()
|
||||
{
|
||||
Start = false;
|
||||
}
|
||||
|
||||
void Aggro(Unit* who)
|
||||
{
|
||||
}
|
||||
|
||||
void UpdateAI(const uint32 diff)
|
||||
{
|
||||
if(!Start)
|
||||
{
|
||||
m_creature->SetUInt32Value(UNIT_NPC_FLAGS,0);
|
||||
m_creature->setFaction(45);
|
||||
m_creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
Start = true;
|
||||
DoCast(m_creature,SPELL_POISON);
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_boss_broggokAI(Creature *_Creature)
|
||||
{
|
||||
return new boss_broggokAI (_Creature);
|
||||
}
|
||||
|
||||
CreatureAI* GetAI_mob_broggok_poisoncloudAI(Creature *_Creature)
|
||||
{
|
||||
return new mob_broggok_poisoncloudAI (_Creature);
|
||||
}
|
||||
|
||||
void AddSC_boss_broggok()
|
||||
{
|
||||
Script *newscript;
|
||||
@@ -124,9 +91,4 @@ void AddSC_boss_broggok()
|
||||
newscript->Name="boss_broggok";
|
||||
newscript->GetAI = GetAI_boss_broggokAI;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name="mob_broggok_poisoncloud";
|
||||
newscript->GetAI = GetAI_mob_broggok_poisoncloudAI;
|
||||
newscript->RegisterSelf();
|
||||
}
|
||||
|
||||
@@ -25,7 +25,6 @@ EndScriptData */
|
||||
|
||||
#include "precompiled.h"
|
||||
#include "def_zulaman.h"
|
||||
#include "Spell.h"
|
||||
#include "Weather.h"
|
||||
|
||||
#define SPELL_STATIC_DISRUPTION 43622
|
||||
@@ -34,6 +33,7 @@ EndScriptData */
|
||||
#define SPELL_GUST_OF_WIND 43621
|
||||
#define SPELL_ELECTRICAL_STORM 43648
|
||||
#define SPELL_BERSERK 45078
|
||||
#define SPELL_ELECTRICAL_DAMAGE 43657
|
||||
#define SPELL_ELECTRICAL_OVERLOAD 43658
|
||||
#define SPELL_EAGLE_SWOOP 44732
|
||||
|
||||
@@ -57,15 +57,13 @@ EndScriptData */
|
||||
#define SE_LOC_Y_MAX 1435
|
||||
#define SE_LOC_Y_MIN 1370
|
||||
|
||||
#define MOB_TEMP_TRIGGER 23920
|
||||
|
||||
struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI
|
||||
{
|
||||
boss_akilzonAI(Creature *c) : ScriptedAI(c)
|
||||
{
|
||||
SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_ELECTRICAL_STORM);
|
||||
SpellEntry *TempSpell = (SpellEntry*)GetSpellStore()->LookupEntry(SPELL_ELECTRICAL_DAMAGE);
|
||||
if(TempSpell)
|
||||
TempSpell->Effect[1] = 0;//disable bugged lightning until fixed in core
|
||||
TempSpell->EffectBasePoints[1] = 49;//disable bugged lightning until fixed in core
|
||||
pInstance = ((ScriptedInstance*)c->GetInstanceData());
|
||||
Reset();
|
||||
}
|
||||
@@ -214,7 +212,7 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI
|
||||
{
|
||||
x = 343+rand()%60;
|
||||
y = 1380+rand()%60;
|
||||
if(Unit *trigger = m_creature->SummonCreature(MOB_TEMP_TRIGGER, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 2000))
|
||||
if(Unit *trigger = m_creature->SummonTrigger(x, y, z, 0, 2000))
|
||||
{
|
||||
trigger->setFaction(35);
|
||||
trigger->SetMaxHealth(100000);
|
||||
@@ -315,7 +313,7 @@ struct TRINITY_DLL_DECL boss_akilzonAI : public ScriptedAI
|
||||
target->SetUnitMovementFlags(MOVEMENTFLAG_LEVITATING);
|
||||
target->SendMonsterMove(x,y,m_creature->GetPositionZ()+15,0,0,0);
|
||||
}
|
||||
Unit *Cloud = m_creature->SummonCreature(MOB_TEMP_TRIGGER, x, y, m_creature->GetPositionZ()+16, 0, TEMPSUMMON_TIMED_DESPAWN, 15000);
|
||||
Unit *Cloud = m_creature->SummonTrigger(x, y, m_creature->GetPositionZ()+16, 0, 15000);
|
||||
if(Cloud)
|
||||
{
|
||||
CloudGUID = Cloud->GetGUID();
|
||||
|
||||
@@ -226,9 +226,9 @@ struct TRINITY_DLL_DECL boss_janalaiAI : public ScriptedAI
|
||||
for(uint8 j = 0; j < WallNum; j++)
|
||||
{
|
||||
if(WallNum == 3)
|
||||
wall = m_creature->SummonCreature(MOB_FIRE_BOMB, FireWallCoords[i][0],FireWallCoords[i][1]+5*(j-1),FireWallCoords[i][2],FireWallCoords[i][3],TEMPSUMMON_TIMED_DESPAWN,15000);
|
||||
wall = m_creature->SummonTrigger(FireWallCoords[i][0],FireWallCoords[i][1]+5*(j-1),FireWallCoords[i][2],FireWallCoords[i][3],15000);
|
||||
else
|
||||
wall = m_creature->SummonCreature(MOB_FIRE_BOMB, FireWallCoords[i][0]-2+4*j,FireWallCoords[i][1],FireWallCoords[i][2],FireWallCoords[i][3],TEMPSUMMON_TIMED_DESPAWN,15000);
|
||||
wall = m_creature->SummonTrigger(FireWallCoords[i][0]-2+4*j,FireWallCoords[i][1],FireWallCoords[i][2],FireWallCoords[i][3],15000);
|
||||
if(wall) wall->CastSpell(wall, SPELL_FIRE_WALL, true);
|
||||
}
|
||||
}
|
||||
@@ -683,14 +683,9 @@ CreatureAI* GetAI_mob_hatchlingAI(Creature *_Creature)
|
||||
return new mob_hatchlingAI(_Creature);
|
||||
}
|
||||
|
||||
struct TRINITY_DLL_DECL mob_eggAI : public ScriptedAI
|
||||
struct TRINITY_DLL_DECL mob_eggAI : public NullCreatureAI
|
||||
{
|
||||
mob_eggAI(Creature *c) : ScriptedAI(c){}
|
||||
void Reset() {}
|
||||
void Aggro(Unit* who) {}
|
||||
void AttackStart(Unit* who) {}
|
||||
void MoveInLineOfSight(Unit* who) {}
|
||||
void UpdateAI(const uint32 diff) {}
|
||||
mob_eggAI(Creature *c) : NullCreatureAI(c){}
|
||||
|
||||
void SpellHit(Unit *caster, const SpellEntry *spell)
|
||||
{
|
||||
|
||||
@@ -546,23 +546,15 @@ struct TRINITY_DLL_DECL boss_zuljinAI : public ScriptedAI
|
||||
if(Pillar_Of_Fire_Timer < diff)
|
||||
{
|
||||
if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
|
||||
{
|
||||
float x, y, z;
|
||||
target->GetPosition(x, y, z);
|
||||
Creature* Pillar = m_creature->SummonCreature(CREATURE_COLUMN_OF_FIRE, x, y, z, 0, TEMPSUMMON_TIMED_DESPAWN, 30000);
|
||||
if(Pillar)
|
||||
{
|
||||
Pillar->CastSpell(Pillar, SPELL_PILLAR_TRIGGER, true);
|
||||
Pillar->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE);
|
||||
}
|
||||
}
|
||||
DoCast(target, SPELL_SUMMON_PILLAR);
|
||||
Pillar_Of_Fire_Timer = 10000;
|
||||
}else Pillar_Of_Fire_Timer -= diff;
|
||||
|
||||
if(Flame_Breath_Timer < diff)
|
||||
{
|
||||
if(Unit* target = SelectUnit(SELECT_TARGET_RANDOM, 0))
|
||||
m_creature->CastSpell(m_creature, SPELL_FLAME_BREATH, false);
|
||||
m_creature->SetInFront(target);
|
||||
DoCast(m_creature, SPELL_FLAME_BREATH);
|
||||
Flame_Breath_Timer = 10000;
|
||||
}else Flame_Breath_Timer -= diff;
|
||||
break;
|
||||
@@ -581,21 +573,6 @@ CreatureAI* GetAI_boss_zuljin(Creature *_Creature)
|
||||
return new boss_zuljinAI (_Creature);
|
||||
}
|
||||
|
||||
struct TRINITY_DLL_DECL do_nothingAI : public ScriptedAI
|
||||
{
|
||||
do_nothingAI(Creature *c) : ScriptedAI(c) {}
|
||||
void Reset() {}
|
||||
void Aggro(Unit* who) {}
|
||||
void AttackStart(Unit* who) {}
|
||||
void MoveInLineOfSight(Unit* who) {}
|
||||
void UpdateAI(const uint32 diff) {}
|
||||
};
|
||||
|
||||
CreatureAI* GetAI_do_nothing(Creature *_Creature)
|
||||
{
|
||||
return new do_nothingAI (_Creature);
|
||||
}
|
||||
|
||||
struct TRINITY_DLL_DECL feather_vortexAI : public ScriptedAI
|
||||
{
|
||||
feather_vortexAI(Creature *c) : ScriptedAI(c) {}
|
||||
@@ -631,11 +608,6 @@ void AddSC_boss_zuljin()
|
||||
newscript->GetAI = GetAI_boss_zuljin;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name="do_nothing";
|
||||
newscript->GetAI = GetAI_do_nothing;
|
||||
newscript->RegisterSelf();
|
||||
|
||||
newscript = new Script;
|
||||
newscript->Name="mob_zuljin_vortex";
|
||||
newscript->GetAI = GetAI_feather_vortexAI;
|
||||
|
||||
Reference in New Issue
Block a user