Optimize Mountaction: Movement Logic with Early Return for Matching F… (#1099)

* Optimize Mountaction: Movement Logic with Early Return for Matching Forms or Speed

Added a missing check, so if both master and bot are in matching forms or master is mounted with corresponding speed, early return as there is nothing to do.

This improves logic, actions, and prevents some strange movement behavior when both master and bot already are in travel form.
This commit is contained in:
SaW
2025-03-20 19:53:56 +01:00
committed by GitHub
parent 3d6d454337
commit 28be2b13c3

View File

@@ -237,6 +237,13 @@ bool CheckMountStateAction::TryForms(Player* master, int32 masterMountType, int3
if (!master)
return false;
// If both master and bot are in matching forms or master is mounted with corresponding speed, nothing to do
else if
((masterInShapeshiftForm == FORM_TRAVEL && botInShapeshiftForm == FORM_TRAVEL) ||
((masterInShapeshiftForm == FORM_FLIGHT || (masterMountType == 1 && masterSpeed == 149)) && botInShapeshiftForm == FORM_FLIGHT) ||
((masterInShapeshiftForm == FORM_FLIGHT_EPIC || (masterMountType == 1 && masterSpeed == 279)) && botInShapeshiftForm == FORM_FLIGHT_EPIC))
return true;
// Check if master is in Travel Form and bot can do the same
if (botAI->CanCastSpell(SPELL_TRAVEL_FORM, bot, true) &&
masterInShapeshiftForm == FORM_TRAVEL && botInShapeshiftForm != FORM_TRAVEL)