diff options
-rw-r--r-- | sql/FULL/world_scripts_full.sql | 1 | ||||
-rw-r--r-- | sql/updates/5009_world_TDB.sql | 1 | ||||
-rw-r--r-- | src/bindings/scripts/scripts/npc/npcs_special.cpp | 98 | ||||
-rw-r--r-- | src/game/Pet.cpp | 10 | ||||
-rw-r--r-- | src/game/SpellAuras.cpp | 5 | ||||
-rw-r--r-- | src/game/SpellEffects.cpp | 10 |
6 files changed, 112 insertions, 13 deletions
diff --git a/sql/FULL/world_scripts_full.sql b/sql/FULL/world_scripts_full.sql index 5bb7fad1947..7b86cb1167e 100644 --- a/sql/FULL/world_scripts_full.sql +++ b/sql/FULL/world_scripts_full.sql @@ -109,6 +109,7 @@ UPDATE `creature_template` SET `ScriptName`='npc_valkyr_battle_maiden' WHERE `en UPDATE `creature_template` SET `ScriptName`='npc_mirror_image' WHERE `entry`=31216; UPDATE `creature_template` SET `ScriptName`='npc_training_dummy' WHERE `entry` IN (17578,24792,32543,32546,32542,32545,30527,31143,31144,31146,32541,32666,32667); UPDATE `creature_template` SET `ScriptName`='npc_lightwell' WHERE `entry` IN (31883,31893,31894,31895,31896,31897); +UPDATE `creature_template` SET `ScriptName`='npc_ebon_gargoyle' WHERE `entry`=27829; /* */ /* ZONE */ diff --git a/sql/updates/5009_world_TDB.sql b/sql/updates/5009_world_TDB.sql new file mode 100644 index 00000000000..574546fb60b --- /dev/null +++ b/sql/updates/5009_world_TDB.sql @@ -0,0 +1 @@ +UPDATE `creature_template` SET `spell1`=51963 WHERE `entry`=27829;
\ No newline at end of file diff --git a/src/bindings/scripts/scripts/npc/npcs_special.cpp b/src/bindings/scripts/scripts/npc/npcs_special.cpp index 1764708d0e3..68c3e0e2559 100644 --- a/src/bindings/scripts/scripts/npc/npcs_special.cpp +++ b/src/bindings/scripts/scripts/npc/npcs_special.cpp @@ -1685,6 +1685,91 @@ CreatureAI* GetAI_npc_mirror_image(Creature* pCreature) return new npc_mirror_image (pCreature); } +struct TRINITY_DLL_DECL npc_ebon_gargoyleAI : SpellCasterAI +{ + npc_ebon_gargoyleAI(Creature *c) : SpellCasterAI(c) {} + + int despawnTimer; + + void InitializeAI() + { + SpellCasterAI::InitializeAI(); + Unit * owner = me->GetOwner(); + if (!owner) + return; + // Not needed to be despawned now + despawnTimer = 0; + // Find victim of Summon Gargoyle spell + std::list<Unit*> targets; + Trinity::AnyUnfriendlyUnitInObjectRangeCheck u_check(m_creature, m_creature, 30); + Trinity::UnitListSearcher<Trinity::AnyUnfriendlyUnitInObjectRangeCheck> searcher(m_creature, targets, u_check); + m_creature->VisitNearbyObject(30, searcher); + for(std::list<Unit*>::iterator iter = targets.begin(); iter != targets.end(); ++iter) + if((*iter)->GetAura(49206,owner->GetGUID())) + { + me->Attack((*iter),false); + break; + } + } + + void JustDied(Unit *killer) + { + // Stop Feeding Gargoyle when it dies + if (Unit *owner = me->GetOwner()) + owner->RemoveAurasDueToSpell(50514); + } + + // Fly away when dismissed + void SpellHit(Unit *source, const SpellEntry *spell) + { + if(spell->Id != 50515 || !me->isAlive() ) + return; + + Unit *owner = me->GetOwner(); + + if (!owner || owner != source) + return; + + // Stop Fighting + me->ApplyModFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE, true); + // Sanctuary + me->CastSpell(m_creature, 54661, true); + me->SetReactState(REACT_PASSIVE); + + // Fly Away + me->AddUnitMovementFlag(MOVEMENTFLAG_FLY_MODE); + me->SetSpeed(MOVE_FLIGHT, 0.25f, true); + me->SetSpeed(MOVE_RUN, 0.25f, true); + float x = me->GetPositionX() + 10 * cos(me->GetOrientation()); + float y = me->GetPositionY() + 10 * sin(me->GetOrientation()); + float z = me->GetPositionZ() + 25; + me->GetMotionMaster()->MovePoint(0, x, y, z); + + // Despawn as soon as possible + despawnTimer = 4 * IN_MILISECONDS; + } + + void UpdateAI(const uint32 diff) + { + if (despawnTimer > 0) + { + if (despawnTimer > diff) + despawnTimer -= diff; + else + { + me->ForcedDespawn(); + } + return; + } + SpellCasterAI::UpdateAI(diff); + } +}; + +CreatureAI* GetAI_npc_ebon_gargoyle(Creature* pCreature) +{ + return new npc_ebon_gargoyleAI (pCreature); +} + //TODO: 30% Attackdamage check for Lightwell struct TRINITY_DLL_DECL npc_lightwellAI : public PassiveAI { @@ -1853,13 +1938,18 @@ void AddSC_npcs_special() newscript->RegisterSelf(); newscript = new Script; - newscript->Name="npc_lightwell"; - newscript->GetAI = &GetAI_npc_lightwellAI; + newscript->Name="npc_mirror_image"; + newscript->GetAI = &GetAI_npc_mirror_image; newscript->RegisterSelf(); newscript = new Script; - newscript->Name="npc_mirror_image"; - newscript->GetAI = &GetAI_npc_mirror_image; + newscript->Name="npc_ebon_gargoyle"; + newscript->GetAI = &GetAI_npc_ebon_gargoyle; + newscript->RegisterSelf(); + + newscript = new Script; + newscript->Name="npc_lightwell"; + newscript->GetAI = &GetAI_npc_lightwellAI; newscript->RegisterSelf(); newscript = new Script; diff --git a/src/game/Pet.cpp b/src/game/Pet.cpp index 894a3b37f32..3bce66a631a 100644 --- a/src/game/Pet.cpp +++ b/src/game/Pet.cpp @@ -940,6 +940,16 @@ bool Guardian::InitStatsForLevel(uint32 petlevel) } break; } + case 27829: // Ebon Gargoyle + { + SetBonusDamage( int32(m_owner->GetTotalAttackPowerValue(BASE_ATTACK) * 0.4f)); + if(!pInfo) + { + SetCreateMana(28 + 10*petlevel); + SetCreateHealth(28 + 30*petlevel); + } + break; + } default: { if(!pInfo) diff --git a/src/game/SpellAuras.cpp b/src/game/SpellAuras.cpp index 23357171352..b682bab6254 100644 --- a/src/game/SpellAuras.cpp +++ b/src/game/SpellAuras.cpp @@ -1233,6 +1233,11 @@ void Aura::HandleAuraSpecificMods(bool apply) return; m_target->CastSpell(m_target, 32612, true, NULL, GetPartAura(1)); } + // Summon Gargoyle + else if (m_spellProto->Id == 50514) + { + m_target->CastSpell(m_target, GetPartAura(0)->GetAmount(), true, NULL, GetPartAura(0)); + } // Curse of Doom else if(m_spellProto->SpellFamilyName==SPELLFAMILY_WARLOCK && m_spellProto->SpellFamilyFlags[1] & 0x02) { diff --git a/src/game/SpellEffects.cpp b/src/game/SpellEffects.cpp index c826c70900a..154357c76f8 100644 --- a/src/game/SpellEffects.cpp +++ b/src/game/SpellEffects.cpp @@ -1909,20 +1909,12 @@ void Spell::EffectDummy(uint32 i) { // No power, dismiss Gargoyle if (m_caster->GetPower(POWER_RUNIC_POWER)<30) - m_caster->CastSpell((Unit*)NULL,50515,true); + m_caster->RemoveAurasDueToSpell(50514, m_caster->GetGUID()); else m_caster->ModifyPower(POWER_RUNIC_POWER,-30); return; } - // Dismiss Gargoyle - else if (m_spellInfo->Id == 50515) - { - // FIXME: gargoyle should fly away - unitTarget->setDeathState(JUST_DIED); - m_caster->RemoveAurasDueToSpell(50514); - return; - } break; } |