Merge pull request #36 from liyunfan1223/dev

Dev
This commit is contained in:
Yunfan Li 2023-09-15 00:07:41 +08:00 committed by GitHub
commit 022c7c7796
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
38 changed files with 286 additions and 143 deletions

View File

@ -504,7 +504,7 @@ AiPlayerbot.TooCloseDistance = 5.0
AiPlayerbot.MeleeDistance = 0.01 AiPlayerbot.MeleeDistance = 0.01
AiPlayerbot.FollowDistance = 1.5 AiPlayerbot.FollowDistance = 1.5
AiPlayerbot.WhisperDistance = 6000.0 AiPlayerbot.WhisperDistance = 6000.0
AiPlayerbot.ContactDistance = 0.01 AiPlayerbot.ContactDistance = 0.45
AiPlayerbot.AoeRadius = 10 AiPlayerbot.AoeRadius = 10
AiPlayerbot.RpgDistance = 200 AiPlayerbot.RpgDistance = 200
AiPlayerbot.AggroDistance = 22 AiPlayerbot.AggroDistance = 22
@ -623,6 +623,13 @@ AiPlayerbot.RandomBotRandomPassword = 0
# Set RandomBotMaxLevel bots to RandomBotMinLevel or not # Set RandomBotMaxLevel bots to RandomBotMinLevel or not
AiPlayerbot.DowngradeMaxLevelBot = 0 AiPlayerbot.DowngradeMaxLevelBot = 0
# Enable/Disable bot equipments persistence (stop random initialization) after certain level (EquipmentPersistenceLevel)
# default: 0 (disable)
AiPlayerbot.EquipmentPersistence = 0
# default: 80
AiPlayerbot.EquipmentPersistenceLevel = 80
################################################################################## ##################################################################################
# # # #
# Database Stuff # # Database Stuff #

View File

