Skip to content

Commit

Permalink
Core/Scripting: Move Boss_Gatewatcher_Gyrokill to c++ scripting. Addi…
Browse files Browse the repository at this point in the history
…tional cleanup in Mechanar.
  • Loading branch information
malcrom committed Jan 12, 2013
1 parent 41817bc commit 0b6997b
Show file tree
Hide file tree
Showing 6 changed files with 292 additions and 189 deletions.
13 changes: 13 additions & 0 deletions sql/updates/world/2013_01_11_05_world_creature_text.sql
@@ -0,0 +1,13 @@
-- NPC talk text for Gatewatcher Gyro-Kill
DELETE FROM `creature_text` WHERE `entry`=19218;
INSERT INTO `creature_text` (`entry`,`groupid`,`id`,`text`,`type`,`language`,`probability`,`emote`,`duration`,`sound`,`comment`) VALUES
(19218,0,0, 'I predict a painful death.',14,0,100,0,0,11101, 'Gatewatcher Gyro-Kill - Aggro'),
(19218,1,0, 'Your strategy was flawed.',14,0,100,0,0,11102, 'Gatewatcher Gyro-Kill - On Kill'),
(19218,1,1, 'Yes, the only logical outcome.',12,0,100,0,0,11103, 'Gatewatcher Gyro-Kill - On Kill'),
(19218,2,0, 'Measure twice; cut once.',14,0,100,0,0,11104, 'Gatewatcher Gyro-Kill - Sawblades'),
(19218,2,1, 'If my division is correct you should be quite dead.',14,0,100,0,0,11105, 'Gatewatcher Gyro-Kill - Sawblades'),
(19218,3,0, 'An unforeseen... contingency.',14,0,100,0,0,11106, 'Gatewatcher Gyro-Kill - On Death');

DELETE FROM `creature_ai_scripts` WHERE `creature_id`=19218;
DELETE FROM `creature_ai_texts` WHERE `entry` BETWEEN -86 AND -81;
UPDATE `creature_template` SET `AIName`='', `ScriptName`= 'Boss_Gatewatcher_Gyrokill' WHERE `entry`=19218;
@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
Expand All @@ -25,18 +24,120 @@ EndScriptData */

#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "mechanar.h"

//not used
#define SAY_AGGRO -1554000
#define SAY_SAW_ATTACK1 -1554001
#define SAY_SAW_ATTACK2 -1554002
#define SAY_SLAY1 -1554003
#define SAY_SLAY2 -1554004
#define SAY_DEATH -1554005
enum Say
{
SAY_AGGRO = 0,
SAY_SLAY = 1,
SAY_SAW_BLADEs = 2,
SAY_DEATH = 3
};

#define SPELL_STREAM_OF_MACHINE_FLUID 35311
#define SPELL_SAW_BLADE 35318
#define H_SPELL_SAW_BLADE 39192
#define SPELL_SHADOW_POWER 35322
#define H_SPELL_SHADOW_POWER 39193
enum Spells
{
SPELL_STREAM_OF_MACHINE_FLUID = 35311,
SPELL_SAW_BLADE = 35318,
H_SPELL_SAW_BLADE = 39192,
SPELL_SHADOW_POWER = 35322,
H_SPELL_SHADOW_POWER = 39193
};

enum Events
{
EVENT_STREAM_OF_MACHINE_FLUID = 0,
EVENT_SAW_BLADE = 1,
EVENT_SHADOW_POWER = 2
};

