fix(Core/TempleOfAhnQiraj): Rewrite Fankriss (#12652)

* fix(Core/TempleOfAhnQiraj): Rewrite Fankriss

* sneaky line

* linked respawn
This commit is contained in:
Angelo Venturini
2022-08-09 23:27:06 -03:00
committed by GitHub
parent 1455be34ba
commit fb785f6ae2
3 changed files with 96 additions and 96 deletions

View File

@@ -15,128 +15,99 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Fankriss
SD%Complete: 100
SDComment: sound not implemented
SDCategory: Temple of Ahn'Qiraj
EndScriptData */
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "TaskScheduler.h"
#include "temple_of_ahnqiraj.h"
#define SOUND_SENTENCE_YOU 8588
#define SOUND_SERVE_TO 8589
#define SOUND_LAWS 8590
#define SOUND_TRESPASS 8591
#define SOUND_WILL_BE 8592
enum Spells
{
SPELL_MORTAL_WOUND = 25646,
SPELL_ROOT = 28858,
SPELL_ENTANGLE_RIGHT = 720,
SPELL_ENTANGLE_CENTER = 731,
SPELL_ENTANGLE_LEFT = 1121,
// Enrage for his spawns
SPELL_ENRAGE = 28798
SPELL_SUMMON_WORM_1 = 518,
SPELL_SUMMON_WORM_2 = 25831,
SPELL_SUMMON_WORM_3 = 25832
};
struct boss_fankriss : public ScriptedAI
enum Misc
{
boss_fankriss(Creature* creature) : ScriptedAI(creature) { }
MAX_HATCHLING_SPAWN = 4,
NPC_VEKNISS_HATCHLING = 15962
};
void SummonSpawn()
const std::array<Position, 3> hatchlingsSpawnPoints
{
{
Rand = 10 + (rand() % 10);
switch (rand() % 2)
{
case 0:
RandX = 0.0f - Rand;
break;
case 1:
RandX = 0.0f + Rand;
break;
}
Rand = 10 + (rand() % 10);
switch (rand() % 2)
{
case 0:
RandY = 0.0f - Rand;
break;
case 1:
RandY = 0.0f + Rand;
break;
}
Rand = 0;
DoSpawnCreature(15630, RandX, RandY, 0, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 30000);
{ -8043.6f, 1254.1f, -84.3f }, // Right
{ -8003.0f, 1222.9f, -82.1f }, // Center
{ -8022.3f, 1149.0f, -89.1f } // Left
}
};
void EnterCombat(Unit* /*who*/) override
const std::array<uint32, 3> entangleSpells = { SPELL_ENTANGLE_RIGHT, SPELL_ENTANGLE_CENTER, SPELL_ENTANGLE_LEFT };
struct boss_fankriss : public BossAI
{
boss_fankriss(Creature* creature) : BossAI(creature, DATA_FANKRISS) { }
void Reset() override
{
_scheduler.CancelAll();
summonWormSpells = { SPELL_SUMMON_WORM_1, SPELL_SUMMON_WORM_2, SPELL_SUMMON_WORM_3};
BossAI::Reset();
}
void SummonWorms()
{
uint32 amount = urand(1, 3);
Acore::Containers::RandomResize(summonWormSpells, amount);
for (uint32 summonSpell : summonWormSpells)
DoCastAOE(summonSpell, true);
summonWormSpells = { SPELL_SUMMON_WORM_1, SPELL_SUMMON_WORM_2, SPELL_SUMMON_WORM_3 };
}
void SummonHatchlingWaves()
{
for (Position spawnPos : hatchlingsSpawnPoints)
{
for (uint8 i = 0; i < MAX_HATCHLING_SPAWN; i++)
{
Position randSpawn = me->GetRandomPoint(spawnPos, 10.f);
me->SummonCreature(NPC_VEKNISS_HATCHLING, randSpawn, TEMPSUMMON_CORPSE_DESPAWN);
}
}
}
void EnterCombat(Unit* who) override
{
_scheduler.CancelAll();
BossAI::EnterCombat(who);
_scheduler
.Schedule(4s, 8s, [this](TaskContext context)
.Schedule(7s, 14s, [this](TaskContext context)
{
DoCastVictim(SPELL_MORTAL_WOUND);
context.Repeat();
})
.Schedule(15s, 45s, [this](TaskContext context)
.Schedule(30s, 50s, [this](TaskContext context)
{
switch (urand(0, 2))
{
case 0:
SummonSpawn();
break;
case 1:
SummonSpawn();
SummonSpawn();
break;
case 2:
SummonSpawn();
SummonSpawn();
SummonSpawn();
break;
}
context.Repeat(30s, 60s);
SummonWorms();
context.Repeat(22s, 70s);
})
.Schedule(15s, 45s, [this](TaskContext context)
.Schedule(15s, 20s, [this](TaskContext context)
{
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true))
if (Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 0.0f, true))
{
DoCast(target, SPELL_ROOT);
if (DoGetThreat(target))
DoModifyThreatPercent(target, -100);
switch (urand(0, 2))
{
case 0:
DoTeleportPlayer(target, -8106.0142f, 1289.2900f, -74.419533f, 5.112f);
me->SummonCreature(15962, target->GetPositionX() - 3, target->GetPositionY() - 3, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(15962, target->GetPositionX() - 3, target->GetPositionY() + 3, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(15962, target->GetPositionX() - 5, target->GetPositionY() - 5, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(15962, target->GetPositionX() - 5, target->GetPositionY() + 5, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
break;
case 1:
DoTeleportPlayer(target, -7990.135354f, 1155.1907f, -78.849319f, 2.608f);
me->SummonCreature(15962, target->GetPositionX() - 3, target->GetPositionY() - 3, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(15962, target->GetPositionX() - 3, target->GetPositionY() + 3, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(15962, target->GetPositionX() - 5, target->GetPositionY() - 5, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(15962, target->GetPositionX() - 5, target->GetPositionY() + 5, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
break;
case 2:
DoTeleportPlayer(target, -8159.7753f, 1127.9064f, -76.868660f, 0.675f);
me->SummonCreature(15962, target->GetPositionX() - 3, target->GetPositionY() - 3, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(15962, target->GetPositionX() - 3, target->GetPositionY() + 3, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(15962, target->GetPositionX() - 5, target->GetPositionY() - 5, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
me->SummonCreature(15962, target->GetPositionX() - 5, target->GetPositionY() + 5, target->GetPositionZ(), 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 15000);
break;
}
uint32 spellId = Acore::Containers::SelectRandomContainerElement(entangleSpells);
DoCast(target, spellId);
}
context.Repeat(45s, 60s);
SummonHatchlingWaves();
context.Repeat(25s, 55s);
});
}
@@ -152,9 +123,7 @@ struct boss_fankriss : public ScriptedAI
private:
TaskScheduler _scheduler;
int Rand;
float RandX;
float RandY;
std::vector<uint32> summonWormSpells;
};
void AddSC_boss_fankriss()

View File

@@ -35,6 +35,7 @@ enum DataTypes
DATA_VEKNILASH = 9,
DATA_VEKNILASHISDEAD = 10,
DATA_VEKNILASH_DEATH = 11,
DATA_FANKRISS = 12,
DATA_BUG_TRIO_DEATH = 14,
DATA_CTHUN_PHASE = 20,
DATA_VISCIDUS = 21,