@ -940,13 +940,13 @@ void PlayerbotAI::ChangeEngine(BotState type)
switch (type) switch (type)
{ {
case BOT_STATE_COMBAT: case BOT_STATE_COMBAT:
LOG_DEBUG("playerbots", "=== {} COMBAT ===", bot->GetName().c_str()); // LOG_DEBUG("playerbots", "=== {} COMBAT ===", bot->GetName().c_str());
break; break;
case BOT_STATE_NON_COMBAT: case BOT_STATE_NON_COMBAT:
LOG_DEBUG("playerbots", "=== {} NON-COMBAT ===", bot->GetName().c_str()); // LOG_DEBUG("playerbots", "=== {} NON-COMBAT ===", bot->GetName().c_str());
break; break;
case BOT_STATE_DEAD: case BOT_STATE_DEAD:
LOG_DEBUG("playerbots", "=== {} DEAD ===", bot->GetName().c_str()); // LOG_DEBUG("playerbots", "=== {} DEAD ===", bot->GetName().c_str());
break; break;
} }
} }
@ -2060,18 +2060,18 @@ bool PlayerbotAI::CanCastSpell(std::string const name, Unit* target, Item* itemT
bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, Item* itemTarget) bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell, Item* itemTarget)
{ {
if (!spellid) { if (!spellid) {
// if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Can cast spell failed. No spellid. - spellid: {}, bot name: {}", LOG_DEBUG("playerbots", "Can cast spell failed. No spellid. - spellid: {}, bot name: {}",
// spellid, bot->GetName()); spellid, bot->GetName());
// } }
return false; return false;
} }
if (bot->HasUnitState(UNIT_STATE_LOST_CONTROL)) { if (bot->HasUnitState(UNIT_STATE_LOST_CONTROL)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Unit state lost control. - spellid: {}, bot name: {}", LOG_DEBUG("playerbots", "Can cast spell failed. Unit state lost control. - spellid: {}, bot name: {}",
// spellid, bot->GetName()); spellid, bot->GetName());
// } }
return false; return false;
} }
@ -2079,7 +2079,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
if (!target) if (!target)
target = bot; target = bot;
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster()))
// LOG_DEBUG("playerbots", "Can cast spell? - target name: {}, spellid: {}, bot name: {}", // LOG_DEBUG("playerbots", "Can cast spell? - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName()); // target->GetName(), spellid, bot->GetName());
@ -2088,42 +2088,42 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
return true; return true;
if (checkHasSpell && !bot->HasSpell(spellid)) { if (checkHasSpell && !bot->HasSpell(spellid)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Bot not has spell. - target name: {}, spellid: {}, bot name: {}", LOG_DEBUG("playerbots", "Can cast spell failed. Bot not has spell. - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName()); target->GetName(), spellid, bot->GetName());
// } }
return false; return false;
} }
if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr) { if (bot->GetCurrentSpell(CURRENT_CHANNELED_SPELL) != nullptr) {
// LOG_DEBUG("playerbots", "CanCastSpell() target name: {}, spellid: {}, bot name: {}, failed because has current channeled spell", LOG_DEBUG("playerbots", "CanCastSpell() target name: {}, spellid: {}, bot name: {}, failed because has current channeled spell",
// target->GetName(), spellid, bot->GetName()); target->GetName(), spellid, bot->GetName());
return false; return false;
} }
if (bot->HasSpellCooldown(spellid)) { if (bot->HasSpellCooldown(spellid)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Spell not has cooldown. - target name: {}, spellid: {}, bot name: {}", LOG_DEBUG("playerbots", "Can cast spell failed. Spell not has cooldown. - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName()); target->GetName(), spellid, bot->GetName());
// } }
return false; return false;
} }
SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid); SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellid);
if (!spellInfo) { if (!spellInfo) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Can cast spell failed. No spellInfo. - target name: {}, spellid: {}, bot name: {}", LOG_DEBUG("playerbots", "Can cast spell failed. No spellInfo. - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName()); target->GetName(), spellid, bot->GetName());
// } }
return false; return false;
} }
uint32 CastingTime = !spellInfo->IsChanneled() ? spellInfo->CalcCastTime(bot) : spellInfo->GetDuration(); uint32 CastingTime = !spellInfo->IsChanneled() ? spellInfo->CalcCastTime(bot) : spellInfo->GetDuration();
if (CastingTime && bot->isMoving()) { if (CastingTime && bot->isMoving()) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Casting time and bot is moving - target name: {}, spellid: {}, bot name: {}", LOG_DEBUG("playerbots", "Casting time and bot is moving - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName()); target->GetName(), spellid, bot->GetName());
// } }
return false; return false;
} }
@ -2147,10 +2147,10 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
// } // }
if (target->IsImmunedToSpell(spellInfo)) { if (target->IsImmunedToSpell(spellInfo)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// 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;
} }
@ -2159,7 +2159,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
// 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() && HasRealPlayerMaster())) {
// 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());
// } // }
@ -2169,10 +2169,10 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
// } // }
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() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "target is out of sight distance - target name: {}, spellid: {}, bot name: {}", LOG_DEBUG("playerbots", "target is out of sight distance - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellid, bot->GetName()); target->GetName(), spellid, bot->GetName());
// } }
return false; return false;
} }
} }
@ -2188,7 +2188,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
SpellCastResult result = spell->CheckCast(true); SpellCastResult result = spell->CheckCast(true);
delete spell; delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) { // if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) {
// LOG_DEBUG("playerbots", "CanCastSpell - target name: {}, spellid: {}, bot name: {}, result: {}", // LOG_DEBUG("playerbots", "CanCastSpell - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellid, bot->GetName(), result); // target->GetName(), spellid, bot->GetName(), result);
@ -2207,14 +2207,14 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
case SPELL_FAILED_TRY_AGAIN: case SPELL_FAILED_TRY_AGAIN:
case SPELL_CAST_OK: case SPELL_CAST_OK:
case SPELL_FAILED_NOT_SHAPESHIFT: case SPELL_FAILED_NOT_SHAPESHIFT:
case SPELL_FAILED_OUT_OF_RANGE:
return true; return true;
default: default:
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) { // if (result != SPELL_FAILED_NOT_READY && result != SPELL_CAST_OK) {
// LOG_DEBUG("playerbots", "CanCastSpell Check Failed. - target name: {}, spellid: {}, bot name: {}, result: {}", LOG_DEBUG("playerbots", "CanCastSpell Check Failed. - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellid, bot->GetName(), result); target->GetName(), spellid, bot->GetName(), result);
// } }
// }
return false; return false;
} }
} }
@ -2381,7 +2381,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
aiObjectContext->GetValue<time_t>("stay time")->Set(0); aiObjectContext->GetValue<time_t>("stay time")->Set(0);
if (bot->IsFlying() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) { if (bot->IsFlying() || bot->HasUnitState(UNIT_STATE_IN_FLIGHT)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast is flying - target name: {}, spellid: {}, bot name: {}}", // LOG_DEBUG("playerbots", "Spell cast is flying - target name: {}, spellid: {}, bot name: {}}",
// target->GetName(), spellId, bot->GetName()); // target->GetName(), spellId, bot->GetName());
// } // }
@ -2411,7 +2411,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
if (failWithDelay) if (failWithDelay)
{ {
SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast fail with delay - target name: {}, spellid: {}, bot name: {}", // LOG_DEBUG("playerbots", "Spell cast fail with delay - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellId, bot->GetName()); // target->GetName(), spellId, bot->GetName());
// } // }
@ -2430,7 +2430,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
{ {
bot->GetTradeData()->SetSpell(spellId); bot->GetTradeData()->SetSpell(spellId);
delete spell; delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast no item - target name: {}, spellid: {}, bot name: {}", // LOG_DEBUG("playerbots", "Spell cast no item - target name: {}, spellid: {}, bot name: {}",
// target->GetName(), spellId, bot->GetName()); // target->GetName(), spellId, bot->GetName());
// } // }
@ -2485,7 +2485,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
// spell->m_targets.SetUnitTarget(target); // spell->m_targets.SetUnitTarget(target);
// SpellCastResult spellSuccess = spell->CheckCast(true); // SpellCastResult spellSuccess = spell->CheckCast(true);
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast result - target name: {}, spellid: {}, bot name: {}, result: {}", // LOG_DEBUG("playerbots", "Spell cast result - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellId, bot->GetName(), spellSuccess); // target->GetName(), spellId, bot->GetName(), spellSuccess);
// } // }
@ -2495,7 +2495,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
SpellCastResult result = spell->prepare(&targets); SpellCastResult result = spell->prepare(&targets);
if (result != SPELL_CAST_OK) { if (result != SPELL_CAST_OK) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Spell cast failed. - target name: {}, spellid: {}, bot name: {}, result: {}", // LOG_DEBUG("playerbots", "Spell cast failed. - target name: {}, spellid: {}, bot name: {}, result: {}",
// target->GetName(), spellId, bot->GetName(), result); // target->GetName(), spellId, bot->GetName(), result);
// } // }
@ -2508,7 +2508,7 @@ bool PlayerbotAI::CastSpell(uint32 spellId, Unit* target, Item* itemTarget)
// { // {
// spell->cancel(); // spell->cancel();
// delete spell; // delete spell;
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { // if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && HasRealPlayerMaster())) {
// 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());
// } // }

View File

@ -162,9 +162,9 @@ bool PlayerbotAIConfig::Initialize()
{ {
for (uint32 spec = 0; spec < 3; ++spec) for (uint32 spec = 0; spec < 3; ++spec)
{ {
std::ostringstream os; os << "AiPlayerbot.RandomClassSpecProbability." << cls << "." << spec; std::ostringstream os;
os << "AiPlayerbot.RandomClassSpecProbability." << cls << "." << spec;
specProbability[cls][spec] = sConfigMgr->GetOption<uint32>(os.str().c_str(), 33); specProbability[cls][spec] = sConfigMgr->GetOption<uint32>(os.str().c_str(), 33);
os.str(""); os.str("");
os.clear(); os.clear();
os << "AiPlayerbot.DefaultTalentsOrder." << cls << "." << spec; os << "AiPlayerbot.DefaultTalentsOrder." << cls << "." << spec;
@ -296,6 +296,8 @@ bool PlayerbotAIConfig::Initialize()
disableRandomLevels = sConfigMgr->GetOption<bool>("AiPlayerbot.DisableRandomLevels", false); disableRandomLevels = sConfigMgr->GetOption<bool>("AiPlayerbot.DisableRandomLevels", false);
randomBotRandomPassword = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotRandomPassword", true); randomBotRandomPassword = sConfigMgr->GetOption<bool>("AiPlayerbot.RandomBotRandomPassword", true);
downgradeMaxLevelBot = sConfigMgr->GetOption<bool>("AiPlayerbot.DowngradeMaxLevelBot", true); downgradeMaxLevelBot = sConfigMgr->GetOption<bool>("AiPlayerbot.DowngradeMaxLevelBot", true);
equipmentPersistence = sConfigMgr->GetOption<bool>("AiPlayerbot.EquipmentPersistence", false);
equipmentPersistenceLevel = sConfigMgr->GetOption<int32>("AiPlayerbot.EquipmentPersistenceLevel", 80);
playerbotsXPrate = sConfigMgr->GetOption<int32>("AiPlayerbot.KillXPRate", 1); playerbotsXPrate = sConfigMgr->GetOption<int32>("AiPlayerbot.KillXPRate", 1);
botActiveAlone = sConfigMgr->GetOption<int32>("AiPlayerbot.BotActiveAlone", 10); botActiveAlone = sConfigMgr->GetOption<int32>("AiPlayerbot.BotActiveAlone", 10);
randombotsWalkingRPG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandombotsWalkingRPG", false); randombotsWalkingRPG = sConfigMgr->GetOption<bool>("AiPlayerbot.RandombotsWalkingRPG", false);

View File

@ -167,6 +167,8 @@ class PlayerbotAIConfig
uint32 selfBotLevel; uint32 selfBotLevel;
bool downgradeMaxLevelBot; bool downgradeMaxLevelBot;
bool equipmentPersistence;
int32 equipmentPersistenceLevel;
std::string const GetTimestampStr(); std::string const GetTimestampStr();
bool hasLog(std::string const fileName) { return std::find(allowedLogFiles.begin(), allowedLogFiles.end(), fileName) != allowedLogFiles.end(); }; bool hasLog(std::string const fileName) { return std::find(allowedLogFiles.begin(), allowedLogFiles.end(), fileName) != allowedLogFiles.end(); };
bool openLog(std::string const fileName, char const* mode = "a"); bool openLog(std::string const fileName, char const* mode = "a");

View File

@ -130,7 +130,9 @@ void PlayerbotFactory::Randomize(bool incremental)
{ {
ResetQuests(); ResetQuests();
} }
ClearAllItems(); if (!sPlayerbotAIConfig->equipmentPersistence || level < sPlayerbotAIConfig->equipmentPersistenceLevel) {
ClearAllItems();
}
bot->SaveToDB(false, false); bot->SaveToDB(false, false);
bot->GiveLevel(level); bot->GiveLevel(level);
@ -222,7 +224,9 @@ void PlayerbotFactory::Randomize(bool incremental)
pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Equip"); pmo = sPerformanceMonitor->start(PERF_MON_RNDBOT, "PlayerbotFactory_Equip");
LOG_INFO("playerbots", "Initializing equipmemt..."); LOG_INFO("playerbots", "Initializing equipmemt...");
InitEquipment(incremental); if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel) {
InitEquipment(incremental);
}
// bot->SaveToDB(false, false); // bot->SaveToDB(false, false);
if (pmo) if (pmo)
pmo->finish(); pmo->finish();
@ -342,7 +346,9 @@ void PlayerbotFactory::Randomize(bool incremental)
void PlayerbotFactory::Refresh() void PlayerbotFactory::Refresh()
{ {
// Prepare(); // Prepare();
InitEquipment(true); if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel) {
InitEquipment(true);
}
ClearInventory(); ClearInventory();
InitAmmo(); InitAmmo();
InitFood(); InitFood();
@ -1153,9 +1159,7 @@ void Shuffle(std::vector<uint32>& items)
void PlayerbotFactory::InitEquipment(bool incremental) void PlayerbotFactory::InitEquipment(bool incremental)
{ {
std::unordered_map<uint8, std::vector<uint32> > items;
// todo(yunfan): to be refactored, too much time overhead
std::map<uint8, std::vector<uint32> > items;
int tab = AiFactory::GetPlayerSpecTab(bot); int tab = AiFactory::GetPlayerSpecTab(bot);
uint32 blevel = bot->getLevel(); uint32 blevel = bot->getLevel();

View File

@ -206,11 +206,11 @@ Player* RandomPlayerbotFactory::CreateRandomBot(WorldSession* session, uint8 cls
player->setCinematic(2); player->setCinematic(2);
player->SetAtLoginFlag(AT_LOGIN_NONE); player->SetAtLoginFlag(AT_LOGIN_NONE);
// player->SaveToDB(true, false); player->SaveToDB(true, false);
// if (player->getClass() == CLASS_DEATH_KNIGHT) if (player->getClass() == CLASS_DEATH_KNIGHT)
// { {
// player->learnSpell(50977, false); player->learnSpell(50977, false);
// } }
// player->RewardQuest(const Quest *quest, uint32 reward, Object *questGiver) // player->RewardQuest(const Quest *quest, uint32 reward, Object *questGiver)
LOG_DEBUG("playerbots", "Random bot created for account {} - name: \"{}\"; race: {}; class: {}", accountId, name.c_str(), race, cls); LOG_DEBUG("playerbots", "Random bot created for account {} - name: \"{}\"; race: {}; class: {}", accountId, name.c_str(), race, cls);
@ -396,7 +396,7 @@ void RandomPlayerbotFactory::CreateRandomBots()
} }
if (bot_creation) { if (bot_creation) {
LOG_INFO("playerbots", "Wait for {} characters load into database...", totalCharCount); LOG_INFO("playerbots", "Waiting for {} characters load into database...", totalCharCount);
/* wait for characters load into database, or characters will fail to loggin */ /* wait for characters load into database, or characters will fail to loggin */
std::this_thread::sleep_for(15ms * totalCharCount); std::this_thread::sleep_for(15ms * totalCharCount);
} }

View File

@ -85,6 +85,7 @@ class ActionContext : public NamedObjectContext<Action>
creators["reach spell"] = &ActionContext::ReachSpell; creators["reach spell"] = &ActionContext::ReachSpell;
creators["reach melee"] = &ActionContext::ReachMelee; creators["reach melee"] = &ActionContext::ReachMelee;
creators["reach party member to heal"] = &ActionContext::reach_party_member_to_heal; creators["reach party member to heal"] = &ActionContext::reach_party_member_to_heal;
creators["reach party member to resurrect"] = &ActionContext::reach_party_member_to_resurrect;
creators["flee"] = &ActionContext::flee; creators["flee"] = &ActionContext::flee;
creators["flee with pet"] = &ActionContext::flee_with_pet; creators["flee with pet"] = &ActionContext::flee_with_pet;
creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru; creators["gift of the naaru"] = &ActionContext::gift_of_the_naaru;
@ -259,6 +260,7 @@ class ActionContext : public NamedObjectContext<Action>
static Action* ReachSpell(PlayerbotAI* botAI) { return new ReachSpellAction(botAI); } static Action* ReachSpell(PlayerbotAI* botAI) { return new ReachSpellAction(botAI); }
static Action* ReachMelee(PlayerbotAI* botAI) { return new ReachMeleeAction(botAI); } static Action* ReachMelee(PlayerbotAI* botAI) { return new ReachMeleeAction(botAI); }
static Action* reach_party_member_to_heal(PlayerbotAI* botAI) { return new ReachPartyMemberToHealAction(botAI); } static Action* reach_party_member_to_heal(PlayerbotAI* botAI) { return new ReachPartyMemberToHealAction(botAI); }
static Action* reach_party_member_to_resurrect(PlayerbotAI* botAI) { return new ReachPartyMemberToResurrectAction(botAI); }
static Action* flee(PlayerbotAI* botAI) { return new FleeAction(botAI); } static Action* flee(PlayerbotAI* botAI) { return new FleeAction(botAI); }
static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); } static Action* flee_with_pet(PlayerbotAI* botAI) { return new FleeWithPetAction(botAI); }
static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); } static Action* gift_of_the_naaru(PlayerbotAI* botAI) { return new CastGiftOfTheNaaruAction(botAI); }

View File

@ -102,6 +102,10 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
context->GetValue<Unit*>("current target")->Set(target); context->GetValue<Unit*>("current target")->Set(target);
context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid); context->GetValue<LootObjectStack*>("available loot")->Get()->Add(guid);
/* prevent pet dead immediately in group */
if (bot->GetGroup() && !target->IsInCombat()) {
with_pet = false;
}
if (Pet* pet = bot->GetPet()) if (Pet* pet = bot->GetPet())
{ {
if (with_pet) { if (with_pet) {
@ -118,8 +122,10 @@ bool AttackAction::Attack(Unit* target, bool with_pet /*true*/)
} }
} }
if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target)) if (IsMovingAllowed() && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target)) {
bot->SetFacingToObject(target); sServerFacade->SetFacingTo(bot, target);
}
// bot->SetFacingToObject(target);
bool attacked = bot->Attack(target, true); bool attacked = bot->Attack(target, true);
botAI->ChangeEngine(BOT_STATE_COMBAT); botAI->ChangeEngine(BOT_STATE_COMBAT);

View File

@ -20,6 +20,8 @@ void AutoTeleportForLevelAction::AutoUpgradeEquip() {
return; return;
} }
PlayerbotFactory factory(bot, bot->GetLevel(), ITEM_QUALITY_RARE); PlayerbotFactory factory(bot, bot->GetLevel(), ITEM_QUALITY_RARE);
factory.InitEquipment(true); if (!sPlayerbotAIConfig->equipmentPersistence || bot->GetLevel() < sPlayerbotAIConfig->equipmentPersistenceLevel) {
factory.InitEquipment(true);
}
factory.InitAmmo(); factory.InitAmmo();
} }

