miscs(spell): paladin, rogue poison, shaman totem

This commit is contained in:
Yunfan Li
2023-06-11 18:21:45 +08:00
parent 33576bd969
commit e7ad355396
10 changed files with 48 additions and 24 deletions

View File

@@ -1882,7 +1882,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
}
}
ObjectGuid oldSel = bot->GetSelectedUnit()->GetGUID();
Unit* oldSel = bot->GetSelectedUnit();
Spell* spell = new Spell(bot, spellInfo, TRIGGERED_NONE);
spell->m_targets.SetUnitTarget(target);
@@ -1901,7 +1901,7 @@ bool PlayerbotAI::CanCastSpell(uint32 spellid, Unit* target, bool checkHasSpell,
}
if (oldSel)
bot->SetSelection(oldSel);
bot->SetSelection(oldSel->GetGUID());
switch (result)
{

View File

@@ -137,15 +137,16 @@ CastEnchantItemAction::CastEnchantItemAction(PlayerbotAI* botAI, std::string con
bool CastEnchantItemAction::isPossible()
{
if (!CastSpellAction::isPossible()) {
// if (!CastSpellAction::isPossible()) {
botAI->TellMasterNoFacing("Impossible: " + spell);
return false;
}
// botAI->TellMasterNoFacing("Impossible: " + spell);
// return false;
// }
uint32 spellId = AI_VALUE2(uint32, "spell id", spell);
bool ok = AI_VALUE2(Item*, "item for spell", spellId);
Item* item = AI_VALUE2(Item*, "item for spell", spellId);
botAI->TellMasterNoFacing("spell: " + spell + ", spell id: " + std::to_string(spellId) + " item for spell: " + std::to_string(ok));
return spellId && AI_VALUE2(Item*, "item for spell", spellId);
}

View File

@@ -81,7 +81,10 @@ void DpsPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
GenericPaladinStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of command", 90.0f), nullptr)));
triggers.push_back(new TriggerNode(
"seal",
NextAction::array(0, new NextAction("seal of vengeance", 89.0f), NULL)));
// triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of command", 90.0f), nullptr)));
triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("seal of wisdom", 91.0f), nullptr)));
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 shield", ACTION_CRITICAL_HEAL + 3), new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr)));

View File

@@ -15,7 +15,7 @@ void GenericPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
CombatStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("divine shield", ACTION_CRITICAL_HEAL + 2), new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr)));
// triggers.push_back(new TriggerNode("low health", NextAction::array(0, new NextAction("divine shield", ACTION_CRITICAL_HEAL + 2), new NextAction("holy light", ACTION_CRITICAL_HEAL + 2), nullptr)));
triggers.push_back(new TriggerNode("hammer of justice interrupt", NextAction::array(0, new NextAction("hammer of justice", ACTION_INTERRUPT), nullptr)));
triggers.push_back(new TriggerNode("hammer of justice on enemy healer", NextAction::array(0, new NextAction("hammer of justice on enemy healer", ACTION_INTERRUPT), nullptr)));
triggers.push_back(new TriggerNode("hammer of justice on snare target", NextAction::array(0, new NextAction("hammer of justice on snare target", ACTION_INTERRUPT), nullptr)));

View File

