21 lines
835 B
C++
21 lines
835 B
C++
#ifndef VCORE_ADVENTURE_INTERACTION_POLICY_H
|
|
#define VCORE_ADVENTURE_INTERACTION_POLICY_H
|
|
#include <algorithm>
|
|
#include <cstdint>
|
|
#include <string>
|
|
namespace AdventureInteractionPolicy
|
|
{
|
|
constexpr std::int64_t LeaderTimeout=600;
|
|
inline float Willingness(std::string const& intent,float sociability)
|
|
{
|
|
float bias=intent=="rest"?-0.5f:intent=="profession"||intent=="economy"?-0.25f:
|
|
intent=="adventure"||intent=="instance"?0.2f:0.1f;
|
|
return std::max(0.0f,std::min(1.0f,sociability+bias));
|
|
}
|
|
inline bool CanLeave(bool alive,bool combat,bool dungeon,bool transport)
|
|
{return alive && !combat && !dungeon && !transport;}
|
|
inline bool LeaderExpired(std::int64_t now,std::int64_t lastActivity)
|
|
{return lastActivity>0 && now>=lastActivity && now-lastActivity>=LeaderTimeout;}
|
|
}
|
|
#endif
|