View File

@ -7,6 +7,7 @@
#include "Event.h" #include "Event.h"
#include "ItemUsageValue.h" #include "ItemUsageValue.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "ServerFacade.h"
uint32 FindLastSeparator(std::string const text, std::string const sep) uint32 FindLastSeparator(std::string const text, std::string const sep)
{ {
@ -99,7 +100,7 @@ bool CastCustomSpellAction::Execute(Event event)
if (target != bot && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target, sPlayerbotAIConfig->sightDistance)) if (target != bot && !bot->HasInArc(CAST_ANGLE_IN_FRONT, target, sPlayerbotAIConfig->sightDistance))
{ {
bot->SetFacingToObject(target); sServerFacade->SetFacingTo(bot, target);
botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
msg << "cast " << text; msg << "cast " << text;

View File

@ -63,10 +63,10 @@ bool CastSpellAction::Execute(Event event)
bool CastSpellAction::isPossible() bool CastSpellAction::isPossible()
{ {
if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true)) { if (botAI->IsInVehicle() && !botAI->IsInVehicle(false, false, true)) {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}", LOG_DEBUG("playerbots", "Can cast spell failed. Vehicle. - bot name: {}",
// bot->GetName()); bot->GetName());
// } }
return false; return false;
} }
@ -75,10 +75,10 @@ bool CastSpellAction::isPossible()
if (spell == "mount" && bot->IsInCombat()) if (spell == "mount" && bot->IsInCombat())
{ {
// if (!sPlayerbotAIConfig->logInGroupOnly || bot->GetGroup()) { if (!sPlayerbotAIConfig->logInGroupOnly || (bot->GetGroup() && botAI->HasRealPlayerMaster())) {
// LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}", LOG_DEBUG("playerbots", "Can cast spell failed. Mount. - bot name: {}",
// bot->GetName()); bot->GetName());
// } }
bot->Dismount(); bot->Dismount();
return false; return false;
} }
@ -153,7 +153,7 @@ bool CastEnchantItemAction::isPossible()
CastHealingSpellAction::CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount) : CastAuraSpellAction(botAI, spell, true), estAmount(estAmount) CastHealingSpellAction::CastHealingSpellAction(PlayerbotAI* botAI, std::string const spell, uint8 estAmount) : CastAuraSpellAction(botAI, spell, true), estAmount(estAmount)
{ {
range = botAI->GetRange("spell"); range = botAI->GetRange("heal");
} }
bool CastHealingSpellAction::isUseful() bool CastHealingSpellAction::isUseful()
@ -168,7 +168,7 @@ bool CastAoeHealSpellAction::isUseful()
CastCureSpellAction::CastCureSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) CastCureSpellAction::CastCureSpellAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell)
{ {
range = botAI->GetRange("spell"); range = botAI->GetRange("heal");
} }
Value<Unit*>* CurePartyMemberAction::GetTargetValue() Value<Unit*>* CurePartyMemberAction::GetTargetValue()

View File

