Commit Graph

44 Commits

Author SHA1 Message Date
SaW
27311b734d Revert "feat: Improve bot mount behavior to faster close distance between bot and master" (#1855)
Reverts mod-playerbots/mod-playerbots#1760

This, as it is causing issues in BG, where bots just don't dismount and
just stand there instead.

<img width="2336" height="1374" alt="image"
src="https://github.com/user-attachments/assets/b61d7a77-1561-4f05-a438-edbb9321e113"
/>
2025-11-18 20:06:24 +01:00
Tecc
05057ae9b5 feat: Improve bot mount behavior to faster close distance between bot and master (#1760)
# Fix bot mount behavior when master dismounts

## Summary

Improves bot mount/dismount logic to ensure better coordination with the
master player. The bot now remains mounted when closing distance to a
recently dismounted master and mounts up to assist the master in combat.

The changes have been tested using the testcases described in the second
half of the PR description, which provide some directions on how this PR
can be tested and verified.

Closes: #1660

## Changes

- Add masterInCombat variable to track master combat state
- Modify target-based logic to consider master combat state
- Change mount priority when bot is not in combat to favor
master-following
- Remove combatReach from distance calculations (duplicate)

## Implementation

Added two methods:
- `StayMountedToCloseDistance()` - prevents premature dismounting when
the master dismounts
- `ShouldMountToCloseDistance()` - determines when to mount for master
assistance, even if master is not mounted at this time

Modified Execute() method:
- Target-based shouldMount/shouldDismount considers the master's combat
state
- Combat assistance logic separated from general following
- Mount when master in combat, but the bot is not

Distance logic:
- Combat: dismount at CalculateDismountDistance() (18-25 yards)
- Non-combat: dismount at 10 yards
- Mount threshold: 21+ yards

## Result
- Bots mount to assist masters in combat
- Bots stay mounted longer during travel
- Different dismount distances based on context
- Existing mount selection logic unchanged


# Mount Behavior Testing

## Prerequisites

1. Add a test bot: `.playerbots bot add <charactername>` or `.playerbots
bot addclass <class>`
2. Test in a level-appropriate outdoor area (mobs should not die with
one hit, as this makes testing combat assistance impossible)
3. Both master and bot must have mounts available

## Test 1: Combat Assistance Mounting

**Objective**: Verify bot mounts to assist the master in combat

**Detailed Steps**:
1. Position both master and bot dismounted
2. Command bot to stay: `/w <botname> stay`
3. Move master 35+ yards away from bot
4. Target a nearby mob and attack the mob
5. Command bot to assist: `/w <botname> follow`

**Expected Results**:
- Bot immediately mounts up (within 1-2 seconds cast time)
- Bot rides toward master while mounted
- Bot dismounts at ~18-25 yards from master/mob
- Bot engages in combat to assist

**Failure Indicators**:
- Bot runs dismounted (old behavior)
- Bot never mounts despite distance
- Bot mounts but doesn't dismount at proper assist range

## Test 2: Non-Combat Dismount Distance

**Objective**: Verify bot stays mounted longer during peaceful travel

**Detailed Steps**:
1. Both master and bot start dismounted
2. Mount up: use any mount
3. Verify bot also mounts: `/w <botname> follow`
4. Travel together for 10+ seconds to establish following
5. While moving, dismount master but continue running
6. Observe bot behavior as you move away

**Expected Results**:
- Bot stays mounted while master runs dismounted
- Bot only dismounts when within ~10 yards of master

## Test 3: Target Interference Prevention

**Objective**: Verify target selection doesn't prevent mounting when
master needs help

**Detailed Steps**:
1. Position bot 35+ yards from master: `/w <botname> stay` then move
away
2. Find a mob visible to both master and bot
3. Target the mob (do not attack): click on mob to select it
4. Verify bot can see the target: `/w <botname> attack` (bot should
respond about target)
5. Cancel bot attack: `/w <botname> follow`
6. Now attack the mob yourself (master enters combat)
7. Observe bot behavior immediately after master engages

**Expected Results**:
- Bot mounts up despite having the same target selected
- Bot rides toward combat area while mounted
- Bot dismounts at assist range (~18-25 yards)
- Target selection does not prevent proper mount behavior

**Failure Indicators**:
- Bot runs dismounted toward target (target interference)
- Bot doesn't mount because it's "focused on target"

## Test 4: Basic Mount Following

**Objective**: Verify fundamental mount matching still works

**Detailed Steps**:
1. Start both master and bot dismounted
2. Ensure bot is following: `/w <botname> follow`
3. Mount up on any available mount
4. Wait 2-3 seconds and observe bot
5. Test different mount speeds if available (60%, 100%, 280% speed)
6. Test dismounting and remounting

**Expected Results**:
- Bot mounts within 2-3 seconds of master mounting
- Bot uses appropriate mount speed to match master
- Bot dismounts when master dismounts (basic following)
- No regression in basic mount following behavior

## Test 5: Distance-Based Mounting Threshold

**Objective**: Verify bot mounts at efficient distance threshold (21+
yards)

**Detailed Steps**:
1. Both master and bot start dismounted in safe area (no mobs)
2. Command bot to stay: `/w <botname> stay`
3. Record starting position: `.gps`
4. Walk exactly 15 yards away (short distance)
5. Command bot to follow: `/w <botname> follow`
6. Observe: bot should run dismounted (distance too short)
7. Command bot to stay again: `/w <botname> stay`
8. Walk to 25+ yards away from bot
9. Record new position: `.gps`
10. Command bot to follow: `/w <botname> follow`

**Expected Results**:
- At 15 yards: Bot runs dismounted (inefficient to mount)
- At 25+ yards: Bot mounts up immediately (efficient distance)
- Distance threshold should be ~21 yards based on mount cast time
efficiency

**Distance Calculation**: Use coordinates from `.gps` to verify exact
distances

## Test 6: Druid Form Integration (Druid Master Required)

**Objective**: Verify druid form compatibility with mount system

**Detailed Steps**:
1. Master must be druid with travel form available
2. Start both dismounted: `/w <botname> follow`
3. Shift master to travel form
4. Observe bot response (should mount or shift if druid)
5. Travel together for 10+ seconds
6. Shift master to normal form while moving
7. Observe bot dismount behavior
8. If available, test flight form in appropriate zones

**Expected Results**:
- Druid bot: matches master's form (travel form)
- Non-druid bot: uses equivalent mount speed
- Form changes trigger appropriate bot responses
- Speed matching works between forms and mounts

## Test 7: Battleground Mount Behavior

**Objective**: Verify mount behavior works in PvP environments

**Detailed Steps**:
1. Queue for battleground with bot in party
2. Enter battleground together
3. Test basic mount following in BG
4. Test flag-carrying restrictions (WSG/EotS)
5. Test mounting during BG combat scenarios

**Expected Results**:
- Bot mounts appropriately in battlegrounds
- Flag carrying prevents mounting
- Combat assistance mounting still works in PvP
2025-11-16 22:49:12 +01:00
bashermens
610a032379 Bots fly/follow (movePoint core refactor), water walking fixes (#1825)
Closer the original solution, i dont wanna drift to much away without
really good reason. At this point i still see NPC and bots moving
through the levels or even falling out the levels here and there. I
verified whether the MovePoint signature changes and related params
itself in playerbots has anything todo with it, even when params are
hardcoded the behavior remains. It could be deeper problem, but for now
it seems core problem. Therefore i dont wanna change to much until the
dust has settled a bit in core itself.

I havent implemented moveTakeOff or moveLand which are basically
responsible for the transitions phases between ground and air visa
versa. I have version where i use takeOff for the animation, which means
moving vertical. For now i am gonna leave for what it is.

PS: also includes additional movement fix for AreaTriggerAction which we
missed first time after the core update on movements.

@Wishmaster117 Been testing and trying a lot in the background on find
solutions and causes. The general solutions remains removed some tweaks,
altered code here and there. With the general idea to keep closer to the
original code for now at least.

Testing:
- Class abilities: Slow fall (priest), Flight Form (druid) : Green
- BG: Green
- Swimming and walking shallow waters: Green
- Takeoff and land when following master: Green
- Boat and zeppelins: Green
- Flymount and ground walking: Green
- Water Walking (shaman), Path of Frost (DK): Green
- Water Walking (shaman), Path of Frost (DK) transisions; flying,
swimming, water walking: Green


Skipping pets when group water walking, path of frost, once core pathing
changes has settled more i will add it. Which is easy but i dont wanna
add more edge cases and code branches for now.
2025-11-16 22:39:46 +01:00
kadeshar
85c7009fe1 Codestyle fix (#1797)
Warning:
Dont change this PR as draft to make it testable


DONT REVIEW UNTIL Codestyle C++ workflow dont pass
2025-11-05 21:10:17 +01:00
bash
0cc15411c1 license update (#1674) 2025-09-30 15:19:44 +02:00
Tecc
b9dbfe9646 fix: Allow following master's mount state regardless of group leader in CheckMountStateAction 2025-09-27 22:50:14 +02:00
Revision
fcb956ec1b Removed unnecessary spaces 2025-09-19 22:43:50 +02:00
Boxhead78
309d177dd8 Battleground Rewrite
- Refactored BattleGroundTactics.cpp
- Bots choose strategies to determine if they are more aggressive or defensive in objectives
- Largely improved bots tactics in WSG, AB, AV and EY
- Improved how bots chase flag carriers
- Fixed some bots stuck in action loops - especially in WSG and AV
- Fixed several other Bugs
2025-07-03 08:25:55 +02:00
SaW
28be2b13c3 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.
2025-03-20 19:53:56 +01:00
SaW
4f43600e7a Silence error if preferred mounts SQL table playerbots_preferred_mounts does not exist (#1062)
* Fix error spam if DB does not exist
2025-03-06 15:03:23 +01:00
SaW
b9747fdd69 Reinstate cached preferred mounts (#1058) 2025-03-05 17:24:54 +01:00
SaW
bf22f20997 Fix: Bots not mounting in BG's anymore (#1056)
Bots didn't stop as they were supposed to, leading to some issues.
2025-03-04 13:42:41 +01:00
SaW
fe21dfe48e Fix/Feature: Bots can use travel/flight Shapeshift where appropriate (#1042) 2025-03-03 15:10:35 +01:00
SaW
6cb1599b52 CheckMountStateAction refactor Final (#960)
- Fix for the issue that bots occasionally moved awkward when mounted inside BG's
- Removed redundant mount data retrieval
- Removed redundant extra check on if carrying a flag (already covered in isUseful)
- Removed no longer necessary code
- Combined some conditions as having them separate made little sense anymore
- Moved checking carrying flag into the BG logic
2025-02-11 11:39:29 +01:00
SaW
e07a9e194a MSA Improvement Part 2 (#66) (#933)
Reduce iterations.
2025-02-01 20:23:25 +01:00
avirar
247c67e449 CheckMountStateAction: Added SPELL_AURA_TRANSFORM and IsInDisallowedMountForm (#923)
Resolved issue where bots are transformed (e.g Deathbringer's Will trinket) and would stand still attempting to mount, still allows mounting when the transform allows it (e.g Pirate Costume, Transporter Malfunction)
2025-01-29 12:37:24 +01:00
SaW
f52f999c09 Refactor of the CheckMountStateAction class (#919)
* Update CheckMountStateAction.cpp

The refactoring focused on improving readability, reducing redundancy, and optimizing performance where possible.

* Update CheckMountStateAction.h

* Update CheckMountStateAction.cpp

* Update CheckMountStateAction.cpp

* Update CheckMountStateAction.cpp

* Update CheckMountStateAction.h

* Fix lowest level mount from config

* Properly fix

* Reduced masterInShapeshiftForm lookups to 1

Reduced masterInShapeshiftForm lookups to 1

* Fix for missing useFastGroundMountAtMinLevel

* Final commit: Ensure max 99 speed in BG
2025-01-28 09:08:21 +01:00
valsan-azerty-boi
f95e812d26 add bot mount in conf 2025-01-05 21:55:13 +01:00
SaW
848401be67 Make bots use mounts when player is in travel form as well (#806)
Addition to https://github.com/liyunfan1223/mod-playerbots/pull/805
2024-12-21 17:22:06 +01:00
SaW
99dd094a5b Feature: Bots use flying mounts when player has flight form (#805)
* Make bots use flying mounts when player goes into flight form

* add && !bot->InBattleground() check

* Final commit
2024-12-21 13:33:47 +01:00
Bobblybook
a430786133 Reapply "Preferred mount selection for bots"
This reverts commit eb5dd450cd.
2024-10-19 22:44:11 +11:00
Bobblybook
eb5dd450cd Revert "Preferred mount selection for bots"
This reverts commit 312c661311.
2024-10-19 22:42:21 +11:00
Bobblybook
312c661311 Preferred mount selection for bots
Added a new table to store user-specified mount ids.
Can specify flying and ground mounts for a character which will prioritise that mount. If multiple entries, a random entry will be selected from that list.

Currently no way to add entries other than manual DB editing, but can be developed into a whisper command pretty easily.

This should gracefully fail (if no entries exist for the character, or the db table does not exist) and fallback to the default random selection as usual.
2024-10-19 22:40:26 +11:00
Bobblybook
1165442505 Winged Steed of the Ebon Blade northrend fix
Winged Steed of the Ebon Blade gets incorrectly categorised as a ground mount, causes issues and bots will not be able to ground mount if they have this mount in the account spellbook.

There may by other scaling mounts that have the same issue, either we blacklist them all or figure out a way to correctly read them as flyers.
2024-10-19 18:16:44 +11:00
Fuzz
87cbaa9527 bot will no longer mount to reach target within 21 units (as this is the distance at which the time taken to cast mount spell is more than the time saved by moving faster), warrior bot will now dismount with enough distance to perform charge (rather than right infront of target which real warrior wouldnt do) 2024-08-20 16:32:08 +10:00
Fuzz
bb34a09afe fixed bug I introduced in f87c87f5d4 where bots wont dismount when they should 2024-08-20 16:25:28 +10:00
Fuzz
f87c87f5d4 fix for bots trying to mount in WSG and AV tunnels 2024-08-15 21:26:09 +10:00
Yunfan Li
7b0bb20078 Movement priority 2024-08-14 18:37:21 +08:00
Yunfan Li
1a92743dfd Allow spell casting during movement 2024-08-05 10:37:33 +08:00
Yunfan Li
de37cfd5aa Code style 2024-08-04 23:44:24 +08:00
Yunfan Li
fe94083a3f Dismount distance check 2024-08-04 23:35:55 +08:00
Yunfan Li
d33c565e31 Check mount state 2024-08-04 23:34:28 +08:00
Yunfan Li
53611c9040 Run clang-format 2024-08-04 10:23:36 +08:00
Yunfan Li
54c06887d5 Enable mount for random bots 2024-08-03 00:02:34 +08:00
Fuzz
c69d828a51 Merge branch 'master' into more-av-fixes 2024-07-22 14:26:01 +10:00
Fuzz
6417e836e1 [BattleGrounds] Bots no longer needlessly dismount in BG's when near a creature (eg: AV rams). AV: attacking bots now concentrate on final GY and boss when all enemy towers are down (prevents them running back to previous GY's when they should just down the boss), attacking bots now try to get first enemy GY before first tower (helps alliance), bots respawning in cave starting area's now leave cave before selecting path (they were making bad selections due to all paths starting too far away from spawn point, defending horde bots would try to clip through walls and go directly to horde base GY), new path to get from horde cave to horde base (prevents horde defenders trying to scale the hills/walls to get in), overall balance between teams much improved. new playerbots debug bg commands (that I used to develop/test these changes) 2024-07-22 09:02:00 +10:00
Revision
838bfe333d Fix: Updated to work with newer commits of AzerothCore 2024-07-22 00:39:06 +02:00
Yunfan Li
ac6f7a1e98 init=auto 2023-10-05 00:59:08 +08:00
Yunfan Li
5f5faf00cd move & knockback 2023-09-02 10:43:13 +08:00
Yunfan Li
25da0af70e tank target, formation arrow, mount fix, miscs 2023-06-02 15:49:49 +08:00
Yunfan Li
0fa640959f mount state 2023-05-30 17:09:55 +08:00
Yunfan Li
09463feb8f movement, disable hearthstone 2023-05-27 23:59:59 +08:00
Yunfan Li
5d570a81a0 feat: fix initialization 2023-05-27 13:59:37 +08:00
UltraNix
b952636f0d Big update. 2022-03-12 22:27:09 +01:00