Skip to content
This repository has been archived by the owner on Jan 18, 2024. It is now read-only.

Commit

Permalink
Scripts/Totems: scripted Shaman's Searing Totem behavior
Browse files Browse the repository at this point in the history
  • Loading branch information
Ovahlord committed Oct 24, 2023
1 parent 3249c5c commit 621d951
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 7 deletions.
7 changes: 0 additions & 7 deletions src/server/game/Entities/Creature/TemporarySummon/NewPet.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -763,13 +763,6 @@ bool NewPet::AddSpell(uint32 spellId, ActiveStates active /*= ACT_DECIDE*/, PetS
}
}

// Store pet scaling auras in a own vector to handle the updating more efficient
//if (spellInfo->HasAttribute(SPELL_ATTR4_OWNER_POWER_SCALING))
//{
// m_petScalingAuras.push_back(spellInfo->Id);
// return true;
//}

_spells[spellId] = newspell;

if (spellInfo->IsPassive() && (!spellInfo->CasterAuraState || HasAuraState(AuraStateType(spellInfo->CasterAuraState))))
Expand Down
53 changes: 53 additions & 0 deletions src/server/scripts/World/npcs_special.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3075,6 +3075,58 @@ struct npc_shaman_spirit_wolf : public PetAI
}
};

struct npc_shaman_searing_totem : public NullCreatureAI
{
npc_shaman_searing_totem(Creature* creature) : NullCreatureAI(creature) { }

static constexpr uint32 SPELL_SEARING_BOLT = 3606;

void JustAppeared() override
{
_scheduler.Schedule(1ms, [this](TaskContext context)
{
context.Repeat(1s + 600ms);

// The Searing Totem prefers targets afflicted by its creator's Flameshock and Stormstrike ability
std::list<Unit*> targets;
Trinity::NearestAttackableUnitInObjectRangeCheck u_check(me, me->GetCreator(), 15.f);
Trinity::UnitListSearcher<Trinity::NearestAttackableUnitInObjectRangeCheck> searcher(me, targets, u_check);
Cell::VisitAllObjects(me, searcher, 15.f);
targets.sort(Trinity::ObjectDistanceOrderPred(me));

if (targets.empty())
return;

Unit* target = targets.front();

targets.remove_if([creatorGuid = me->GetCreatorGUID()](Unit const* target)
{
if (target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_SHAMAN, 0x10000000, 0x0, 0x0, creatorGuid))
return false;

if (target->GetAuraEffect(SPELL_AURA_MOD_CRIT_CHANCE_FOR_CASTER, SPELLFAMILY_SHAMAN, 0x0, 0x1000000, 0x0, creatorGuid))
return false;

return true;
});

if (!targets.empty())
target = targets.front();

if (target)
me->CastSpell(target, SPELL_SEARING_BOLT);
});
}

void UpdateAI(uint32 diff) override
{
_scheduler.Update(diff);
}

private:
TaskScheduler _scheduler;
};

void AddSC_npcs_special()
{
new npc_air_force_bots();
Expand Down Expand Up @@ -3105,4 +3157,5 @@ void AddSC_npcs_special()
RegisterCreatureAI(npc_druid_wild_mushroom);
RegisterCreatureAI(npc_darkmoon_island_gnoll);
RegisterCreatureAI(npc_shaman_spirit_wolf);
RegisterCreatureAI(npc_shaman_searing_totem);
}

0 comments on commit 621d951

Please sign in to comment.