game/_incl_data/class/Magic/Elemental/Fire.php

44 lines
1.0 KiB
PHP

<?php
namespace Magic\Elemental;
use DTO\BattleSpell;
use Helper\Math;
class Fire
{
private static string $magicElement = 'fire';
private Battle $btl;
public function __construct(Battle $btl)
{
$this->btl = $btl;
}
/** Вспышка. Приёмы: 34(8), 67(9), 68 (10), 69(11)
* @param int $level
* @param int $fireTargetMultiplier
* @return BattleSpell
*/
public function flash(int $level, int $fireTargetMultiplier = 0): BattleSpell
{
$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);
$spell = new BattleSpell(self::$magicElement);
$spell->name = "Вспышка [$level]";
$spell->damage = $rawDamage;
return $spell;
}
}