Merge pull request #11948 from MitchesD/misc

Scripts/Azuregos: converted to EventMap and WorldBossAI
This commit is contained in:
joschiwald
2014-04-28 19:58:17 +02:00
2 changed files with 177 additions and 117 deletions

View File

@@ -0,0 +1,7 @@
DELETE FROM `spell_dbc` WHERE `Id`=23183;
INSERT INTO `spell_dbc` (`Id`, `Dispel`, `Mechanic`, `Attributes`, `AttributesEx`, `AttributesEx2`, `AttributesEx3`, `AttributesEx4`, `AttributesEx5`, `AttributesEx6`, `AttributesEx7`, `Stances`, `StancesNot`, `Targets`, `CastingTimeIndex`, `AuraInterruptFlags`, `ProcFlags`, `ProcChance`, `ProcCharges`, `MaxLevel`, `BaseLevel`, `SpellLevel`, `DurationIndex`, `RangeIndex`, `StackAmount`, `EquippedItemClass`, `EquippedItemSubClassMask`, `EquippedItemInventoryTypeMask`, `Effect1`, `Effect2`, `Effect3`, `EffectDieSides1`, `EffectDieSides2`, `EffectDieSides3`, `EffectRealPointsPerLevel1`, `EffectRealPointsPerLevel2`, `EffectRealPointsPerLevel3`, `EffectBasePoints1`, `EffectBasePoints2`, `EffectBasePoints3`, `EffectMechanic1`, `EffectMechanic2`, `EffectMechanic3`, `EffectImplicitTargetA1`, `EffectImplicitTargetA2`, `EffectImplicitTargetA3`, `EffectImplicitTargetB1`, `EffectImplicitTargetB2`, `EffectImplicitTargetB3`, `EffectRadiusIndex1`, `EffectRadiusIndex2`, `EffectRadiusIndex3`, `EffectApplyAuraName1`, `EffectApplyAuraName2`, `EffectApplyAuraName3`, `EffectAmplitude1`, `EffectAmplitude2`, `EffectAmplitude3`, `EffectMultipleValue1`, `EffectMultipleValue2`, `EffectMultipleValue3`, `EffectMiscValue1`, `EffectMiscValue2`, `EffectMiscValue3`, `EffectMiscValueB1`, `EffectMiscValueB2`, `EffectMiscValueB3`, `EffectTriggerSpell1`, `EffectTriggerSpell2`, `EffectTriggerSpell3`, `EffectSpellClassMaskA1`, `EffectSpellClassMaskA2`, `EffectSpellClassMaskA3`, `EffectSpellClassMaskB1`, `EffectSpellClassMaskB2`, `EffectSpellClassMaskB3`, `EffectSpellClassMaskC1`, `EffectSpellClassMaskC2`, `EffectSpellClassMaskC3`, `MaxTargetLevel`, `SpellFamilyName`, `SpellFamilyFlags1`, `SpellFamilyFlags2`, `SpellFamilyFlags3`, `MaxAffectedTargets`, `DmgClass`, `PreventionType`, `DmgMultiplier1`, `DmgMultiplier2`, `DmgMultiplier3`, `AreaGroupId`, `SchoolMask`, `Comment`) VALUES
(23183, 0, 0, 536871296, 268435592, 4, 196864, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 101, 0, 0, 0, 0, 29, 1, 0, -1, 0, 0, 6, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 22, 0, 0, 15, 0, 0, 12, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 'Mark of Frost - Triggered spell');
DELETE FROM `spell_script_names` WHERE `spell_id`=23183;
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(23183, 'spell_mark_of_frost');

View File

