weapon type fix

This commit is contained in:
Yunfan Li
2024-09-02 17:47:46 +08:00
parent 4114ffa68b
commit a84c7f35f3
11 changed files with 43 additions and 31 deletions

View File

@@ -342,6 +342,7 @@ AiPlayerbot.MediumHealth = 65
AiPlayerbot.AlmostFullHealth = 85 AiPlayerbot.AlmostFullHealth = 85
AiPlayerbot.LowMana = 15 AiPlayerbot.LowMana = 15
AiPlayerbot.MediumMana = 40 AiPlayerbot.MediumMana = 40
AiPlayerbot.HighMana = 65
# #
# #

View File

@@ -94,6 +94,7 @@ bool PlayerbotAIConfig::Initialize()
almostFullHealth = sConfigMgr->GetOption<int32>("AiPlayerbot.AlmostFullHealth", 85); almostFullHealth = sConfigMgr->GetOption<int32>("AiPlayerbot.AlmostFullHealth", 85);
lowMana = sConfigMgr->GetOption<int32>("AiPlayerbot.LowMana", 15); lowMana = sConfigMgr->GetOption<int32>("AiPlayerbot.LowMana", 15);
mediumMana = sConfigMgr->GetOption<int32>("AiPlayerbot.MediumMana", 40); mediumMana = sConfigMgr->GetOption<int32>("AiPlayerbot.MediumMana", 40);
highMana = sConfigMgr->GetOption<int32>("AiPlayerbot.HighMana", 65);
autoSaveMana = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoSaveMana", true); autoSaveMana = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoSaveMana", true);
saveManaThreshold = sConfigMgr->GetOption<int32>("AiPlayerbot.SaveManaThreshold", 60); saveManaThreshold = sConfigMgr->GetOption<int32>("AiPlayerbot.SaveManaThreshold", 60);
autoAvoidAoe = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoAvoidAoe", true); autoAvoidAoe = sConfigMgr->GetOption<bool>("AiPlayerbot.AutoAvoidAoe", true);

View File

@@ -63,7 +63,7 @@ public:
tooCloseDistance, meleeDistance, followDistance, whisperDistance, contactDistance, aoeRadius, rpgDistance, tooCloseDistance, meleeDistance, followDistance, whisperDistance, contactDistance, aoeRadius, rpgDistance,
targetPosRecalcDistance, farDistance, healDistance, aggroDistance; targetPosRecalcDistance, farDistance, healDistance, aggroDistance;
uint32 criticalHealth, lowHealth, mediumHealth, almostFullHealth; uint32 criticalHealth, lowHealth, mediumHealth, almostFullHealth;
uint32 lowMana, mediumMana; uint32 lowMana, mediumMana, highMana;
bool autoSaveMana; bool autoSaveMana;
uint32 saveManaThreshold; uint32 saveManaThreshold;
bool autoAvoidAoe; bool autoAvoidAoe;

View File

