27 lines
774 B
C++
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
|