fixed player health regen

This commit is contained in:
CPunch 2020-09-27 01:13:27 -05:00
parent 062302a7aa
commit f8f2088e38
2 changed files with 4 additions and 3 deletions

View File

@ -506,7 +506,6 @@ void MobManager::dealGooDamage(CNSocket *sock, int amount) {
} }
void MobManager::playerTick(CNServer *serv, time_t currTime) { void MobManager::playerTick(CNServer *serv, time_t currTime) {
static time_t lastHealTime = 0;
for (auto& pair : PlayerManager::players) { for (auto& pair : PlayerManager::players) {
CNSocket *sock = pair.first; CNSocket *sock = pair.first;
Player *plr = pair.second.plr; Player *plr = pair.second.plr;
@ -517,9 +516,10 @@ void MobManager::playerTick(CNServer *serv, time_t currTime) {
dealGooDamage(sock, 150); dealGooDamage(sock, 150);
// a somewhat hacky way tick goo damage faster than heal, but eh // a somewhat hacky way tick goo damage faster than heal, but eh
if (currTime - lastHealTime < 4000) if (currTime - plr->lastHealTime < 4000)
continue; continue;
lastHealTime = currTime;
plr->lastHealTime = currTime;
// heal // heal
if (!plr->inCombat && plr->HP < PC_MAXHEALTH(plr->level)) { if (!plr->inCombat && plr->HP < PC_MAXHEALTH(plr->level)) {

View File

@ -46,6 +46,7 @@ struct Player {
bool inCombat; bool inCombat;
bool dotDamage; bool dotDamage;
time_t lastHealTime;
int64_t aQuestFlag[16]; int64_t aQuestFlag[16];
int tasks[ACTIVE_MISSION_COUNT]; int tasks[ACTIVE_MISSION_COUNT];