@@ -1217,7 +1217,7 @@ bool PlayerbotFactory::CanEquipWeapon(ItemTemplate const* proto)
{ {
case CLASS_PRIEST: case CLASS_PRIEST:
if (proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && proto->SubClass != ITEM_SUBCLASS_WEAPON_WAND && if (proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && proto->SubClass != ITEM_SUBCLASS_WEAPON_WAND &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE) proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE && proto->SubClass != ITEM_SUBCLASS_WEAPON_DAGGER)
return false; return false;
break; break;
case CLASS_MAGE: case CLASS_MAGE:
@@ -1231,15 +1231,12 @@ bool PlayerbotFactory::CanEquipWeapon(ItemTemplate const* proto)
proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD2 &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE && proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD && proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE && proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_GUN && proto->SubClass != ITEM_SUBCLASS_WEAPON_CROSSBOW && proto->SubClass != ITEM_SUBCLASS_WEAPON_GUN && proto->SubClass != ITEM_SUBCLASS_WEAPON_CROSSBOW &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_BOW && proto->SubClass != ITEM_SUBCLASS_WEAPON_THROWN) proto->SubClass != ITEM_SUBCLASS_WEAPON_BOW && proto->SubClass != ITEM_SUBCLASS_WEAPON_THROWN &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_FIST &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_DAGGER && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF)
return false; return false;
break; break;
case CLASS_PALADIN: case CLASS_PALADIN:
if (proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD2 &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE && proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE2 &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD)
return false;
break;
case CLASS_DEATH_KNIGHT: case CLASS_DEATH_KNIGHT:
if (proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && if (proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE2 &&
@@ -1251,28 +1248,30 @@ bool PlayerbotFactory::CanEquipWeapon(ItemTemplate const* proto)
if (proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE && proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE && if (proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE && proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_FIST && proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_FIST && proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE2 &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_DAGGER && proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_DAGGER &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_FIST && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF) proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF)
return false; return false;
break; break;
case CLASS_DRUID: case CLASS_DRUID:
if (proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE && proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE2 && if (proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE && proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE2 &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_DAGGER && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF) proto->SubClass != ITEM_SUBCLASS_WEAPON_DAGGER && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM)
return false; return false;
break; break;
case CLASS_HUNTER: case CLASS_HUNTER:
if (proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE && if (proto->SubClass != ITEM_SUBCLASS_WEAPON_DAGGER && proto->SubClass != ITEM_SUBCLASS_WEAPON_BOW &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM && proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD2 && proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_FIST && proto->SubClass != ITEM_SUBCLASS_WEAPON_GUN && proto->SubClass != ITEM_SUBCLASS_WEAPON_FIST && proto->SubClass != ITEM_SUBCLASS_WEAPON_GUN &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_CROSSBOW && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF && proto->SubClass != ITEM_SUBCLASS_WEAPON_CROSSBOW && proto->SubClass != ITEM_SUBCLASS_WEAPON_STAFF &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_BOW) proto->SubClass != ITEM_SUBCLASS_WEAPON_POLEARM)
return false; return false;
break; break;
case CLASS_ROGUE: case CLASS_ROGUE:
if (proto->SubClass != ITEM_SUBCLASS_WEAPON_DAGGER && proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD && if (proto->SubClass != ITEM_SUBCLASS_WEAPON_DAGGER && proto->SubClass != ITEM_SUBCLASS_WEAPON_SWORD &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_FIST && proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE && proto->SubClass != ITEM_SUBCLASS_WEAPON_FIST && proto->SubClass != ITEM_SUBCLASS_WEAPON_MACE &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_GUN && proto->SubClass != ITEM_SUBCLASS_WEAPON_CROSSBOW && proto->SubClass != ITEM_SUBCLASS_WEAPON_GUN && proto->SubClass != ITEM_SUBCLASS_WEAPON_CROSSBOW &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_BOW && proto->SubClass != ITEM_SUBCLASS_WEAPON_THROWN) proto->SubClass != ITEM_SUBCLASS_WEAPON_BOW && proto->SubClass != ITEM_SUBCLASS_WEAPON_THROWN &&
proto->SubClass != ITEM_SUBCLASS_WEAPON_AXE)
return false; return false;
break; break;
} }

View File

@@ -224,7 +224,7 @@ void StatsWeightCalculator::GenerateBasicWeights(Player* player)
stats_weights_[STATS_TYPE_INTELLECT] += 0.15f; stats_weights_[STATS_TYPE_INTELLECT] += 0.15f;
stats_weights_[STATS_TYPE_ATTACK_POWER] += 1.0f; stats_weights_[STATS_TYPE_ATTACK_POWER] += 1.0f;
stats_weights_[STATS_TYPE_SPELL_POWER] += 0.3f; stats_weights_[STATS_TYPE_SPELL_POWER] += 0.3f;
stats_weights_[STATS_TYPE_ARMOR_PENETRATION] += 0.8f; stats_weights_[STATS_TYPE_ARMOR_PENETRATION] += 0.5f;
stats_weights_[STATS_TYPE_HIT] += 1.9f; stats_weights_[STATS_TYPE_HIT] += 1.9f;
stats_weights_[STATS_TYPE_CRIT] += 1.2f; stats_weights_[STATS_TYPE_CRIT] += 1.2f;
stats_weights_[STATS_TYPE_HASTE] += 1.3f; stats_weights_[STATS_TYPE_HASTE] += 1.3f;

View File

