*Update gluth script.

--HG--
branch : trunk
This commit is contained in:
megamage
2009-05-16 16:52:57 -05:00
parent a0ba5dc206
commit c583767ad6
4 changed files with 84 additions and 42 deletions

View File

@@ -53,6 +53,8 @@ INSERT INTO creature_template (entry, spell1, spell2, spell3, spell4, spell5, sp
(29632, 15496, 0, 0, 0, 0, 0, 0, 0), # Plagued Warrior (H)
(16290, 28156, 0, 0, 0, 0, 0, 0, 0), # Fallout Slime
(29388, 54367, 0, 0, 0, 0, 0, 0, 0), # Fallout Slime (H)
(16360, 29307, 0, 0, 0, 0, 0, 0, 0), # Zombie Chow
(30303, 29307, 0, 0, 0, 0, 0, 0, 0), # Zombie Chow (H)
(16803, 0, 0, 0, 61696, 29060, 29061, 0, 0), # Death Knight Understudy
(29941, 0, 0, 0, 61696, 29060, 29061, 0, 0), # Death Knight Understudy (H)
(16124, 55604, 0, 0, 0, 0, 0, 0, 27892), # Unrelenting Trainee

View File

@@ -23,43 +23,14 @@
#define SPELL_BERSERK 26662
#define SPELL_INFECTED_WOUND 29306
#define MOB_ZOMBIE
#define MOB_ZOMBIE 16360
#define ADD_1X 3269.590
#define ADD_1Y -3161.287
#define ADD_1Z 297.423
#define ADD_2X 3277.797
#define ADD_2Y -3170.352
#define ADD_2Z 297.423
#define ADD_3X 3267.049
#define ADD_3Y -3172.820
#define ADD_3Z 297.423
#define ADD_4X 3252.157
#define ADD_4Y -3132.135
#define ADD_4Z 297.423
#define ADD_5X 3259.990
#define ADD_5Y -3126.590
#define ADD_5Z 297.423
#define ADD_6X 3259.815
#define ADD_6Y -3137.576
#define ADD_6Z 297.423
#define ADD_7X 3308.030
#define ADD_7Y -3132.135
#define ADD_7Z 297.423
#define ADD_8X 3303.046
#define ADD_8Y -3180.682
#define ADD_8Z 297.423
#define ADD_9X 3313.283
#define ADD_9Y -3180.766
#define ADD_9Z 297.423
const float PosSummon[3][4] =
{
{3267.9, -3172.1, 297.42, 0.94},
{3253.2, -3132.3, 297.42, 0},
{3308.3, -3185.8, 297.42, 1.58},
};
enum Events
{
@@ -78,18 +49,37 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI
me->ApplySpellImmune(0, IMMUNITY_ID, SPELL_INFECTED_WOUND, true);
}
std::vector<Creature*> triggers;
void Reset()
{
triggers.clear();
_Reset();
}
void MoveInLineOfSight(Unit *who)
{
/*if(who->GetEntry() == MOB_ZOMBIE)
if(who->GetEntry() == MOB_ZOMBIE && me->IsWithinDistInMap(who, 20))
{
me->AddThreat(who, 1000000
SetGazeOn(who);
me->MonsterTextEmote(" spots a nearby zombie to devour!", 0, true);
}
else
BossAI::MoveInLineOfSight(who);*/
BossAI::MoveInLineOfSight(who);
}
void EnterCombat(Unit *who)
{
for(uint32 i = 0; i < 3; ++i)
if(Creature *trigger = DoSummon(WORLD_TRIGGER, PosSummon[i]))
triggers.push_back(trigger);
if(triggers.size() < 3)
{
error_log("Script Gluth: cannot summon triggers!");
EnterEvadeMode();
return;
}
_EnterCombat();
events.ScheduleEvent(EVENT_WOUND, 10000);
events.ScheduleEvent(EVENT_ENRAGE, 30000);
@@ -98,9 +88,18 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI
events.ScheduleEvent(EVENT_SUMMON, 10000);
}
void JustSummoned(Creature *summon)
{
if(summon->GetEntry() == WORLD_TRIGGER)
summon->setActive(true);
else if(summon->GetEntry() == MOB_ZOMBIE)
summon->AI()->AttackStart(me);
summons.Summon(summon);
}
void UpdateAI(const uint32 diff)
{
if(!UpdateVictim())
if(!UpdateVictimWithGaze())
return;
events.Update(diff);
@@ -126,14 +125,25 @@ struct TRINITY_DLL_DECL boss_gluthAI : public BossAI
return;
case EVENT_SUMMON:
for(uint32 i = 0; i < HEROIC(1,2); ++i)
//SummonZombie(HEROIC(1,2));
DoSummon(MOB_ZOMBIE, triggers[rand()%3]);
events.ScheduleEvent(EVENT_SUMMON, 10000);
return;
}
}
DoMeleeAttackIfReady();
if(me->getVictim()->GetEntry() == MOB_ZOMBIE)
{
if(me->IsWithinMeleeRange(me->getVictim()))
{
me->Kill(me->getVictim());
me->ModifyHealth(me->GetMaxHealth() * 0.05f);
}
}
else
DoMeleeAttackIfReady();
}
};
CreatureAI* GetAI_boss_gluth(Creature *_Creature)
{
return new boss_gluthAI (_Creature);

View File

@@ -97,6 +97,33 @@ void CreatureAI::MoveInLineOfSight(Unit *who)
AttackStart(who->getVictim());
}
void CreatureAI::SetGazeOn(Unit *target)
{
if(me->canAttack(target))
{
AttackStart(target);
me->SetReactState(REACT_PASSIVE);
}
}
bool CreatureAI::UpdateVictimWithGaze()
{
if(!me->isInCombat())
return false;
if(me->HasReactState(REACT_PASSIVE))
{
if(me->getVictim())
return true;
else
me->SetReactState(REACT_AGGRESSIVE);
}
if(Unit *victim = me->SelectVictim())
AttackStart(victim);
return me->getVictim();
}
bool CreatureAI::UpdateVictimByReact()
{
if(!me->isInCombat())

View File

@@ -83,6 +83,7 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
bool UpdateVictim();
bool UpdateVictimByReact();
bool UpdateVictimWithGaze();
public:
explicit CreatureAI(Creature *c) : UnitAI((Unit*)c), me(c), m_creature(c) {}
@@ -167,6 +168,8 @@ class TRINITY_DLL_SPEC CreatureAI : public UnitAI
Unit* SelectTarget(SelectAggroTarget target, uint32 position = 0, float dist = 0, bool playerOnly = false, int32 aura = 0);
void SelectTargetList(std::list<Unit*> &targetList, uint32 num, SelectAggroTarget target, float dist = 0, bool playerOnly = false, int32 aura = 0);
void SetGazeOn(Unit *target);
static AISpellInfoType *AISpellInfo;
static void FillAISpellInfo();