Документирование Healing.php, смена имени чтобы соответствовать стандарту.
This commit is contained in:
@@ -6,11 +6,19 @@ class Healing
|
||||
{
|
||||
private $target;
|
||||
private $magicPower;
|
||||
private $status = null;
|
||||
private $status;
|
||||
private $isPercentage;
|
||||
|
||||
/**
|
||||
* Магия лечения.
|
||||
* @param $target - кого лечим.
|
||||
* @param $power - на сколько лечим.
|
||||
* @param null $isPercentage - если включён, считает $power в процентах, иначе, по-умочанию просто как число.
|
||||
*/
|
||||
public function __construct($target, $power, $isPercentage = null)
|
||||
{
|
||||
$this->magicPower = $power;
|
||||
$this->isPercentage = $isPercentage;
|
||||
if ($target && $this->isUsable()) {
|
||||
//TODO: Проверка на то, что магу хватает навыка владения школой магии.
|
||||
//IDEA: Можно добавить проверку на интеллект, где при определённом интеллекте шанс на успех становится 95-100%.
|
||||
@@ -20,6 +28,10 @@ class Healing
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Проверки на успех.
|
||||
* @return bool
|
||||
*/
|
||||
private function isUsable()
|
||||
{
|
||||
$caster = new User($_SESSION['uid']);
|
||||
@@ -37,9 +49,14 @@ class Healing
|
||||
return true;
|
||||
}
|
||||
|
||||
private function useSpell($isPercentage)
|
||||
/**
|
||||
* Применение заклинания.
|
||||
* @return string
|
||||
* @throws \Krugozor\Database\Mysql\Exception
|
||||
*/
|
||||
private function useSpell()
|
||||
{
|
||||
if ($isPercentage) {
|
||||
if ($this->isPercentage) {
|
||||
$healHealthAmount = $this->target->health + $this->target->maxHealth / 100 * $this->magicPower;
|
||||
} else {
|
||||
$healHealthAmount = $this->target->health + $this->magicPower;
|
||||
Reference in New Issue
Block a user