Files
Viano-Core/src/server/game/World/AdventurePopulationPolicy.h
T
Nico d3273c677e
clang PCH / build (push) Canceled after 0s
GCC PCH / build (push) Canceled after 0s
Implement AdventureBot profiles, daily planning and population management
2026-10-28 18:22:13 +01:00

18 lines
821 B
C++

#ifndef VCORE_ADVENTURE_POPULATION_POLICY_H
#define VCORE_ADVENTURE_POPULATION_POLICY_H
#include <array>
#include <algorithm>
#include <cstdint>
namespace AdventurePopulationPolicy
{
constexpr unsigned Pool(unsigned faction,bool persistent){return (faction==2?2:0)+(persistent?0:1);}
constexpr unsigned Faction(unsigned pool){return pool<2?1:2;}
constexpr bool Persistent(unsigned pool){return pool%2==0;}
inline bool Replace(bool persistent,bool offline,bool considered,std::int64_t age,std::int64_t minimumAge,
double sample,double chance)
{return !persistent && offline && !considered && age>=minimumAge && sample<std::clamp(chance,0.0,1.0);}
inline unsigned Deficit(unsigned target,unsigned online,unsigned loading)
{return target>online+loading?target-online-loading:0;}
}
#endif