@@ -82,9 +82,11 @@ DpsPaladinStrategy::DpsPaladinStrategy(PlayerbotAI* botAI) : GenericPaladinStrat
NextAction** DpsPaladinStrategy::getDefaultActions() NextAction** DpsPaladinStrategy::getDefaultActions()
{ {
return NextAction::array(0, new NextAction("crusader strike", ACTION_DEFAULT + 0.4f), return NextAction::array(0,
new NextAction("judgement of wisdom", ACTION_DEFAULT + 0.3f), new NextAction("crusader strike", ACTION_DEFAULT + 0.6f),
new NextAction("divine storm", ACTION_DEFAULT + 0.2f), new NextAction("hammer of wrath", ACTION_DEFAULT + 0.5f),
new NextAction("judgement of wisdom", ACTION_DEFAULT + 0.4f),
new NextAction("divine storm", ACTION_DEFAULT + 0.3f),
new NextAction("consecration", ACTION_DEFAULT + 0.1f), new NextAction("consecration", ACTION_DEFAULT + 0.1f),
new NextAction("melee", ACTION_DEFAULT), NULL); new NextAction("melee", ACTION_DEFAULT), NULL);
} }
@@ -93,12 +95,17 @@ void DpsPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{ {
GenericPaladinStrategy::InitTriggers(triggers); GenericPaladinStrategy::InitTriggers(triggers);
triggers.push_back(
new TriggerNode("art of war", NextAction::array(0, new NextAction("exorcism", ACTION_DEFAULT + 0.2f), nullptr)));
triggers.push_back( triggers.push_back(
new TriggerNode("seal", NextAction::array(0, new NextAction("seal of corruption", ACTION_HIGH), NULL))); new TriggerNode("seal", NextAction::array(0, new NextAction("seal of corruption", ACTION_HIGH), NULL)));
// triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of command", 90.0f), // triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of command", 90.0f),
// nullptr))); // nullptr)));
triggers.push_back( triggers.push_back(
new TriggerNode("low mana", NextAction::array(0, new NextAction("seal of wisdom", ACTION_HIGH + 5), nullptr))); new TriggerNode("low mana", NextAction::array(0, new NextAction("seal of wisdom", ACTION_HIGH + 5), nullptr)));
triggers.push_back(new TriggerNode(
"avenging wrath", NextAction::array(0, new NextAction("avenging wrath", ACTION_HIGH + 2), nullptr)));
// triggers.push_back(new TriggerNode("sanctity aura", NextAction::array(0, new NextAction("sanctity aura", 90.0f), // triggers.push_back(new TriggerNode("sanctity aura", NextAction::array(0, new NextAction("sanctity aura", 90.0f),
// nullptr))); triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("repentance or // nullptr))); triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("repentance or
// shield", ACTION_CRITICAL_HEAL + 3), new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr))); // shield", ACTION_CRITICAL_HEAL + 3), new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr)));
@@ -112,11 +119,11 @@ void DpsPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
// triggers.push_back(new TriggerNode("repentance", NextAction::array(0, new NextAction("repentance", // triggers.push_back(new TriggerNode("repentance", NextAction::array(0, new NextAction("repentance",
// ACTION_INTERRUPT + 2), nullptr))); // ACTION_INTERRUPT + 2), nullptr)));
triggers.push_back(new TriggerNode( triggers.push_back(new TriggerNode(
"medium aoe", NextAction::array(0, new NextAction("consecration", ACTION_HIGH + 3), nullptr))); "medium aoe", NextAction::array(0,
triggers.push_back( new NextAction("divine storm", ACTION_HIGH + 4),
new TriggerNode("art of war", NextAction::array(0, new NextAction("exorcism", ACTION_HIGH + 2), nullptr))); new NextAction("consecration", ACTION_HIGH + 3), nullptr)));
triggers.push_back(new TriggerNode("target critical health", // triggers.push_back(new TriggerNode("target critical health",
NextAction::array(0, new NextAction("hammer of wrath", ACTION_HIGH), nullptr))); // NextAction::array(0, new NextAction("hammer of wrath", ACTION_HIGH), nullptr)));
// triggers.push_back(new TriggerNode( // triggers.push_back(new TriggerNode(
// "not facing target", // "not facing target",
// NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), NULL))); // NextAction::array(0, new NextAction("set facing", ACTION_NORMAL + 7), NULL)));

View File

@@ -37,7 +37,7 @@ void GenericPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
"protect party member", "protect party member",
NextAction::array(0, new NextAction("blessing of protection on party", ACTION_EMERGENCY + 2), nullptr))); NextAction::array(0, new NextAction("blessing of protection on party", ACTION_EMERGENCY + 2), nullptr)));
triggers.push_back( triggers.push_back(
new TriggerNode("medium mana", NextAction::array(0, new NextAction("divine plea", ACTION_HIGH), NULL))); new TriggerNode("high mana", NextAction::array(0, new NextAction("divine plea", ACTION_HIGH), NULL)));
} }
void PaladinCureStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) void PaladinCureStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
@@ -61,8 +61,7 @@ void PaladinCureStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
void PaladinBoostStrategy::InitTriggers(std::vector<TriggerNode*>& triggers) void PaladinBoostStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{ {
triggers.push_back(new TriggerNode(
"avenging wrath", NextAction::array(0, new NextAction("avenging wrath", ACTION_HIGH + 2), nullptr)));
// triggers.push_back(new TriggerNode("divine favor", NextAction::array(0, new NextAction("divine favor", // triggers.push_back(new TriggerNode("divine favor", NextAction::array(0, new NextAction("divine favor",
// ACTION_HIGH + 1), nullptr))); // ACTION_HIGH + 1), nullptr)));
} }

