Merge pull request #841 from nolt/bot-behaviour

Make the server-side bots hold up as a population

(cherry picked from commit 88535b63a958fee9803d5fc3a4bdac5a3318d221)
This commit is contained in:
sven-n
2026-07-22 21:56:51 +02:00
committed by Acentech Dev
parent eb4c05eda2
commit e910845383
21 changed files with 1691 additions and 287 deletions

View File

@@ -5,6 +5,7 @@
namespace MUnique.OpenMU.GameLogic.Offline;
using MUnique.OpenMU.DataModel.Entities;
using MUnique.OpenMU.GameLogic.Bots;
using MUnique.OpenMU.GameLogic.MuHelper;
using MUnique.OpenMU.GameLogic.PlayerActions.Skills;
using MUnique.OpenMU.GameLogic.PlugIns;
@@ -114,7 +115,8 @@ public sealed class BuffHandler
}
var skillEntry = this._player.SkillList?.GetSkill((ushort)buffId);
if (skillEntry?.Skill?.MagicEffectDef is null)
if (skillEntry?.Skill?.MagicEffectDef is null
|| !this.CanCast(skillEntry.Skill))
{
continue;
}
@@ -132,6 +134,22 @@ public sealed class BuffHandler
return true;
}
/// <summary>
/// Whether the character currently meets the skill's own requirements, and can therefore cast it
/// at all. A character keeps its skills across a reset but not the level which unlocked them, so a
/// veteran back at level 12 still owns Swell Life, which asks for level 120.
/// <para>
/// Skipping it here is what keeps the whole helper running. A buff which targets the party goes
/// through the skill plugin, which refuses an unmet requirement deep inside and silently - and this
/// handler reports it as applied regardless. The buff step then ends every tick believing it had
/// just buffed, so the steps behind it, picking up loot and attacking, never ran at all: the
/// character stood in the world doing nothing, for good.
/// </para>
/// </summary>
/// <param name="skill">The skill to cast.</param>
private bool CanCast(Skill skill)
=> BotProgression.MeetsRequirements(skill, attribute => this._player.Attributes?[attribute]);
/// <summary>
/// Attempts to apply the buff to self and, if applicable, to party members.
/// </summary>