<?php
/**
 * Created by PhpStorm.
 * User: Lopar
 * Date: 11.01.2019
 * Time: 18:21
 */

class ItemClass extends Item
{
    private function wrap($number)
    {
        if ($number > 0) return ": <b>" . $number . "</b>";
        else return ": <b style='color: maroon;'>" . $number . "</b>";
    }

    public function printStats()
    {
        echo $this->name . " (Масса: " . $this->massa . ")";
        if ($this->nalign) echo " <img src=i/align_{$this->nalign}.gif title='Этот предмет могут использовать только игроки с определённой склонностью.'> ";
        if ($this->count > 0) echo "<br><small>(Осталось: {$this->count} штук)</small>";
        if ($this->maxdur > 0) echo "<br>Долговечность: {$this->maxdur}";
        if ($this->maxdur == -1) echo "<br>Долговечность: <i>неразрушимо</i>";

        if ($this->nlevel > 0) echo "<br>Требуется уровень" . $this->wrap($this->nlevel);
        if ($this->nnoj > 0) echo "<br>Требуется владение колющим оружиием" . $this->wrap($this->nnoj);
        if ($this->ndubina > 0) echo "<br>Требуется владение дробящим оружием" . $this->wrap($this->ndubina);
        if ($this->ntopor > 0) echo "<br>Требуется владение рубящим оружием" . $this->wrap($this->ntopor);
        if ($this->nmech > 0) echo "<br>Требуется владение режущим оружием" . $this->wrap($this->nmech);
        if ($this->nsila > 0) echo "<br>Требуется сила" . $this->wrap($this->nsila);
        if ($this->nlovk > 0) echo "<br>Требуется ловкость" . $this->wrap($this->nlovk);
        if ($this->ninta > 0) echo "<br>Требуется интуиция" . $this->wrap($this->ninta);
        if ($this->nvinos > 0) echo "<br>Требуется выносливость" . $this->wrap($this->nvinos);
        if ($this->nintel > 0) echo "<br>Требуется интеллект" . $this->wrap($this->nintel);

        if ($this->gsila) echo "<br>Сила" . $this->wrap($this->gsila);
        if ($this->glovk) echo "<br>Ловкость" . $this->wrap($this->glovk);
        if ($this->ginta) echo "<br>Интуиция" . $this->wrap($this->ginta);
        if ($this->gintel) echo "<br>Интеллект" . $this->wrap($this->gintel);
        if ($this->minu AND $this->maxu) echo "<br>Урон: {$this->minu} - {$this->maxu}";
        if ($this->ghp) echo "<br>Здоровье" . $this->wrap($this->ghp);
        if ($this->gnoj) echo "<br>Владение колющим оружиием" . $this->wrap($this->gnoj);
        if ($this->gdubina) echo "<br>Владение дробящим оружием" . $this->wrap($this->gdubina);
        if ($this->gtopor) echo "<br>Владение рубящим оружием" . $this->wrap($this->gtopor);
        if ($this->gmech) echo "<br>Владение режущим оружием" . $this->wrap($this->gmech);

        echo "<br>";
    }

}