class Boss_Gatewatcher_Gyrokill : public CreatureScript
{
public: Boss_Gatewatcher_Gyrokill() : CreatureScript("Boss_Gatewatcher_Gyrokill") { }

struct Boss_Gatewatcher_GyrokillAI : public BossAI
{
Boss_Gatewatcher_GyrokillAI(Creature* creature) : BossAI(creature, DATA_GATEWATCHER_GYROKILL) {}

void Reset()
{
if (instance)
instance->SetData(DATA_GATEWATCHER_GYROKILL, NOT_STARTED);
}

void JustDied(Unit* /*killer*/)
{
if (instance)
instance->SetData(DATA_GATEWATCHER_GYROKILL, DONE);

Talk(SAY_DEATH);
}

void EnterCombat(Unit* /*who*/)
{
if (instance)
instance->SetData(DATA_GATEWATCHER_GYROKILL, IN_PROGRESS);

events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, 10000);
events.ScheduleEvent(EVENT_SAW_BLADE, 20000);
events.ScheduleEvent(EVENT_SHADOW_POWER, 25000);

Talk(SAY_AGGRO);
}

void KilledUnit(Unit* /*victim*/)
{
Talk(SAY_SLAY);
}

void UpdateAI(uint32 const diff)
{
if (!UpdateVictim())
return;

events.Update(diff);

if (me->HasUnitState(UNIT_STATE_CASTING))
return;

while (uint32 eventId = events.ExecuteEvent())
{
switch (eventId)
{
case EVENT_STREAM_OF_MACHINE_FLUID:
DoCastVictim(SPELL_STREAM_OF_MACHINE_FLUID, true);
events.ScheduleEvent(EVENT_STREAM_OF_MACHINE_FLUID, urand(13000, 17000));
break;
case EVENT_SAW_BLADE:
if (IsHeroic())
DoCast(me, H_SPELL_SAW_BLADE);
else
DoCast(me, SPELL_SAW_BLADE);
Talk(SAY_SAW_BLADEs);
events.ScheduleEvent(EVENT_SAW_BLADE, urand(20000, 30000));
break;
case EVENT_SHADOW_POWER:
if (IsHeroic())

This comment has been minimized.

Copy link
@Subv

Subv Jan 12, 2013

Contributor

spelldifficulty_dbc, man.

This comment has been minimized.

Copy link
@malcrom

malcrom Jan 12, 2013

Author Contributor

I'm amazed how you can say something but do it so poorly.

This comment has been minimized.

Copy link
@Subv

Subv Jan 12, 2013

Contributor

Read the wiki about spelldifficulty_dbc to see what i mean, maybe?

DoCast(me, H_SPELL_SHADOW_POWER);
else
DoCast(me, SPELL_SHADOW_POWER);
events.ScheduleEvent(EVENT_SAW_BLADE, urand(25000, 35000));
break;
default:
break;
}
}

DoMeleeAttackIfReady();
}
};

CreatureAI* GetAI(Creature* creature) const
{
return new Boss_Gatewatcher_GyrokillAI (creature);
}
};

void AddSC_Boss_Gatewatcher_Gyrokill()
{
new Boss_Gatewatcher_Gyrokill();
}
Expand Up @@ -36,59 +36,58 @@ enum eSays
SAY_DEATH = 4
};

enum eSpells
enum Spells
{
SPELL_SUMMON_RAGIN_FLAMES = 35275,
SPELL_SUMMON_RAGIN_FLAMES = 35275, // Not scripted
SPELL_FROST_ATTACK = 35263,
SPELL_ARCANE_BLAST = 35314,
SPELL_DRAGONS_BREATH = 35250,
SPELL_KNOCKBACK = 37317,
SPELL_SOLARBURN = 35267,
H_SPELL_SUMMON_RAGIN_FLAMES = 39084,
SPELL_INFERNO = 35268,
H_SPELL_INFERNO = 39346,
SPELL_FIRE_TAIL = 35278,
H_SPELL_SUMMON_RAGIN_FLAMES = 39084, // Not scripted
SPELL_INFERNO = 35268, // Not scripted
H_SPELL_INFERNO = 39346, // Not scripted
SPELL_FIRE_TAIL = 35278 // Not scripted
};

enum Events
{
EVENT_FROST_ATTACK = 0,
EVENT_ARCANE_BLAST = 1,
EVENT_DRAGONS_BREATH = 2,
EVENT_KNOCKBACK = 3,
EVENT_SOLARBURN = 4
};

