miscs(triggers): spell range, fury warrior equip

This commit is contained in:
Yunfan Li
2023-06-11 21:15:02 +08:00
parent 617d0ee031
commit df43d7dff7
8 changed files with 39 additions and 28 deletions

View File

@@ -264,6 +264,7 @@ void PlayerbotAI::UpdateAI(uint32 elapsed, bool minimal)
UpdateAIInternal(elapsed, min); UpdateAIInternal(elapsed, min);
inCombat = bot->IsInCombat();
// test fix lags because of BG // test fix lags because of BG
if (bot && !inCombat) if (bot && !inCombat)
min = true; min = true;
@@ -3672,16 +3673,20 @@ Item* PlayerbotAI::FindStoneFor(Item* weapon) const
{ {
for (uint8 i = 0; i < std::size(uPriorizedSharpStoneIds); ++i) for (uint8 i = 0; i < std::size(uPriorizedSharpStoneIds); ++i)
{ {
if (stone = FindConsumable(uPriorizedSharpStoneIds[i])) stone = FindConsumable(uPriorizedSharpStoneIds[i]);
return stone; if (stone) {
return stone;
}
} }
} }
else if (pProto && (pProto->SubClass == ITEM_SUBCLASS_WEAPON_MACE || pProto->SubClass == ITEM_SUBCLASS_WEAPON_MACE2)) else if (pProto && (pProto->SubClass == ITEM_SUBCLASS_WEAPON_MACE || pProto->SubClass == ITEM_SUBCLASS_WEAPON_MACE2))
{ {
for (uint8 i = 0; i < std::size(uPriorizedWeightStoneIds); ++i) for (uint8 i = 0; i < std::size(uPriorizedWeightStoneIds); ++i)
{ {
if (stone = FindConsumable(uPriorizedWeightStoneIds[i])) stone = FindConsumable(uPriorizedWeightStoneIds[i]);
return stone; if (stone) {
return stone;
}
} }
} }

View File

@@ -3007,6 +3007,7 @@ float PlayerbotFactory::CalculateItemScore(uint32 item_id)
((cls == CLASS_SHAMAN && tab == 1 && bot->HasSpell(674)) || ((cls == CLASS_SHAMAN && tab == 1 && bot->HasSpell(674)) ||
(cls == CLASS_ROGUE) || (cls == CLASS_ROGUE) ||
(cls == CLASS_DEATH_KNIGHT && tab == 1) || (cls == CLASS_DEATH_KNIGHT && tab == 1) ||
(cls == CLASS_WARRIOR && tab == 1 && !bot->HasSpell(46917)) ||
IsShieldTank())) { IsShieldTank())) {
score *= 0.1; score *= 0.1;
} }

View File

