Fix stuck on knockback, enhance movement & flee and trap weave strats (#980)

* Hunter trap weave strats

* Do not allow actions to stack

* Remove trap weave by default

* Refactor on Engine

Co-authored-by: SaW <swerkhoven@outlook.com>

* Remove unused funcs in Queue

* Remove ExpireActionTime config

---------

Co-authored-by: SaW <swerkhoven@outlook.com>
This commit is contained in:
Yunfan Li
2025-02-18 22:55:44 +08:00
committed by GitHub
parent 6353c86b53
commit bb729e35b9
23 changed files with 173 additions and 81 deletions

View File

@@ -87,27 +87,23 @@ Engine::~Engine(void)
void Engine::Reset()
{
strategyTypeMask = 0;
ActionNode* action = nullptr;
do
{
action = queue.Pop();
if (!action)
break;
while ((action = queue.Pop()) != nullptr)
{
delete action;
} while (true);
}
for (std::vector<TriggerNode*>::iterator i = triggers.begin(); i != triggers.end(); i++)
for (TriggerNode* trigger : triggers)
{
TriggerNode* trigger = *i;
delete trigger;
}
triggers.clear();
for (std::vector<Multiplier*>::iterator i = multipliers.begin(); i != multipliers.end(); i++)
for (Multiplier* multiplier : multipliers)
{
Multiplier* multiplier = *i;
delete multiplier;
}
@@ -244,8 +240,13 @@ bool Engine::DoNextAction(Unit* unit, uint32 depth, bool minimal)
if (!actionExecuted)
LogAction("No actions executed");
ActionNode* action = nullptr;
while ((action = queue.Pop()) != nullptr)
{
delete action;
}
queue.RemoveExpired(); // Clean up expired actions in the queue
return actionExecuted;
}