From 2d73a57d318c909d24c22e59270512445838a59f Mon Sep 17 00:00:00 2001 From: "Igor Barkov (iwork)" Date: Fri, 10 Jul 2020 11:08:00 +0300 Subject: [PATCH] =?UTF-8?q?=D0=A0=D0=B0=D1=81=D1=81=D1=87=D1=91=D1=82=20?= =?UTF-8?q?=D0=B7=D0=B4=D0=BE=D1=80=D0=BE=D0=B2=D1=8C=D1=8F.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- classes/User.php | 26 +++++++++++++++++++------- 1 file changed, 19 insertions(+), 7 deletions(-) diff --git a/classes/User.php b/classes/User.php index ba030e7..2d9ebdd 100644 --- a/classes/User.php +++ b/classes/User.php @@ -26,9 +26,11 @@ class User public $block; public $shadow; // Пока несуществующие, для совместимости. - public $married ='Someone или нет.'; - public $experience=200; - public $stat_points =1; + public $married = 'Someone или нет.'; + public $experience = 200; + public $stat_points = 1; + // Динамически рассчитываемые + public $health; //Статусы того, кто смотрит на информацию. public $watcher_id; protected $watcherIsAdmin; @@ -44,12 +46,17 @@ 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)); + } /** * Отображает куклу персонажа (образ и слоты). - * @param int $isBattle - установить 1, если куклу нужно отобразить в поединке (показывает параметры при наведении на образ). - * @param int $isMain - установить 1, если куклу надо показать на странице игрока (по клику на предмет снимает его). + * + * @param int $isBattle - установить 1, если куклу нужно отобразить в поединке (показывает параметры при наведении + * на образ). + * @param int $isMain - установить 1, если куклу надо показать на странице игрока (по клику на предмет снимает + * его). * * @throws \Krugozor\Database\Mysql\Exception */ @@ -91,8 +98,8 @@ class User $variables = $this->level . '
' . $this->getStrength() . '
' . $this->getDexterity() . '
' . $this->getIntuition() . '
' . $this->getEndurance() . '
' . $this->getIntelligence() . '
' . $this->getWisdom() . '
' . $this->getRoomName($this->room); if ($isMainWindow) { $this->Bank = new Bank($this->id); - $captions = 'Уровень:
Сила:
Ловкость:
Интуиция:
Выносливость:
Интеллект:
Мудрость:
Опыт:
Очки характеристик:
Деньги:
Деньги в банке:'; - $variables = $this->level . '
' . $this->getStrength(1) . '
' . $this->getDexterity(1) . '
' . $this->getIntuition(1) . '
' . $this->getEndurance(1) . '
' . $this->getIntelligence(1) . '
' . $this->getWisdom(1) . '
' . $this->experience . '
' . $this->stat_points . '
' . $this->money . '
' . $this->Bank->money; + $captions = 'Уровень:
Здоровье:
Сила:
Ловкость:
Интуиция:
Выносливость:
Интеллект:
Мудрость:
Опыт:
Очки характеристик:
Деньги:
Деньги в банке:'; + $variables = $this->level . '
' . $this->health . '
' . $this->getStrength(1) . '
' . $this->getDexterity(1) . '
' . $this->getIntuition(1) . '
' . $this->getEndurance(1) . '
' . $this->getIntelligence(1) . '
' . $this->getWisdom(1) . '
' . $this->experience . '
' . $this->stat_points . '
' . $this->money . '
' . $this->Bank->money; } if ($this->align) { @@ -300,4 +307,9 @@ class User } return $sign ?? null; } + + public function getHealth(): int + { + return $this->health; + } } \ No newline at end of file