@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2014 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
@@ -16,151 +15,205 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Azuregos
SD%Complete: 90
SDComment: Teleport not included, spell reflect not effecting dots (Core problem)
SDCategory: Azshara
EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
enum Say
{
SAY_TELEPORT = 0
SAY_TELEPORT = 0
};
enum Spells
{
SPELL_MARKOFFROST = 23182,
SPELL_MANASTORM = 21097,
SPELL_CHILL = 21098,
SPELL_FROSTBREATH = 21099,
SPELL_REFLECT = 22067,
SPELL_CLEAVE = 8255, //Perhaps not right ID
SPELL_ENRAGE = 23537
SPELL_MARK_OF_FROST = 23182,
SPELL_AURA_OF_FROST = 23186,
SPELL_MARK_OF_FROST_AURA = 23184,
SPELL_MANA_STORM = 21097,
SPELL_CHILL = 21098,
SPELL_FROST_BREATH = 21099,
SPELL_REFLECT = 22067,
SPELL_CLEAVE = 8255, // Perhaps not right ID
SPELL_ENRAGE = 23537
};
enum Events
{
EVENT_MARK_OF_FROST = 1,
EVENT_MANA_STORM,
EVENT_CHILL,
EVENT_BREATH,
EVENT_TELEPORT,
EVENT_REFLECT,
EVENT_CLEAVE,
EVENT_ENRAGE
};
class boss_azuregos : public CreatureScript
{
public:
boss_azuregos() : CreatureScript("boss_azuregos") { }
public:
boss_azuregos() : CreatureScript("boss_azuregos") { }
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new boss_azuregosAI(creature);
}
struct boss_azuregosAI : public ScriptedAI
{
boss_azuregosAI(Creature* creature) : ScriptedAI(creature) { }
uint32 MarkOfFrostTimer;
uint32 ManaStormTimer;
uint32 ChillTimer;
uint32 BreathTimer;
uint32 TeleportTimer;
uint32 ReflectTimer;
uint32 CleaveTimer;
uint32 EnrageTimer;
bool Enraged;
void Reset() OVERRIDE
struct boss_azuregosAI : public WorldBossAI
{
MarkOfFrostTimer = 35000;
ManaStormTimer = urand(5000, 17000);
ChillTimer = urand(10000, 30000);
BreathTimer = urand(2000, 8000);
TeleportTimer = 30000;
ReflectTimer = urand(15000, 30000);
CleaveTimer = 7000;
EnrageTimer = 0;
Enraged = false;
}
boss_azuregosAI(Creature* creature) : WorldBossAI(creature) { }
void EnterCombat(Unit* /*who*/) OVERRIDE { }
void UpdateAI(uint32 diff) OVERRIDE
{
//Return since we have no target
if (!UpdateVictim())
return;
if (TeleportTimer <= diff)
void Reset() OVERRIDE
{
Talk(SAY_TELEPORT);
ThreatContainer::StorageType threatlist = me->getThreatManager().getThreatList();
ThreatContainer::StorageType::const_iterator i = threatlist.begin();
for (i = threatlist.begin(); i != threatlist.end(); ++i)
_Reset();
}
void EnterCombat(Unit* /*who*/) OVERRIDE
{
DoCast(me, SPELL_MARK_OF_FROST_AURA, true);
_enraged = false;
events.ScheduleEvent(EVENT_MARK_OF_FROST, 35000);
events.ScheduleEvent(EVENT_MANA_STORM, urand(5000, 17000));
events.ScheduleEvent(EVENT_CHILL, urand(10000, 30000));
events.ScheduleEvent(EVENT_BREATH, urand(2000, 8000));
events.ScheduleEvent(EVENT_TELEPORT, 30000);
events.ScheduleEvent(EVENT_REFLECT, urand(15000, 30000));
events.ScheduleEvent(EVENT_CLEAVE, 7000);
}
void KilledUnit(Unit* who) OVERRIDE
{
if (who->GetTypeId() == TYPEID_PLAYER)
who->CastSpell(who, SPELL_MARK_OF_FROST, true);
}
void UpdateAI(uint32 diff) OVERRIDE
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
Unit* unit = Unit::GetUnit(*me, (*i)->getUnitGuid());
if (unit && (unit->GetTypeId() == TYPEID_PLAYER))
switch (eventId)
{
DoTeleportPlayer(unit, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, unit->GetOrientation());
case EVENT_MANA_STORM:
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 60.0f, true))
DoCast(target, SPELL_MANA_STORM);
events.ScheduleEvent(EVENT_MANA_STORM, urand(7500, 12500));
break;
case EVENT_CHILL:
DoCastVictim(SPELL_CHILL);
events.ScheduleEvent(EVENT_CHILL, urand(13000, 25000));
break;
case EVENT_BREATH:
DoCastVictim(SPELL_FROST_BREATH);
events.ScheduleEvent(EVENT_BREATH, urand(10000, 15000));
break;
case EVENT_TELEPORT:
{
Talk(SAY_TELEPORT);
ThreatContainer::StorageType const& threatlist = me->getThreatManager().getThreatList();
for (ThreatContainer::StorageType::const_iterator i = threatlist.begin(); i != threatlist.end(); ++i)
{
if (Player* player = ObjectAccessor::GetPlayer(*me, (*i)->getUnitGuid()))
DoTeleportPlayer(player, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+3, player->GetOrientation());
}
DoResetThreat();
events.ScheduleEvent(EVENT_TELEPORT, 30000);
break;
}
case EVENT_REFLECT:
DoCast(me, SPELL_REFLECT);
events.ScheduleEvent(EVENT_REFLECT, urand(20000, 35000));
break;
case EVENT_CLEAVE:
DoCastVictim(SPELL_CLEAVE);
events.ScheduleEvent(EVENT_CLEAVE, 7000);
break;
default:
break;
}
}
DoResetThreat();
TeleportTimer = 30000;
} else TeleportTimer -= diff;
if (HealthBelowPct(26) && !_enraged)
{
DoCast(me, SPELL_ENRAGE);
_enraged = true;
}
// //MarkOfFrostTimer
// if (MarkOfFrostTimer <= diff)
// {
// DoCastVictim(SPELL_MARKOFFROST);
// MarkOfFrostTimer = 25000;
// } else MarkOfFrostTimer -= diff;
//ChillTimer
if (ChillTimer <= diff)
{
DoCastVictim(SPELL_CHILL);
ChillTimer = urand(13000, 25000);
} else ChillTimer -= diff;
//BreathTimer
if (BreathTimer <= diff)
{
DoCastVictim(SPELL_FROSTBREATH);
BreathTimer = urand(10000, 15000);
} else BreathTimer -= diff;
//ManaStormTimer
if (ManaStormTimer <= diff)
{
if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0))
DoCast(target, SPELL_MANASTORM);
ManaStormTimer = urand(7500, 12500);
} else ManaStormTimer -= diff;
//ReflectTimer
if (ReflectTimer <= diff)
{
DoCast(me, SPELL_REFLECT);
ReflectTimer = urand(20000, 35000);
} else ReflectTimer -= diff;
//CleaveTimer
if (CleaveTimer <= diff)
{
DoCastVictim(SPELL_CLEAVE);
CleaveTimer = 7000;
} else CleaveTimer -= diff;
//EnrageTimer
if (HealthBelowPct(26) && !Enraged)
{
DoCast(me, SPELL_ENRAGE);
Enraged = true;
DoMeleeAttackIfReady();
}
DoMeleeAttackIfReady();
private:
bool _enraged;
};
CreatureAI* GetAI(Creature* creature) const OVERRIDE
{
return new boss_azuregosAI(creature);
}
};
class MarkOfFrostTargetSelector
{
public:
MarkOfFrostTargetSelector() { }
bool operator()(WorldObject* object) const
{
if (Unit* unit = object->ToUnit())
return !(unit->HasAura(SPELL_MARK_OF_FROST) && !unit->HasAura(SPELL_AURA_OF_FROST));
return true;
}
};
class spell_mark_of_frost : public SpellScriptLoader
{
public:
spell_mark_of_frost() : SpellScriptLoader("spell_mark_of_frost") { }
class spell_mark_of_frost_SpellScript : public SpellScript
{
PrepareSpellScript(spell_mark_of_frost_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_MARK_OF_FROST))
return false;
if (!sSpellMgr->GetSpellInfo(SPELL_AURA_OF_FROST))
return false;
return true;
}
void FilterTargets(std::list<WorldObject*>& targets)
{
targets.remove_if(MarkOfFrostTargetSelector());
}
void HandleEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
GetHitUnit()->CastSpell(GetHitUnit(), SPELL_AURA_OF_FROST, true);
}
void Register() OVERRIDE
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_mark_of_frost_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
OnEffectHitTarget += SpellEffectFn(spell_mark_of_frost_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_APPLY_AURA);
}
};
SpellScript* GetSpellScript() const OVERRIDE
{
return new spell_mark_of_frost_SpellScript();
}
};
};
void AddSC_boss_azuregos()
{
new boss_azuregos();
new spell_mark_of_frost();
}