2019-01-18 19:56:07 +00:00
|
|
|
|
<?php
|
|
|
|
|
|
2020-10-28 20:21:08 +00:00
|
|
|
|
namespace Battles\Magic;
|
2019-01-18 19:56:07 +00:00
|
|
|
|
|
2020-08-30 16:28:15 +00:00
|
|
|
|
use db;
|
|
|
|
|
|
2019-01-18 19:56:07 +00:00
|
|
|
|
class attack
|
|
|
|
|
{
|
|
|
|
|
private $target_user;
|
|
|
|
|
private $caster;
|
|
|
|
|
|
|
|
|
|
private function __construct($target_user_id)
|
|
|
|
|
{
|
2020-08-30 16:28:15 +00:00
|
|
|
|
if (!$this->caster) {
|
|
|
|
|
$this->caster = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $_SESSION['uid']);
|
|
|
|
|
}
|
|
|
|
|
if (!$this->target_user) {
|
|
|
|
|
$this->target_user = db::c()->query('SELECT * FROM `users` WHERE `id` = ?i', $target_user_id);
|
|
|
|
|
}
|
|
|
|
|
if ($this->checks() == 1) {
|
|
|
|
|
return 'Done!';
|
|
|
|
|
}
|
2019-01-18 19:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private function checks()
|
|
|
|
|
{
|
2020-08-30 16:28:15 +00:00
|
|
|
|
if ($this->caster['battle']) {
|
|
|
|
|
return 'Не в бою...';
|
|
|
|
|
}
|
|
|
|
|
else {
|
|
|
|
|
return 1;
|
|
|
|
|
}
|
2019-01-18 19:56:07 +00:00
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public static function id($playerId)
|
|
|
|
|
{
|
|
|
|
|
return new self($playerId);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
}
|