mirror of
https://github.com/ErikasKontenis/SabrehavenServer.git
synced 2025-10-14 06:34:55 +02:00
proper drowning implementation
This commit is contained in:
@@ -917,6 +917,13 @@ bool ConditionDamage::executeCondition(Creature* creature, int32_t)
|
||||
return false;
|
||||
}
|
||||
} else if (conditionType == CONDITION_DROWN) {
|
||||
if (isFirstCycle && count - max_count == -2) {
|
||||
doDamage(creature, -20);
|
||||
isFirstCycle = false;
|
||||
count = max_count;
|
||||
return true;
|
||||
}
|
||||
|
||||
const int32_t r_cycle = cycle;
|
||||
if (r_cycle) {
|
||||
if (count <= 0) {
|
||||
|
@@ -283,7 +283,7 @@ class ConditionDamage final : public Condition
|
||||
int32_t max_count = 0;
|
||||
int32_t factor_percent = -1;
|
||||
int32_t hit_damage = 0;
|
||||
|
||||
bool isFirstCycle = true;
|
||||
uint32_t owner = 0;
|
||||
|
||||
bool doDamage(Creature* creature, int32_t healthChange);
|
||||
|
@@ -1164,6 +1164,7 @@ void Player::onThink(uint32_t interval)
|
||||
addMessageBuffer();
|
||||
}
|
||||
|
||||
lastWalkingTime += interval;
|
||||
if (!getTile()->hasFlag(TILESTATE_NOLOGOUT) && !isAccessPlayer()) {
|
||||
idleTime += interval;
|
||||
const int32_t kickAfterMinutes = g_config.getNumber(ConfigManager::KICK_AFTER_MINUTES);
|
||||
|
14
src/player.h
14
src/player.h
@@ -286,6 +286,19 @@ class Player final : public Creature, public Cylinder
|
||||
|
||||
void resetIdleTime() {
|
||||
idleTime = 0;
|
||||
resetLastWalkingTime();
|
||||
}
|
||||
|
||||
int32_t getIdleTime() const {
|
||||
return idleTime;
|
||||
}
|
||||
|
||||
void resetLastWalkingTime() {
|
||||
lastWalkingTime = 0;
|
||||
}
|
||||
|
||||
int32_t getLastWalkingTime() const {
|
||||
return lastWalkingTime;
|
||||
}
|
||||
|
||||
bool isInGhostMode() const {
|
||||
@@ -1045,6 +1058,7 @@ class Player final : public Creature, public Cylinder
|
||||
int32_t bloodHitCount = 0;
|
||||
int32_t shieldBlockCount = 0;
|
||||
int32_t idleTime = 0;
|
||||
int32_t lastWalkingTime = 0;
|
||||
|
||||
uint16_t staminaMinutes = 3360;
|
||||
uint16_t maxWriteLen = 0;
|
||||
|
Reference in New Issue
Block a user