Нормальный пул здоровья с обычным и максимальным значением. Обычное в базе, максимальное высчитывается формулой. Добавлен задел под ману, но формулы прассчёта пока нет.

This commit is contained in:
lopar 2020-08-29 21:14:33 +03:00
parent a718553a84
commit d28d8b4e10
2 changed files with 12 additions and 3 deletions

View File

@ -18,6 +18,8 @@ class User
public $endurance = 0;
public $intelligence = 0;
public $wisdom = 0;
public $health;
public $mana;
public $ip;
public $session_id;
public $admin = 0;
@ -40,7 +42,8 @@ class User
public $married = 'Someone или нет.';
public $experience = 200;
// Динамически рассчитываемые
public $health;
public $maxHealth = 5;
public $maxMana = 5;
//Статусы того, кто смотрит на информацию.
public $watcher_id;
protected $watcherIsAdmin;
@ -56,7 +59,7 @@ class User
$this->$key = $user_query[$key];
}
}
$this->health = round(($this->endurance * 3) + ($this->endurance / 2) * ($this->level - 1) + ($this->endurance / 5) * (($this->level - 1) * ($this->level - 2) / 2));
$this->maxHealth = round(($this->endurance * 3) + ($this->endurance / 2) * ($this->level - 1) + ($this->endurance / 5) * (($this->level - 1) * ($this->level - 2) / 2));
}
@ -393,7 +396,12 @@ class User
public function getHealth(): int
{
return $this->health;
return $this->health.'/'.$this->maxHealth;
}
public function getMana(): int
{
return $this->mana.'/'.$this->maxMana;
}
public function setRoom()

View File

@ -704,6 +704,7 @@ try {
<?php endif; ?>
<br>
Здоровье: <?= $showUser->getHealth() ?><br>
Пыль: <?= $showUser->getMana() ?><br>
Уворот: <?= $getItemsBonuses->getEvasionBonus() ?><br>
Точность: <?= $getItemsBonuses->getAccuracyBonus() ?><br>
Шанс крита: <?= $getItemsBonuses->getCriticalsBonus() ?><br>