@ -6,6 +6,8 @@
#define _PLAYERBOT_GENERICSPELLACTIONS_H #define _PLAYERBOT_GENERICSPELLACTIONS_H
#include "Action.h" #include "Action.h"
#include "PlayerbotAI.h"
#include "PlayerbotAIConfig.h"
#include "Value.h" #include "Value.h"
class PlayerbotAI; class PlayerbotAI;
@ -66,10 +68,10 @@ class CastDebuffSpellOnAttackerAction : public CastDebuffSpellAction
// ActionThreatType getThreatType() override { return ActionThreatType::Aoe; } // ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
}; };
class CastDebuffSpellOnMeleeAttackerAction : public CastAuraSpellAction class CastDebuffSpellOnMeleeAttackerAction : public CastDebuffSpellAction
{ {
public: public:
CastDebuffSpellOnMeleeAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true) : CastAuraSpellAction(botAI, spell, isOwner) { } CastDebuffSpellOnMeleeAttackerAction(PlayerbotAI* botAI, std::string const spell, bool isOwner = true, float needLifeTime = 8.0f) : CastDebuffSpellAction(botAI, spell, isOwner, needLifeTime) { }
Value<Unit*>* GetTargetValue() override; Value<Unit*>* GetTargetValue() override;
std::string const getName() override { return spell + " on attacker"; } std::string const getName() override { return spell + " on attacker"; }
@ -150,9 +152,14 @@ class HealPartyMemberAction : public CastHealingSpellAction, public PartyMemberA
class ResurrectPartyMemberAction : public CastSpellAction class ResurrectPartyMemberAction : public CastSpellAction
{ {
public: public:
ResurrectPartyMemberAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) { } ResurrectPartyMemberAction(PlayerbotAI* botAI, std::string const spell) : CastSpellAction(botAI, spell) {
}
std::string const GetTargetName() override { return "party member to resurrect"; } std::string const GetTargetName() override { return "party member to resurrect"; }
NextAction** getPrerequisites() override
{
return NextAction::merge( NextAction::array(0, new NextAction("reach party member to resurrect"), NULL), Action::getPrerequisites());
}
}; };
class CurePartyMemberAction : public CastSpellAction, public PartyMemberActionNameSupport class CurePartyMemberAction : public CastSpellAction, public PartyMemberActionNameSupport

View File

@ -26,8 +26,8 @@ bool DrinkAction::Execute(Event event)
if (bot->isMoving()) if (bot->isMoving())
{ {
bot->StopMoving(); // bot->StopMoving();
botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); // botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
return false; return false;
} }
bot->SetStandState(UNIT_STAND_STATE_SIT); bot->SetStandState(UNIT_STAND_STATE_SIT);
@ -78,8 +78,8 @@ bool EatAction::Execute(Event event)
if (bot->isMoving()) if (bot->isMoving())
{ {
bot->StopMoving(); // bot->StopMoving();
botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown); // botAI->SetNextCheckDelay(sPlayerbotAIConfig->globalCoolDown);
return false; return false;
} }

View File

@ -45,3 +45,12 @@ std::string const ReachPartyMemberToHealAction::GetTargetName()
{ {
return "party member to heal"; return "party member to heal";
} }
ReachPartyMemberToResurrectAction::ReachPartyMemberToResurrectAction(PlayerbotAI* botAI) : ReachTargetAction(botAI, "reach party member to resurrect", botAI->GetRange("spell"))
{
}
std::string const ReachPartyMemberToResurrectAction::GetTargetName()
{
return "party member to resurrect";
}

View File

@ -54,4 +54,13 @@ class ReachPartyMemberToHealAction : public ReachTargetAction
std::string const GetTargetName() override; std::string const GetTargetName() override;
}; };
class ReachPartyMemberToResurrectAction : public ReachTargetAction
{
public:
ReachPartyMemberToResurrectAction(PlayerbotAI* botAI);
std::string const GetTargetName() override;
};
#endif #endif

View File

@ -73,6 +73,12 @@ bool SummonAction::Execute(Event event)
Player* master = GetMaster(); Player* master = GetMaster();
if (!master) if (!master)
return false; return false;
if (Pet* pet = bot->GetPet()) {
pet->SetReactState(REACT_PASSIVE);
pet->GetCharmInfo()->SetIsCommandFollow(true);
pet->GetCharmInfo()->IsReturning();
}
if (master->GetSession()->GetSecurity() >= SEC_PLAYER) if (master->GetSession()->GetSecurity() >= SEC_PLAYER)
return Teleport(master, bot); return Teleport(master, bot);

View File

@ -80,12 +80,14 @@ BloodDKStrategy::BloodDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI)
NextAction** BloodDKStrategy::getDefaultActions() NextAction** BloodDKStrategy::getDefaultActions()
{ {
return NextAction::array(0, return NextAction::array(0,
new NextAction("rune strike", ACTION_NORMAL + 7), new NextAction("rune strike", ACTION_NORMAL + 8),
new NextAction("icy touch", ACTION_NORMAL + 6), new NextAction("icy touch", ACTION_NORMAL + 7),
new NextAction("heart strike", ACTION_NORMAL + 5), new NextAction("heart strike", ACTION_NORMAL + 6),
new NextAction("blood strike", ACTION_NORMAL + 4), new NextAction("blood strike", ACTION_NORMAL + 5),
new NextAction("dancing rune weapon", ACTION_NORMAL + 4),
new NextAction("death coil", ACTION_NORMAL + 3), new NextAction("death coil", ACTION_NORMAL + 3),
new NextAction("plague strike", ACTION_NORMAL + 2), new NextAction("plague strike", ACTION_NORMAL + 2),
new NextAction("horn of winter", ACTION_NORMAL + 1),
new NextAction("melee", ACTION_NORMAL), new NextAction("melee", ACTION_NORMAL),
NULL); NULL);
} }

View File

@ -91,8 +91,14 @@ class CastPestilenceAction : public CastSpellAction
//debuff //debuff
BEGIN_DEBUFF_ACTION(CastHowlingBlastAction, "howling blast") // BEGIN_DEBUFF_ACTION(CastHowlingBlastAction, "howling blast")
END_SPELL_ACTION() // END_SPELL_ACTION()
class CastHowlingBlastAction : public CastSpellAction
{
public:
CastHowlingBlastAction(PlayerbotAI* ai) : CastSpellAction(ai, "howling blast") {}
};
//debuff it //debuff it
// BEGIN_DEBUFF_ACTION(CastIcyTouchAction, "icy touch") // BEGIN_DEBUFF_ACTION(CastIcyTouchAction, "icy touch")
@ -107,17 +113,23 @@ class CastIcyTouchAction : public CastSpellAction
class CastIcyTouchOnAttackerAction : public CastDebuffSpellOnMeleeAttackerAction class CastIcyTouchOnAttackerAction : public CastDebuffSpellOnMeleeAttackerAction
{ {
public: public:
CastIcyTouchOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnMeleeAttackerAction(botAI, "icy touch", true) { } CastIcyTouchOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnMeleeAttackerAction(botAI, "icy touch", true, .0f) { }
}; };
//debuff ps //debuff ps
BEGIN_DEBUFF_ACTION(CastPlagueStrikeAction, "plague strike")
END_SPELL_ACTION() class CastPlagueStrikeAction : public CastSpellAction
{
public:
CastPlagueStrikeAction(PlayerbotAI* ai) : CastSpellAction(ai, "plague strike") {}
};
// BEGIN_DEBUFF_ACTION(CastPlagueStrikeAction, "plague strike")
// END_SPELL_ACTION()
class CastPlagueStrikeOnAttackerAction : public CastDebuffSpellOnMeleeAttackerAction class CastPlagueStrikeOnAttackerAction : public CastDebuffSpellOnMeleeAttackerAction
{ {
public: public:
CastPlagueStrikeOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnMeleeAttackerAction(botAI, "plague strike", true) { } CastPlagueStrikeOnAttackerAction(PlayerbotAI* botAI) : CastDebuffSpellOnMeleeAttackerAction(botAI, "plague strike", true, .0f) { }
}; };
//debuff //debuff
@ -136,10 +148,10 @@ class CastUnholyBlightAction : public CastBuffSpellAction
CastUnholyBlightAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "unholy blight") { } CastUnholyBlightAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "unholy blight") { }
}; };
class CastSummonGargoyleAction : public CastBuffSpellAction class CastSummonGargoyleAction : public CastSpellAction
{ {
public: public:
CastSummonGargoyleAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "summon gargoyle") { } CastSummonGargoyleAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "summon gargoyle") { }
}; };
class CastGhoulFrenzyAction : public CastBuffSpellAction class CastGhoulFrenzyAction : public CastBuffSpellAction
@ -224,10 +236,10 @@ class CastDeathAndDecayAction : public CastSpellAction
CastDeathAndDecayAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "death and decay") { } CastDeathAndDecayAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "death and decay") { }
}; };
class CastHornOfWinterAction : public CastBuffSpellAction class CastHornOfWinterAction : public CastSpellAction
{ {
public: public:
CastHornOfWinterAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "horn of winter") { } CastHornOfWinterAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "horn of winter") { }
}; };
class CastImprovedIcyTalonsAction : public CastBuffSpellAction class CastImprovedIcyTalonsAction : public CastBuffSpellAction
@ -254,10 +266,10 @@ class CastDeathRuneMasteryAction : public CastBuffSpellAction
CastDeathRuneMasteryAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "death rune mastery") { } CastDeathRuneMasteryAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "death rune mastery") { }
}; };
class CastDancingWeaponAction : public CastBuffSpellAction class CastDancingRuneWeaponAction : public CastSpellAction
{ {
public: public:
CastDancingWeaponAction(PlayerbotAI* botAI) : CastBuffSpellAction(botAI, "dancing weapon") { } CastDancingRuneWeaponAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "dancing rune weapon") { }
}; };
class CastEmpowerRuneWeaponAction : public CastBuffSpellAction class CastEmpowerRuneWeaponAction : public CastBuffSpellAction

