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

45 lines
1.1 KiB
PHP
Raw Normal View History

<?php
namespace Magic\Elemental;
use Battle;
use DTO\BattleSpell;
use Helper\Math;
class Fire
{
private static string $magicElement = 'fire';
private Battle $btl;
2023-08-11 15:28:54 +00:00
public function __construct(Battle $btl)
{
$this->btl = $btl;
}
2023-01-10 16:29:32 +00:00
/** Вспышка. Приёмы: 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;
}
}