misc(druid shape shift and spell immuned)

This commit is contained in:
Yunfan Li
2023-05-30 01:06:56 +08:00
parent 96f439bf22
commit cdbd5fb8c7
2 changed files with 46 additions and 45 deletions

View File

@@ -1679,44 +1679,44 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
if (!itemTarget) if (!itemTarget)
{ {
// bool positiveSpell = spellInfo->IsPositive(); bool positiveSpell = spellInfo->IsPositive();
// if (positiveSpell && bot->IsHostileTo(target)) // if (positiveSpell && bot->IsHostileTo(target))
// return false; // return false;
// if (!positiveSpell && bot->IsFriendlyTo(target)) // if (!positiveSpell && bot->IsFriendlyTo(target))
// return false; // return false;
// bool damage = false; bool damage = false;
// for (uint8 i = EFFECT_0; i <= EFFECT_2; i++) for (uint8 i = EFFECT_0; i <= EFFECT_2; i++)
// { {
// if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE) if (spellInfo->Effects[i].Effect == SPELL_EFFECT_SCHOOL_DAMAGE)
// { {
// damage = true; damage = true;
// break; break;
// } }
// } }
// if (target->IsImmunedToSpell(spellInfo)) { if (target->IsImmunedToSpell(spellInfo)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "target is immuned to spell - target name: {}, spellid: {}, bot name: {}", LOG_DEBUG("playerbots", "target is immuned to spell - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName()); target->GetName(), spellid, bot->GetName());
// } }
// return false; return false;
// } }
// if (!damage) if (!damage)
// { {
// for (uint8 i = EFFECT_0; i <= EFFECT_2; i++) for (uint8 i = EFFECT_0; i <= EFFECT_2; i++)
// { {
// if (target->IsImmunedToSpellEffect(spellInfo, i)) { if (target->IsImmunedToSpellEffect(spellInfo, i)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
// LOG_DEBUG("playerbots", "target is immuned to spell effect - target name: {}, spellid: {}, bot name: {}", LOG_DEBUG("playerbots", "target is immuned to spell effect - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName()); target->GetName(), spellid, bot->GetName());
// } }
// return false; return false;
// } }
// } }
// } }
if (bot != target && sServerFacade->GetDistance2d(bot, target) > sPlayerbotAIConfig->sightDistance) { if (bot != target && sServerFacade->GetDistance2d(bot, target) > sPlayerbotAIConfig->sightDistance) {
if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
@@ -2036,20 +2036,20 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
spell->prepare(&targets); spell->prepare(&targets);
if (spellInfo->Effects[0].Effect == SPELL_EFFECT_OPEN_LOCK || spellInfo->Effects[0].Effect == SPELL_EFFECT_SKINNING) // if (spellInfo->Effects[0].Effect == SPELL_EFFECT_OPEN_LOCK || spellInfo->Effects[0].Effect == SPELL_EFFECT_SKINNING)
{ // {
LootObject loot = *aiObjectContext->GetValue<LootObject>("loot target"); // LootObject loot = *aiObjectContext->GetValue<LootObject>("loot target");
if (!loot.IsLootPossible(bot)) // if (!loot.IsLootPossible(bot))
{ // {
spell->cancel(); // spell->cancel();
delete spell; // delete spell;
if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { // if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
LOG_DEBUG("playerbots", "Spell cast loot - target name: {}, spellid: {}, bot name: {}", // LOG_DEBUG("playerbots", "Spell cast loot - target name: {}, spellid: {}, bot name: {}",
target->GetName(), spellId, bot->GetName()); // target->GetName(), spellId, bot->GetName());
} // }
return false; // return false;
} // }
} // }
WaitForSpellCast(spell); WaitForSpellCast(spell);
if (spell->GetCastTime()) if (spell->GetCastTime())
@@ -2473,6 +2473,7 @@ void PlayerbotAI::WaitForSpellCast(Spell* spell)
if (spellInfo->IsChanneled()) if (spellInfo->IsChanneled())
{ {
int32 duration = spellInfo->GetDuration(); int32 duration = spellInfo->GetDuration();
bot->ApplySpellMod(spellInfo->Id, SPELLMOD_DURATION, duration);
if (duration > 0) if (duration > 0)
castTime += duration; castTime += duration;
} }

View File

@@ -31,7 +31,7 @@ bool CastTravelFormAction::isUseful()
bool CastCasterFormAction::isUseful() bool CastCasterFormAction::isUseful()
{ {
return botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form", return botAI->HasAnyAuraOf(GetTarget(), "dire bear form", "bear form", "cat form", "travel form", "aquatic form",
"flight form", "swift flight form", "moonkin form", "tree of life", nullptr); "flight form", "swift flight form", "moonkin form", nullptr);
} }
bool CastCasterFormAction::Execute(Event event) bool CastCasterFormAction::Execute(Event event)