mirror of
https://github.com/liyunfan1223/mod-playerbots.git
synced 2026-06-20 15:39:25 +02:00
Add Core Hounds to MC strategy (#2446)
<!--
Thank you for contributing to mod-playerbots, please make sure that
you...
1. Submit your PR to the test-staging branch, not master.
2. Read the guidelines below before submitting.
3. Don't delete parts of this template.
DESIGN PHILOSOPHY: We prioritize STABILITY, PERFORMANCE, AND
PREDICTABILITY over behavioral realism.
Every action and decision executes PER BOT AND PER TRIGGER. Small
increases in logic complexity scale
poorly across thousands of bots and negatively affect all. We prioritize
a stable system over a smarter
one. Bots don't need to behave perfectly; believable behavior is the
goal, not human simulation.
Default behavior must be cheap in processing; expensive behavior must be
opt-in.
Before submitting, make sure your changes aligns with these principles.
-->
## Pull Request Description
<!-- Describe what this change does and why it is needed -->
PR adds actions to the Molten Core strategy to allow the bots to handle
the core hound packs better. These are the packs where all the hounds
need to die together.
The strat adds skull marks to the highest hp core hound, with a 10%
buffer so the skull doesnt rapidly change targets, allowing the bots to
make sure the hounds all die closer together
## Feature Evaluation
<!--
If your PR is very minimal (comment typo, wrong ID reference, etc), and
it is very obvious it will not have
any impact on performance, you may skip these question. If necessary, a
maintainer may ask you for them later.
-->
<!-- Please answer the following: -->
- Describe the **minimum logic** required to achieve the intended
behavior.
- Describe the **processing cost** when this logic executes across many
bots.
## How to Test the Changes
<!--
- Step-by-step instructions to test the change.
- Any required setup (e.g. multiple players, number of bots, specific
configuration).
- Expected behavior and how to verify it.
-->
Go to Molten Core to the area with the Core Hounds packs (where the
first and second bosses are).
Pull a pack. The bots should automatically mark the highest core hound
with a skull.
## Impact Assessment
<!-- As a generic test, before and after measure of pmon (playerbot pmon
tick) can help you here. -->
- Does this change increase per-bot/per-tick processing or risk scaling
poorly with thousands of bots?
- - [x] No, not at all
- - [ ] Minimal impact (**explain below**)
- - [ ] Moderate impact (**explain below**)
- Does this change modify default bot behavior?
- - [x] No
- - [ ] Yes (**explain why**)
- Does this change add new decision branches or increase maintenance
complexity?
- - [x] No
- - [ ] Yes (**explain below**)
## AI Assistance
<!--
AI assistance is allowed, but all submitted code must be fully
understood, reviewed, and owned by the contributor.
We expect contributors to be honest about what they do and do not
understand.
-->
Was AI assistance used while working on this change?
- - [ ] No
- - [x] Yes (**explain below**)
<!--
If yes, please specify:
- Purpose of usage (e.g. brainstorming, refactoring, documentation, code
generation).
- Which parts of the change were influenced or generated, and whether it
was thoroughly reviewed.
-->
Claude was used to generate the marking action's execute function, which
I then reviewed and modifed to improve.
<!--
TRANSLATIONS:
Anything new that the bots say in chat must be in a translatable format.
This is done using GetBotTextOrDefault,
which you can search for in the codebase to find examples. Your code
needs to have English as the default fallback,
while the full translations need to be in an SQL update file. The
languages in the file are the nine language
options supported by AzerothCore: English, Korean, French, German,
Chinese, Taiwanese, Spanish, Spanish Mexico, and
Russian. See
data/sql/playerbots/updates/2025_12_27_ai_playerbot_fishing_text.sql as
an example of a translation SQL
update, whose content are called within the codebase at
src/strategy/actions/FishingAction.cpp
-->
## 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
<!-- Anything else that's helpful to review or test your pull request.
-->
This commit is contained in:
parent
03d184cbef
commit
8542e39c77
@ -26,6 +26,7 @@ public:
|
|||||||
creators["mc golemagg assist tank attack core rager"] = &RaidMcActionContext::golemagg_assist_tank_attack_core_rager;
|
creators["mc golemagg assist tank attack core rager"] = &RaidMcActionContext::golemagg_assist_tank_attack_core_rager;
|
||||||
creators["mc majordomo shadow resistance"] = &RaidMcActionContext::majordomo_shadow_resistance;
|
creators["mc majordomo shadow resistance"] = &RaidMcActionContext::majordomo_shadow_resistance;
|
||||||
creators["mc ragnaros fire resistance"] = &RaidMcActionContext::ragnaros_fire_resistance;
|
creators["mc ragnaros fire resistance"] = &RaidMcActionContext::ragnaros_fire_resistance;
|
||||||
|
creators["mc core hound mark"] = &RaidMcActionContext::core_hound_mark;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -44,6 +45,7 @@ private:
|
|||||||
static Action* golemagg_assist_tank_attack_core_rager(PlayerbotAI* botAI) { return new McGolemaggAssistTankAttackCoreRagerAction(botAI); }
|
static Action* golemagg_assist_tank_attack_core_rager(PlayerbotAI* botAI) { return new McGolemaggAssistTankAttackCoreRagerAction(botAI); }
|
||||||
static Action* majordomo_shadow_resistance(PlayerbotAI* botAI) { return new BossShadowResistanceAction(botAI, "majordomo executus"); }
|
static Action* majordomo_shadow_resistance(PlayerbotAI* botAI) { return new BossShadowResistanceAction(botAI, "majordomo executus"); }
|
||||||
static Action* ragnaros_fire_resistance(PlayerbotAI* botAI) { return new BossFireResistanceAction(botAI, "ragnaros"); }
|
static Action* ragnaros_fire_resistance(PlayerbotAI* botAI) { return new BossFireResistanceAction(botAI, "ragnaros"); }
|
||||||
|
static Action* core_hound_mark(PlayerbotAI* botAI) { return new McCoreHoundMarkAction(botAI); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -212,3 +212,45 @@ bool McGolemaggAssistTankAttackCoreRagerAction::Execute(Event event)
|
|||||||
|
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Unit* McCoreHoundMarkAction::GetTarget()
|
||||||
|
{
|
||||||
|
Unit* highestHealthHound = nullptr;
|
||||||
|
for (auto const& [guid, ref] : bot->GetThreatMgr().GetThreatenedByMeList())
|
||||||
|
{
|
||||||
|
Unit* unit = ref->GetOwner();
|
||||||
|
if (unit && unit->IsAlive() && unit->GetEntry() == NPC_CORE_HOUND)
|
||||||
|
{
|
||||||
|
if (!highestHealthHound || unit->GetHealth() > highestHealthHound->GetHealth())
|
||||||
|
highestHealthHound = unit;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!highestHealthHound)
|
||||||
|
return nullptr;
|
||||||
|
|
||||||
|
Group* group = bot->GetGroup();
|
||||||
|
ObjectGuid currentSkullGuid = group ? group->GetTargetIcon(RtiTargetValue::skullIndex) : ObjectGuid::Empty;
|
||||||
|
if (!currentSkullGuid.IsEmpty() && currentSkullGuid != highestHealthHound->GetGUID())
|
||||||
|
{
|
||||||
|
// Only switch skull if the new target has meaningfully more health (10% buffer) to prevent rapid re-marking
|
||||||
|
if (Unit* currentSkullUnit = botAI->GetUnit(currentSkullGuid))
|
||||||
|
if (currentSkullUnit->IsAlive() && highestHealthHound->GetHealth() <= currentSkullUnit->GetHealth() * 1.10f)
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (currentSkullGuid.IsEmpty() || currentSkullGuid != highestHealthHound->GetGUID())
|
||||||
|
return highestHealthHound;
|
||||||
|
|
||||||
|
return nullptr;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool McCoreHoundMarkAction::Execute(Event /*event*/)
|
||||||
|
{
|
||||||
|
Unit* target = GetTarget();
|
||||||
|
if (!target)
|
||||||
|
return false;
|
||||||
|
|
||||||
|
bot->GetGroup()->SetTargetIcon(RtiTargetValue::skullIndex, bot->GetGUID(), target->GetGUID());
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|||||||
@ -64,4 +64,13 @@ public:
|
|||||||
bool Execute(Event event) override;
|
bool Execute(Event event) override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class McCoreHoundMarkAction : public Action
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
McCoreHoundMarkAction(PlayerbotAI* botAI, std::string const name = "mc core hound mark")
|
||||||
|
: Action(botAI, name) {};
|
||||||
|
Unit* GetTarget() override;
|
||||||
|
bool Execute(Event event) override;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -7,6 +7,9 @@ enum MoltenCoreNPCs
|
|||||||
{
|
{
|
||||||
// Golemagg
|
// Golemagg
|
||||||
NPC_CORE_RAGER = 11672,
|
NPC_CORE_RAGER = 11672,
|
||||||
|
|
||||||
|
// Core Hound (trash)
|
||||||
|
NPC_CORE_HOUND = 11671,
|
||||||
};
|
};
|
||||||
enum MoltenCoreSpells
|
enum MoltenCoreSpells
|
||||||
{
|
{
|
||||||
|
|||||||
@ -71,6 +71,11 @@ void RaidMcStrategy::InitTriggers(std::vector<TriggerNode*>& triggers)
|
|||||||
triggers.push_back(
|
triggers.push_back(
|
||||||
new TriggerNode("mc ragnaros fire resistance",
|
new TriggerNode("mc ragnaros fire resistance",
|
||||||
{ NextAction("mc ragnaros fire resistance", ACTION_RAID) }));
|
{ NextAction("mc ragnaros fire resistance", ACTION_RAID) }));
|
||||||
|
|
||||||
|
// Trash
|
||||||
|
triggers.push_back(
|
||||||
|
new TriggerNode("mc core hound mark",
|
||||||
|
{ NextAction("mc core hound mark", ACTION_RAID) }));
|
||||||
}
|
}
|
||||||
|
|
||||||
void RaidMcStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers)
|
void RaidMcStrategy::InitMultipliers(std::vector<Multiplier*>& multipliers)
|
||||||
|
|||||||
@ -25,6 +25,7 @@ public:
|
|||||||
creators["mc golemagg is assist tank"] = &RaidMcTriggerContext::golemagg_is_assist_tank;
|
creators["mc golemagg is assist tank"] = &RaidMcTriggerContext::golemagg_is_assist_tank;
|
||||||
creators["mc majordomo shadow resistance"] = &RaidMcTriggerContext::majordomo_shadow_resistance;
|
creators["mc majordomo shadow resistance"] = &RaidMcTriggerContext::majordomo_shadow_resistance;
|
||||||
creators["mc ragnaros fire resistance"] = &RaidMcTriggerContext::ragnaros_fire_resistance;
|
creators["mc ragnaros fire resistance"] = &RaidMcTriggerContext::ragnaros_fire_resistance;
|
||||||
|
creators["mc core hound mark"] = &RaidMcTriggerContext::core_hound_mark;
|
||||||
}
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
@ -43,6 +44,7 @@ private:
|
|||||||
static Trigger* golemagg_is_assist_tank(PlayerbotAI* botAI) { return new McGolemaggIsAssistTankTrigger(botAI); }
|
static Trigger* golemagg_is_assist_tank(PlayerbotAI* botAI) { return new McGolemaggIsAssistTankTrigger(botAI); }
|
||||||
static Trigger* majordomo_shadow_resistance(PlayerbotAI* botAI) { return new BossShadowResistanceTrigger(botAI, "majordomo executus"); }
|
static Trigger* majordomo_shadow_resistance(PlayerbotAI* botAI) { return new BossShadowResistanceTrigger(botAI, "majordomo executus"); }
|
||||||
static Trigger* ragnaros_fire_resistance(PlayerbotAI* botAI) { return new BossFireResistanceTrigger(botAI, "ragnaros"); }
|
static Trigger* ragnaros_fire_resistance(PlayerbotAI* botAI) { return new BossFireResistanceTrigger(botAI, "ragnaros"); }
|
||||||
|
static Trigger* core_hound_mark(PlayerbotAI* botAI) { return new McCoreHoundMarkTrigger(botAI); }
|
||||||
};
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
@ -38,3 +38,8 @@ bool McGolemaggIsAssistTankTrigger::IsActive()
|
|||||||
{
|
{
|
||||||
return AI_VALUE2(Unit*, "find target", "golemagg the incinerator") && PlayerbotAI::IsAssistTank(bot);
|
return AI_VALUE2(Unit*, "find target", "golemagg the incinerator") && PlayerbotAI::IsAssistTank(bot);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bool McCoreHoundMarkTrigger::IsActive()
|
||||||
|
{
|
||||||
|
return PlayerbotAI::IsMainTank(bot) && AI_VALUE2(Unit*, "find target", "core hound");
|
||||||
|
}
|
||||||
|
|||||||
@ -47,4 +47,11 @@ public:
|
|||||||
bool IsActive() override;
|
bool IsActive() override;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
class McCoreHoundMarkTrigger : public Trigger
|
||||||
|
{
|
||||||
|
public:
|
||||||
|
McCoreHoundMarkTrigger(PlayerbotAI* botAI) : Trigger(botAI, "mc core hound mark") {}
|
||||||
|
bool IsActive() override;
|
||||||
|
};
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user