mirror of
https://github.com/mod-playerbots/mod-playerbots.git
synced 2026-02-18 01:24:35 +00:00
warlock and dk strategy port
This commit is contained in:
@@ -62,14 +62,23 @@ bool CastSpellAction::Execute(Event event)
|
||||
|
||||
bool CastSpellAction::isPossible()
|
||||
{
|
||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true))
|
||||
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true)) {
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}",
|
||||
bot->GetName());
|
||||
}
|
||||
return false;
|
||||
}
|
||||
|
||||
if (spell == "mount" && !bot->IsMounted() && !bot->IsInCombat())
|
||||
return true;
|
||||
|
||||
if (spell == "mount" && bot->IsInCombat())
|
||||
{
|
||||
if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) {
|
||||
LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}",
|
||||
bot->GetName());
|
||||
}
|
||||
bot->Dismount();
|
||||
return false;
|
||||
}
|
||||
@@ -118,7 +127,7 @@ CastMeleeSpellAction::CastMeleeSpellAction(PlayerbotAI* botAI, std::string const
|
||||
|
||||
bool CastAuraSpellAction::isUseful()
|
||||
{
|
||||
return GetTarget() && (GetTarget() != nullptr) && (GetTarget() != nullptr) && CastSpellAction::isUseful() && !botAI->HasAura(spell, GetTarget(), true, isOwner);
|
||||
return GetTarget() && (GetTarget() != nullptr) && CastSpellAction::isUseful() && !botAI->HasAura(spell, GetTarget(), false, isOwner);
|
||||
}
|
||||
|
||||
CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
|
||||
|
||||
@@ -222,6 +222,12 @@ std::vector<Item*> InventoryAction::parseItems(std::string const text, IterateIt
|
||||
FindFoodVisitor visitor(bot, 59, text == "conjured drink" || text == "conjured water");
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
found.insert(visitor.GetResult().begin(), visitor.GetResult().end());
|
||||
|
||||
if (found.empty()) {
|
||||
FindFoodVisitor visitor(bot, 11);
|
||||
IterateItems(&visitor, ITERATE_ITEMS_IN_BAGS);
|
||||
found.insert(visitor.GetResult().begin(), visitor.GetResult().end());
|
||||
}
|
||||
}
|
||||
|
||||
if (text == "mana potion")
|
||||
|
||||
@@ -254,9 +254,8 @@ bool UseItemAction::UseItem(Item* item, ObjectGuid goGuid, Item* itemTarget, Uni
|
||||
if (bot->IsInCombat())
|
||||
return false;
|
||||
|
||||
bot->SetStandState(UNIT_STAND_STATE_SIT);
|
||||
// bot->SetStandState(UNIT_STAND_STATE_SIT);
|
||||
botAI->InterruptSpell();
|
||||
|
||||
float hp = bot->GetHealthPct();
|
||||
float mp = bot->GetPower(POWER_MANA) * 100.0f / bot->GetMaxPower(POWER_MANA);
|
||||
float p = 0.f;
|
||||
@@ -272,17 +271,18 @@ bool UseItemAction::UseItem(Item* item, ObjectGuid goGuid, Item* itemTarget, Uni
|
||||
}
|
||||
else if (isFood)
|
||||
{
|
||||
p = hp;
|
||||
p = std::min(hp, mp);
|
||||
TellConsumableUse(item, "Eating", p);
|
||||
}
|
||||
|
||||
if (!bot->IsInCombat() && !bot->InBattleground())
|
||||
botAI->SetNextCheckDelay(27000.0f * (100 - p) / 100.0f);
|
||||
botAI->SetNextCheckDelay(std::max(10000.0f, 27000.0f * (100 - p) / 100.0f));
|
||||
|
||||
if (!bot->IsInCombat() && bot->InBattleground())
|
||||
botAI->SetNextCheckDelay(20000.0f * (100 - p) / 100.0f);
|
||||
botAI->SetNextCheckDelay(std::max(10000.0f,20000.0f * (100 - p) / 100.0f));
|
||||
|
||||
//botAI->SetNextCheckDelay(27000.0f * (100 - p) / 100.0f);
|
||||
// botAI->SetNextCheckDelay(20000);
|
||||
bot->GetSession()->HandleUseItemOpcode(packet);
|
||||
|
||||
return true;
|
||||
|
||||
Reference in New Issue
Block a user