Scripts/Icecrown Citadel

* Fixed Lord Marrowgar's Coldflame
* Fixed crashes cause by recent targeting changes in Professor Putricide
* Corrected target usage in Rotface's Ooze Explosion spell script
* Added missing previous bosses killed check to Valithria Dreamwalker
This commit is contained in:
Shauren
2011-08-27 17:02:44 +02:00
parent 8754166071
commit 28a8732c8b
6 changed files with 100 additions and 29 deletions
@@ -0,0 +1 @@
UPDATE `spell_script_names` SET `ScriptName`='spell_marrowgar_coldflame_bonestorm' WHERE `spell_id`=72705 AND `ScriptName`='spell_marrowgar_coldflame';
@@ -655,7 +655,7 @@ class spell_blood_queen_bloodbolt : public SpellScriptLoader
void FilterTargets(std::list<Unit*>& targets)
{
uint32 targetCount = targets.size() / 3 + 1;
uint32 targetCount = (targets.size() + 2) / 3;
targets.remove_if(BloodboltHitCheck(static_cast<LanaThelAI*>(GetCaster()->GetAI())));
Trinity::RandomResizeList(targets, targetCount);
}
@@ -77,6 +77,8 @@ enum MovementPoints
POINT_TARGET_COLDFLAME = 36672631,
};
#define DATA_COLDFLAME_GUID 0
class boss_lord_marrowgar : public CreatureScript
{
public:
@@ -165,8 +167,9 @@ class boss_lord_marrowgar : public CreatureScript
break;
case EVENT_COLDFLAME:
_coldflameLastPos.Relocate(me);
_coldflameTarget = 0LL;
if (!me->HasAura(SPELL_BONE_STORM))
me->CastCustomSpell(SPELL_COLDFLAME_NORMAL, SPELLVALUE_MAX_TARGETS, 1, me);
DoCastAOE(SPELL_COLDFLAME_NORMAL);
else
DoCast(me, SPELL_COLDFLAME_BONE_STORM);
events.ScheduleEvent(EVENT_COLDFLAME, 5000, EVENT_GROUP_SPECIAL);
@@ -242,8 +245,24 @@ class boss_lord_marrowgar : public CreatureScript
return &_coldflameLastPos;
}
uint64 GetGUID(int32 type/* = 0 */)
{
if (type == DATA_COLDFLAME_GUID)
return _coldflameTarget;
return 0LL;
}
void SetGUID(uint64 const guid, int32 type/* = 0 */)
{
if (type != DATA_COLDFLAME_GUID)
return;
_coldflameTarget = guid;
}
private:
Position _coldflameLastPos;
uint64 _coldflameTarget;
uint32 _boneStormDuration;
float _baseSpeed;
bool _introDone;
@@ -277,22 +296,7 @@ class npc_coldflame : public CreatureScript
Creature* creOwner = owner->ToCreature();
Position pos;
// random target case
if (!owner->HasAura(SPELL_BONE_STORM))
{
// select any unit but not the tank (by owners threatlist)
Unit* target = creOwner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 1, -owner->GetObjectSize(), true, -SPELL_IMPALED);
if (!target)
target = creOwner->AI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); // or the tank if its solo
if (!target)
{
me->DespawnOrUnsummon();
return;
}
me->SetOrientation(me->GetAngle(target));
owner->GetNearPosition(pos, owner->GetObjectSize() / 2.0f, 0.0f);
}
else
if (owner->HasAura(SPELL_BONE_STORM))
{
if (MarrowgarAI* marrowgarAI = CAST_AI(MarrowgarAI, creOwner->AI()))
{
@@ -303,6 +307,18 @@ class npc_coldflame : public CreatureScript
owner->GetNearPosition(pos, 2.5f, 0.0f);
}
}
else
{
Player* target = ObjectAccessor::GetPlayer(*owner, owner->GetAI()->GetGUID(DATA_COLDFLAME_GUID));
if (!target)
{
me->DespawnOrUnsummon();
return;
}
me->SetOrientation(owner->GetAngle(target));
owner->GetNearPosition(pos, owner->GetObjectSize() / 2.0f, 0.0f);
}
me->NearTeleportTo(pos.GetPositionX(), pos.GetPositionY(), me->GetPositionZ(), me->GetOrientation());
_events.ScheduleEvent(EVENT_COLDFLAME_TRIGGER, 450);
@@ -399,16 +415,53 @@ class spell_marrowgar_coldflame : public SpellScriptLoader
{
PrepareSpellScript(spell_marrowgar_coldflame_SpellScript);
void SelectTarget(std::list<Unit*>& targets)
{
targets.clear();
// select any unit but not the tank (by owners threatlist)
Unit* target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 1, -GetCaster()->GetObjectSize(), true, -SPELL_IMPALED);
if (!target)
target = GetCaster()->GetAI()->SelectTarget(SELECT_TARGET_RANDOM, 0, 0.0f, true); // or the tank if its solo
if (!target)
return;
GetCaster()->GetAI()->SetGUID(target->GetGUID(), DATA_COLDFLAME_GUID);
targets.push_back(target);
}
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
Unit* caster = GetCaster();
uint8 count = 1;
if (GetSpellInfo()->Id == 72705)
count = 4;
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue()), true);
}
for (uint8 i = 0; i < count; ++i)
caster->CastSpell(caster, uint32(GetEffectValue() + i), true);
void Register()
{
OnUnitTargetSelect += SpellUnitTargetFn(spell_marrowgar_coldflame_SpellScript::SelectTarget, EFFECT_0, TARGET_UNIT_DEST_AREA_ENEMY);
OnEffect += SpellEffectFn(spell_marrowgar_coldflame_SpellScript::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
SpellScript* GetSpellScript() const
{
return new spell_marrowgar_coldflame_SpellScript();
}
};
class spell_marrowgar_coldflame_bonestorm : public SpellScriptLoader
{
public:
spell_marrowgar_coldflame_bonestorm() : SpellScriptLoader("spell_marrowgar_coldflame_bonestorm") { }
class spell_marrowgar_coldflame_SpellScript : public SpellScript
{
PrepareSpellScript(spell_marrowgar_coldflame_SpellScript);
void HandleScriptEffect(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(effIndex);
for (uint8 i = 0; i < 4; ++i)
GetCaster()->CastSpell(GetHitUnit(), uint32(GetEffectValue() + i), true);
}
void Register()
@@ -534,6 +587,7 @@ void AddSC_boss_lord_marrowgar()
new npc_coldflame();
new npc_bone_spike();
new spell_marrowgar_coldflame();
new spell_marrowgar_coldflame_bonestorm();
new spell_marrowgar_coldflame_damage();
new spell_marrowgar_bone_spike_graveyard();
new spell_marrowgar_bone_storm();
@@ -840,6 +840,13 @@ class spell_putricide_expunged_gas : public SpellScriptLoader
return GetCaster()->GetTypeId() == TYPEID_UNIT && GetCaster()->GetInstanceScript();
}
SpellCastResult CheckCast()
{
if (!GetCaster()->getVictim())
return SPELL_FAILED_NO_VALID_TARGETS;
return SPELL_CAST_OK;
}
void CalcDamage(SpellEffIndex /*effIndex*/)
{
// checked in script loading, cant be NULL here
@@ -850,7 +857,7 @@ class spell_putricide_expunged_gas : public SpellScriptLoader
int32 dmg = 0;
uint32 bloatId = sSpellMgr->GetSpellIdForDifficulty(SPELL_GASEOUS_BLOAT, GetCaster());
if (Aura* gasBloat = GetTargetUnit()->GetAura(bloatId))
if (Aura* gasBloat = GetCaster()->getVictim()->GetAura(bloatId))
{
uint32 stack = gasBloat->GetStackAmount();
int32 const mod = (GetCaster()->GetMap()->GetSpawnMode() & 1) ? 1500 : 1250;
@@ -659,15 +659,17 @@ class spell_rotface_unstable_ooze_explosion : public SpellScriptLoader
void CheckTarget(SpellEffIndex effIndex)
{
PreventHitDefaultEffect(EFFECT_0);
if (!GetTargetUnit())
if (!GetTargetDest())
return;
uint32 triggered_spell_id = GetSpellInfo()->Effects[effIndex].TriggerSpell;
float x, y, z;
GetTargetDest()->GetPosition(x, y, z);
// let Rotface handle the cast - caster dies before this executes
if (InstanceScript* script = GetTargetUnit()->GetInstanceScript())
if (InstanceScript* script = GetCaster()->GetInstanceScript())
if (Creature* rotface = script->instance->GetCreature(script->GetData64(DATA_ROTFACE)))
rotface->CastSpell(GetTargetUnit(), triggered_spell_id, true, NULL, NULL, GetCaster()->GetGUID());
rotface->CastSpell(x, y, z, triggered_spell_id, true, NULL, NULL, GetCaster()->GetGUID());
}
void Register()
@@ -506,8 +506,15 @@ class npc_green_dragon_combat_trigger : public CreatureScript
me->SetReactState(REACT_PASSIVE);
}
void EnterCombat(Unit* /*target*/)
void EnterCombat(Unit* target)
{
if (!instance->CheckRequiredBosses(DATA_VALITHRIA_DREAMWALKER, target->ToPlayer()))
{
EnterEvadeMode();
instance->DoCastSpellOnPlayers(LIGHT_S_HAMMER_TELEPORT);
return;
}
me->setActive(true);
DoZoneInCombat();
instance->SetBossState(DATA_VALITHRIA_DREAMWALKER, IN_PROGRESS);