From df35ebe524ceca3f1fe803a75353c9e602bfd8bc Mon Sep 17 00:00:00 2001 From: lopar Date: Wed, 16 Sep 2020 18:38:18 +0300 Subject: [PATCH] =?UTF-8?q?=D0=9D=D0=B5=20=D0=BF=D0=B5=D1=80=D0=B5=D0=B4?= =?UTF-8?q?=D0=B0=D0=B2=D0=B0=D0=BB=D1=81=D1=8F=20target=20=D0=B2=20=D1=84?= =?UTF-8?q?=D1=83=D0=BD=D0=BA=D1=86=D0=B8=D0=B8.?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- magic/CureInjury.php | 10 +++++++--- magic/Healing.php | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/magic/CureInjury.php b/magic/CureInjury.php index e4279de..3c7aaa5 100644 --- a/magic/CureInjury.php +++ b/magic/CureInjury.php @@ -15,17 +15,21 @@ class CureInjury extends Magic */ public function __construct($target, $injuryType) { + $this->target = $target; if ($target && $this->isUsable()) { - $injury = db::c()->query('SELECT effect_id, type, name FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i ORDER BY type DESC LIMIT 1', $this->target->id)->fetch_object(); - if (in_array($injury->effect_id, [11,12,13,14]) && $injuryType >= $injury->type) { + $injury = db::c()->query('SELECT effect_id, type, name FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i ORDER BY type DESC LIMIT 1', $target)->fetch_object(); + $targetName = $this->target->login; + if (in_array($injury->effect_id, [11, 12, 13, 14]) && $injuryType >= $injury->type) { db::c()->query('DELETE FROM users_effects WHERE effect_id = ?i', $injury->effect_id); - $targetName = $this->target->login; if (empty($injury->name) || $injury->name == 'Неизвестный эффект') { $injuryName = self::$effectName[$injury->type]; } else { $injuryName = $injury->name; } return "Вы вылечили повреждение ${injuryName} персонажу ${targetName}."; + } elseif ($injury->effect_id && $injuryType == 15) { + db::c()->query('DELETE FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?i', $target); + return "Вы вылечили все повреждения персонажу ${targetName}."; } else { return false; } diff --git a/magic/Healing.php b/magic/Healing.php index 1755321..d4f91ad 100644 --- a/magic/Healing.php +++ b/magic/Healing.php @@ -15,6 +15,7 @@ class Healing extends Magic public function __construct($target, $power, $isPercentage = null) { $this->magicPower = $power; + $this->target = $target; if ($target && $this->isUsable()) { //TODO: Проверка на то, что магу хватает навыка владения школой магии. //IDEA: Можно добавить проверку на интеллект, где при определённом интеллекте шанс на успех становится 95-100%.