Skip to content

Commit

Permalink
-Rpg change: Random spells no longer require a game object but can no…
Browse files Browse the repository at this point in the history
…w also be cast on/near players or units.
  • Loading branch information
mostlikely4r committed Feb 8, 2023
1 parent 5f3510d commit 0ab3ac9
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 10 deletions.
9 changes: 6 additions & 3 deletions playerbot/strategy/actions/CastCustomSpellAction.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ bool CastRandomSpellAction::Execute(Event& event)

if (target && ai->CanCastSpell(spellId, target, true))
spellList.push_back(make_pair(spellId,make_pair(spellPriority, target)));
if (target && ai->CanCastSpell(spellId, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), true))
spellList.push_back(make_pair(spellId, make_pair(spellPriority, target)));
if (got && ai->CanCastSpell(spellId, got->GetPositionX(), got->GetPositionY(), got->GetPositionZ(), true))
spellList.push_back(make_pair(spellId, make_pair(spellPriority, got)));
if (ai->CanCastSpell(spellId, bot, true))
Expand Down Expand Up @@ -249,9 +251,10 @@ bool CastRandomSpellAction::Execute(Event& event)
bool CastRandomSpellAction::castSpell(uint32 spellId, WorldObject* wo)
{
if (wo->GetObjectGuid().IsUnit())
return ai->CastSpell(spellId, (Unit*)(wo));
else
return ai->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ());
if (ai->CastSpell(spellId, (Unit*)(wo)))
return true;

return ai->CastSpell(spellId, wo->GetPositionX(), wo->GetPositionY(), wo->GetPositionZ());
}

bool DisEnchantRandomItemAction::Execute(Event& event)
Expand Down
8 changes: 1 addition & 7 deletions playerbot/strategy/triggers/RpgTriggers.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -474,13 +474,7 @@ bool RpgUseTrigger::IsActive()

bool RpgSpellTrigger::IsActive()
{
GuidPosition guidP(getGuidP());

if (guidP.IsPlayer())
return false;

if (!guidP.GetWorldObject())
return false;
//GuidPosition guidP(getGuidP());

return true;
}
Expand Down

0 comments on commit 0ab3ac9

Please sign in to comment.