mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
# Pull Request Note: When I reference Aspect of the Hawk below, it also means Aspect of the Dragonhawk (the code will use Dragonhawk if the Hunter has it, Hawk if not, they share actions, triggers, and strategies). Hunter Aspects are currently bugged. All Hunters, regardless of spec or strategy, are hardcoded to use Aspect of the Hawk when mana is at 70%+ and Aspect of the Viper when mana drops to "lowMana" from the config (default is 15%), divided by 2. This means the following: - Hawk (bdps) and Viper (bmana) strategies are useless - Pack (bspeed) and Wild (rnature) strategies are applied, but bots will rapidly switch back and forth between Pack/Wild and Hawk/Viper, depending on strategy and mana level. This PR addresses the issues by doing the following: - Global Hawk strategy is removed. Now you need to set bdps for Hunters to use Hawk, but bdps remains the default Aspect strategy for all Hunters. - Dedicated Viper strategy is removed, leaving the global strategy. However, Viper will be used (when lowMana/2) ONLY if the bot is set to bdps. If the bot has the Wild or Pack strategy, they will not switch to Viper at all. I did this because I am assuming if you are using Wild or Pack, you need them for reasons other than to pump DPS. - The threshold to switch back to Hawk is lowered from 70% to 60%. The gap between lowMana/2 and 60% is now filled--if bdps is on, Hunters will switch to Hawk whenever above the Viper threshold, _except_ for when they have the Viper aura, in which case they will not switch to Hawk until 60% mana. This lets the Hunter build back mana before swapping back to Hawk (more like general player behavior) while still letting them swap from other Aspects to Hawk without needing to be all the way at 60% mana. - Gets rid of a weird condition in the Hawk trigger that would make it so that Hunters would switch to Hawk when at exactly 0 mana. I'm not sure what the point of that is. Also, I refactored the triggers a bit because I noticed there was some dead code in there. I didn't do a comprehensive refactor, but there was a lot of stuff that clearly didn't make sense even to my eyes, like back-to-back returns. I think there's more unnecessary code even just in the triggers, but I didn't want to get too into the weeds with this PR. --- ## Design Philosophy We prioritize **stability, performance, and predictability** over behavioral realism. Complex player-mimicking logic is intentionally limited due to its negative impact on scalability, maintainability, and long-term robustness. Excessive processing overhead can lead to server hiccups, increased CPU usage, and degraded performance for all participants. Because every action and decision tree is executed **per bot and per trigger**, even small increases in logic complexity can scale poorly and negatively affect both players and world (random) bots. Bots are not expected to behave perfectly, and perfect simulation of human decision-making is not a project goal. Increased behavioral realism often introduces disproportionate cost, reduced predictability, and significantly higher maintenance overhead. Every additional branch of logic increases long-term responsibility. All decision paths must be tested, validated, and maintained continuously as the system evolves. If advanced or AI-intensive behavior is introduced, the **default configuration must remain the lightweight decision model**. More complex behavior should only be available as an **explicit opt-in option**, clearly documented as having a measurable performance cost. Principles: - **Stability before intelligence** A stable system is always preferred over a smarter one. - **Performance is a shared resource** Any increase in bot cost affects all players and all bots. - **Simple logic scales better than smart logic** Predictable behavior under load is more valuable than perfect decisions. - **Complexity must justify itself** If a feature cannot clearly explain its cost, it should not exist. - **Defaults must be cheap** Expensive behavior must always be optional and clearly communicated. - **Bots should look reasonable, not perfect** The goal is believable behavior, not human simulation. Before submitting, confirm that this change aligns with those principles. --- ## Feature Evaluation Please answer the following: - Describe the **minimum logic** required to achieve the intended behavior? - Describe the **cheapest implementation** that produces an acceptable result? - Describe the **runtime cost** when this logic executes across many bots? I don't expect there to be any impact on costs, and if anything this PR removes some unneeded checks from triggers. --- ## How to Test the Changes - Step-by-step instructions to test the change - Any required setup (e.g. multiple players, bots, specific configuration) - Expected behavior and how to verify it The easiest way is to go shoot a dummy with Volley until low on mana and then toggle on selfbot. You can do this with various Aspects active to test. ## Complexity & Impact Does this change add new decision branches? - - [X] No - - [ ] Yes (**explain below**) Does this change increase per-bot or per-tick processing? - - [X] No - - [ ] Yes (**describe and justify impact**) Could this logic scale poorly under load? - - [X] No - - [ ] Yes (**explain why**) --- ## Defaults & Configuration Does this change modify default bot behavior? - - [ ] No - - [X] Yes (**explain why**) Described above. Default behavior is broken. If this introduces more advanced or AI-heavy logic: - - [X] Lightweight mode remains the default - - [ ] More complex behavior is optional and thereby configurable --- ## AI Assistance Was AI assistance (e.g. ChatGPT or similar tools) used while working on this change? - - [ ] No - - [X] Yes (**explain below**) I asked Claude some questions about the triggers to make sure I didn't screw anything up. If yes, please specify: - AI tool or model used (e.g. ChatGPT, GPT-4, Claude, etc.) - Purpose of usage (e.g. brainstorming, refactoring, documentation, code generation) - Which parts of the change were influenced or generated - Whether the result was manually reviewed and adapted AI assistance is allowed, but all submitted code must be fully understood, reviewed, and owned by the contributor. Any AI-influenced changes must be verified against existing CORE and PB logic. We expect contributors to be honest about what they do and do not understand. --- ## Final Checklist - - [X] Stability is not compromised - - [X] Performance impact is understood, tested, and acceptable - - [X] Added logic complexity is justified and explained - - [X] Documentation updated if needed --- ## Notes for Reviewers Anything that significantly improves realism at the cost of stability or performance should be carefully discussed before merging. --------- 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>
258 lines
6.5 KiB
C++
258 lines
6.5 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_HUNTERTRIGGERS_H
|
|
#define _PLAYERBOT_HUNTERTRIGGERS_H
|
|
|
|
#include "CureTriggers.h"
|
|
#include "GenericTriggers.h"
|
|
#include "Trigger.h"
|
|
#include "PlayerbotAI.h"
|
|
#include <set>
|
|
|
|
class PlayerbotAI;
|
|
|
|
// Buff and Out of Combat Triggers
|
|
|
|
class HunterAspectOfTheDragonhawkTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
HunterAspectOfTheDragonhawkTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "aspect of the dragonhawk") {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HunterAspectOfTheWildTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
HunterAspectOfTheWildTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "aspect of the wild") {}
|
|
};
|
|
|
|
class HunterAspectOfTheViperTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
HunterAspectOfTheViperTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "aspect of the viper") {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HunterAspectOfThePackTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
HunterAspectOfThePackTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "aspect of the pack") {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class TrueshotAuraTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
TrueshotAuraTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "trueshot aura") {}
|
|
};
|
|
|
|
class NoTrackTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
NoTrackTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "no track") {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HunterLowAmmoTrigger : public AmmoCountTrigger
|
|
{
|
|
public:
|
|
HunterLowAmmoTrigger(PlayerbotAI* botAI) : AmmoCountTrigger(botAI, "ammo", 1, 30) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HunterNoAmmoTrigger : public AmmoCountTrigger
|
|
{
|
|
public:
|
|
HunterNoAmmoTrigger(PlayerbotAI* botAI) : AmmoCountTrigger(botAI, "ammo", 1, 10) {}
|
|
};
|
|
|
|
class HunterHasAmmoTrigger : public AmmoCountTrigger
|
|
{
|
|
public:
|
|
HunterHasAmmoTrigger(PlayerbotAI* botAI) : AmmoCountTrigger(botAI, "ammo", 1, 10) {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
// Cooldown Triggers
|
|
|
|
class RapidFireTrigger : public BoostTrigger
|
|
{
|
|
public:
|
|
RapidFireTrigger(PlayerbotAI* botAI) : BoostTrigger(botAI, "rapid fire") {}
|
|
};
|
|
|
|
class BestialWrathTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
BestialWrathTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "bestial wrath") {}
|
|
};
|
|
|
|
class IntimidationTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
IntimidationTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "intimidation") {}
|
|
};
|
|
|
|
class KillCommandTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
KillCommandTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "kill command") {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class LockAndLoadTrigger : public BuffTrigger
|
|
{
|
|
public:
|
|
LockAndLoadTrigger(PlayerbotAI* botAI) : BuffTrigger(botAI, "lock and load") {}
|
|
|
|
bool IsActive() override
|
|
{
|
|
return botAI->HasAura("lock and load", botAI->GetBot());
|
|
}
|
|
};
|
|
|
|
// CC Triggers
|
|
|
|
class FreezingTrapTrigger : public HasCcTargetTrigger
|
|
{
|
|
public:
|
|
FreezingTrapTrigger(PlayerbotAI* botAI) : HasCcTargetTrigger(botAI, "freezing trap") {}
|
|
};
|
|
|
|
class ConcussiveShotOnSnareTargetTrigger : public SnareTargetTrigger
|
|
{
|
|
public:
|
|
ConcussiveShotOnSnareTargetTrigger(PlayerbotAI* botAI) : SnareTargetTrigger(botAI, "concussive shot") {}
|
|
};
|
|
|
|
class ScareBeastTrigger : public HasCcTargetTrigger
|
|
{
|
|
public:
|
|
ScareBeastTrigger(PlayerbotAI* botAI) : HasCcTargetTrigger(botAI, "scare beast") {}
|
|
};
|
|
|
|
class SilencingShotTrigger : public InterruptSpellTrigger
|
|
{
|
|
public:
|
|
SilencingShotTrigger(PlayerbotAI* botAI) : InterruptSpellTrigger(botAI, "silencing shot") {}
|
|
};
|
|
|
|
// DoT/Debuff Triggers
|
|
|
|
class HuntersMarkTrigger : public DebuffTrigger
|
|
{
|
|
public:
|
|
HuntersMarkTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "hunter's mark", 1, true, 0.5f) {}
|
|
bool IsActive() override { return BuffTrigger::IsActive(); }
|
|
};
|
|
|
|
class ExplosiveShotTrigger : public DebuffTrigger
|
|
{
|
|
public:
|
|
ExplosiveShotTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "explosive shot", 1, true) {}
|
|
bool IsActive() override { return BuffTrigger::IsActive(); }
|
|
};
|
|
|
|
class BlackArrowTrigger : public DebuffTrigger
|
|
{
|
|
public:
|
|
BlackArrowTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "black arrow", 1, true) {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class HunterNoStingsActiveTrigger : public DebuffTrigger
|
|
{
|
|
public:
|
|
HunterNoStingsActiveTrigger(PlayerbotAI* botAI) : DebuffTrigger(botAI, "no stings") {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class SerpentStingOnAttackerTrigger : public DebuffOnAttackerTrigger
|
|
{
|
|
public:
|
|
SerpentStingOnAttackerTrigger(PlayerbotAI* botAI) : DebuffOnAttackerTrigger(botAI, "serpent sting", true) {}
|
|
bool IsActive() override;
|
|
};
|
|
|
|
// Damage/Combat Triggers
|
|
|
|
class AutoShotTrigger : public Trigger
|
|
{
|
|
public:
|
|
AutoShotTrigger(PlayerbotAI* botAI) : Trigger(botAI, "auto shot") {}
|
|
};
|
|
|
|
class SwitchToRangedTrigger : public Trigger
|
|
{
|
|
public:
|
|
SwitchToRangedTrigger(PlayerbotAI* botAI) : Trigger(botAI, "switch to ranged") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class SwitchToMeleeTrigger : public Trigger
|
|
{
|
|
public:
|
|
SwitchToMeleeTrigger(PlayerbotAI* botAI) : Trigger(botAI, "switch to melee") {}
|
|
|
|
bool IsActive() override;
|
|
};
|
|
|
|
class MisdirectionOnMainTankTrigger : public BuffOnMainTankTrigger
|
|
{
|
|
public:
|
|
MisdirectionOnMainTankTrigger(PlayerbotAI* botAI) : BuffOnMainTankTrigger(botAI, "misdirection", true) {}
|
|
};
|
|
|
|
class TargetRemoveEnrageTrigger : public TargetAuraDispelTrigger
|
|
{
|
|
public:
|
|
TargetRemoveEnrageTrigger(PlayerbotAI* botAI) : TargetAuraDispelTrigger(botAI, "tranquilizing shot", DISPEL_ENRAGE) {}
|
|
};
|
|
|
|
class TargetRemoveMagicTrigger : public TargetAuraDispelTrigger
|
|
{
|
|
public:
|
|
TargetRemoveMagicTrigger(PlayerbotAI* botAI) : TargetAuraDispelTrigger(botAI, "tranquilizing shot", DISPEL_MAGIC) {}
|
|
};
|
|
|
|
class ImmolationTrapNoCdTrigger : public SpellNoCooldownTrigger
|
|
{
|
|
public:
|
|
ImmolationTrapNoCdTrigger(PlayerbotAI* botAI) : SpellNoCooldownTrigger(botAI, "immolation trap") {}
|
|
};
|
|
|
|
BEGIN_TRIGGER(HuntersPetDeadTrigger, Trigger)
|
|
END_TRIGGER()
|
|
|
|
BEGIN_TRIGGER(HuntersPetLowHealthTrigger, Trigger)
|
|
END_TRIGGER()
|
|
|
|
BEGIN_TRIGGER(HuntersPetMediumHealthTrigger, Trigger)
|
|
END_TRIGGER()
|
|
|
|
BEGIN_TRIGGER(HunterPetNotHappy, Trigger)
|
|
END_TRIGGER()
|
|
|
|
class VolleyChannelCheckTrigger : public Trigger
|
|
{
|
|
public:
|
|
VolleyChannelCheckTrigger(PlayerbotAI* botAI, uint32 minEnemies = 2)
|
|
: Trigger(botAI, "volley channel check"), minEnemies(minEnemies)
|
|
{
|
|
}
|
|
|
|
bool IsActive() override;
|
|
|
|
protected:
|
|
uint32 minEnemies;
|
|
static const std::set<uint32> VOLLEY_SPELL_IDS;
|
|
};
|
|
|
|
#endif
|