2022-08-11 10:38:38 +00:00
|
|
|
<?php
|
|
|
|
|
|
|
|
namespace Magic\Elemental;
|
|
|
|
|
2022-08-25 11:23:36 +00:00
|
|
|
use Battle;
|
2023-08-14 15:15:05 +00:00
|
|
|
use DTO\BattleSpell;
|
|
|
|
use Helper\Math;
|
2022-08-11 10:38:38 +00:00
|
|
|
|
|
|
|
class Fire
|
|
|
|
{
|
2023-08-14 15:15:05 +00:00
|
|
|
private static string $magicElement = 'fire';
|
|
|
|
private Battle $btl;
|
2023-08-11 15:28:54 +00:00
|
|
|
|
2022-08-25 11:23:36 +00:00
|
|
|
public function __construct(Battle $btl)
|
2022-08-11 10:38:38 +00:00
|
|
|
{
|
|
|
|
$this->btl = $btl;
|
|
|
|
}
|
|
|
|
|
2023-01-10 16:29:32 +00:00
|
|
|
/** Вспышка. Приёмы: 34(8), 67(9), 68 (10), 69(11)
|
2023-08-14 15:15:05 +00:00
|
|
|
* @param int $level
|
|
|
|
* @param int $fireTargetMultiplier
|
|
|
|
* @return BattleSpell
|
2022-08-11 10:38:38 +00:00
|
|
|
*/
|
2023-08-14 15:15:05 +00:00
|
|
|
public function flash(int $level, int $fireTargetMultiplier = 0): BattleSpell
|
2022-08-11 10:38:38 +00:00
|
|
|
{
|
|
|
|
$baseDamage = [
|
|
|
|
8 => [40, 40],
|
|
|
|
9 => [45, 45],
|
|
|
|
10 => [50, 50],
|
|
|
|
11 => [60, 60],
|
|
|
|
];
|
2023-08-14 15:15:05 +00:00
|
|
|
|
2022-08-11 10:38:38 +00:00
|
|
|
if (!is_numeric($fireTargetMultiplier)) {
|
|
|
|
$fireTargetMultiplier = 0;
|
|
|
|
}
|
|
|
|
$rawDamage = mt_rand($baseDamage[$level][0], $baseDamage[$level][1]);
|
|
|
|
$rawDamage = Math::addPercent($rawDamage, $fireTargetMultiplier);
|
2023-08-14 15:15:05 +00:00
|
|
|
|
|
|
|
$spell = new BattleSpell(self::$magicElement);
|
|
|
|
$spell->name = "Вспышка [$level]";
|
|
|
|
$spell->damage = $rawDamage;
|
|
|
|
return $spell;
|
2022-08-11 10:38:38 +00:00
|
|
|
}
|
2023-08-14 15:15:05 +00:00
|
|
|
}
|