game/_incl_data/class/magic/Elemental/Fire.php
2023-01-10 18:30:35 +02:00

45 lines
1.1 KiB
PHP

<?php
namespace Magic\Elemental;
use Battle;
use Insallah\Math;
class Fire
{
private $btl;
private $color = '#a00';
private $colorCrit = '#f00';
private $colorMiss = '#909090';
public function __construct(Battle $btl)
{
$this->btl = $btl;
}
/** Вспышка. Приёмы: 34(8), 67(9), 68 (10), 69(11)
* @param $level
* @param $fireTargetMultiplier
* @return array
*/
public function Flash($level, $fireTargetMultiplier = 0)
{
$baseDamage = [
8 => [40, 40],
9 => [45, 45],
10 => [50, 50],
11 => [60, 60],
];
if (!is_numeric($fireTargetMultiplier)) {
$fireTargetMultiplier = 0;
}
$rawDamage = mt_rand($baseDamage[$level][0], $baseDamage[$level][1]);
$rawDamage = Math::addPercent($rawDamage, $fireTargetMultiplier);
return [
'name' => "Вспышка [$level]",
'damage' => $rawDamage,
'color' => $this->color,
'colorCrit' => $this->colorCrit,
'colorMiss' => $this->colorMiss,
];
}
}