Minor fixes to spell and mount init (#863)

* Make summon imp non-temporary

* Remove horse mount from troll

* Set facing to during spell casting

* Allow rpg status command

* Init unarmed skill and fix skill clear

* Cast delay after interrupt spell
This commit is contained in:
Yunfan Li
2025-01-13 01:03:27 +08:00
committed by GitHub
parent 4311dabe24
commit 568592f188
5 changed files with 24 additions and 12 deletions

View File

@@ -328,13 +328,14 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
if (currentSpell && currentSpell->GetSpellInfo() && currentSpell->getState() == SPELL_STATE_PREPARING)
{
const SpellInfo* spellInfo = currentSpell->GetSpellInfo();
Unit* spellTarget = currentSpell->m_targets.GetUnitTarget();
// interrupt if target is dead
if (currentSpell->m_targets.GetUnitTarget() && !currentSpell->m_targets.GetUnitTarget()->IsAlive() &&
if (spellTarget && !spellTarget->IsAlive() &&
!spellInfo->IsAllowingDeadTarget())
{
InterruptSpell();
SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
YieldThread(GetReactDelay());
return;
}
bool isHeal = false;
@@ -357,10 +358,16 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
}
}
// interrupt if target ally has full health (heal by other member)
if (isHeal && isSingleTarget && currentSpell->m_targets.GetUnitTarget() && currentSpell->m_targets.GetUnitTarget()->IsFullHealth())
if (isHeal && isSingleTarget && spellTarget && spellTarget->IsFullHealth())
{
InterruptSpell();
SetNextCheckDelay(sPlayerbotAIConfig->reactDelay);
YieldThread(GetReactDelay());
return;
}
if (spellTarget && !bot->HasInArc(CAST_ANGLE_IN_FRONT, spellTarget) && (spellInfo->FacingCasterFlags & SPELL_FACING_FLAG_INFRONT))
{
sServerFacade->SetFacingTo(bot, spellTarget);
}
// wait for spell cast
@@ -817,6 +824,7 @@ bool PlayerbotAI::IsAllowedCommand(std::string const text)
unsecuredCommands.insert("sendmail");
unsecuredCommands.insert("invite");
unsecuredCommands.insert("leave");
unsecuredCommands.insert("rpg status");
}
for (std::set<std::string>::iterator i = unsecuredCommands.begin(); i != unsecuredCommands.end(); ++i)