Files
Viano-Core/src/server/game/World/AdventureRecoveryPolicy.h
T
Nico 49712aadfe
GCC PCH / build (push) Waiting to run
clang PCH / build (push) Canceled after 0s
Improve AdventureBot travel recovery and destination eligibility
2026-10-29 11:10:27 +01:00

27 lines
774 B
C++

#ifndef VCORE_ADVENTURE_RECOVERY_POLICY_H
#define VCORE_ADVENTURE_RECOVERY_POLICY_H
#include <cstdint>
namespace AdventureRecoveryPolicy
{
struct DeathChain
{
std::int64_t Revived = 0;
unsigned QuickDeaths = 0;
bool NextGraveyard = false;
bool Died(std::int64_t now)
{
bool force=NextGraveyard;
if(force){QuickDeaths=0;NextGraveyard=false;}
else
{
QuickDeaths=Revived>0 && now>=Revived && now-Revived<=60?QuickDeaths+1:0;
if(QuickDeaths>=5)NextGraveyard=true;
}
Revived=0;return force;
}
};
inline bool Rescue(std::int64_t now,std::int64_t stalled,std::int64_t last,unsigned failures)
{return stalled>0 && now>=stalled+600 && failures>=5 && (!last || now>=last+1800);}
}
#endif