mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
## Pull Request Description
These changes I originally made for myself because as a person who
really likes to raid with bots, I felt like the current group buff
system is fundamentally broken, and I needed something more consistent
and optimal. I debated a lot whether to PR this because it's such an
extensive overhaul that was almost entirely reliant on AI, and I know
that wishmaster still has a PR open regarding the greater blessings. I
decided to after a couple of conversations so at least people can look
at it and see if it's something that they want.
The tl;dr version is that this PR overhauls buff handling in two related
areas:
1. It adds a dedicated greater blessing assignment system.
2. It generalizes party/raid reagent-buff handling for Paladins, Druids,
Mages, and Priests.
Under this PR, greater blessings are determined by assignments for the
current group, and those assignments are determined based on:
1. a hardcoded priority list of blessings for each spec;
2. the number of Paladins in the group; and
3. whether any Paladins have talents for Blessing of Sanctuary, Improved
Blessing of Might, or Improved Blessing of Wisdom.
Assignment determinations are cached in a value to avoid constant
reevaluation.
The exact priority list is:
- All casters: Kings, Wisdom, Sanctuary, Might
- Physical-only DPS (Rogues, Warriors, DKs): Might, Kings, Sanctuary,
N/A
- Hybrid DPS (Enh, Ret, Hunters, Cats): Might, Kings, Wisdom, Sanctuary
- Druid tanks: Kings, Might, Sanctuary, Wisdom
- Warrior and DK tanks: Kings, Might, Sanctuary, N/A
- Paladin tank: Sanctuary, Might, Wisdom, Kings
Note that Sanctuary is preferred over Kings for Paladin tanks because of
the mana regen component but deprioritized for other tanks because Kings
provides Agility. The extra 3% damage reduction from Sanctuary does not
stack with Disc Priests’ Renewed Hope, which will have 100% uptime.
For group buffs, logic is centralized so that class triggers use the
same gating and upgrade rules for Gift of the Wild, Arcane Brilliance,
Prayer of Fortitude, Prayer of Spirit, and Prayer of Shadow Protection.
Also, Shadow Protection is now a default strategy for Priests (rshadow,
which existed before but wasn’t added by default).
I’ve added a config setting for the greater blessing system and adjusted
the current config setting for group buffs. In each case, you can pick
whether to disable the feature entirely, use it in all groups, or use it
only in raid groups. The default is raid only for greater blessings and
all groups for group buffs. Note that for group buffs, even if the
config is enabled, they will be used only if at least 3 group/raid
members on the same map are missing the buff family. This is mainly to
stop group buff spamming during wipe recovery as bots are revived
one-by-one.
I renamed the Paladin buff strategies to align them with the actual
blessing names:
- `bhealth` -> `bsanc`
- `bmana` -> `bwisdom`
- `bdps` -> `bmight`
- `bstats` -> `bkings`
This is an intentional breaking change for saved strategy strings. Bots
will need a one-time strategy reset after update.
I removed bots telling you when they are out of reagents for greater
blessings. If people like that though, I can add it back.
A small cleanup is also included in TankPaladinStrategy: Holy Shield was
subject to three overlapping health triggers with the same priority; I
removed the two lower health thresholds which have no purpose.
## Feature Evaluation
- Describe the **minimum logic** required to achieve the intended
behavior.
I’m going to let the AI answer this one.
> The minimum logic is:
> - a shared config-gated check for whether group/raid buff variants are
allowed
> - a shared way to treat single and group variants as equivalent aura
families
> - a shared upgrade path from single-target buff to group buff when the
group variant is appropriate
> - a Paladin-only cached assignment model that decides which blessing
family each Paladin should cover for the current group
> - trigger/action wiring that only attempts casts when a group member
is actually missing the assigned buff
>
> This avoids scattering separate per-class heuristics across many
triggers and actions.
- Describe the **processing cost** when this logic executes across many
bots.
Processing cost should be minimal but non-zero. The general party buff
changes are limited to existing buff trigger paths and mostly replace
duplicated checks with shared helpers. They do not add expensive default
per-tick behavior outside those existing trigger evaluations.
The Paladin greater blessing logic does add extra decision-making, but
it is limited to Paladins, gated by config and group eligibility,
subject to a delayed trigger evaluation of only once per 4s, and cached
per group assignment set instead of recomputing the full assignment
model on every action attempt.
This PR also increases the throttle duration for group buff triggers to
limit performance impact; I’m open to adjustments to these durations:
- Mark of the Wild triggers were increased from 4s to 8s
- Arcane Intellect triggers were increased from 4s to 8s
- Priest buff triggers were increased to 8s (previously, Fortitude was
6s, Spirit was 4s, and Shadow Protection had no throttle)
- There is now a 5s delay on buffing (greater blessings and group buffs)
after bots log in—I was getting bots spamming buffs as soon as they
logged in even when it was not necessary
I’ve tested with pmon, and the impact is minimal—these are very cheap
triggers even compared to standard bot rotational ability triggers.
## How to Test the Changes
1. Try different config settings to confirm that they work to
enable/disable greater blessings/group buffs in the configured scenarios
2. For greater blessing changes:
- test with one Paladin in a party/raid
- test with multiple Paladins in a party/raid
- confirm the Paladins divide blessing coverage instead of repeatedly
overwriting each other
- include at least one Paladin with Improved Blessing of Might and make
sure it casts Might over Paladins without the talent; check the same
with a Paladin with Improved Blessing of Wisdom
- do not include a Paladin that knows Sanctuary, confirm any Paladin
tank receives Kings instead (you’ll need a low-level Paladin for this
since Sanctuary is a prot talent)
- confirm bots cast blessings only when a member is actually missing the
relevant blessing family
- confirm there is a 5s delay on buffing when bots log in
3. For group buff changes:
- confirm there is a 5s delay on buffing when bots log in
- confirm that single buffs are used when there aren’t at least three
unbuffed members in the same map, even if group buffs are enabled in the
config
4. For all buffs, test with reagents missing to confirm fallback to
single-target buffs and single blessings
5. Confirm the Paladin buff strategy names are changed after resetting
AI
## Impact Assessment
- Does this change increase per-bot/per-tick processing or risk scaling
poorly with thousands of bots?
- - [ ] No, not at all
- - [x] Minimal impact (**explain below**)
- - [ ] Moderate impact (**explain below**)
Discussed above in processing costs.
- Does this change modify default bot behavior?
- - [ ] No
- - [x] Yes (**explain why**)
Yes—that is the purpose of this PR, to change default buffing behavior.
- Does this change add new decision branches or increase maintenance
complexity?
- - [ ] No
- - [x] Yes (**explain below**)
Yes, but I think it’s inevitable to add complexity to get greater
blessings to function consistently, given the challenges brought by
their mechanic of applying across each class.
## AI Assistance
Was AI assistance used while working on this change?
- - [ ] No
- - [x] Yes (**explain below**)
I used GPT-5.4 extensively for this overhaul. It’s much more complicated
than I could handle on my own. I’ve done a lot of testing and have
reviewed the code and provided plenty of revisions, but I cannot say I
can perfectly explain each addition and how it works, not even close.
## Final Checklist
- - [x] Stability is not compromised.
- - [x] Performance impact is understood, tested, and acceptable.
- - [x] Added logic complexity is justified and explained.
- - [x] Any new bot dialogue lines are translated.
- - [x] Documentation updated if needed (Conf comments, WiKi commands).
## Notes for Reviewers
---------
Co-authored-by: Keleborn <22352763+Celandriel@users.noreply.github.com>
Co-authored-by: bash <hermensb@gmail.com>
Co-authored-by: Revision <tkn963@gmail.com>
Co-authored-by: kadeshar <kadeshar@gmail.com>
959 lines
23 KiB
C++
959 lines
23 KiB
C++
/*
|
|
* Copyright (C) 2016+ AzerothCore <www.azerothcore.org>, released under GNU AGPL v3 license, you may redistribute it
|
|
* and/or modify it under version 3 of the License, or (at your option), any later version.
|
|
*/
|
|
|
|
#ifndef _PLAYERBOT_GENERICTRIGGERS_H
|
|
#define _PLAYERBOT_GENERICTRIGGERS_H
|
|
|
|
#include <utility>
|
|
|
|
#include "HealthTriggers.h"
|
|
#include "RangeTriggers.h"
|
|
#include "Trigger.h"
|
|
#include "Player.h"
|
|
|
|
class PlayerbotAI;
|
|
class Unit;
|
|
|
|
class StatAvailable : public Trigger
|
|
{
|
|
public:
|
|
StatAvailable(PlayerbotAI* botAI, int32 amount, std::string const name = "stat available")
|
|
: Trigger(botAI, name), amount(amount) {}
|
|
|
|
protected:
|
|
int32 amount;
|
|
};
|
|
|
|
class HighManaTrigger : public Trigger
|
|
{
|
|
public:
|
|
HighManaTrigger(PlayerbotAI* botAI) : Trigger(botAI, "high mana") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class EnoughManaTrigger : public Trigger
|
|
{
|
|
public:
|
|
EnoughManaTrigger(PlayerbotAI* botAI) : Trigger(botAI, "enough mana") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class AlmostFullManaTrigger : public Trigger
|
|
{
|
|
public:
|
|
AlmostFullManaTrigger(PlayerbotAI* botAI) : Trigger(botAI, "almost full mana") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class RageAvailable : public StatAvailable
|
|
{
|
|
public:
|
|
RageAvailable(PlayerbotAI* botAI, int32 amount) : StatAvailable(botAI, amount, "rage available") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class LightRageAvailableTrigger : public RageAvailable
|
|
{
|
|
public:
|
|
LightRageAvailableTrigger(PlayerbotAI* botAI) : RageAvailable(botAI, 20) {}
|
|
};
|
|
|
|
class MediumRageAvailableTrigger : public RageAvailable
|
|
{
|
|
public:
|
|
MediumRageAvailableTrigger(PlayerbotAI* botAI) : RageAvailable(botAI, 40) {}
|
|
};
|
|
|
|
class HighRageAvailableTrigger : public RageAvailable
|
|
{
|
|
public:
|
|
HighRageAvailableTrigger(PlayerbotAI* botAI) : RageAvailable(botAI, 60) {}
|
|
};
|
|
|
|
class EnergyAvailable : public StatAvailable
|
|
{
|
|
public:
|
|
EnergyAvailable(PlayerbotAI* botAI, int32 amount) : StatAvailable(botAI, amount, "energy available") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class LightEnergyAvailableTrigger : public EnergyAvailable
|
|
{
|
|
public:
|
|
LightEnergyAvailableTrigger(PlayerbotAI* botAI) : EnergyAvailable(botAI, 20) {}
|
|
};
|
|
|
|
class MediumEnergyAvailableTrigger : public EnergyAvailable
|
|
{
|
|
public:
|
|
MediumEnergyAvailableTrigger(PlayerbotAI* botAI) : EnergyAvailable(botAI, 40) {}
|
|
};
|
|
|
|
class HighEnergyAvailableTrigger : public EnergyAvailable
|
|
{
|
|
public:
|
|
HighEnergyAvailableTrigger(PlayerbotAI* botAI) : EnergyAvailable(botAI, 60) {}
|
|
};
|
|
|
|
class ComboPointsAvailableTrigger : public StatAvailable
|
|
{
|
|
public:
|
|
ComboPointsAvailableTrigger(PlayerbotAI* botAI, int32 amount = 5)
|
|
: StatAvailable(botAI, amount, "combo points available")
|
|
{
|
|
}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class TargetWithComboPointsLowerHealTrigger : public ComboPointsAvailableTrigger
|
|
{
|
|
public:
|
|
TargetWithComboPointsLowerHealTrigger(PlayerbotAI* botAI, int32 combo_point = 5, float lifeTime = 8.0f)
|
|
: ComboPointsAvailableTrigger(botAI, combo_point), lifeTime(lifeTime)
|
|
{
|
|
}
|
|
bool IsActive() override;
|
|
|
|
private:
|
|
float lifeTime;
|
|
};
|
|
|
|
class ComboPointsNotFullTrigger : public StatAvailable
|
|
{
|
|
public:
|
|
ComboPointsNotFullTrigger(PlayerbotAI* botAI, int32 amount = 5, std::string const name = "combo points not full")
|
|
: StatAvailable(botAI, amount, name)
|
|
{
|
|
}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class LoseAggroTrigger : public Trigger
|
|
{
|
|
public:
|
|
LoseAggroTrigger(PlayerbotAI* botAI) : Trigger(botAI, "lose aggro") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HasAggroTrigger : public Trigger
|
|
{
|
|
public:
|
|
HasAggroTrigger(PlayerbotAI* botAI) : Trigger(botAI, "have aggro") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class SpellTrigger : public Trigger
|
|
{
|
|
public:
|
|
SpellTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1)
|
|
: Trigger(botAI, spell, checkInterval), spell(spell)
|
|
{
|
|
}
|
|
|
|
std::string const GetTargetName() override { return "current target"; }
|
|
std::string const getName() override { return spell; }
|
|
bool IsActive() override;
|
|
|
|
protected:
|
|
std::string spell;
|
|
};
|
|
|
|
class SpellCanBeCastTrigger : public SpellTrigger
|
|
{
|
|
public:
|
|
SpellCanBeCastTrigger(PlayerbotAI* botAI, std::string const spell) : SpellTrigger(botAI, spell) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class SpellNoCooldownTrigger : public SpellTrigger
|
|
{
|
|
public:
|
|
SpellNoCooldownTrigger(PlayerbotAI* botAI, std::string const spell) : SpellTrigger(botAI, spell) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class SpellCooldownTrigger : public SpellTrigger
|
|
{
|
|
public:
|
|
SpellCooldownTrigger(PlayerbotAI* botAI, std::string const spell) : SpellTrigger(botAI, spell) {}
|
|
|
|
std::string const GetTargetName() override { return "self target"; }
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class InterruptSpellTrigger : public SpellTrigger
|
|
{
|
|
public:
|
|
InterruptSpellTrigger(PlayerbotAI* botAI, std::string const spell) : SpellTrigger(botAI, spell) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class DeflectSpellTrigger : public SpellTrigger
|
|
{
|
|
public:
|
|
DeflectSpellTrigger(PlayerbotAI* botAI, std::string const spell) : SpellTrigger(botAI, spell) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class AttackerCountTrigger : public Trigger
|
|
{
|
|
public:
|
|
AttackerCountTrigger(PlayerbotAI* botAI, int32 amount, float distance = sPlayerbotAIConfig.sightDistance)
|
|
: Trigger(botAI), amount(amount), distance(distance) {}
|
|
|
|
bool IsActive() override;
|
|
std::string const getName() override { return "attacker count"; }
|
|
|
|
protected:
|
|
int32 amount;
|
|
float distance;
|
|
};
|
|
|
|
class HasAttackersTrigger : public AttackerCountTrigger
|
|
{
|
|
public:
|
|
HasAttackersTrigger(PlayerbotAI* botAI) : AttackerCountTrigger(botAI, 1) {}
|
|
};
|
|
|
|
class MyAttackerCountTrigger : public AttackerCountTrigger
|
|
{
|
|
public:
|
|
MyAttackerCountTrigger(PlayerbotAI* botAI, int32 amount) : AttackerCountTrigger(botAI, amount) {}
|
|
|
|
bool IsActive() override;
|
|
std::string const getName() override { return "my attacker count"; }
|
|
};
|
|
|
|
class BeingAttackedTrigger : public MyAttackerCountTrigger
|
|
{
|
|
public:
|
|
BeingAttackedTrigger(PlayerbotAI* botAI) : MyAttackerCountTrigger(botAI, 1) {}
|
|
std::string const getName() override { return "being attacked"; }
|
|
};
|
|
|
|
class MediumThreatTrigger : public MyAttackerCountTrigger
|
|
{
|
|
public:
|
|
MediumThreatTrigger(PlayerbotAI* botAI) : MyAttackerCountTrigger(botAI, 2) {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class LowTankThreatTrigger : public Trigger
|
|
{
|
|
public:
|
|
LowTankThreatTrigger(PlayerbotAI* botAI) : Trigger(botAI, "low tank threat") {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class AoeTrigger : public AttackerCountTrigger
|
|
{
|
|
public:
|
|
AoeTrigger(PlayerbotAI* botAI, int32 amount = 3, float range = 15.0f)
|
|
: AttackerCountTrigger(botAI, amount), range(range) {}
|
|
|
|
bool IsActive() override;
|
|
std::string const getName() override { return "aoe"; }
|
|
|
|
private:
|
|
float range;
|
|
};
|
|
|
|
class NoFoodTrigger : public Trigger
|
|
{
|
|
public:
|
|
NoFoodTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no food trigger") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class NoDrinkTrigger : public Trigger
|
|
{
|
|
public:
|
|
NoDrinkTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no drink trigger") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class LightAoeTrigger : public AoeTrigger
|
|
{
|
|
public:
|
|
LightAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 2, 8.0f) {}
|
|
};
|
|
|
|
class MediumAoeTrigger : public AoeTrigger
|
|
{
|
|
public:
|
|
MediumAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 3, 8.0f) {}
|
|
};
|
|
|
|
class HighAoeTrigger : public AoeTrigger
|
|
{
|
|
public:
|
|
HighAoeTrigger(PlayerbotAI* botAI) : AoeTrigger(botAI, 4, 8.0f) {}
|
|
};
|
|
|
|
class BuffTrigger : public SpellTrigger
|
|
{
|
|
public:
|
|
BuffTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1,
|
|
bool checkIsOwner = false, bool checkDuration = false, uint32 beforeDuration = 0)
|
|
: SpellTrigger(botAI, spell, checkInterval)
|
|
{
|
|
this->checkIsOwner = checkIsOwner;
|
|
this->checkDuration = checkDuration;
|
|
this->beforeDuration = beforeDuration;
|
|
}
|
|
|
|
public:
|
|
std::string const GetTargetName() override { return "self target"; }
|
|
bool IsActive() override;
|
|
|
|
protected:
|
|
bool checkIsOwner;
|
|
bool checkDuration;
|
|
uint32 beforeDuration;
|
|
};
|
|
|
|
class BuffOnPartyTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
BuffOnPartyTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1)
|
|
: BuffTrigger(botAI, spell, checkInterval) {}
|
|
|
|
Value<Unit*>* GetTargetValue() override;
|
|
bool IsActive() override;
|
|
std::string const getName() override { return spell + " on party"; }
|
|
};
|
|
|
|
class ProtectPartyMemberTrigger : public Trigger
|
|
{
|
|
public:
|
|
ProtectPartyMemberTrigger(PlayerbotAI* botAI) : Trigger(botAI, "protect party member") {}
|
|
|
|
std::string const GetTargetName() override { return "party member to protect"; }
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class NoAttackersTrigger : public Trigger
|
|
{
|
|
public:
|
|
NoAttackersTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no attackers") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class NoTargetTrigger : public Trigger
|
|
{
|
|
public:
|
|
NoTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no target") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class InvalidTargetTrigger : public Trigger
|
|
{
|
|
public:
|
|
InvalidTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "invalid target") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class TargetInSightTrigger : public Trigger
|
|
{
|
|
public:
|
|
TargetInSightTrigger(PlayerbotAI* botAI) : Trigger(botAI, "target in sight") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class DebuffTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
DebuffTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1, bool checkIsOwner = false,
|
|
float needLifeTime = 8.0f, uint32 beforeDuration = 0)
|
|
: BuffTrigger(botAI, spell, checkInterval, checkIsOwner, false, beforeDuration), needLifeTime(needLifeTime) {}
|
|
|
|
std::string const GetTargetName() override { return "current target"; }
|
|
bool IsActive() override;
|
|
|
|
protected:
|
|
float needLifeTime;
|
|
};
|
|
|
|
class DebuffOnBossTrigger : public DebuffTrigger
|
|
{
|
|
public:
|
|
DebuffOnBossTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1, bool checkIsOwner = false)
|
|
: DebuffTrigger(botAI, spell, checkInterval, checkIsOwner) {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class DebuffOnAttackerTrigger : public DebuffTrigger
|
|
{
|
|
public:
|
|
DebuffOnAttackerTrigger(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = true,
|
|
float needLifeTime = 8.0f)
|
|
: DebuffTrigger(botAI, spell, 1, checkIsOwner, needLifeTime) {}
|
|
|
|
Value<Unit*>* GetTargetValue() override;
|
|
std::string const getName() override { return spell + " on attacker"; }
|
|
};
|
|
|
|
class DebuffOnMeleeAttackerTrigger : public DebuffTrigger
|
|
{
|
|
public:
|
|
DebuffOnMeleeAttackerTrigger(PlayerbotAI* botAI, std::string const spell, bool checkIsOwner = true,
|
|
float needLifeTime = 8.0f)
|
|
: DebuffTrigger(botAI, spell, 1, checkIsOwner, needLifeTime) {}
|
|
|
|
Value<Unit*>* GetTargetValue() override;
|
|
std::string const getName() override { return spell + " on attacker"; }
|
|
};
|
|
|
|
class BoostTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
BoostTrigger(PlayerbotAI* botAI, std::string const spell, float balance = 50.f)
|
|
: BuffTrigger(botAI, spell, 1), balance(balance) {}
|
|
|
|
bool IsActive() override;
|
|
|
|
protected:
|
|
float balance;
|
|
};
|
|
|
|
class GenericBoostTrigger : public Trigger
|
|
{
|
|
public:
|
|
GenericBoostTrigger(PlayerbotAI* botAI, float balance = 50.f)
|
|
: Trigger(botAI, "generic boost", 1), balance(balance) {}
|
|
|
|
bool IsActive() override;
|
|
|
|
protected:
|
|
float balance;
|
|
};
|
|
|
|
class HealerShouldAttackTrigger : public Trigger
|
|
{
|
|
public:
|
|
HealerShouldAttackTrigger(PlayerbotAI* botAI)
|
|
: Trigger(botAI, "healer should attack", 1) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class RandomTrigger : public Trigger
|
|
{
|
|
public:
|
|
RandomTrigger(PlayerbotAI* botAI, std::string const name, int32 probability = 7);
|
|
|
|
bool IsActive() override;
|
|
|
|
protected:
|
|
int32 probability;
|
|
uint32 lastCheck;
|
|
};
|
|
|
|
class AndTrigger : public Trigger
|
|
{
|
|
public:
|
|
AndTrigger(PlayerbotAI* botAI, Trigger* ls, Trigger* rs) : Trigger(botAI), ls(ls), rs(rs) {}
|
|
virtual ~AndTrigger()
|
|
{
|
|
delete ls;
|
|
delete rs;
|
|
}
|
|
|
|
bool IsActive() override;
|
|
std::string const getName() override;
|
|
|
|
protected:
|
|
Trigger* ls;
|
|
Trigger* rs;
|
|
};
|
|
|
|
class TwoTriggers : public Trigger
|
|
{
|
|
public:
|
|
explicit TwoTriggers(PlayerbotAI* botAI, std::string name1 = "", std::string name2 = "") : Trigger(botAI)
|
|
{
|
|
this->name1 = std::move(name1);
|
|
this->name2 = std::move(name2);
|
|
}
|
|
bool IsActive() override;
|
|
std::string const getName() override;
|
|
|
|
protected:
|
|
std::string name1;
|
|
std::string name2;
|
|
};
|
|
|
|
class SnareTargetTrigger : public DebuffTrigger
|
|
{
|
|
public:
|
|
SnareTargetTrigger(PlayerbotAI* botAI, std::string const spell) : DebuffTrigger(botAI, spell) {}
|
|
|
|
Value<Unit*>* GetTargetValue() override;
|
|
std::string const getName() override { return spell + " on snare target"; }
|
|
};
|
|
|
|
class LowManaTrigger : public Trigger
|
|
{
|
|
public:
|
|
LowManaTrigger(PlayerbotAI* botAI) : Trigger(botAI, "low mana") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class MediumManaTrigger : public Trigger
|
|
{
|
|
public:
|
|
MediumManaTrigger(PlayerbotAI* botAI) : Trigger(botAI, "medium mana") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class LowEnergyTrigger : public Trigger
|
|
{
|
|
public:
|
|
LowEnergyTrigger(PlayerbotAI* botAI, uint8 threshold = 30) : Trigger(botAI, "low energy"), threshold(threshold) {}
|
|
|
|
bool IsActive() override;
|
|
|
|
private:
|
|
uint8 threshold;
|
|
};
|
|
|
|
BEGIN_TRIGGER(PanicTrigger, Trigger) // cppcheck-suppress unknownMacro
|
|
std::string const getName() override { return "panic"; }
|
|
END_TRIGGER()
|
|
|
|
BEGIN_TRIGGER(OutNumberedTrigger, Trigger)
|
|
std::string const getName() override { return "outnumbered"; }
|
|
END_TRIGGER()
|
|
|
|
class NoPetTrigger : public Trigger
|
|
{
|
|
public:
|
|
NoPetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no pet", 5 * 1000) {}
|
|
|
|
virtual bool IsActive() override;
|
|
};
|
|
|
|
class HasPetTrigger : public Trigger
|
|
{
|
|
public:
|
|
HasPetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "has pet", 5 * 1000) {}
|
|
|
|
virtual bool IsActive() override;
|
|
};
|
|
|
|
class PetAttackTrigger : public Trigger
|
|
{
|
|
public:
|
|
PetAttackTrigger(PlayerbotAI* botAI) : Trigger(botAI, "pet attack") {}
|
|
|
|
virtual bool IsActive() override;
|
|
};
|
|
|
|
class ItemCountTrigger : public Trigger
|
|
{
|
|
public:
|
|
ItemCountTrigger(PlayerbotAI* botAI, std::string const item, int32 count, int32 interval = 30 * 1000)
|
|
: Trigger(botAI, item, interval), item(item), count(count) {}
|
|
|
|
bool IsActive() override;
|
|
std::string const getName() override { return "item count"; }
|
|
|
|
protected:
|
|
std::string const item;
|
|
int32 count;
|
|
};
|
|
|
|
class AmmoCountTrigger : public ItemCountTrigger
|
|
{
|
|
public:
|
|
AmmoCountTrigger(PlayerbotAI* botAI, std::string const item, uint32 count = 1, int32 interval = 30 * 1000)
|
|
: ItemCountTrigger(botAI, item, count, interval) {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HasAuraTrigger : public Trigger
|
|
{
|
|
public:
|
|
HasAuraTrigger(PlayerbotAI* botAI, std::string const spell, int32 checkInterval = 1)
|
|
: Trigger(botAI, spell, checkInterval) {}
|
|
|
|
std::string const GetTargetName() override { return "self target"; }
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HasAuraStackTrigger : public Trigger
|
|
{
|
|
public:
|
|
HasAuraStackTrigger(PlayerbotAI* botAI, std::string spell, int stack, int checkInterval = 1)
|
|
: Trigger(botAI, spell, checkInterval), stack(stack) {}
|
|
|
|
std::string const GetTargetName() override { return "self target"; }
|
|
bool IsActive() override;
|
|
|
|
private:
|
|
int stack;
|
|
};
|
|
|
|
class HasNoAuraTrigger : public Trigger
|
|
{
|
|
public:
|
|
HasNoAuraTrigger(PlayerbotAI* botAI, std::string const spell) : Trigger(botAI, spell) {}
|
|
|
|
std::string const GetTargetName() override { return "self target"; }
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class TimerTrigger : public Trigger
|
|
{
|
|
public:
|
|
TimerTrigger(PlayerbotAI* botAI) : Trigger(botAI, "timer"), lastCheck(0) {}
|
|
|
|
bool IsActive() override;
|
|
|
|
private:
|
|
time_t lastCheck;
|
|
};
|
|
|
|
class TimerBGTrigger : public Trigger
|
|
{
|
|
public:
|
|
TimerBGTrigger(PlayerbotAI* botAI) : Trigger(botAI, "timer bg"), lastCheck(0) {}
|
|
|
|
bool IsActive() override;
|
|
|
|
private:
|
|
time_t lastCheck;
|
|
};
|
|
|
|
class TankAssistTrigger : public NoAttackersTrigger
|
|
{
|
|
public:
|
|
TankAssistTrigger(PlayerbotAI* botAI) : NoAttackersTrigger(botAI) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class IsBehindTargetTrigger : public Trigger
|
|
{
|
|
public:
|
|
IsBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "behind target") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class IsNotBehindTargetTrigger : public Trigger
|
|
{
|
|
public:
|
|
IsNotBehindTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "is not behind target") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class IsNotFacingTargetTrigger : public Trigger
|
|
{
|
|
public:
|
|
IsNotFacingTargetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "not facing target") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HasCcTargetTrigger : public Trigger
|
|
{
|
|
public:
|
|
HasCcTargetTrigger(PlayerbotAI* botAI, std::string const name) : Trigger(botAI, name) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class NoMovementTrigger : public Trigger
|
|
{
|
|
public:
|
|
NoMovementTrigger(PlayerbotAI* botAI, std::string const name) : Trigger(botAI, name) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class NoPossibleTargetsTrigger : public Trigger
|
|
{
|
|
public:
|
|
NoPossibleTargetsTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no possible targets") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class NotDpsTargetActiveTrigger : public Trigger
|
|
{
|
|
public:
|
|
NotDpsTargetActiveTrigger(PlayerbotAI* botAI) : Trigger(botAI, "not dps target active") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class NotDpsAoeTargetActiveTrigger : public Trigger
|
|
{
|
|
public:
|
|
NotDpsAoeTargetActiveTrigger(PlayerbotAI* botAI) : Trigger(botAI, "not dps aoe target active") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class PossibleAddsTrigger : public Trigger
|
|
{
|
|
public:
|
|
PossibleAddsTrigger(PlayerbotAI* botAI) : Trigger(botAI, "possible adds") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class LossOfControlTrigger : public Trigger
|
|
{
|
|
public:
|
|
LossOfControlTrigger(PlayerbotAI* botAI) : Trigger(botAI, "loss of control", 1) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class FearCharmSleepTrigger : public Trigger
|
|
{
|
|
public:
|
|
FearCharmSleepTrigger(PlayerbotAI* botAI) : Trigger(botAI, "fear charm sleep", 1) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class FearSleepSapTrigger : public Trigger
|
|
{
|
|
public:
|
|
FearSleepSapTrigger(PlayerbotAI* botAI) : Trigger(botAI, "fear sleep sap", 1) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class IsSwimmingTrigger : public Trigger
|
|
{
|
|
public:
|
|
IsSwimmingTrigger(PlayerbotAI* botAI) : Trigger(botAI, "swimming") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HasNearestAddsTrigger : public Trigger
|
|
{
|
|
public:
|
|
HasNearestAddsTrigger(PlayerbotAI* botAI) : Trigger(botAI, "has nearest adds") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HasItemForSpellTrigger : public Trigger
|
|
{
|
|
public:
|
|
HasItemForSpellTrigger(PlayerbotAI* botAI, std::string const spell) : Trigger(botAI, spell) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class TargetChangedTrigger : public Trigger
|
|
{
|
|
public:
|
|
TargetChangedTrigger(PlayerbotAI* botAI) : Trigger(botAI, "target changed") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class InterruptEnemyHealerTrigger : public SpellTrigger
|
|
{
|
|
public:
|
|
InterruptEnemyHealerTrigger(PlayerbotAI* botAI, std::string const spell) : SpellTrigger(botAI, spell) {}
|
|
|
|
Value<Unit*>* GetTargetValue() override;
|
|
std::string const getName() override { return spell + " on enemy healer"; }
|
|
};
|
|
|
|
class RandomBotUpdateTrigger : public RandomTrigger
|
|
{
|
|
public:
|
|
RandomBotUpdateTrigger(PlayerbotAI* botAI) : RandomTrigger(botAI, "random bot update", 30 * 1000) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class NoNonBotPlayersAroundTrigger : public Trigger
|
|
{
|
|
public:
|
|
NoNonBotPlayersAroundTrigger(PlayerbotAI* botAI) : Trigger(botAI, "no non bot players around", 10 * 1000) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class NewPlayerNearbyTrigger : public Trigger
|
|
{
|
|
public:
|
|
NewPlayerNearbyTrigger(PlayerbotAI* botAI) : Trigger(botAI, "new player nearby", 10 * 1000) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class CollisionTrigger : public Trigger
|
|
{
|
|
public:
|
|
CollisionTrigger(PlayerbotAI* botAI) : Trigger(botAI, "collision", 5 * 1000) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class StayTimeTrigger : public Trigger
|
|
{
|
|
public:
|
|
StayTimeTrigger(PlayerbotAI* botAI, uint32 delay, std::string const name)
|
|
: Trigger(botAI, name, 5 * 1000), delay(delay) {}
|
|
|
|
bool IsActive() override;
|
|
|
|
private:
|
|
uint32 delay;
|
|
};
|
|
|
|
class SitTrigger : public StayTimeTrigger
|
|
{
|
|
public:
|
|
SitTrigger(PlayerbotAI* botAI) : StayTimeTrigger(botAI, sPlayerbotAIConfig.sitDelay, "sit") {}
|
|
};
|
|
|
|
class ReturnToStayPositionTrigger : public Trigger
|
|
{
|
|
public:
|
|
ReturnToStayPositionTrigger(PlayerbotAI* botAI) : Trigger(botAI, "return to stay position", 2) {}
|
|
|
|
virtual bool IsActive() override;
|
|
};
|
|
|
|
class ReturnTrigger : public StayTimeTrigger
|
|
{
|
|
public:
|
|
ReturnTrigger(PlayerbotAI* botAI) : StayTimeTrigger(botAI, sPlayerbotAIConfig.returnDelay, "return") {}
|
|
};
|
|
|
|
class GiveItemTrigger : public Trigger
|
|
{
|
|
public:
|
|
GiveItemTrigger(PlayerbotAI* botAI, std::string const name, std::string const item)
|
|
: Trigger(botAI, name, 2 * 1000), item(item) {}
|
|
|
|
bool IsActive() override;
|
|
|
|
protected:
|
|
std::string const item;
|
|
};
|
|
|
|
class GiveFoodTrigger : public GiveItemTrigger
|
|
{
|
|
public:
|
|
GiveFoodTrigger(PlayerbotAI* botAI) : GiveItemTrigger(botAI, "give food", "conjured food") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class GiveWaterTrigger : public GiveItemTrigger
|
|
{
|
|
public:
|
|
GiveWaterTrigger(PlayerbotAI* botAI) : GiveItemTrigger(botAI, "give water", "conjured water") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class IsMountedTrigger : public Trigger
|
|
{
|
|
public:
|
|
IsMountedTrigger(PlayerbotAI* botAI) : Trigger(botAI, "mounted", 1) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class CorpseNearTrigger : public Trigger
|
|
{
|
|
public:
|
|
CorpseNearTrigger(PlayerbotAI* botAI) : Trigger(botAI, "corpse near", 1 * 1000) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class IsFallingTrigger : public Trigger
|
|
{
|
|
public:
|
|
IsFallingTrigger(PlayerbotAI* botAI) : Trigger(botAI, "falling", 10 * 1000) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class IsFallingFarTrigger : public Trigger
|
|
{
|
|
public:
|
|
IsFallingFarTrigger(PlayerbotAI* botAI) : Trigger(botAI, "falling far", 10 * 1000) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HasAreaDebuffTrigger : public Trigger
|
|
{
|
|
public:
|
|
HasAreaDebuffTrigger(PlayerbotAI* botAI) : Trigger(botAI, "have area debuff") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class BuffOnMainTankTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
BuffOnMainTankTrigger(PlayerbotAI* botAI, std::string spell, bool checkIsOwner = false, int checkInterval = 1)
|
|
: BuffTrigger(botAI, spell, checkInterval, checkIsOwner) {}
|
|
|
|
public:
|
|
virtual Value<Unit*>* GetTargetValue();
|
|
};
|
|
|
|
class SelfResurrectTrigger : public Trigger
|
|
{
|
|
public:
|
|
SelfResurrectTrigger(PlayerbotAI* botAI) : Trigger(botAI, "can self resurrect") {}
|
|
|
|
bool IsActive() override { return !bot->IsAlive() && bot->GetUInt32Value(PLAYER_SELF_RES_SPELL); }
|
|
};
|
|
|
|
class NewPetTrigger : public Trigger
|
|
{
|
|
public:
|
|
NewPetTrigger(PlayerbotAI* botAI) : Trigger(botAI, "new pet"), lastPetGuid(ObjectGuid::Empty), triggered(false) {}
|
|
|
|
bool IsActive() override;
|
|
|
|
private:
|
|
ObjectGuid lastPetGuid;
|
|
bool triggered;
|
|
};
|
|
|
|
#endif
|