View File

@ -85,6 +85,8 @@ class DeathKnightTriggerFactoryInternal : public NamedObjectContext<Trigger>
creators["raise dead"] = &DeathKnightTriggerFactoryInternal::raise_dead; creators["raise dead"] = &DeathKnightTriggerFactoryInternal::raise_dead;
creators["chains of ice"] = &DeathKnightTriggerFactoryInternal::chains_of_ice; creators["chains of ice"] = &DeathKnightTriggerFactoryInternal::chains_of_ice;
creators["unbreakable armor"] = &DeathKnightTriggerFactoryInternal::unbreakable_armor; creators["unbreakable armor"] = &DeathKnightTriggerFactoryInternal::unbreakable_armor;
creators["high blood rune"] = &DeathKnightTriggerFactoryInternal::high_blood_rune;
creators["freezing fog"] = &DeathKnightTriggerFactoryInternal::freezing_fog;
} }
private: private:
@ -106,6 +108,9 @@ class DeathKnightTriggerFactoryInternal : public NamedObjectContext<Trigger>
static Trigger* raise_dead(PlayerbotAI* botAI) { return new RaiseDeadTrigger(botAI); } static Trigger* raise_dead(PlayerbotAI* botAI) { return new RaiseDeadTrigger(botAI); }
static Trigger* chains_of_ice(PlayerbotAI* botAI) { return new ChainsOfIceSnareTrigger(botAI); } static Trigger* chains_of_ice(PlayerbotAI* botAI) { return new ChainsOfIceSnareTrigger(botAI); }
static Trigger* unbreakable_armor(PlayerbotAI* botAI) { return new UnbreakableArmorTrigger(botAI); } static Trigger* unbreakable_armor(PlayerbotAI* botAI) { return new UnbreakableArmorTrigger(botAI); }
static Trigger* high_blood_rune(PlayerbotAI* botAI) { return new HighBloodRuneTrigger(botAI); }
static Trigger* freezing_fog(PlayerbotAI* botAI) { return new FreezingFogTrigger(botAI); }
}; };
class DeathKnightAiObjectContextInternal : public NamedObjectContext<Action> class DeathKnightAiObjectContextInternal : public NamedObjectContext<Action>
@ -164,7 +169,7 @@ class DeathKnightAiObjectContextInternal : public NamedObjectContext<Action>
creators["death pact"] = &DeathKnightAiObjectContextInternal::death_pact; creators["death pact"] = &DeathKnightAiObjectContextInternal::death_pact;
creators["death rune_mastery"] = &DeathKnightAiObjectContextInternal::death_rune_mastery; creators["death rune_mastery"] = &DeathKnightAiObjectContextInternal::death_rune_mastery;
//creators["hysteria"] = &DeathKnightAiObjectContextInternal::hysteria; //creators["hysteria"] = &DeathKnightAiObjectContextInternal::hysteria;
creators["dancing weapon"] = &DeathKnightAiObjectContextInternal::dancing_weapon; creators["dancing rune weapon"] = &DeathKnightAiObjectContextInternal::dancing_rune_weapon;
creators["dark command"] = &DeathKnightAiObjectContextInternal::dark_command; creators["dark command"] = &DeathKnightAiObjectContextInternal::dark_command;
} }
@ -221,7 +226,7 @@ class DeathKnightAiObjectContextInternal : public NamedObjectContext<Action>
static Action* death_pact(PlayerbotAI* botAI) { return new CastDeathPactAction(botAI); } static Action* death_pact(PlayerbotAI* botAI) { return new CastDeathPactAction(botAI); }
static Action* death_rune_mastery(PlayerbotAI* botAI) { return new CastDeathRuneMasteryAction(botAI); } static Action* death_rune_mastery(PlayerbotAI* botAI) { return new CastDeathRuneMasteryAction(botAI); }
//static Action* hysteria(PlayerbotAI* botAI) { return new CastHysteriaAction(botAI); } //static Action* hysteria(PlayerbotAI* botAI) { return new CastHysteriaAction(botAI); }
static Action* dancing_weapon(PlayerbotAI* botAI) { return new CastDancingWeaponAction(botAI); } static Action* dancing_rune_weapon(PlayerbotAI* botAI) { return new CastDancingRuneWeaponAction(botAI); }
static Action* dark_command(PlayerbotAI* botAI) { return new CastDarkCommandAction(botAI); } static Action* dark_command(PlayerbotAI* botAI) { return new CastDarkCommandAction(botAI); }
static Action* mind_freeze_on_enemy_healer(PlayerbotAI* botAI) { return new CastMindFreezeOnEnemyHealerAction(botAI); } static Action* mind_freeze_on_enemy_healer(PlayerbotAI* botAI) { return new CastMindFreezeOnEnemyHealerAction(botAI); }
}; };

View File

@ -27,4 +27,9 @@ bool PestilenceTrigger::IsActive() {
return true; return true;
} }
return false; return false;
}
bool HighBloodRuneTrigger::IsActive() {
// bot->Say(std::to_string(bot->GetBaseRune(0)) + "_" + std::to_string(bot->GetRuneCooldown(0)) + " " + std::to_string(bot->GetBaseRune(1)) + "_" + std::to_string(bot->GetRuneCooldown(1)), LANG_UNIVERSAL);
return !bot->GetRuneCooldown(0) && !bot->GetRuneCooldown(1);
} }

View File