@@ -15,6 +15,8 @@ class GenericDruidNonCombatStrategyActionNodeFactory : public NamedObjectFactory
creators["mark of the wild"] = &mark_of_the_wild; creators["mark of the wild"] = &mark_of_the_wild;
creators["mark of the wild on party"] = &mark_of_the_wild_on_party; creators["mark of the wild on party"] = &mark_of_the_wild_on_party;
// creators["innervate"] = &innervate; // creators["innervate"] = &innervate;
creators["regrowth_on_party"] = &regrowth_on_party;
creators["rejuvenation on party"] = &rejuvenation_on_party;
} }
private: private:
@@ -49,7 +51,20 @@ class GenericDruidNonCombatStrategyActionNodeFactory : public NamedObjectFactory
/*A*/ nullptr, /*A*/ nullptr,
/*C*/ nullptr); /*C*/ nullptr);
} }
static ActionNode* regrowth_on_party(PlayerbotAI* ai)
{
return new ActionNode ("regrowth on party",
/*P*/ NextAction::array(0, new NextAction("caster form"), NULL),
/*A*/ NULL,
/*C*/ NULL);
}
static ActionNode* rejuvenation_on_party(PlayerbotAI* ai)
{
return new ActionNode ("rejuvenation on party",
/*P*/ NextAction::array(0, new NextAction("caster form"), NULL),
/*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",

View File

@@ -60,14 +60,6 @@ bool ComboPointsAvailableTrigger::IsActive()
bool LoseAggroTrigger::IsActive() bool LoseAggroTrigger::IsActive()
{ {
// Unit* mt = AI_VALUE(Unit*, "main tank");
// if (mt) {
// botAI->TellMasterNoFacing("Has aggro: " + std::to_string(AI_VALUE2(bool, "has aggro", "current target"))
// + " My main tank is: " + mt->GetName());
// } else {
// botAI->TellMasterNoFacing("Has aggro: " + std::to_string(AI_VALUE2(bool, "has aggro", "current target"))
// + " No main tank detected");
// }
return !AI_VALUE2(bool, "has aggro", "current target"); return !AI_VALUE2(bool, "has aggro", "current target");
} }

View File

@@ -135,15 +135,15 @@ EnemyOutOfSpellRangeTrigger::EnemyOutOfSpellRangeTrigger(PlayerbotAI* botAI) : O
{ {
} }
bool EnemyOutOfSpellRangeTrigger::IsActive() // bool EnemyOutOfSpellRangeTrigger::IsActive()
{ // {
Unit* target = AI_VALUE(Unit*, GetTargetName()); // Unit* target = AI_VALUE(Unit*, GetTargetName());
if (!target) // if (!target)
return false; // return false;
float combatReach = bot->GetCombatReach() + target->GetCombatReach(); // float combatReach = bot->GetCombatReach() + target->GetCombatReach();
return target && (sServerFacade->GetDistance2d(bot, target) > (distance + combatReach + sPlayerbotAIConfig->contactDistance) || !bot->IsWithinLOSInMap(target)); // return target && (sServerFacade->GetDistance2d(bot, target) > (distance + combatReach + sPlayerbotAIConfig->contactDistance) || !bot->IsWithinLOSInMap(target));
} // }
// bool EnemyOutOfMeleeTrigger::IsActive() // bool EnemyOutOfMeleeTrigger::IsActive()
// { // {

View File

@@ -74,8 +74,6 @@ class EnemyOutOfSpellRangeTrigger : public OutOfRangeTrigger
{ {
public: public:
EnemyOutOfSpellRangeTrigger(PlayerbotAI* botAI); EnemyOutOfSpellRangeTrigger(PlayerbotAI* botAI);
bool IsActive() override;
}; };
class PartyMemberToHealOutOfSpellRangeTrigger : public OutOfRangeTrigger class PartyMemberToHealOutOfSpellRangeTrigger : public OutOfRangeTrigger

View File

@@ -26,10 +26,10 @@ bool HasAggroValue::Calculate()
return true; return true;
} }
botAI->TellMaster("target: " + target->GetName() + " victim: " + victim->GetName()); // botAI->TellMaster("target: " + target->GetName() + " victim: " + victim->GetName());
if (victim->ToPlayer() ) { // if (victim->ToPlayer() ) {
botAI->TellMaster("victim is mt: " + std::to_string(botAI->IsMainTank(victim->ToPlayer()))); // botAI->TellMaster("victim is mt: " + std::to_string(botAI->IsMainTank(victim->ToPlayer())));
} // }
return false; return false;
// HostileReference *ref = bot->getHostileRefMgr().getFirst(); // HostileReference *ref = bot->getHostileRefMgr().getFirst();
// if (!ref) // if (!ref)

View File

@@ -25,7 +25,7 @@ class SpellEntryPredicate
class PartyMemberValue : public UnitCalculatedValue class PartyMemberValue : public UnitCalculatedValue
{ {
public: public:
PartyMemberValue(PlayerbotAI* botAI, std::string const name = "party member") : UnitCalculatedValue(botAI, name) { } PartyMemberValue(PlayerbotAI* botAI, std::string const name = "party member", int checkInterval = 1) : UnitCalculatedValue(botAI, name, checkInterval) { }
bool IsTargetOfSpellCast(Player* target, SpellEntryPredicate& predicate); bool IsTargetOfSpellCast(Player* target, SpellEntryPredicate& predicate);