target = $target; if (!$this->isUsable()) { return $this->status; } $ok = null; $injury = $db->ofetch('SELECT effect_id, type, name FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ? ORDER BY type DESC LIMIT 1', $target); if (in_array($injury->type, [11, 12, 13, 14]) && $injuryType >= $injury->type) { $db->execute('DELETE FROM users_effects WHERE effect_id = ?', $injury->effect_id); if (empty($injury->name) || $injury->name == 'Неизвестный эффект') { $injuryName = self::$effectName[$injury->type]; } else { $injuryName = $injury->name; } $ok = "Вы вылечили повреждение ${injuryName} персонажу $this->login."; } elseif ($injury->effect_id && $injuryType == 15) { $db->execute('DELETE FROM users_effects WHERE type IN (11,12,13,14) AND owner_id = ?', $target); $ok = "Вы вылечили все повреждения персонажу $this->login."; } return $ok; } /** * Проверки на успех. * @return bool */ private function isUsable(): bool { $caster = new User($_SESSION['uid']); if ($this->target == $_SESSION['uid']) { $this->target = $caster; } else { $this->target = new User($this->target); } $this->login = $this->target->getLogin(); return ($this->isVisible($caster, $this->target) && $this->isNotDead($caster) && $this->enoughMana($caster) && $this->isNotInBattle($caster)); } }