@ -12,19 +12,31 @@ class PlayerbotAI;
BUFF_TRIGGER(HornOfWinterTrigger, "horn of winter"); BUFF_TRIGGER(HornOfWinterTrigger, "horn of winter");
BUFF_TRIGGER(BoneShieldTrigger, "bone shield"); BUFF_TRIGGER(BoneShieldTrigger, "bone shield");
BUFF_TRIGGER(ImprovedIcyTalonsTrigger, "improved icy talons"); BUFF_TRIGGER(ImprovedIcyTalonsTrigger, "improved icy talons");
DEBUFF_CHECKISOWNER_TRIGGER(PlagueStrikeDebuffTrigger, "blood plague"); // DEBUFF_CHECKISOWNER_TRIGGER(PlagueStrikeDebuffTrigger, "blood plague");
DEBUFF_CHECKISOWNER_TRIGGER(IcyTouchDebuffTrigger, "frost fever"); class PlagueStrikeDebuffTrigger : public DebuffTrigger
{
public:
PlagueStrikeDebuffTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "blood plague", true, .0f) { }
};
// DEBUFF_CHECKISOWNER_TRIGGER(IcyTouchDebuffTrigger, "frost fever");
class IcyTouchDebuffTrigger : public DebuffTrigger
{
public:
IcyTouchDebuffTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "frost fever", true, .0f) { }
};
BUFF_TRIGGER(UnbreakableArmorTrigger, "unbreakable armor"); BUFF_TRIGGER(UnbreakableArmorTrigger, "unbreakable armor");
class PlagueStrikeDebuffOnAttackerTrigger : public DebuffOnMeleeAttackerTrigger class PlagueStrikeDebuffOnAttackerTrigger : public DebuffOnMeleeAttackerTrigger
{ {
public: public:
PlagueStrikeDebuffOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnMeleeAttackerTrigger(botAI, "blood plague", true) { } PlagueStrikeDebuffOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnMeleeAttackerTrigger(botAI, "blood plague", true, .0f) { }
}; };
class IcyTouchDebuffOnAttackerTrigger : public DebuffOnMeleeAttackerTrigger class IcyTouchDebuffOnAttackerTrigger : public DebuffOnMeleeAttackerTrigger
{ {
public: public:
IcyTouchDebuffOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnMeleeAttackerTrigger(botAI, "frost fever", true) { } IcyTouchDebuffOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnMeleeAttackerTrigger(botAI, "frost fever", true, .0f) { }
}; };
class DKPresenceTrigger : public BuffTrigger class DKPresenceTrigger : public BuffTrigger
@ -114,4 +126,17 @@ class StrangulateOnEnemyHealerTrigger : public InterruptEnemyHealerTrigger
StrangulateOnEnemyHealerTrigger(PlayerbotAI* botAI) : InterruptEnemyHealerTrigger(botAI, "strangulate") { } StrangulateOnEnemyHealerTrigger(PlayerbotAI* botAI) : InterruptEnemyHealerTrigger(botAI, "strangulate") { }
}; };
class HighBloodRuneTrigger : public Trigger
{
public:
HighBloodRuneTrigger(PlayerbotAI* botAI) : Trigger(botAI, "high blood rune") { }
bool IsActive() override;
};
class FreezingFogTrigger : public HasAuraTrigger
{
public:
FreezingFogTrigger(PlayerbotAI* botAI) : HasAuraTrigger(botAI, "freezing fog") { }
};
#endif #endif

View File

@ -82,6 +82,7 @@ NextAction** FrostDKStrategy::getDefaultActions()
new NextAction("frost strike", ACTION_NORMAL + 4), new NextAction("frost strike", ACTION_NORMAL + 4),
// new NextAction("death strike", ACTION_NORMAL + 3), // new NextAction("death strike", ACTION_NORMAL + 3),
new NextAction("empower rune weapon", ACTION_NORMAL + 2), new NextAction("empower rune weapon", ACTION_NORMAL + 2),
new NextAction("horn of winter", ACTION_NORMAL),
new NextAction("melee", ACTION_NORMAL), new NextAction("melee", ACTION_NORMAL),
NULL NULL
); );
@ -91,10 +92,13 @@ void FrostDKStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{ {
GenericDKStrategy::InitTriggers(triggers); GenericDKStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("unbreakable armor", NextAction::array(0, new NextAction("unbreakable armor", ACTION_NORMAL + 4), nullptr))); triggers.push_back(new TriggerNode("unbreakable armor", NextAction::array(0, new NextAction("unbreakable armor", ACTION_NORMAL + 4), nullptr)));
triggers.push_back(new TriggerNode("high blood rune", NextAction::array(0, new NextAction("blood strike", ACTION_NORMAL + 1), nullptr)));
triggers.push_back(new TriggerNode("freezing fog", NextAction::array(0, new NextAction("howling blast", ACTION_HIGH + 1), nullptr)));
// triggers.push_back(new TriggerNode("empower rune weapon", NextAction::array(0, new NextAction("empower rune weapon", ACTION_NORMAL + 4), nullptr))); // triggers.push_back(new TriggerNode("empower rune weapon", NextAction::array(0, new NextAction("empower rune weapon", ACTION_NORMAL + 4), nullptr)));
} }
void FrostDKAoeStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) void FrostDKAoeStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{ {
triggers.push_back(new TriggerNode("high aoe", NextAction::array(0, new NextAction("howling blast", ACTION_NORMAL + 4), nullptr))); triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("howling blast", ACTION_HIGH + 4), nullptr)));
} }

View File

@ -157,26 +157,32 @@ void GenericDKStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{ {
MeleeCombatStrategy::InitTriggers(triggers); MeleeCombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("high aoe", NextAction::array(0, new NextAction("anti magic shell", ACTION_NORMAL + 3), nullptr))); // triggers.push_back(new TriggerNode("high aoe", NextAction::array(0, new NextAction("anti magic shell", ACTION_NORMAL + 3), nullptr)));
// triggers.push_back(new TriggerNode("death coil", NextAction::array(0, new NextAction("death coil", ACTION_NORMAL + 3), nullptr))); // triggers.push_back(new TriggerNode("death coil", NextAction::array(0, new NextAction("death coil", ACTION_NORMAL + 3), nullptr)));
triggers.push_back(new TriggerNode("critical aoe heal", NextAction::array(0, new NextAction("anti magic zone", ACTION_EMERGENCY + 1), nullptr))); // triggers.push_back(new TriggerNode("critical aoe heal", NextAction::array(0, new NextAction("anti magic zone", ACTION_EMERGENCY + 1), nullptr)));
triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("raise dead", ACTION_NORMAL + 5), nullptr))); triggers.push_back(new TriggerNode("no pet", NextAction::array(0, new NextAction("raise dead", ACTION_NORMAL + 5), nullptr)));
triggers.push_back(new TriggerNode("mind freeze", NextAction::array(0, new NextAction("mind freeze", ACTION_HIGH + 1), nullptr))); triggers.push_back(new TriggerNode("mind freeze", NextAction::array(0, new NextAction("mind freeze", ACTION_HIGH + 1), nullptr)));
triggers.push_back(new TriggerNode("mind freeze on enemy healer", NextAction::array(0, new NextAction("mind freeze on enemy healer", ACTION_HIGH + 1), nullptr)));
triggers.push_back(new TriggerNode("bone shield", NextAction::array(0, new NextAction("bone shield", ACTION_NORMAL + 1), nullptr))); triggers.push_back(new TriggerNode("bone shield", NextAction::array(0, new NextAction("bone shield", ACTION_NORMAL + 1), nullptr)));
triggers.push_back(new TriggerNode("horn of winter", NextAction::array(0, new NextAction("horn of winter", ACTION_NORMAL + 1), nullptr))); triggers.push_back(new TriggerNode("horn of winter", NextAction::array(0, new NextAction("horn of winter", ACTION_NORMAL + 1), nullptr)));
triggers.push_back(new TriggerNode("mind freeze on enemy healer", NextAction::array(0, new NextAction("mind freeze on enemy healer", ACTION_HIGH + 1), nullptr)));
// triggers.push_back(new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("reach melee", ACTION_NORMAL + 8), nullptr))); // triggers.push_back(new TriggerNode("enemy out of melee", NextAction::array(0, new NextAction("reach melee", ACTION_NORMAL + 8), nullptr)));
triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("icebound fortitude", ACTION_HIGH + 5), new NextAction("rune tap", ACTION_HIGH + 4), nullptr))); triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("icebound fortitude", ACTION_HIGH + 5), new NextAction("rune tap", ACTION_HIGH + 4), nullptr)));
triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("rune tap", ACTION_NORMAL + 4), new NextAction("death strike", ACTION_NORMAL + 3), nullptr))); triggers.push_back(new TriggerNode("medium health", NextAction::array(0, new NextAction("rune tap", ACTION_NORMAL + 4), new NextAction("death strike", ACTION_NORMAL + 3), nullptr)));
triggers.push_back(new TriggerNode("icy touch", NextAction::array(0, new NextAction("icy touch", ACTION_HIGH + 1), nullptr))); triggers.push_back(new TriggerNode("icy touch", NextAction::array(0, new NextAction("icy touch", ACTION_HIGH + 2), nullptr)));
triggers.push_back(new TriggerNode("icy touch on attacker", NextAction::array(0, new NextAction("icy touch on attacker", ACTION_HIGH + 1), nullptr))); triggers.push_back(new TriggerNode("icy touch on attacker", NextAction::array(0, new NextAction("icy touch on attacker", ACTION_HIGH + 1), nullptr)));
triggers.push_back(new TriggerNode("plague strike", NextAction::array(0, new NextAction("plague strike", ACTION_HIGH + 1), nullptr))); triggers.push_back(new TriggerNode("plague strike", NextAction::array(0, new NextAction("plague strike", ACTION_HIGH + 2), nullptr)));
triggers.push_back(new TriggerNode("plague strike on attacker", NextAction::array(0, new NextAction("plague strike on attacker", ACTION_HIGH + 1), nullptr))); triggers.push_back(new TriggerNode("plague strike on attacker", NextAction::array(0, new NextAction("plague strike on attacker", ACTION_HIGH + 1), nullptr)));
triggers.push_back(new TriggerNode("high aoe", NextAction::array(0, new NextAction("unholy blight", ACTION_HIGH + 6), new NextAction("death and decay", ACTION_NORMAL + 5), // triggers.push_back(new TriggerNode("high aoe",
new NextAction("pestilence", ACTION_NORMAL + 4), new NextAction("blood boil", ACTION_NORMAL + 3), nullptr))); // NextAction::array(0,
triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0, new NextAction("death and decay", ACTION_HIGH + 9), // new NextAction("death and decay", ACTION_NORMAL + 5),
new NextAction("pestilence", ACTION_NORMAL + 4), new NextAction("blood boil", ACTION_NORMAL + 3), nullptr))); // new NextAction("pestilence", ACTION_NORMAL + 4),
triggers.push_back(new TriggerNode("light aoe", NextAction::array(0, new NextAction("howling blast", ACTION_NORMAL + 5), new NextAction("pestilence", ACTION_NORMAL + 4), // new NextAction("blood boil", ACTION_NORMAL + 3), nullptr)));
new NextAction("hearth strike", ACTION_NORMAL + 3), new NextAction("blood boil", ACTION_NORMAL + 3), nullptr))); triggers.push_back(new TriggerNode("medium aoe", NextAction::array(0,
new NextAction("death and decay", ACTION_HIGH + 9),
new NextAction("pestilence", ACTION_NORMAL + 4),
new NextAction("blood boil", ACTION_NORMAL + 3), nullptr)));
// triggers.push_back(new TriggerNode("light aoe", NextAction::array(0,
// new NextAction("pestilence", ACTION_NORMAL + 4),
// nullptr)));
triggers.push_back(new TriggerNode("pestilence", NextAction::array(0, new NextAction("pestilence", ACTION_HIGH + 9), NULL))); triggers.push_back(new TriggerNode("pestilence", NextAction::array(0, new NextAction("pestilence", ACTION_HIGH + 9), NULL)));
} }

