2020-09-16 15:13:25 +00:00
|
|
|
<?php
|
|
|
|
# Date: 16.09.2020 (08:45)
|
2020-10-28 20:21:08 +00:00
|
|
|
namespace Battles\Magic;
|
2020-09-16 15:13:25 +00:00
|
|
|
class Magic
|
|
|
|
{
|
|
|
|
protected $status;
|
|
|
|
|
2021-01-25 17:59:55 +00:00
|
|
|
protected function isVisible($caster, $target):bool
|
2020-09-16 15:13:25 +00:00
|
|
|
{
|
|
|
|
if ($caster->battle != $target->battle || $caster->room != $target->room) {
|
|
|
|
$this->status = 'Вы не видите цель!';
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-25 17:59:55 +00:00
|
|
|
protected function isNotDead($caster):bool
|
2020-09-16 15:13:25 +00:00
|
|
|
{
|
|
|
|
if ($caster->health < 1) {
|
|
|
|
$this->status = 'Вы мертвы!';
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-25 17:59:55 +00:00
|
|
|
protected function enoughMana($caster):bool
|
2020-09-16 15:13:25 +00:00
|
|
|
{
|
|
|
|
if ($caster->mana < 1) {
|
|
|
|
$this->status = 'Недостаточно пыли!';
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-01-25 17:59:55 +00:00
|
|
|
protected function isNotInBattle($caster):bool
|
2020-09-16 15:13:25 +00:00
|
|
|
{
|
|
|
|
if ($caster->battle) {
|
|
|
|
$this->status = 'Невозможно применить в поединке!';
|
|
|
|
return false;
|
|
|
|
} else {
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|