Files
Viano-Core/src/server/game/World/AdventureCombatPolicy.h
T
Nico d6fea6ee68
clang PCH / build (push) Canceled after 0s
GCC PCH / build (push) Canceled after 0s
Add AdventureBot groups, raid preparation and shared travel
Implement native bot recruitment and player admission, leader-owned destinations, intent-specific capacities, preparation scheduling and shared graph and flight travel. Support native group instance visits and separate raid entrances.

Include pending personality-driven faction PvP and solo fleeing, preserving the absolute group fleeing exclusion. Add regression fixtures, migration, documentation and test-server evidence.
2026-10-28 15:00:41 +01:00

45 lines
2.0 KiB
C++

#ifndef VCORE_ADVENTURE_COMBAT_POLICY_H
#define VCORE_ADVENTURE_COMBAT_POLICY_H
#include <cstdint>
#include <cmath>
#include <string>
#include <algorithm>
namespace AdventureCombatPolicy
{
// Conservative initial tuning. Self-defence deliberately bypasses this filter.
constexpr unsigned MaxLevelAdvantage=2;
constexpr float MinimumHealth=60, MinimumMana=30, SearchRadius=20, PathCorridor=8;
inline bool SafeFirstAttack(unsigned level,unsigned enemy,float health,bool elite,
bool boss,unsigned nearbyHostiles,bool manaUser,float mana)
{
return enemy<=level+MaxLevelAdvantage && health>=MinimumHealth && !elite && !boss &&
nearbyHostiles<=1 && (!manaUser || mana>=MinimumMana);
}
inline bool ShouldFlee(bool grouped,float health,unsigned level,unsigned enemy,bool elite,bool boss)
{
return !grouped && (health<20 || (enemy>level && enemy-level>=6) ||
((elite || boss) && enemy>=level));
}
constexpr float PvPRadius=50;
inline bool PvPLevel(unsigned level,unsigned enemy)
{return level>enemy?level-enemy<=5:enemy-level<=5;}
inline float PvPWillingness(std::string const& intent,float adventure,float risk)
{
float weight=intent=="adventure"?1.0f:intent=="leisure"?0.35f:
intent=="social"?0.2f:intent=="profession"?0.15f:intent=="economy"?0.1f:0.0f;
return weight*std::max(0.0f,std::min(1.0f,adventure))*
std::max(0.0f,std::min(1.0f,risk));
}
inline bool CemeteryFallback(std::int64_t now,std::int64_t released,bool noPath)
{return noPath && released>0 && now>=released && now-released>=300;}
inline float SegmentDistance(float x,float y,float z,float ax,float ay,float az,float bx,float by,float bz)
{
float dx=bx-ax,dy=by-ay,dz=bz-az,length=dx*dx+dy*dy+dz*dz;
float t=length>0?((x-ax)*dx+(y-ay)*dy+(z-az)*dz)/length:0;
t=t<0?0:t>1?1:t;
dx=x-ax-t*dx;dy=y-ay-t*dy;dz=z-az-t*dz;
return std::sqrt(dx*dx+dy*dy+dz*dz);
}
}
#endif