View File

@ -72,12 +72,14 @@ UnholyDKStrategy::UnholyDKStrategy(PlayerbotAI* botAI) : GenericDKStrategy(botAI
NextAction** UnholyDKStrategy::getDefaultActions() NextAction** UnholyDKStrategy::getDefaultActions()
{ {
return NextAction::array(0, return NextAction::array(0,
new NextAction("scourge strike", ACTION_NORMAL + 6), new NextAction("scourge strike", ACTION_NORMAL + 7),
new NextAction("blood strike", ACTION_NORMAL + 5), new NextAction("blood strike", ACTION_NORMAL + 6),
new NextAction("ghoul frenzy", ACTION_NORMAL + 4), new NextAction("ghoul frenzy", ACTION_NORMAL + 5),
new NextAction("summon gargoyle", ACTION_NORMAL + 4),
new NextAction("death coil", ACTION_NORMAL + 3), new NextAction("death coil", ACTION_NORMAL + 3),
new NextAction("plague strike", ACTION_NORMAL + 2), new NextAction("plague strike", ACTION_NORMAL + 2),
new NextAction("icy touch", ACTION_NORMAL + 1), new NextAction("icy touch", ACTION_NORMAL + 1),
new NextAction("horn of winter", ACTION_NORMAL),
new NextAction("melee", ACTION_NORMAL), new NextAction("melee", ACTION_NORMAL),
nullptr); nullptr);
} }

View File

@ -48,5 +48,5 @@ NextAction** CastRebirthAction::getPrerequisites()
bool CastRebirthAction::isUseful() bool CastRebirthAction::isUseful()
{ {
return AI_VALUE2(float, "distance", GetTargetName()) <= sPlayerbotAIConfig->spellDistance; return CastSpellAction::isUseful() && AI_VALUE2(float, "distance", GetTargetName()) <= sPlayerbotAIConfig->spellDistance;
} }

View File

@ -136,6 +136,7 @@ class CastHurricaneAction : public CastSpellAction
{ {
public: public:
CastHurricaneAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "hurricane") { } CastHurricaneAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "hurricane") { }
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
}; };
class CastMoonfireAction : public CastDebuffSpellAction class CastMoonfireAction : public CastDebuffSpellAction

View File

@ -17,6 +17,8 @@ class GenericDruidNonCombatStrategyActionNodeFactory : public NamedObjectFactory
// creators["innervate"] = &innervate; // creators["innervate"] = &innervate;
creators["regrowth_on_party"] = &regrowth_on_party; creators["regrowth_on_party"] = &regrowth_on_party;
creators["rejuvenation on party"] = &rejuvenation_on_party; creators["rejuvenation on party"] = &rejuvenation_on_party;
creators["remove curse on party"] = &remove_curse_on_party;
creators["abolish poison on party"] = &abolish_poison_on_party;
} }
private: private:
@ -65,6 +67,20 @@ class GenericDruidNonCombatStrategyActionNodeFactory : public NamedObjectFactory
/*A*/ NULL, /*A*/ NULL,
/*C*/ NULL); /*C*/ NULL);
} }
static ActionNode* remove_curse_on_party(PlayerbotAI* ai)
{
return new ActionNode ("remove curse on party",
/*P*/ NextAction::array(0, new NextAction("caster form"), nullptr),
/*A*/ NULL,
/*C*/ NULL);
}
static ActionNode* abolish_poison_on_party(PlayerbotAI* ai)
{
return new ActionNode ("abolish poison on party",
/*P*/ NextAction::array(0, new NextAction("caster form"), nullptr),
/*A*/ NULL,
/*C*/ NULL);
}
// static ActionNode* innervate([[maybe_unused]] PlayerbotAI* botAI) // static ActionNode* innervate([[maybe_unused]] PlayerbotAI* botAI)
// { // {
// return new ActionNode ("innervate", // return new ActionNode ("innervate",
@ -84,7 +100,7 @@ void GenericDruidNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& trig
NonCombatStrategy::InitTriggers(triggers); NonCombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("mark of the wild", NextAction::array(0, new NextAction("mark of the wild", 14.0f), nullptr))); triggers.push_back(new TriggerNode("mark of the wild", NextAction::array(0, new NextAction("mark of the wild", 14.0f), nullptr)));
triggers.push_back(new TriggerNode("thorns", NextAction::array(0, new NextAction("thorns", 12.0f), nullptr))); // triggers.push_back(new TriggerNode("thorns", NextAction::array(0, new NextAction("thorns", 12.0f), nullptr)));
// triggers.push_back(new TriggerNode("cure poison", NextAction::array(0, new NextAction("abolish poison", 21.0f), nullptr))); // triggers.push_back(new TriggerNode("cure poison", NextAction::array(0, new NextAction("abolish poison", 21.0f), nullptr)));
triggers.push_back(new TriggerNode("party member cure poison", NextAction::array(0, new NextAction("abolish poison on party", 20.0f), nullptr))); triggers.push_back(new TriggerNode("party member cure poison", NextAction::array(0, new NextAction("abolish poison on party", 20.0f), nullptr)));
triggers.push_back(new TriggerNode("party member dead", NextAction::array(0, new NextAction("revive", ACTION_CRITICAL_HEAL + 10), nullptr))); triggers.push_back(new TriggerNode("party member dead", NextAction::array(0, new NextAction("revive", ACTION_CRITICAL_HEAL + 10), nullptr)));
@ -106,6 +122,9 @@ void GenericDruidNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& trig
triggers.push_back(new TriggerNode("party member almost full health", triggers.push_back(new TriggerNode("party member almost full health",
NextAction::array(0, new NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 2), NULL))); NextAction::array(0, new NextAction("rejuvenation on party", ACTION_LIGHT_HEAL + 2), NULL)));
triggers.push_back(new TriggerNode("party member remove curse",
NextAction::array(0, new NextAction("remove curse on party", ACTION_DISPEL + 7), NULL)));
} }
GenericDruidBuffStrategy::GenericDruidBuffStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI) GenericDruidBuffStrategy::GenericDruidBuffStrategy(PlayerbotAI* botAI) : NonCombatStrategy(botAI)

View File

