Skip to content

Commit

Permalink
fix(Scripts/Hyjal): Limit Anetheron sleep to 3 targets (#18929)
Browse files Browse the repository at this point in the history
  • Loading branch information
Nyeriah authored May 20, 2024
1 parent ce32e51 commit 0aaf521
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 3 deletions.
4 changes: 4 additions & 0 deletions data/sql/updates/pending_db_world/rev_1716154650178411700.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
--
DELETE FROM `spell_script_names` WHERE `ScriptName` = 'spell_anetheron_sleep';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(31298, 'spell_anetheron_sleep');
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,8 @@

#include "CreatureScript.h"
#include "ScriptedCreature.h"
#include "SpellScript.h"
#include "SpellScriptLoader.h"
#include "hyjal.h"

enum Spells
Expand Down Expand Up @@ -58,18 +60,18 @@ struct boss_anetheron : public BossAI

scheduler.Schedule(20s, 28s, [this](TaskContext context)
{
if (DoCastRandomTarget(SPELL_CARRION_SWARM, 0, 60.f))
if (DoCastRandomTarget(SPELL_CARRION_SWARM, 0, 60.f) == SPELL_CAST_OK)
Talk(SAY_SWARM);
context.Repeat(10s, 15s);
}).Schedule(25s, 32s, [this](TaskContext context)
{
if (DoCastRandomTarget(SPELL_SLEEP))
if (DoCastRandomTarget(SPELL_SLEEP) == SPELL_CAST_OK)
Talk(SAY_SLEEP);

context.Repeat(35s, 48s);
}).Schedule(30s, 48s, [this](TaskContext context)
{
if (DoCastRandomTarget(SPELL_INFERNO))
if (DoCastRandomTarget(SPELL_INFERNO) == SPELL_CAST_OK)
Talk(SAY_INFERNO);

context.Repeat(50s, 55s);
Expand Down Expand Up @@ -138,7 +140,24 @@ struct boss_anetheron : public BossAI

};

class spell_anetheron_sleep : public SpellScript
{
PrepareSpellScript(spell_anetheron_sleep);

void FilterTargets(std::list<WorldObject*>& targets)
{
if (!targets.empty())
Acore::Containers::RandomResize(targets, 3);
}

void Register() override
{
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_anetheron_sleep::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY);
}
};

void AddSC_boss_anetheron()
{
RegisterHyjalAI(boss_anetheron);
RegisterSpellScript(spell_anetheron_sleep);
}

3 comments on commit 0aaf521

@zbhcn
Copy link

@zbhcn zbhcn commented on 0aaf521 May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

After installing this update, the console prompts: Spell 31298 Effect Index: EFFECT_0 Target: 15 of script spell_anetheron_sleep did not match dbc effect data - handler bound to hook OnObjectAreaTargetSelect of SpellScript won't be executed

@Nyeriah
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your database is compromised, no such error exists.

@zbhcn
Copy link

@zbhcn zbhcn commented on 0aaf521 May 27, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Your database is compromised, no such error exists.

my spell.dbc is ok,I've compared it to others several times,very strange

Please sign in to comment.