class boss_nethermancer_sepethrea : public CreatureScript
{
public:
public: boss_nethermancer_sepethrea(): CreatureScript("boss_nethermancer_sepethrea") {}

boss_nethermancer_sepethrea()
: CreatureScript("boss_nethermancer_sepethrea")
{
}
struct boss_nethermancer_sepethreaAI : public ScriptedAI
struct boss_nethermancer_sepethreaAI : public BossAI
{
boss_nethermancer_sepethreaAI(Creature* creature) : ScriptedAI(creature)
boss_nethermancer_sepethreaAI(Creature* creature) : BossAI(creature,DATA_NETHERMANCER_SEPRETHREA)
{
instance = creature->GetInstanceScript();
}

InstanceScript* instance;

uint32 frost_attack_Timer;
uint32 arcane_blast_Timer;
uint32 dragons_breath_Timer;
uint32 knockback_Timer;
uint32 solarburn_Timer;

void Reset()
{
frost_attack_Timer = urand(7000, 10000);
arcane_blast_Timer = urand(12000, 18000);
dragons_breath_Timer = urand(18000, 22000);
knockback_Timer = urand(22000, 28000);
solarburn_Timer = 30000;

if (instance)
instance->SetData(DATA_NETHERMANCER_EVENT, NOT_STARTED);
instance->SetData(DATA_NETHERMANCER_SEPRETHREA, NOT_STARTED);
}

void EnterCombat(Unit* who)
{
if (instance)
instance->SetData(DATA_NETHERMANCER_EVENT, IN_PROGRESS);
instance->SetData(DATA_NETHERMANCER_SEPRETHREA, IN_PROGRESS);

events.ScheduleEvent(EVENT_FROST_ATTACK, urand(7000, 10000));
events.ScheduleEvent(EVENT_ARCANE_BLAST, urand(12000, 18000));
events.ScheduleEvent(EVENT_DRAGONS_BREATH, urand(18000, 22000));
events.ScheduleEvent(EVENT_KNOCKBACK, urand(22000, 28000));
events.ScheduleEvent(EVENT_SOLARBURN, 30000);

Talk(SAY_AGGRO);
DoCast(who, SPELL_SUMMON_RAGIN_FLAMES);
Expand All @@ -104,64 +103,49 @@ class boss_nethermancer_sepethrea : public CreatureScript
{
Talk(SAY_DEATH);
if (instance)
instance->SetData(DATA_NETHERMANCER_EVENT, DONE);
instance->SetData(DATA_NETHERMANCER_SEPRETHREA, DONE);
}

void UpdateAI(const uint32 diff)
void UpdateAI(uint32 const diff)
{
//Return since we have no target
if (!UpdateVictim())
return;

//Frost Attack
if (frost_attack_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_FROST_ATTACK);
events.Update(diff);

frost_attack_Timer = urand(7000, 10000);
}
else
frost_attack_Timer -= diff;
if (me->HasUnitState(UNIT_STATE_CASTING))
return;

//Arcane Blast
if (arcane_blast_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_ARCANE_BLAST);
arcane_blast_Timer = 15000;
}
else
arcane_blast_Timer -= diff;
//Dragons Breath
if (dragons_breath_Timer <= diff)
while (uint32 eventId = events.ExecuteEvent())
{
DoCast(me->getVictim(), SPELL_DRAGONS_BREATH);
switch (eventId)
{
if (rand()%2)
return;
Talk(SAY_DRAGONS_BREATH);
case EVENT_FROST_ATTACK:
DoCastVictim(SPELL_FROST_ATTACK, true);
events.ScheduleEvent(EVENT_FROST_ATTACK, urand(7000, 10000));
break;
case EVENT_ARCANE_BLAST:
DoCastVictim(SPELL_ARCANE_BLAST, true);
events.ScheduleEvent(EVENT_ARCANE_BLAST, 15000);
break;
case EVENT_DRAGONS_BREATH:
DoCastVictim(SPELL_DRAGONS_BREATH, true);
events.ScheduleEvent(EVENT_DRAGONS_BREATH, urand(12000, 22000));
if (roll_chance_i(50))
Talk(SAY_DRAGONS_BREATH);
break;
case EVENT_KNOCKBACK:
DoCastVictim(SPELL_KNOCKBACK, true);
events.ScheduleEvent(EVENT_KNOCKBACK, urand(15000, 25000));
break;
case EVENT_SOLARBURN:
DoCastVictim(SPELL_SOLARBURN, true);
events.ScheduleEvent(EVENT_SOLARBURN, 30000);
break;
default:
break;
}
dragons_breath_Timer = urand(12000, 22000);
}
else
dragons_breath_Timer -= diff;

//Knockback
if (knockback_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_KNOCKBACK);
knockback_Timer = urand(15000, 25000);
}
else
knockback_Timer -= diff;

//Solarburn
if (solarburn_Timer <= diff)
{
DoCast(me->getVictim(), SPELL_SOLARBURN);
solarburn_Timer = 30000;
}
else
solarburn_Timer -= diff;

DoMeleeAttackIfReady();
}
Expand All @@ -172,6 +156,7 @@ class boss_nethermancer_sepethrea : public CreatureScript
return new boss_nethermancer_sepethreaAI(creature);
}
};

class mob_ragin_flames : public CreatureScript
{
public:
Expand Down Expand Up @@ -217,7 +202,7 @@ class mob_ragin_flames : public CreatureScript
{
if (instance)
{
if (instance->GetData(DATA_NETHERMANCER_EVENT) != IN_PROGRESS)
if (instance->GetData(DATA_NETHERMANCER_SEPRETHREA) != IN_PROGRESS)
{
//remove
me->setDeathState(JUST_DIED);
Expand Down Expand Up @@ -259,6 +244,7 @@ class mob_ragin_flames : public CreatureScript
return new mob_ragin_flamesAI(creature);
}
};

void AddSC_boss_nethermancer_sepethrea()
{
new boss_nethermancer_sepethrea();
Expand Down

0 comments on commit 0b6997b

Please sign in to comment.