diff options
| author | QAston <none@none> | 2010-01-10 01:23:15 +0100 |
|---|---|---|
| committer | QAston <none@none> | 2010-01-10 01:23:15 +0100 |
| commit | 8e9d2cdf01929f513e37eccbfdea952aa04e78f6 (patch) | |
| tree | 54d298a9e7f5b84bd230bf340d76180116008496 /src/bindings/scripts | |
| parent | a0f7762cab9b759b7d3e7dc25a447b5e43f2048b (diff) | |
Update aura system:
* Change system logic - unify Auras, AreaAuras and PersistentAreaAuras:
* Aura has now its owner - which is the WorldObject, which applies aura (creates AuraApplication object) dependant on aura radius, and effect type
* Owner can be Dynobj (DynObjAura class) for PersistentAreaAuras, or Unit (UnitAura class) for Area and nonArea auras
* Aura data is shared for all units which have AuraApplication of the Aura
* Because of that AuraEffect handlers , and periodic tick functions can't modify AuraEffect object (they are const now)
* Remove spell source and AreaAuraEffect classes
* Add AuraEffect::UpdatePeriodic function, to allow periodic aura object modification (target independant)
* Add AuraEffect::CalculateAmount and AuraEffect::CalculateSpellMod function, to allow non-default amount calculation
* AreaAura updates are done in owner _UpdateSpells cycle
* Since now you don't need to wait an aura update cycle to get area aura applied on it's correct target list
* And you can access area aura target list
* Add basic support for aura amount recalculation
* Save recalculation state and base amount of auras to db
* Add AuraEffect::CalculatePeriodic function to determine if aura is periodic, and to set correct tick number after aura is loaded from db
* Add ChangeAmount function in addition to SetAmount function, to allow easy reapplication of AuraEffect handlers on all targets
* Sort aura effect handlers in SpellAuras.cpp and .h by their use
* Add check for already existing aura of that type to some AuraEffect handlers, to prevent incorrect effect removal
* SPELL_AURA_CONVERT_RUNE and MOD_POWER_REGEN and MOD_REGEN hacky handlers are now implemented correctly
* Send aura application client update only once per unit update - prevent unnecesary packet spam
* Fix ByteBuffer::appendPackGUID function - it added additionall 0s at the end of the packet
* Fix memory leak at player creation (not deleted auras)
* Updated some naming conventions (too many to mention)
* Added Unit::GetAuraOfRankedSpell() function
* Remove procflags on aura remove, use Aura::HandleAuraSpecificMods instead
* Added functions to maintain owned auras (GetOwnedAuras, GetOwnedAura, RemoveOwnedAura, etc)
* Implement AURA_INTERRUPT_FLAG_LANDING
* Implement EffectPlayerNotification (thanks to Spp)
* Remove wrong aura 304 handler
* Add better handler for death runes
* Remove unnecesary variables from DynamicObject class, and cleanup related code, link dynobj duration with aura
* Add GetAuraEffectTriggerTarget function in CreatureAi for special target selection for periodic trigger auras used in a script
* Add many assert() procection from idiots using some functions in wrong way
* I am to lazy to write here anything more
Thanks to Visagalis for testing this patch
PS: Do not make patches like this, please
--HG--
branch : trunk
Diffstat (limited to 'src/bindings/scripts')
9 files changed, 37 insertions, 113 deletions
diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp index 1ff205162a4..cbfc86ea183 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/boss_twinemperors.cpp @@ -413,15 +413,7 @@ struct TRINITY_DLL_DECL boss_veknilashAI : public boss_twinemperorsAI { pTarget->setFaction(14); pTarget->AI()->AttackStart(m_creature->getThreatManager().getHostilTarget()); - SpellEntry *spell = GET_SPELL(SPELL_MUTATE_BUG); - uint8 eff_mask=0; - for (int i=0; i<3; ++i) - { - if (!spell->Effect[i]) - continue; - eff_mask|=1<<i; - } - pTarget->AddAura(new Aura(spell, eff_mask, pTarget, pTarget, pTarget)); + pTarget->AddAura(SPELL_MUTATE_BUG, pTarget); pTarget->SetHealth(pTarget->GetMaxHealth()); } @@ -498,15 +490,7 @@ struct TRINITY_DLL_DECL boss_veklorAI : public boss_twinemperorsAI void CastSpellOnBug(Creature *pTarget) { pTarget->setFaction(14); - SpellEntry *spell = GET_SPELL(SPELL_EXPLODEBUG); - uint8 eff_mask=0; - for (int i=0; i<3; ++i) - { - if (!spell->Effect[i]) - continue; - eff_mask|=1<<i; - } - pTarget->AddAura(new Aura(spell, eff_mask, pTarget, pTarget, pTarget)); + pTarget->AddAura(SPELL_EXPLODEBUG, pTarget); pTarget->SetHealth(pTarget->GetMaxHealth()); } diff --git a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp index d548ff7155e..0d715785140 100644 --- a/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp +++ b/src/bindings/scripts/scripts/kalimdor/temple_of_ahnqiraj/mob_anubisath_sentinel.cpp @@ -53,19 +53,6 @@ EndScriptData */ #define SPELL_STORM_BUFF 2148 #define SPELL_STORM 26546 -struct TRINITY_DLL_DECL aqsentinelAI; -class TRINITY_DLL_DECL SentinelAbilityAura : public Aura -{ - public: - ~SentinelAbilityAura(); - Unit* GetTriggerTarget() const; - SentinelAbilityAura(aqsentinelAI *abilityOwner, SpellEntry *spell, uint32 ability, uint32 eff); - protected: - aqsentinelAI *aOwner; - int32 currentBasePoints; - uint32 abilityId; -}; - struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI { uint32 ability; @@ -222,16 +209,7 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI void GainSentinelAbility(uint32 id) { - const SpellEntry *spell = GetSpellStore()->LookupEntry(id); - uint8 eff_mask=0; - for (int i=0; i<3; ++i) - { - if (!spell->Effect[i]) - continue; - eff_mask=1<<i; - } - SentinelAbilityAura *a = new SentinelAbilityAura(this, (SpellEntry*)spell, id, eff_mask); - m_creature->AddAura(a); + m_creature->AddAura(id, m_creature); } void EnterCombat(Unit *who) @@ -260,7 +238,7 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI } } - Unit *GetHatedManaUser() + Unit *GetHatedManaUser() const { std::list<HostilReference*>::iterator i; for (i = m_creature->getThreatManager().getThreatList().begin(); i != m_creature->getThreatManager().getThreatList().end(); ++i) @@ -271,6 +249,28 @@ struct TRINITY_DLL_DECL aqsentinelAI : public ScriptedAI } return NULL; } + + Unit* GetAuraEffectTriggerTarget(uint32 spellId, uint8 effIndex) const + { + switch (spellId) + { + case SPELL_KNOCK_BUFF: + case SPELL_THUNDER_BUFF: + case SPELL_MSTRIKE_BUFF: + case SPELL_STORM_BUFF: + return m_creature->getVictim(); + + case SPELL_MANAB_BUFF: + return GetHatedManaUser(); + + case SPELL_MENDING_BUFF: + case SPELL_REFLECTAF_BUFF: + case SPELL_REFLECTSFr_BUFF: + case SPELL_THORNS_BUFF: + default: + return m_creature; + } + } }; CreatureAI* GetAI_mob_anubisath_sentinelAI(Creature* pCreature) { @@ -285,34 +285,3 @@ void AddSC_mob_anubisath_sentinel() newscript->GetAI = &GetAI_mob_anubisath_sentinelAI; newscript->RegisterSelf(); } - -SentinelAbilityAura::~SentinelAbilityAura() {} -Unit* SentinelAbilityAura::GetTriggerTarget() const -{ - switch (abilityId) - { - case SPELL_KNOCK_BUFF: - case SPELL_THUNDER_BUFF: - case SPELL_MSTRIKE_BUFF: - case SPELL_STORM_BUFF: - return aOwner->m_creature->getVictim(); - - case SPELL_MANAB_BUFF: - return aOwner->GetHatedManaUser(); - - case SPELL_MENDING_BUFF: - case SPELL_REFLECTAF_BUFF: - case SPELL_REFLECTSFr_BUFF: - case SPELL_THORNS_BUFF: - default: - return aOwner->m_creature; - } -} - -SentinelAbilityAura::SentinelAbilityAura(aqsentinelAI *abilityOwner, SpellEntry *spell, uint32 ability, uint32 eff) -: Aura(spell, eff, abilityOwner->m_creature, abilityOwner->m_creature, abilityOwner->m_creature, NULL) -{ - aOwner = abilityOwner; - abilityId = ability; -} - diff --git a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_trollgore.cpp b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_trollgore.cpp index a2c7d44a7c3..ed54bd05eb8 100644 --- a/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_trollgore.cpp +++ b/src/bindings/scripts/scripts/northrend/draktharon_keep/boss_trollgore.cpp @@ -133,9 +133,8 @@ struct TRINITY_DLL_DECL boss_trollgoreAI : public ScriptedAI { if (uiAuraCountTimer <= diff) { - if (m_creature->HasAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME))) + if (Aura *pConsumeAura = m_creature->GetAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME))) { - Aura *pConsumeAura = m_creature->GetAura(HEROIC(SPELL_CONSUME,H_SPELL_CONSUME)); if (pConsumeAura && pConsumeAura->GetStackAmount() > 9) bAchiev = false; } diff --git a/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_emalon.cpp b/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_emalon.cpp index 1260cd98557..412920961a6 100644 --- a/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_emalon.cpp +++ b/src/bindings/scripts/scripts/northrend/vault_of_archavon/boss_emalon.cpp @@ -225,7 +225,7 @@ struct TRINITY_DLL_DECL mob_tempest_minionAI : public ScriptedAI if(me->hasUnitState(UNIT_STAT_CASTING)) return; - if(Aura *OverchargedAura = m_creature->GetAura(SPELL_OVERCHARGED)) + if(Aura * OverchargedAura = m_creature->GetAura(SPELL_OVERCHARGED)) { if(OverchargedAura->GetStackAmount() < 10) { diff --git a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp index e94c8953117..0a4fe3e8cd1 100644 --- a/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp +++ b/src/bindings/scripts/scripts/outland/auchindoun/shadow_labyrinth/boss_grandmaster_vorpil.cpp @@ -92,10 +92,8 @@ struct TRINITY_DLL_DECL mob_voidtravelerAI : public ScriptedAI { if (sacrificed) { - SpellEntry *spell = GET_SPELL(HeroicMode?H_SPELL_EMPOWERING_SHADOWS:SPELL_EMPOWERING_SHADOWS); - if (spell) - Vorpil->AddAura(new Aura(spell, 1, Vorpil, me, me)); - Vorpil->SetHealth(Vorpil->GetHealth()+Vorpil->GetMaxHealth()/25); + m_creature->AddAura(HEROIC(H_SPELL_EMPOWERING_SHADOWS, SPELL_EMPOWERING_SHADOWS), Vorpil); + Vorpil->SetHealth(Vorpil->GetHealth() + Vorpil->GetMaxHealth()/25); DoCast(m_creature, SPELL_SHADOW_NOVA, true); m_creature->Kill(m_creature); return; diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp index d0c7753f0ac..db440ef0cc1 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_lady_vashj.cpp @@ -636,21 +636,7 @@ struct TRINITY_DLL_DECL mob_enchanted_elementalAI : public ScriptedAI { m_creature->GetMotionMaster()->MovePoint(0, MIDDLE_X, MIDDLE_Y, MIDDLE_Z); if (m_creature->IsWithinDist3d(MIDDLE_X, MIDDLE_Y, MIDDLE_Z, 3)) - { - SpellEntry *spell = GET_SPELL(SPELL_SURGE); - if (spell) - { - uint8 eff_mask=0; - for (uint8 i = 0; i < 3; ++i) - { - if (!spell->Effect[i]) - continue; - eff_mask|=1<<i; - } - Vashj->AddAura(new Aura(spell, eff_mask, Vashj, Vashj, Vashj)); - } - m_creature->Kill(m_creature); - } + DoCast(m_creature, SPELL_SURGE); } if (!Vashj->isInCombat() || CAST_AI(boss_lady_vashjAI, Vashj->AI())->Phase != 2 || Vashj->isDead()) { diff --git a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp index eaa5ce84174..24f47dff4a6 100644 --- a/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp +++ b/src/bindings/scripts/scripts/outland/coilfang_resevoir/serpent_shrine/boss_leotheras_the_blind.cpp @@ -497,14 +497,8 @@ struct TRINITY_DLL_DECL boss_leotheras_the_blindAI : public ScriptedAI demon->AI()->AttackStart((*itr)); CAST_AI(mob_inner_demonAI, demon->AI())->victimGUID = (*itr)->GetGUID(); - uint8 eff_mask=0; - for (int i=0; i<3; ++i) - { - if (!spell->Effect[i]) - continue; - eff_mask|=1<<i; - } - (*itr)->AddAura(new Aura(spell, eff_mask, *itr, *itr, *itr)); + (*itr)->AddAura(SPELL_INSIDIOUS_WHISPER, *itr); + if (InnerDemon_Count > 4) InnerDemon_Count = 0; diff --git a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp index 615d242018a..49b167422af 100644 --- a/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp +++ b/src/bindings/scripts/scripts/outland/hellfire_citadel/blood_furnace/boss_kelidan_the_breaker.cpp @@ -232,14 +232,8 @@ struct TRINITY_DLL_DECL boss_kelidan_the_breakerAI : public ScriptedAI if (SpellEntry *nova = GET_SPELL(SPELL_BURNING_NOVA)) { - uint8 eff_mask=0; - for (int i=0; i<3; ++i) - { - if (!nova->Effect[i]) - continue; - eff_mask|=1<<i; - } - m_creature->AddAura(new Aura(nova, eff_mask, me, me, me)); + if (Aura * aura = Aura::TryCreate(nova, me, me)) + aura->ApplyForTargets(); } if (HeroicMode) diff --git a/src/bindings/scripts/scripts/world/npcs_special.cpp b/src/bindings/scripts/scripts/world/npcs_special.cpp index d5c7d48b607..f3ccb1076cc 100644 --- a/src/bindings/scripts/scripts/world/npcs_special.cpp +++ b/src/bindings/scripts/scripts/world/npcs_special.cpp @@ -190,7 +190,7 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI if (!pWho->IsWithinDistInMap(m_creature, RANGE_GUARDS_MARK)) return; - Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK, 0); + Aura* pMarkAura = pWho->GetAura(SPELL_GUARDS_MARK); if (pMarkAura) { // the target wasn't able to move out of our range within 25 seconds @@ -202,7 +202,7 @@ struct TRINITY_DLL_DECL npc_air_force_botsAI : public ScriptedAI return; } - if (pMarkAura->GetAuraDuration() < AURA_DURATION_TIME_LEFT) + if (pMarkAura->GetDuration() < AURA_DURATION_TIME_LEFT) { if (!pLastSpawnedGuard->getVictim()) pLastSpawnedGuard->AI()->AttackStart(pWho); |