@ -53,6 +53,7 @@ BEGIN_RANGED_SPELL_ACTION(CastMultiShotAction, "multi-shot")
END_SPELL_ACTION() END_SPELL_ACTION()
BEGIN_RANGED_SPELL_ACTION(CastVolleyAction, "volley") BEGIN_RANGED_SPELL_ACTION(CastVolleyAction, "volley")
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
END_SPELL_ACTION() END_SPELL_ACTION()
DEBUFF_CHECKISOWNER_ACTION(CastSerpentStingAction, "serpent sting"); DEBUFF_CHECKISOWNER_ACTION(CastSerpentStingAction, "serpent sting");

View File

@ -37,7 +37,7 @@ class ArcaneMageStrategyActionNodeFactory : public NamedObjectFactory<ActionNode
{ {
return new ActionNode ("arcane missiles", return new ActionNode ("arcane missiles",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("firebolt"), nullptr), /*A*/ NextAction::array(0, new NextAction("fireball"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }

View File

@ -21,7 +21,7 @@ class GenericMageStrategyActionNodeFactory : public NamedObjectFactory<ActionNod
creators["blast wave"] = &blast_wave; creators["blast wave"] = &blast_wave;
creators["remove curse"] = &remove_curse; creators["remove curse"] = &remove_curse;
creators["remove curse on party"] = &remove_curse_on_party; creators["remove curse on party"] = &remove_curse_on_party;
creators["firebolt"] = &firebolt; creators["fireball"] = &fireball;
} }
private: private:
@ -112,9 +112,9 @@ class GenericMageStrategyActionNodeFactory : public NamedObjectFactory<ActionNod
/*A*/ NextAction::array(0, new NextAction("remove lesser curse on party"), nullptr), /*A*/ NextAction::array(0, new NextAction("remove lesser curse on party"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* firebolt([[maybe_unused]] PlayerbotAI* botAI) static ActionNode* fireball([[maybe_unused]] PlayerbotAI* botAI)
{ {
return new ActionNode ("firebolt", return new ActionNode ("fireball",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("shoot"), nullptr), /*A*/ NextAction::array(0, new NextAction("shoot"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);

View File

@ -61,6 +61,7 @@ class CastFlamestrikeAction : public CastSpellAction
{ {
public: public:
CastFlamestrikeAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "flamestrike") { } CastFlamestrikeAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "flamestrike") { }
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
}; };
class CastFrostNovaAction : public CastSpellAction class CastFrostNovaAction : public CastSpellAction

View File

@ -147,6 +147,7 @@ class FanOfKnivesAction : public CastMeleeSpellAction
{ {
public: public:
FanOfKnivesAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "fan of knives") {} FanOfKnivesAction(PlayerbotAI* ai) : CastMeleeSpellAction(ai, "fan of knives") {}
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
}; };
#endif #endif

View File

@ -234,19 +234,19 @@ class NoDrinkTrigger : public Trigger
class LightAoeTrigger : public AoeTrigger class LightAoeTrigger : public AoeTrigger
{ {
public: public:
LightAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 2, 10.0f) { } LightAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 2, 8.0f) { }
}; };
class MediumAoeTrigger : public AoeTrigger class MediumAoeTrigger : public AoeTrigger
{ {
public: public:
MediumAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 3, 10.0f) { } MediumAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 3, 8.0f) { }
}; };
class HighAoeTrigger : public AoeTrigger class HighAoeTrigger : public AoeTrigger
{ {
public: public:
HighAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 4, 10.0f) { } HighAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 4, 8.0f) { }
}; };
class BuffTrigger : public SpellTrigger class BuffTrigger : public SpellTrigger
@ -342,7 +342,7 @@ class DebuffOnAttackerTrigger : public DebuffTrigger
class DebuffOnMeleeAttackerTrigger : public DebuffTrigger class DebuffOnMeleeAttackerTrigger : public DebuffTrigger
{ {
public: public:
DebuffOnMeleeAttackerTrigger(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = true) : DebuffTrigger(botAI, spell, 1, checkIsOwner) { } DebuffOnMeleeAttackerTrigger(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = true, float needLifeTime = 8.0f) : DebuffTrigger(botAI, spell, 1, checkIsOwner, needLifeTime) { }
Value<Unit*>* GetTargetValue() override; Value<Unit*>* GetTargetValue() override;
std::string const getName() override { return spell + " on attacker"; } std::string const getName() override { return spell + " on attacker"; }
@ -523,7 +523,7 @@ class TankAssistTrigger : public NoAttackersTrigger
class IsBehindTargetTrigger : public Trigger class IsBehindTargetTrigger : public Trigger
{ {
public: public:
IsBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI) { } IsBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "behind target") { }
bool IsActive() override; bool IsActive() override;
}; };
@ -531,7 +531,7 @@ class IsBehindTargetTrigger : public Trigger
class IsNotBehindTargetTrigger : public Trigger class IsNotBehindTargetTrigger : public Trigger
{ {
public: public:
IsNotBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI) { } IsNotBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "is not behind target") { }
bool IsActive() override; bool IsActive() override;
}; };
@ -539,7 +539,7 @@ class IsNotBehindTargetTrigger : public Trigger
class IsNotFacingTargetTrigger : public Trigger class IsNotFacingTargetTrigger : public Trigger
{ {
public: public:
IsNotFacingTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI) { } IsNotFacingTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "not facing target") { }
bool IsActive() override; bool IsActive() override;
}; };

View File

@ -107,7 +107,7 @@ class TargetCriticalHealthTrigger : public TargetLowHealthTrigger
class PartyMemberDeadTrigger : public Trigger class PartyMemberDeadTrigger : public Trigger
{ {
public: public:
PartyMemberDeadTrigger(PlayerbotAI* botAI) : Trigger(botAI, "resurrect", 3) { } PartyMemberDeadTrigger(PlayerbotAI* botAI) : Trigger(botAI, "resurrect", 1 * 1000) { }
std::string const GetTargetName() override { return "party member to resurrect"; } std::string const GetTargetName() override { return "party member to resurrect"; }
bool IsActive() override; bool IsActive() override;

View File

@ -13,6 +13,7 @@ float ExpectedLifetimeValue::Calculate()
// bot->Say(target->GetName() + " lifetime: " + std::to_string(res), LANG_UNIVERSAL); // bot->Say(target->GetName() + " lifetime: " + std::to_string(res), LANG_UNIVERSAL);
return res; return res;
} }
float ExpectedGroupDpsValue::Calculate() float ExpectedGroupDpsValue::Calculate()
{ {
float dps_num; float dps_num;
@ -37,7 +38,7 @@ float ExpectedGroupDpsValue::Calculate()
} else if (bot->GetLevel() < 80) { } else if (bot->GetLevel() < 80) {
dps_efficiency = 12; dps_efficiency = 12;
} else { } else {
dps_efficiency = 30; dps_efficiency = 25;
} }
return dps_num * bot->GetLevel() * dps_efficiency; return dps_num * bot->GetLevel() * dps_efficiency;
} }

View File

@ -28,7 +28,7 @@ class ExpectedGroupDpsValue : public FloatCalculatedValue
{ {
public: public:
ExpectedGroupDpsValue(PlayerbotAI* botAI) : ExpectedGroupDpsValue(PlayerbotAI* botAI) :
FloatCalculatedValue(botAI, "expected group dps") { } FloatCalculatedValue(botAI, "expected group dps", 20 * 1000) { }
public: public:
float Calculate() override; float Calculate() override;

View File

@ -53,7 +53,7 @@ class GenericWarlockNonCombatStrategyActionNodeFactory : public NamedObjectFacto
{ {
return new ActionNode("summon felhunter", return new ActionNode("summon felhunter",
/*P*/ nullptr, /*P*/ nullptr,
/*A*/ NextAction::array(0, new NextAction("summon succubus"), nullptr), /*A*/ NextAction::array(0, new NextAction("summon voidwalker"), nullptr),
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* summon_felguard([[maybe_unused]] PlayerbotAI* botAI) static ActionNode* summon_felguard([[maybe_unused]] PlayerbotAI* botAI)

View File

@ -148,6 +148,7 @@ class CastRainOfFireAction : public CastSpellAction
{ {
public: public:
CastRainOfFireAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "rain of fire") { } CastRainOfFireAction(PlayerbotAI* botAI) : CastSpellAction(botAI, "rain of fire") { }
ActionThreatType getThreatType() override { return ActionThreatType::Aoe; }
}; };
class CastShadowfuryAction : public CastSpellAction class CastShadowfuryAction : public CastSpellAction