View File

@@ -50,7 +50,9 @@ void HealPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
triggers.push_back( triggers.push_back(
new TriggerNode("medium group heal occasion", new TriggerNode("medium group heal occasion",
NextAction::array(0, new NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5), nullptr))); NextAction::array(0, new NextAction("divine sacrifice", ACTION_CRITICAL_HEAL + 5),
new NextAction("avenging wrath", ACTION_HIGH + 4),
nullptr)));
triggers.push_back( triggers.push_back(
new TriggerNode("party member critical health", new TriggerNode("party member critical health",

View File

@@ -98,6 +98,8 @@ void TankPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr))); NextAction::array(0, new NextAction("holy shield", ACTION_HIGH + 4), nullptr)));
// triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of sanctuary", // triggers.push_back(new TriggerNode("blessing", NextAction::array(0, new NextAction("blessing of sanctuary",
// ACTION_HIGH + 9), nullptr))); // ACTION_HIGH + 9), nullptr)));
triggers.push_back(new TriggerNode(
"avenging wrath", NextAction::array(0, new NextAction("avenging wrath", ACTION_HIGH + 2), nullptr)));
triggers.push_back( triggers.push_back(
new TriggerNode("target critical health", new TriggerNode("target critical health",
NextAction::array(0, new NextAction("hammer of wrath", ACTION_CRITICAL_HEAL), nullptr))); NextAction::array(0, new NextAction("hammer of wrath", ACTION_CRITICAL_HEAL), nullptr)));

View File

@@ -51,8 +51,8 @@ void CasterShamanStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
// triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell", // triggers.push_back(new TriggerNode("enemy out of spell", NextAction::array(0, new NextAction("reach spell",
// ACTION_NORMAL + 9), nullptr))); triggers.push_back(new TriggerNode("shaman weapon", NextAction::array(0, new // ACTION_NORMAL + 9), nullptr))); triggers.push_back(new TriggerNode("shaman weapon", NextAction::array(0, new
// NextAction("flametongue weapon", 23.0f), nullptr))); // NextAction("flametongue weapon", 23.0f), nullptr)));
triggers.push_back(new TriggerNode( // triggers.push_back(new TriggerNode(
"enough mana", NextAction::array(0, new NextAction("chain lightning", ACTION_DEFAULT + 0.1f), nullptr))); // "enough mana", NextAction::array(0, new NextAction("chain lightning", ACTION_DEFAULT + 0.1f), nullptr)));
triggers.push_back(new TriggerNode("main hand weapon no imbue", triggers.push_back(new TriggerNode("main hand weapon no imbue",
NextAction::array(0, new NextAction("flametongue weapon", 22.0f), nullptr))); NextAction::array(0, new NextAction("flametongue weapon", 22.0f), nullptr)));

View File

@@ -10,6 +10,7 @@
#include "BattlegroundWS.h" #include "BattlegroundWS.h"
#include "CreatureAI.h" #include "CreatureAI.h"
#include "ObjectGuid.h" #include "ObjectGuid.h"
#include "PlayerbotAIConfig.h"
#include "Playerbots.h" #include "Playerbots.h"
#include "SharedDefines.h" #include "SharedDefines.h"
#include "TemporarySummon.h" #include "TemporarySummon.h"
@@ -64,7 +65,7 @@ bool PetAttackTrigger::IsActive()
bool HighManaTrigger::IsActive() bool HighManaTrigger::IsActive()
{ {
return AI_VALUE2(bool, "has mana", "self target") && AI_VALUE2(uint8, "mana", "self target") < 65; return AI_VALUE2(bool, "has mana", "self target") && AI_VALUE2(uint8, "mana", "self target") < sPlayerbotAIConfig->highMana;
} }
bool AlmostFullManaTrigger::IsActive() bool AlmostFullManaTrigger::IsActive()