WIP: new battle
This commit is contained in:
@@ -32,8 +32,11 @@ class Fighter
|
||||
private int $firedefence;
|
||||
private int $earthdefence;
|
||||
private int $armor;
|
||||
public function __construct(private readonly int $id, private readonly int $team) {
|
||||
$u = User::start($id);
|
||||
private int $team;
|
||||
|
||||
public function __construct(private readonly int $id)
|
||||
{
|
||||
$u = User::start($id, true);
|
||||
$this->obraz = $u->info['sex'] . DIRECTORY_SEPARATOR . $u->info['obraz'];
|
||||
$this->login = $u->info['login'];
|
||||
$this->level = $u->info['level'];
|
||||
@@ -41,8 +44,8 @@ class Fighter
|
||||
$this->mana = $u->stats['mpNow'];
|
||||
$this->maxlife = $u->stats['hpAll'];
|
||||
$this->maxmana = $u->stats['mpAll'];
|
||||
$this->damage = 100500;
|
||||
$this->armor = 35;
|
||||
$this->damage = mt_rand(0, 100);
|
||||
$this->armor = mt_rand(0, 5);
|
||||
$this->damageMultiplier = $u->stats['m10'];
|
||||
$this->critChance = $u->stats['m1'];
|
||||
$this->critMultiplier = $u->stats['m3'];
|
||||
@@ -58,37 +61,49 @@ class Fighter
|
||||
$this->waterdefence = $u->stats['zm3'];
|
||||
$this->firedefence = $u->stats['zm1'];
|
||||
$this->earthdefence = $u->stats['zm4'];
|
||||
$this->team = $u->info['team'];
|
||||
unset($u);
|
||||
}
|
||||
|
||||
public function get(): object
|
||||
{
|
||||
return (object)[
|
||||
'damage' => $this->damage,
|
||||
'armor' => $this->armor + $this->defence,
|
||||
'health' => $this->life,
|
||||
'name' => $this->login,
|
||||
'crit' => $this->critChance,
|
||||
'evade' => $this->evadeChance,
|
||||
];
|
||||
}
|
||||
|
||||
public function __toString(): string
|
||||
{
|
||||
|
||||
$dmg = Math::addPercent($this->damage, $this->damageMultiplier);
|
||||
return <<<RETURN
|
||||
$this->login [$this->level] id:$this->id <br>
|
||||
Здоровье: $this->life / $this->maxlife <br>
|
||||
Мана: $this->mana / $this->maxmana <br>
|
||||
<img src="https://img.new-combats.tech/i/obraz/$this->obraz" alt=""><br>
|
||||
Урон: $this->damage + $this->damageMultiplier% = $dmg <br>
|
||||
Броня: $this->armor <br>
|
||||
Крит: $this->critChance% <br>
|
||||
Антикрит $this->anticritChance% <br>
|
||||
Мощность крита $this->critMultiplier% <br>
|
||||
Уровот $this->evadeChance% <br>
|
||||
Антиуворот $this->antievadeChance% <br>
|
||||
Контрудар $this->counterstrikeChance% <br>
|
||||
Парирование $this->parryChance% <br>
|
||||
Блок щитом $this->shieldblockChance% <br>
|
||||
Игнор брони $this->ignoreArmorChance% <br>
|
||||
Защита от урона $this->defence <br>
|
||||
Зашита от огня $this->firedefence <br>
|
||||
Защита от воды $this->waterdefence <br>
|
||||
Защита от воздуха $this->airdefence <br>
|
||||
Защита от земли $this->earthdefence <br><br>
|
||||
Сражается за команду: $this->team
|
||||
RETURN;
|
||||
|
||||
$this->login [$this->level] <a href="/info/$this->id" target="_blank">id:$this->id</a> <br>
|
||||
Здоровье: $this->life / $this->maxlife <br>
|
||||
Мана: $this->mana / $this->maxmana <br><hr>
|
||||
<!-- <img src="https://img.new-combats.tech/i/obraz/$this->obraz" alt=""><br>-->
|
||||
Урон: $this->damage + $this->damageMultiplier% = $dmg <br>
|
||||
Броня: $this->armor <br><hr>
|
||||
Крит: $this->critChance% <br>
|
||||
Антикрит $this->anticritChance% <br>
|
||||
Мощность крита $this->critMultiplier% <br>
|
||||
Уровот $this->evadeChance% <br>
|
||||
Антиуворот $this->antievadeChance% <br>
|
||||
Контрудар $this->counterstrikeChance% <br>
|
||||
<!-- Парирование $this->parryChance% <br>-->
|
||||
<!-- Блок щитом $this->shieldblockChance% <br>-->
|
||||
<!-- Игнор брони $this->ignoreArmorChance% <br>-->
|
||||
Защита от урона $this->defence <br>
|
||||
Зашита от огня $this->firedefence <br>
|
||||
Защита от воды $this->waterdefence <br>
|
||||
Защита от воздуха $this->airdefence <br>
|
||||
Защита от земли $this->earthdefence <br><hr>
|
||||
Сражается за команду: $this->team
|
||||
RETURN;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user