warlock and dk strategy port

This commit is contained in:
Yunfan Li
2023-06-03 14:01:20 +08:00
parent a44b310c0a
commit 0f483047e5
27 changed files with 562 additions and 88 deletions

View File

@@ -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;