Проверки на успех вынесены в отдельный родительский класс.

This commit is contained in:
lopar 2020-09-16 18:13:25 +03:00
parent 77b4f2b7f5
commit 95673bfc0c
2 changed files with 48 additions and 0 deletions

47
classes/Magic.php Normal file
View File

@ -0,0 +1,47 @@
<?php
# Date: 16.09.2020 (08:45)
class Magic
{
protected $status;
protected function isVisible($caster, $target)
{
if ($caster->battle != $target->battle || $caster->room != $target->room) {
$this->status = 'Вы не видите цель!';
return false;
} else {
return true;
}
}
protected function isNotDead($caster)
{
if ($caster->health < 1) {
$this->status = 'Вы мертвы!';
return false;
} else {
return true;
}
}
protected function enoughMana($caster)
{
if ($caster->mana < 1) {
$this->status = 'Недостаточно пыли!';
return false;
} else {
return true;
}
}
protected function isNotInBattle($caster)
{
if ($caster->battle) {
$this->status = 'Невозможно применить в поединке!';
return false;
} else {
return true;
}
}
}

View File

@ -3,6 +3,7 @@
class Healing extends Magic class Healing extends Magic
{ {
private $target;
private $magicPower; private $magicPower;
/** /**