@@ -47,8 +47,12 @@ void TankPaladinStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
{
GenericPaladinStrategy::InitTriggers(triggers);
triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of vengeance", 90.0f), NULL)));
triggers.push_back(new TriggerNode("seal", NextAction::array(0, new NextAction("seal of command", 90.0f), NULL)));
triggers.push_back(new TriggerNode("low mana", NextAction::array(0, new NextAction("seal of wisdom", 91.0f), nullptr)));
triggers.push_back(new TriggerNode(
"devotion aura",
NextAction::array(0, new NextAction("devotion aura", 90.0f), NULL)));
// triggers.push_back(new TriggerNode("judgement of light", NextAction::array(0, new NextAction("judgement of light", ACTION_HIGH + 6), nullptr)));
// triggers.push_back(new TriggerNode("medium mana", NextAction::array(0, new NextAction("judgement of wisdom", ACTION_HIGH + 6), nullptr)));
// triggers.push_back(new TriggerNode("judgement", NextAction::array(0, new NextAction("judgement", ACTION_HIGH + 6), nullptr)));

View File

@@ -16,15 +16,15 @@ void GenericRogueNonCombatStrategy::InitTriggers(std::vector<TriggerNode*>& trig
triggers.push_back(new TriggerNode(
"main hand weapon no enchant",
NextAction::array(0, new NextAction("use instant poison", 20.0f), NULL)));
NextAction::array(0, new NextAction("use instant poison on main hand", 20.0f), NULL)));
triggers.push_back(new TriggerNode(
"off hand weapon no enchant",
NextAction::array(0, new NextAction("use deadly poison", 19.0f), NULL)));
NextAction::array(0, new NextAction("use deadly poison on off hand", 19.0f), NULL)));
triggers.push_back(new TriggerNode(
"off hand weapon no enchant",
NextAction::array(0, new NextAction("use instant poison", 18.0f), NULL)));
// triggers.push_back(new TriggerNode(
// "off hand weapon no enchant",
// NextAction::array(0, new NextAction("use instant poison", 18.0f), NULL)));
triggers.push_back(new TriggerNode(
"often",

View File

@@ -4,6 +4,8 @@
#include "RogueActions.h"
#include "Event.h"
#include "ObjectGuid.h"
#include "Player.h"
#include "Playerbots.h"
bool CastStealthAction::isPossible()
@@ -68,7 +70,9 @@ bool UseDeadlyPoisonAction::Execute(Event event) {
if (items.empty()) {
return false;
}
return UseItemAuto(*items.begin());
Item* const itemForSpell = bot->GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND );
return UseItem(*items.begin(), ObjectGuid::Empty, itemForSpell);
// return UseItemAuto(*items.begin());
}
bool UseDeadlyPoisonAction::isPossible() {
@@ -99,7 +103,8 @@ bool UseInstantPoisonAction::Execute(Event event) {
if (items.empty()) {
return false;
}
return UseItemAuto(*items.begin());
Item* const itemForSpell = bot->GetItemByPos( INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND );
return UseItem(*items.begin(), ObjectGuid::Empty, itemForSpell);
}
bool UseInstantPoisonAction::isPossible() {

View File

@@ -20,7 +20,6 @@ class RogueStrategyFactoryInternal : public NamedObjectContext<Strategy>
public:
RogueStrategyFactoryInternal()
{
creators["dps"] = &RogueStrategyFactoryInternal::dps;
creators["nc"] = &RogueStrategyFactoryInternal::nc;
creators["pull"] = &RogueStrategyFactoryInternal::pull;
creators["aoe"] = &RogueStrategyFactoryInternal::aoe;
@@ -28,18 +27,29 @@ class RogueStrategyFactoryInternal : public NamedObjectContext<Strategy>
creators["stealthed"] = &RogueStrategyFactoryInternal::stealthed;
creators["stealth"] = &RogueStrategyFactoryInternal::stealth;
creators["cc"] = &RogueStrategyFactoryInternal::cc;
creators["melee"] = &RogueStrategyFactoryInternal::melee;
}
private:
static Strategy* boost(PlayerbotAI* botAI) { return new RogueBoostStrategy(botAI); }
static Strategy* aoe(PlayerbotAI* botAI) { return new RogueAoeStrategy(botAI); }
static Strategy* dps(PlayerbotAI* botAI) { return new DpsRogueStrategy(botAI); }
static Strategy* nc(PlayerbotAI* botAI) { return new GenericRogueNonCombatStrategy(botAI); }
static Strategy* pull(PlayerbotAI* botAI) { return new PullStrategy(botAI, "shoot"); }
static Strategy* stealthed(PlayerbotAI* botAI) { return new StealthedRogueStrategy(botAI); }
static Strategy* stealth(PlayerbotAI* botAI) { return new StealthStrategy(botAI); }
static Strategy* cc(PlayerbotAI* botAI) { return new RogueCcStrategy(botAI); }
};
class RogueCombatStrategyFactoryInternal : public NamedObjectContext<Strategy>
{
public:
RogueCombatStrategyFactoryInternal() : NamedObjectContext<Strategy>(false, true)
{
creators["dps"] = &RogueCombatStrategyFactoryInternal::dps;
creators["melee"] = &RogueCombatStrategyFactoryInternal::melee;
}
private:
static Strategy* dps(PlayerbotAI* botAI) { return new DpsRogueStrategy(botAI); }
static Strategy* melee(PlayerbotAI* botAI) { return new AssassinationRogueStrategy(botAI); }
};
@@ -115,8 +125,8 @@ class RogueAiObjectContextInternal : public NamedObjectContext<Action>
creators["check stealth"] = &RogueAiObjectContextInternal::check_stealth;
creators["envenom"] = &RogueAiObjectContextInternal::envenom;
creators["tricks of the trade on main tank"] = &RogueAiObjectContextInternal::tricks_of_the_trade_on_main_tank;
creators["use instant poison"] = &RogueAiObjectContextInternal::use_instant_poison;
creators["use deadly poison"] = &RogueAiObjectContextInternal::use_deadly_poison;
creators["use instant poison on main hand"] = &RogueAiObjectContextInternal::use_instant_poison;
creators["use deadly poison on off hand"] = &RogueAiObjectContextInternal::use_deadly_poison;
}
private:
@@ -155,6 +165,7 @@ class RogueAiObjectContextInternal : public NamedObjectContext<Action>
RogueAiObjectContext::RogueAiObjectContext(PlayerbotAI* botAI) : AiObjectContext(botAI)
{
strategyContexts.Add(new RogueStrategyFactoryInternal());
strategyContexts.Add(new RogueCombatStrategyFactoryInternal());
actionContexts.Add(new RogueAiObjectContextInternal());
triggerContexts.Add(new RogueTriggerFactoryInternal());
}

View File

@@ -39,7 +39,7 @@ bool ShockTrigger::IsActive()
bool TotemTrigger::IsActive()
{
return AI_VALUE(uint8, "attacker count") >= attackerCount && !AI_VALUE2(bool, "has totem", name);
return AI_VALUE(uint8, "attacker count") >= attackerCount && !AI_VALUE2(bool, "has totem", name) && !botAI->HasAura(name, bot);
}
bool ManaSpringTotemTrigger::IsActive()

View File

@@ -25,11 +25,11 @@ class WarrirorAoeStrategyActionNodeFactory : public NamedObjectFactory<ActionNod
public:
WarrirorAoeStrategyActionNodeFactory()
{
creators["whirlwind"] = &whirlwind;
// creators["whirlwind"] = &whirlwind;
}
private:
ACTION_NODE_A(whirlwind, "whirlwind", "cleave");
// ACTION_NODE_A(whirlwind, "whirlwind", "cleave");
};
WarrirorAoeStrategy::WarrirorAoeStrategy(PlayerbotAI* botAI) : CombatStrategy(botAI)