Рассчёт здоровья.

This commit is contained in:
Igor Barkov (iwork) 2020-07-10 11:08:00 +03:00
parent 2fa110c275
commit 2d73a57d31
1 changed files with 19 additions and 7 deletions

View File

@ -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 . '<br>' . $this->getStrength() . '<br>' . $this->getDexterity() . '<br>' . $this->getIntuition() . '<br>' . $this->getEndurance() . '<br>' . $this->getIntelligence() . '<br>' . $this->getWisdom() . '<br>' . $this->getRoomName($this->room);
if ($isMainWindow) {
$this->Bank = new Bank($this->id);
$captions = 'Уровень:<br>Сила:<br>Ловкость:<br>Интуиция:<br>Выносливость:<br>Интеллект:<br>Мудрость:<br>Опыт:<br>Очки характеристик:<br>Деньги:<br>Деньги в банке:';
$variables = $this->level . '<br>' . $this->getStrength(1) . '<br>' . $this->getDexterity(1) . '<br>' . $this->getIntuition(1) . '<br>' . $this->getEndurance(1) . '<br>' . $this->getIntelligence(1) . '<br>' . $this->getWisdom(1) . '<br>' . $this->experience . '<br>' . $this->stat_points . '<br>' . $this->money . '<br>' . $this->Bank->money;
$captions = 'Уровень:<br>Здоровье:<br>Сила:<br>Ловкость:<br>Интуиция:<br>Выносливость:<br>Интеллект:<br>Мудрость:<br>Опыт:<br>Очки характеристик:<br>Деньги:<br>Деньги в банке:';
$variables = $this->level . '<br>' . $this->health . '<br>' . $this->getStrength(1) . '<br>' . $this->getDexterity(1) . '<br>' . $this->getIntuition(1) . '<br>' . $this->getEndurance(1) . '<br>' . $this->getIntelligence(1) . '<br>' . $this->getWisdom(1) . '<br>' . $this->experience . '<br>' . $this->stat_points . '<br>' . $this->money . '<br>' . $this->Bank->money;
}
if ($this->align) {
@ -300,4 +307,9 @@ class User
}
return $sign ?? null;
}
public function getHealth(): int
{
return $this->health;
}
}