2022-12-19 20:22:19 +00:00
< ? php
2023-12-19 01:58:37 +00:00
use Battle\Finish ;
use Battle\Helper ;
2023-12-17 02:32:09 +00:00
use Battle\Log ;
use Clan\ClanInfo ;
2023-03-31 16:54:33 +00:00
use Core\Config ;
use Core\Db ;
2023-08-14 15:15:05 +00:00
use Helper\Conversion ;
2023-12-17 02:32:09 +00:00
use User\Effects ;
2023-08-14 15:15:05 +00:00
use User\ItemsModel ;
2023-12-19 01:58:37 +00:00
use User\Stats ;
2023-03-31 16:54:33 +00:00
2022-12-19 20:22:19 +00:00
class Battle
{
2022-12-30 19:03:37 +00:00
public array $mncolor = [
2022-12-19 20:22:19 +00:00
1 => '006699' ,
2 => '006699' ,
3 => '006699' ,
4 => '006699' ,
5 => '006699' ,
6 => '006699' ,
7 => '006699' ,
2023-01-10 16:29:32 +00:00
]; //не крит
2022-12-30 19:03:37 +00:00
public array $mcolor = [
2022-12-19 20:22:19 +00:00
1 => 'A00000' ,
2 => '008080' ,
3 => '0000FF' ,
4 => 'A52A2A' ,
5 => '006699' ,
6 => '006699' ,
7 => '006699' ,
2023-01-10 16:29:32 +00:00
]; //не крит
2022-12-30 19:03:37 +00:00
public array $mname = [
2023-01-10 16:29:32 +00:00
'огонь' => 1 ,
'воздух' => 2 ,
'вода' => 3 ,
'земля' => 4 ,
'свет' => 5 ,
'тьма' => 6 ,
'серая' => 7 ,
2022-12-19 20:22:19 +00:00
];
2023-12-17 02:32:09 +00:00
/**
* act : 1 - когда персонаж получает повреждение
* 2 - когда персонаж наносит удар
*
* type_of : 1 - уворот
* 2 - крит
* 3 - атака
* 4 - защита
* 5 - прочее
* @ var array | array []
*/
private array $prm = [
2023-01-10 16:29:32 +00:00
1 => [ 'name' => 'Прикрыться' , 'act' => 1 , 'type_of' => 5 ],
2 => [ 'name' => 'Вломить' , 'act' => 2 , 'type_of' => 3 ],
4 => [ 'name' => 'Сильный удар' , 'act' => 2 , 'type_of' => 3 ],
7 => [ 'name' => 'Активная защита' , 'act' => 1 , 'type_of' => 4 ],
290 => [ 'name' => 'Вытягивание души' , 'act' => 1 , 'type_of' => 4 ],
//Канализация
294 => [ 'name' => 'Зловонная Вода' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
295 => [ 'name' => 'Проткнуть' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
296 => [ 'name' => 'Гнилая Кровь' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
297 => [ 'name' => 'Собраться' , 'act' => 2 , 'type_of' => 0 , 'moment' => 3 ],
298 => [ 'name' => 'Приказ Слабости' , 'act' => 2 , 'type_of' => 3 ],
141 => [ 'name' => 'Призрачная защита' , 'act' => 2 , 'type_of' => 4 ],
147 => [ 'name' => 'Призрачный кинжал' , 'act' => 2 , 'type_of' => 4 ],
148 => [ 'name' => 'Призрачный топор' , 'act' => 2 , 'type_of' => 4 ],
149 => [ 'name' => 'Призрачный удар' , 'act' => 2 , 'type_of' => 4 ],
150 => [ 'name' => 'Призрачное лезвие' , 'act' => 2 , 'type_of' => 4 ],
142 => [ 'name' => 'Призрачный огонь' , 'act' => 2 , 'type_of' => 4 ],
144 => [ 'name' => 'Призрачный воздух' , 'act' => 2 , 'type_of' => 4 ],
146 => [ 'name' => 'Призрачная земля' , 'act' => 2 , 'type_of' => 4 ],
145 => [ 'name' => 'Призрачная вода' , 'act' => 2 , 'type_of' => 4 ],
8 => [ 'name' => 'Танец ветра' , 'act' => 1 , 'type_of' => 1 ],
9 => [ 'name' => 'Дикая удача' , 'act' => 2 , 'type_of' => 3 ],
10 => [ 'name' => 'Предвидение' , 'act' => 1 , 'type_of' => 1 ],
11 => [ 'name' => 'Удачный удар' , 'act' => 2 , 'type_of' => 3 ],
45 => [ 'name' => 'Полная защита' , 'act' => 1 , 'type_of' => 4 ],
47 => [ 'name' => 'Слепая удача' , 'act' => 2 , 'type_of' => 2 ],
48 => [ 'name' => 'Танец лезвий' , 'act' => 1 , 'type_of' => 1 ],
49 => [ 'name' => 'Второе дыхание' , 'act' => 1 , 'type_of' => 1 ],
138 => [ 'name' => 'Сокрушающий удар' , 'act' => 2 , 'type_of' => 3 ],
140 => [ 'name' => 'Абсолютная защита' , 'act' => 1 , 'type_of' => 4 ],
193 => [ 'name' => 'Усиленные удары' , 'act' => 2 , 'type_of' => 3 ],
204 => [ 'name' => 'Обречённость' , 'act' => 2 , 'type_of' => 0 , 'moment' => 3 ],
211 => [ 'name' => 'Агрессивная защита' , 'act' => 1 , 'type_of' => 4 ],
213 => [ 'name' => 'Коварный Уход' , 'act' => 1 , 'type_of' => 4 ],
215 => [ 'name' => 'Скрытая ловкость' , 'act' => 1 , 'type_of' => 1 ],
216 => [ 'name' => 'Скрытая сила' , 'act' => 2 , 'type_of' => 2 ],
217 => [ 'name' => 'Разгадать тактику' , 'act' => 2 , 'type_of' => 0 , 'moment' => 3 ],
219 => [ 'name' => 'Точный удар' , 'act' => 2 , 'type_of' => 3 ],
220 => [ 'name' => 'Ставка на опережение' , 'act' => 2 , 'type_of' => 0 , 'moment' => 3 ],
222 => [ 'name' => 'Последний удар' , 'act' => 2 , 'type_of' => 3 ],
225 => [ 'name' => 'Магическая защита' , 'act' => 1 , 'type_of' => 4 ],
226 => [ 'name' => 'Возмездие' , 'act' => 1 , 'type_of' => 4 ],
231 => [ 'name' => 'Глухая защита' , 'act' => 2 , 'type_of' => 0 , 'moment' => 3 ],
234 => [ 'name' => 'Осторожность' , 'act' => 2 , 'type_of' => 4 ],
235 => [ 'name' => 'Шокирующий удар' , 'act' => 2 , 'type_of' => 3 ],
342 => [ 'name' => 'Круговая Защита' , 'act' => 0 , 'type_of' => 0 ],
343 => [ 'name' => 'Натиск' , 'act' => 0 , 'type_of' => 0 ],
237 => [ 'name' => 'Разведка боем' , 'act' => 2 , 'type_of' => 3 ],
239 => [ 'name' => 'Поступь смерти' , 'act' => 2 , 'type_of' => 3 ],
2023-12-17 02:32:09 +00:00
240 => [ 'name' => 'Хлебнуть крови' , 'act' => 2 , 'type_of' => 5 ],
21 => [ 'name' => 'Оледенение [4]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
73 => [ 'name' => 'Оледенение [5]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
74 => [ 'name' => 'Оледенение [6]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
75 => [ 'name' => 'Оледенение [7]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
76 => [ 'name' => 'Оледенение [8]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
77 => [ 'name' => 'Оледенение [9]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
78 => [ 'name' => 'Оледенение [10]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
79 => [ 'name' => 'Оледенение [11]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
22 => [ 'name' => 'Отравление [6]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
80 => [ 'name' => 'Отравление [7]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
81 => [ 'name' => 'Отравление [8]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
82 => [ 'name' => 'Отравление [9]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
83 => [ 'name' => 'Отравление [10]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
84 => [ 'name' => 'Отравление [11]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
36 => [ 'name' => 'Регенерация [5]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
85 => [ 'name' => 'Регенерация [6]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
86 => [ 'name' => 'Регенерация [7]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
87 => [ 'name' => 'Регенерация [8]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
88 => [ 'name' => 'Регенерация [9]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
89 => [ 'name' => 'Регенерация [10]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
90 => [ 'name' => 'Регенерация [11]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
23 => [ 'name' => 'Ядовитое Облако [8]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
70 => [ 'name' => 'Ядовитое Облако [9]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
71 => [ 'name' => 'Ядовитое Облако [10]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
72 => [ 'name' => 'Ядовитое Облако [11]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
269 => [ 'name' => 'Иней [8]' , 'act' => 2 , 'type_of' => 9 ],
276 => [ 'name' => 'Иней [9]' , 'act' => 2 , 'type_of' => 9 ],
277 => [ 'name' => 'Иней [10]' , 'act' => 2 , 'type_of' => 9 ],
270 => [ 'name' => 'Духи Льда' , 'act' => 2 , 'type_of' => 5 , 'type_sec' => 5 ],
280 => [ 'name' => 'Хватка Льда' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
281 => [ 'name' => 'Жертва Воде' , 'act' => 2 , 'type_of' => 5 ],
2023-01-10 16:29:32 +00:00
282 => [ 'name' => 'Ледяное Спасение' , 'act' => 2 , 'type_of' => 5 ],
2023-12-17 02:32:09 +00:00
24 => [ 'name' => 'Медитация' , 'act' => 2 , 'type_of' => 0 , 'moment' => 3 ],
210 => [ 'name' => 'Магический Барьер [4]' , 'act' => 2 , 'type_of' => 8 ],
209 => [ 'name' => 'Магический Барьер [7]' , 'act' => 2 , 'type_of' => 8 ],
208 => [ 'name' => 'Магический Барьер [8]' , 'act' => 2 , 'type_of' => 8 ],
207 => [ 'name' => 'Магический Барьер [9]' , 'act' => 2 , 'type_of' => 8 ],
206 => [ 'name' => 'Магический Барьер [10]' , 'act' => 2 , 'type_of' => 8 ],
284 => [ 'name' => 'Магический Барьер [11]' , 'act' => 2 , 'type_of' => 8 ],
175 => [ 'name' => 'Магический Барьер [7]' , 'act' => 2 , 'type_of' => 8 ],
176 => [ 'name' => 'Магический Барьер [8]' , 'act' => 2 , 'type_of' => 8 ],
177 => [ 'name' => 'Магический Барьер [9]' , 'act' => 2 , 'type_of' => 8 ],
178 => [ 'name' => 'Магический Барьер [10]' , 'act' => 2 , 'type_of' => 8 ],
179 => [ 'name' => 'Магический Барьер [11]' , 'act' => 2 , 'type_of' => 8 ],
42 => [ 'name' => 'Метеорит [6]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
121 => [ 'name' => 'Метеорит [7]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
122 => [ 'name' => 'Метеорит [8]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
123 => [ 'name' => 'Метеорит [9]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
124 => [ 'name' => 'Метеорит [10]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
125 => [ 'name' => 'Метеорит [11]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
249 => [ 'name' => 'Каменный Щит' , 'act' => 2 , 'type_of' => 4 ],
248 => [ 'name' => 'Песчаный Щит' , 'act' => 2 , 'type_of' => 4 ],
251 => [ 'name' => 'Заземление: Плюс' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
252 => [ 'name' => 'Заземление: Минус' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
273 => [ 'name' => 'Туманный Образ [10]' , 'act' => 1 , 'type_of' => 4 ],
286 => [ 'name' => 'Туманный Образ [9]' , 'act' => 1 , 'type_of' => 4 ],
287 => [ 'name' => 'Туманный Образ [8]' , 'act' => 1 , 'type_of' => 4 ],
288 => [ 'name' => 'Туманный Образ [7]' , 'act' => 1 , 'type_of' => 4 ],
255 => [ 'name' => 'Воздушный Щит' , 'act' => 2 , 'type_of' => 8 ],
337 => [ 'name' => 'Выпить Душу' , 'act' => 2 , 'type_of' => 5 ],
33 => [ 'name' => 'Пожирающее Пламя [6]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
56 => [ 'name' => 'Пожирающее Пламя [7]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
57 => [ 'name' => 'Пожирающее Пламя [8]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
58 => [ 'name' => 'Пожирающее Пламя [9]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
59 => [ 'name' => 'Пожирающее Пламя [10]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
60 => [ 'name' => 'Пожирающее Пламя [11]' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
245 => [ 'name' => 'Огненный Щит' , 'act' => 2 , 'type_of' => 9 ],
327 => [ 'name' => 'Живая Вода' , 'act' => 2 , 'type_of' => 0 , 'moment' => 3 ],
328 => [ 'name' => 'Сушеный Мухомор' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
329 => [ 'name' => 'Мешочек Пыли' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
330 => [ 'name' => 'Отвар когтей ПГ' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
331 => [ 'name' => 'Отвар Василиска' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
332 => [ 'name' => 'Точильный Камень' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
333 => [ 'name' => 'Волшебный Эликсир' , 'act' => 2 , 'type_of' => 0 , 'moment' => 3 ],
334 => [ 'name' => 'Цепь Защитника' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
2022-12-19 20:22:19 +00:00
335 => [
2023-01-10 16:29:32 +00:00
'name' => 'Эликсир Безумного Критовика' ,
2022-12-19 20:22:19 +00:00
'act' => 2 ,
'type_of' => 0 ,
'moment' => 0 ,
'moment_end' => 3 ,
2023-12-17 02:32:09 +00:00
],
299 => [ 'name' => 'Ядовитые язвы' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
300 => [ 'name' => 'Элементарный заряд' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
301 => [ 'name' => 'Темное ранение' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
302 => [ 'name' => 'Подлечиться' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
303 => [ 'name' => 'Шкура поглощения' , 'act' => 2 , 'type_of' => 4 ],
304 => [ 'name' => 'Особенное проклятье!' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
2023-01-10 16:29:32 +00:00
305 => [ 'name' => 'Кровожадность' , 'act' => 2 , 'type_of' => 0 , 'moment' => 0 , 'moment_end' => 3 ],
2022-12-19 20:22:19 +00:00
];
2023-09-30 20:17:25 +00:00
public bool $cached = false ; //Кэширование данных
public int $mainStatus = 1 ; //Отображаем главное окно (1 - можно бить, 2 - ожидаем ход противника, 3 - Проиграли. Ожидаем завершения поединка)
public array $info = []; //Информация о поединке
2023-12-17 02:32:09 +00:00
public array $users = []; //Информация о пользователях в этом бою
2023-09-30 20:17:25 +00:00
public array $stats = []; //Информация о статах пользователей в этом бою
public array $uids = []; //Список пользователей и их id в stats или users пример id пользователя = 555 , то $uids[555] выдаст е г о порядковый номер в массиве users \ stats
public array $atacks = []; //Список ударов в этом бою (действующих)
public array $ga = []; //Список uid кто нанес удар и по кому $ga[ {id кто ударил} ][ {id кого ударил} ]
2023-12-17 02:32:09 +00:00
private array $ag = []; //Список uid кто нанес удар и по кому $ga[ {id кого ударили} ][ {id кто ударил} ]
2023-09-30 20:17:25 +00:00
public int $hodID = 0 ;
2023-12-17 02:32:09 +00:00
private int | array $stnZbVs = 0 ;
2023-12-19 01:58:37 +00:00
public array $bots = []; // ID ботов
2023-12-17 02:32:09 +00:00
private array $iBots = []; // i бота
private array $stnZb = [];
2023-11-02 13:57:39 +00:00
/** Выбранные зоны атаки и блока .
* @ var array
*/
2023-12-17 02:32:09 +00:00
private array $uAtc = [
2023-03-31 16:54:33 +00:00
'id' => 0 ,
'a' => [ 1 => 0 , 2 => 0 , 3 => 0 , 4 => 0 , 5 => 0 ],
'b' => 0 ,
]; //Если игрок нанес удар
2023-12-17 02:32:09 +00:00
/**
* Чем лупили
* @ var array | array []
*/
private array $lgItm = [
2023-03-31 16:54:33 +00:00
0 => [
'грудью' ,
'ребром руки' ,
'лбом' ,
'кулаком' ,
'ногой' ,
'левой ногой' ,
'правой ногой' ,
'коленом' ,
],
1 => [ 'ножом' , 'тыльной стороной лезвия ножа' , 'рукоятью ножа' , 'лезвием ножа' ],
2 => [ 'сучковатой палкой' , 'поленом' , 'тяжелой дубиной' , 'дубиной' , 'рукоятью молота' ],
3 => [ 'секирой' , 'топором' , 'лезвием секиры' , 'алебардой' , 'тяжелым держаком' , 'длинной секирой' ],
4 => [
'ножнами' ,
'гардой' ,
'мечом' ,
'лезвием меча' ,
'рукоятью меча' ,
'тупым лезвием' ,
'острой стороной меча' ,
'огромным мечом' ,
],
5 => [ 'сучковатой палкой' , 'посохом' , 'тяжелой тростью' , 'корявым посохом' , 'основанием посоха' ],
22 => [ 'костылем' ],
2023-12-17 02:32:09 +00:00
];
/**
* Куда лупили
* @ var array | array []
*/
private array $lgZon = [
2023-03-31 16:54:33 +00:00
1 => [
'в нос' ,
'в глаз' ,
'в челюсть' ,
'по переносице' ,
'в кадык' ,
'по затылку' ,
'в правый глаз' ,
'в левый глаз' ,
'в скулу' ,
],
2 => [ 'в грудь' , 'в корпус' , 'в солнечное сплетение' , 'в сердце' , 'в область лопаток' ],
3 => [ 'в бок' , 'по желудку' , 'по левой руке' , 'по правой руке' ],
4 => [ 'по <вырезано цензурой>' , 'в пах' , 'в промежность' , 'по левой ягодице' , 'по правой ягодице' ],
5 => [ 'по ногам' , 'в область правой пятки' , 'в область левой пятки' , 'по коленной чашечке' , 'по икрам' ],
2023-12-17 02:32:09 +00:00
];
/**
* Ошибка ( текст )
* @ var string
*/
public string $e ;
2023-03-31 16:54:33 +00:00
public array $is = [];
public array $items = [];
//Очистка кэша для ...
2023-12-17 02:32:09 +00:00
private array $uclearc = [];
private array $ucleari = [];
2023-09-30 20:17:25 +00:00
public array $rehodeff = [];
2023-12-17 02:32:09 +00:00
private array $poglast = [];
2023-09-30 20:17:25 +00:00
public array $um_priem = [];
2023-08-10 14:51:16 +00:00
2023-12-17 02:32:09 +00:00
private int $importUser = 0 ;
2023-09-30 20:17:25 +00:00
public array $pr_not_use = [];
public array $del_val = [];
2023-08-10 14:51:16 +00:00
//Добавляем нанесенный урон
2023-12-19 01:58:37 +00:00
private Finish $finish ;
2023-03-31 16:54:33 +00:00
public function __construct ()
2022-12-19 20:22:19 +00:00
{
2023-03-31 16:54:33 +00:00
ignore_user_abort ( true );
2023-12-19 01:58:37 +00:00
$this -> finish = new Finish ( $this );
2023-03-31 16:54:33 +00:00
}
2023-08-10 14:51:16 +00:00
//JS информация о игроке
2023-03-31 16:54:33 +00:00
public function maginfoattack ( $u1 , $u2 , $type ) : string
{
/*
1 - огонь ,
2 - воздух ,
3 - вода ,
4 - земля
*/
$v_l = str_replace ( ' ' , ' ' , $this -> users [ $this -> uids [ $u1 ]][ 'login' ]);
$v_z = ( int ) $this -> stats [ $this -> uids [ $u2 ]][ 'zm' . $type ]; //защита цели
$v_p = ( int ) round (
(
$this -> stats [ $this -> uids [ $u1 ]][ 'pzm' . $type ] +
$this -> stats [ $this -> uids [ $u1 ]][ 'pzm' ]
)
* 0.4
); //подавление защиты от магии
$v_m = ( int ) $this -> stats [ $this -> uids [ $u1 ]][ 'pm' . $type ]; //мощность мага
//
return ' magelogin=' . $v_l . ' onMouseOver=top.hi(this,maginfo(' . $v_z . ',' . $v_p . ',' . $v_m . ',this),event,3,1,1,1,null); onMouseOut=top.hic(); onMouseDown=top.hic(); ' ;
}
2022-12-19 20:22:19 +00:00
public function hphe ( $uid , $hp , $false_t7 = false )
{
if ( ! isset ( $this -> stats [ $this -> uids [ $uid ]])) {
2023-01-10 16:29:32 +00:00
echo 'WARNING! ОШИБКА! ПОТЕРЯНА ПЕРЕМЕННАЯ ЗДОРОВЬЯ ПЕРСОНАЖА!' ;
2022-12-19 20:22:19 +00:00
} else {
$hpnow = floor ( $this -> stats [ $this -> uids [ $uid ]][ 'hpNow' ]);
$hpall = $this -> stats [ $this -> uids [ $uid ]][ 'hpAll' ];
if ( $hp > 0 ) {
2023-01-10 16:29:32 +00:00
//Хиляем
2022-12-19 20:22:19 +00:00
if ( $hpnow + $hp > $hpall ) {
$hpli = $hpnow + $hp - $hpall ;
$hp -= $hpli ;
}
if ( isset ( $this -> stats [ $this -> uids [ $uid ]][ 'min_heal_proc' ]) && $this -> stats [ $this -> uids [ $uid ]][ 'min_heal_proc' ] < - 99 ) {
$hp = 0 ;
} else {
$hp = $hp / 100 * ( 100 + $this -> stats [ $this -> uids [ $uid ]][ 'min_heal_proc' ]);
}
2023-01-10 16:29:32 +00:00
//Отнимаем тактику
2022-12-30 19:03:37 +00:00
if ( ! $false_t7 ) {
2022-12-19 20:22:19 +00:00
if ( $this -> users [ $this -> uids [ $uid ]][ 'tactic7' ] <= 0 ) {
$hp = 0 ;
$this -> users [ $this -> uids [ $uid ]][ 'tactic7' ] = 0 ;
$this -> stats [ $this -> uids [ $uid ]][ 'tactic7' ] = $this -> users [ $this -> uids [ $uid ]][ 'tactic7' ];
} else {
$gdhh = round ( $hp / $this -> stats [ $this -> uids [ $uid ]][ 'hpAll' ] * 10 , 2 );
if ( $gdhh == 0 ) {
$gdhh = 0.01 ;
}
$gdhd = round ( $this -> users [ $this -> uids [ $uid ]][ 'tactic7' ] / $gdhh * 100 );
2022-12-30 19:03:37 +00:00
$this -> users [ $this -> uids [ $uid ]][ 'tactic7' ] = round (
( $this -> users [ $this -> uids [ $uid ]][ 'tactic7' ] - $gdhh ),
2
);
2022-12-19 20:22:19 +00:00
if ( $this -> users [ $this -> uids [ $uid ]][ 'tactic7' ] < 0 ) {
$this -> users [ $this -> uids [ $uid ]][ 'tactic7' ] = 0 ;
}
$this -> stats [ $this -> uids [ $uid ]][ 'tactic7' ] = $this -> users [ $this -> uids [ $uid ]][ 'tactic7' ];
if ( $gdhd < 100 ) {
$hp = floor ( $hp / 100 * $gdhd );
}
}
}
} elseif ( $hp < 0 ) {
2023-01-10 16:29:32 +00:00
//Отнимаемф
2022-12-19 20:22:19 +00:00
if ( $hpnow + $hp < 0 ) {
$hpli = $hpnow + $hp ;
$hp += - ( $hpli );
}
}
if ( $this -> stats [ $this -> uids [ $uid ]][ 'hpNow' ] < 1 ) {
$hp = 0 ;
}
$this -> stats [ $this -> uids [ $uid ]][ 'last_hp' ] = - $hp ;
2023-03-31 16:54:33 +00:00
Db :: sql (
'update stats set last_hp = ?, tactic7 = ? where id = ?' , [
2023-12-17 02:32:09 +00:00
$this -> users [ $this -> uids [ $uid ]][ 'last_hp' ],
$this -> users [ $this -> uids [ $uid ]][ 'tactic7' ],
$uid ,
]
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
return floor ( $hp );
}
2023-08-10 14:51:16 +00:00
// todo stopped here //
//Мини лог
2023-03-31 16:54:33 +00:00
/**
* Какая - то хуедрыга для номерных файлов - приёмов
* @ param int $pid
* @ param int $uid
* @ param int $id
* @ return void
*/
2023-12-17 02:32:09 +00:00
public function deleffm ( int $pid , int $uid , int $id ) : void
2022-12-19 20:22:19 +00:00
{
if ( $id > 0 ) {
2023-03-31 16:54:33 +00:00
Db :: sql ( 'delete from eff_users where id = ? and v1 = ? and v2 != 0' , [ $id , 'priem' ]);
2022-12-19 20:22:19 +00:00
} else {
2023-03-31 16:54:33 +00:00
Db :: sql ( 'delete from eff_users where uid = ? and v1 = ? and v2 = ?' , [ $uid , 'priem' , $pid ]);
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
//Проверяем завершение боя
2022-12-19 20:22:19 +00:00
2023-12-17 02:32:09 +00:00
public function clear_cache_start () : void
2022-12-19 20:22:19 +00:00
{
2023-03-31 16:54:33 +00:00
$uids = implode ( ',' , $this -> ucleari );
Db :: sql ( 'delete from battle_cache where uid in (?)' , [ $uids ]);
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//завершение поединка
2022-12-19 20:22:19 +00:00
2023-03-31 16:54:33 +00:00
/**
* Проверка урон приемов над защитными .
* Игрок 1 бьет по Игроку 2 при помощи приема на hp ед . здоровья .
2023-12-17 02:32:09 +00:00
* @ param $u2
* @ param array $hp
* @ return array
2023-03-31 16:54:33 +00:00
*/
2023-12-17 02:32:09 +00:00
public function testYronPriemAttack ( $u2 , array $hp ) : array
2023-03-31 16:54:33 +00:00
{
2023-01-10 16:29:32 +00:00
//Получаем приемы и смотрим когда какой действует
2023-03-31 16:54:33 +00:00
foreach ( $this -> stats [ $this -> uids [ $u2 ]][ 'effects' ] as $effect ) {
2023-11-02 13:57:39 +00:00
if ( ! isset ( $effect ) ||
$effect [ 'id_eff' ] != 22 ||
$effect [ 'v1' ] != 'priem' ||
$effect [ 'v2' ] != 140 && $effect [ 'v2' ] != 211 && $effect [ 'v2' ] != 45
2023-03-31 16:54:33 +00:00
) {
2023-11-02 13:57:39 +00:00
continue ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
//Приемы от которых урон = 1 , то есть выдаем 0
$hp [ 'y' ] = - 1 ;
$hp [ 'r' ] = 1 ;
$hp [ 'k' ] = 2 ;
$hp [ 'm_y' ] = 1 ;
$hp [ 'm_k' ] = 2 ;
2022-12-19 20:22:19 +00:00
}
return $hp ;
}
2023-12-17 02:32:09 +00:00
public function takeYronNow ( int $uid , int | float $hpDamageValue ) : void
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
global $u ;
2023-12-17 02:32:09 +00:00
( int ) $hpDamageValue = floor ( $hpDamageValue );
$this -> users [ $this -> uids [ $uid ]][ 'battle_yron' ] += $hpDamageValue ;
$this -> stats [ $this -> uids [ $uid ]][ 'battle_yron' ] += $hpDamageValue ;
2023-08-10 14:51:16 +00:00
if ( $uid == $u -> info [ 'id' ]) {
2023-12-17 02:32:09 +00:00
$u -> info [ 'battle_yron' ] += $hpDamageValue ;
$u -> stats [ 'battle_yron' ] += $hpDamageValue ;
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
Db :: sql ( 'update stats set battle_yron = battle_yron + ? where id = ?' , [ $hpDamageValue , $uid ]);
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
public function myInfo ( $id , $t ) : string
2022-12-19 20:22:19 +00:00
{
2023-09-30 20:17:25 +00:00
global $u ;
2023-08-10 14:51:16 +00:00
if ( ! isset ( $this -> users [ $this -> uids [ $id ]]) && $u -> info [ 'id' ] != $id ) {
2023-12-17 02:32:09 +00:00
return '' ;
2023-08-10 14:51:16 +00:00
}
if ( $u -> info [ 'id' ] == $id || ( $u -> info [ 'enemy' ] == $id && $id > 0 )) {
//Всегда обновляем
2023-09-30 20:17:25 +00:00
$this -> users [ $this -> uids [ $id ]] = Db :: getRow (
' select u . zag , u . id , u . login , u . login2 , u . online , u . admin , u . city , u . cityreg , u . align , u . align_lvl , u . align_exp , u . clan ,
2023-08-10 14:51:16 +00:00
u . level , u . money , u . money3 , u . money2 , u . money4 , u . battle , u . sex , u . obraz , u . win , u . win_t ,
u . lose , u . lose_t , u . nich , u . timeMain , u . invis , u . bot_id , u . animal , u . type_pers ,
2023-09-30 20:17:25 +00:00
u . notrhod , u . bot_room , u . inUser , u . inTurnir , u . inTurnirnew , u . stopexp , u . real , s .* from users as u left join stats as s on ( u . id = s . id ) where u . id = ? ' , [ $id ]
);
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$this -> stats [ $this -> uids [ $id ]] = $u -> getStats ( $this -> users [ $this -> uids [ $id ]], 0 , 0 , false , false , true );
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
}
$ur = $this -> users [ $this -> uids [ $id ]];
$st = $this -> stats [ $this -> uids [ $id ]];
$itm = $this -> stats [ $this -> uids [ $id ]][ 'items' ];
$eff = $this -> stats [ $this -> uids [ $id ]][ 'effects' ];
$i = 0 ;
2023-12-17 02:32:09 +00:00
$img = Config :: img ();
$armor1 = '<br>Броня головы: ' ;
$armor2 = '<br>Броня корпуса: ' ;
$armor3 = '<br>Броня пояса: ' ;
$armor4 = '<br>Броня ног: ' ;
2023-08-10 14:51:16 +00:00
if ( $u -> info [ 'seff' ] < 1 ) {
2023-12-17 02:32:09 +00:00
$ef = <<< HTML
< div class = " pimg " pog = " 0 " col = " 0 " stl = " 0 " stt = " Свернуть " >
< img src = " $img /i/eff/effs_hide.gif " alt = " "
onclick = " top.useMagicBattle('Свернуть',7777,'effs_show.gif',1,2) "
onmouseover = " top.hi(this,'<strong>Свернуть</strong>',event,3,1,1,1,''); "
onmouseout = " top.hic(); " onmousedown = " top.hic(); "
>
</ div >
HTML ;
2023-08-10 14:51:16 +00:00
while ( $i != - 1 ) {
$nseef = 0 ;
2023-12-17 02:32:09 +00:00
if (
$this -> users [ $this -> uids [ $ur [ 'id' ]]][ 'id' ] != $u -> info [ 'id' ] &&
$ur [ 'id' ] != 0 && $this -> stats [ $this -> uids [ $ur [ 'id' ]]][ 'seeAllEff' ] != 1
) {
$nseef = 1 ;
if ( $eff [ $i ][ 'v1' ] == 'priem' ) {
$eff [ $i ][ 'priem' ] = Db :: getRow ( 'select * from priems where id = ?' , [ $eff [ $i ][ 'v2' ]]);
2022-12-19 20:22:19 +00:00
2023-12-17 02:32:09 +00:00
}
if ( isset ( $eff [ $i ][ 'priem' ][ 'id' ]) && $eff [ $i ][ 'priem' ][ 'neg' ] == 1 ) {
$nseef = 0 ;
2023-03-31 16:54:33 +00:00
}
}
if ( isset ( $eff [ $i ]) && $eff [ $i ] != 'delete' ) {
if ( $nseef == 0 ) {
$ei = '<strong><u>' . $eff [ $i ][ 'name' ] . '</u></strong>' ;
if ( $eff [ $i ][ 'x' ] > 1 ) {
$ei .= ' x' . $eff [ $i ][ 'x' ] . ' ' ;
}
2023-12-17 02:32:09 +00:00
$ei .= match ( $eff [ $i ][ 'type1' ]) {
1 , 2 , 3 , 4 , 5 , 6 => ' (Эликсир)' ,
7 , 8 , 9 , 10 , 16 => ' (Заклятие)' ,
14 => ' (Прием)' ,
15 => ' (Изучение)' ,
17 => ' (Проклятие)' ,
18 , 19 => ' (Травма)' ,
20 => ' (Пристрастие)' ,
22 => ' (Ожидание)' ,
default => ' (Эффект)'
};
2023-03-31 16:54:33 +00:00
$ei .= '<br>' ;
2022-12-19 20:22:19 +00:00
2023-03-31 16:54:33 +00:00
$time_still = ( $eff [ $i ][ 'timeUse' ] + ( $eff [ $i ][ 'timeAce' ] - $eff [ $i ][ 'timeUse' ]) + $eff [ $i ][ 'actionTime' ]);
if ( $eff [ $i ][ 'timeAce' ] == 0 ) {
$time_still += $eff [ $i ][ 'timeUse' ];
}
$time_still -= time ();
if ( $eff [ $i ][ 'bp' ] == 0 && $eff [ $i ][ 'timeUse' ] != 77 ) {
if ( $eff [ $i ][ 'type1' ] != 13 ) {
2023-11-02 13:57:39 +00:00
$ei .= 'Осталось: ' . Conversion :: secondsToTimeout ( $time_still );
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
} else {
if ( $eff [ $i ][ 'timeUse' ] != 77 && $eff [ $i ][ 'hod' ] < 1 ) {
2023-11-02 13:57:39 +00:00
$ei .= 'Осталось: ' . Conversion :: secondsToTimeout ( $time_still );
2023-03-31 16:54:33 +00:00
} elseif ( $eff [ $i ][ 'hod' ] >= 0 ) {
2023-11-02 13:57:39 +00:00
$ei .= 'Зарядов: ' . $eff [ $i ][ 'hod' ];
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
2022-12-19 20:22:19 +00:00
2023-03-31 16:54:33 +00:00
if ( $eff [ $i ][ 'user_use' ] != '' ) {
2023-12-17 02:32:09 +00:00
$str = '<br>Автор: <strong>%s</strong>' ;
2023-03-31 16:54:33 +00:00
if ( $this -> users [ $this -> uids [ $eff [ $i ][ 'user_use' ]]][ 'login2' ] != '' ) {
2023-12-17 02:32:09 +00:00
$ei .= sprintf ( $str , $this -> users [ $this -> uids [ $eff [ $i ][ 'user_use' ]]][ 'login2' ]);
2023-03-31 16:54:33 +00:00
} elseif ( $this -> users [ $this -> uids [ $eff [ $i ][ 'user_use' ]]][ 'login' ] != '' ) {
2023-12-17 02:32:09 +00:00
$ei .= sprintf ( $str , $this -> users [ $this -> uids [ $eff [ $i ][ 'user_use' ]]][ 'login' ]);
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
unset ( $str );
2023-03-31 16:54:33 +00:00
}
2022-12-19 20:22:19 +00:00
2023-03-31 16:54:33 +00:00
//Действие эффекта
$tr = '' ;
$ti = $u -> items [ 'add' ];
$x = 0 ;
2023-08-14 15:15:05 +00:00
$ed = Conversion :: dataStringToArray ( $eff [ $i ][ 'data' ]);
2023-03-31 16:54:33 +00:00
while ( $x < count ( $ti )) {
$n = $ti [ $x ];
if ( isset ( $ed [ 'add_' . $n ], $u -> is [ $n ]) && $n != 'pog' ) {
$z = '' ;
if ( $ed [ 'add_' . $n ] > 0 ) {
$z = '+' ;
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
$tr .= '<br>' . $u -> is [ $n ] . ': ' . $z . $ed [ 'add_' . $n ];
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
$x ++ ;
}
2022-12-19 20:22:19 +00:00
2023-03-31 16:54:33 +00:00
if ( $ed [ 'add_mib1' ] != 0 ) {
if ( $ed [ 'add_mab1' ] != 0 ) {
2023-12-17 02:32:09 +00:00
$tr .= $armor1 . $ed [ 'add_mib1' ] . '-' . $ed [ 'add_mab1' ];
2023-03-31 16:54:33 +00:00
} else {
$m1l = $ed [ 'add_mib1' ];
if ( $m1l > 0 ) {
$m1l = '+' . $m1l ;
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
$tr .= $armor1 . $m1l ;
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
if ( $ed [ 'add_mib2' ] != 0 ) {
if ( $ed [ 'add_mab2' ] != 0 ) {
2023-12-17 02:32:09 +00:00
$tr .= $armor2 . $ed [ 'add_mib2' ] . '-' . $ed [ 'add_mab2' ];
2023-03-31 16:54:33 +00:00
} else {
$m1l = $ed [ 'add_mib2' ];
if ( $m1l > 0 ) {
$m1l = '+' . $m1l ;
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
$tr .= $armor2 . $m1l ;
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
if ( $ed [ 'add_mib3' ] != 0 ) {
if ( $ed [ 'add_mab3' ] != 0 ) {
2023-12-17 02:32:09 +00:00
$tr .= $armor3 . $ed [ 'add_mib3' ] . '-' . $ed [ 'add_mab3' ];
2023-03-31 16:54:33 +00:00
} else {
$m1l = $ed [ 'add_mib3' ];
if ( $m1l > 0 ) {
$m1l = '+' . $m1l ;
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
$tr .= $armor3 . $m1l ;
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
if ( $ed [ 'add_mib4' ] != 0 ) {
if ( $ed [ 'add_mab4' ] != 0 ) {
2023-12-17 02:32:09 +00:00
$tr .= $armor4 . $ed [ 'add_mib4' ] . '-' . $ed [ 'add_mab4' ];
2023-03-31 16:54:33 +00:00
} else {
$m1l = $ed [ 'add_mib4' ];
if ( $m1l > 0 ) {
$m1l = '+' . $m1l ;
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
$tr .= $armor4 . $m1l ;
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
2022-12-19 20:22:19 +00:00
2023-03-31 16:54:33 +00:00
$efix = 0 ;
if ( isset ( $ed [ 'add_pog2' ]) && $ed [ 'add_pog2' ] > 0 ) {
$efix = $ed [ 'add_pog2' ];
}
if ( isset ( $ed [ 'add_pog' ])) {
$tr .= '<br>Магический барьер способен поглотить еще <strong>' . $ed [ 'add_pog' ] . '</strong> ед. урона' ;
}
if ( isset ( $ed [ 'add_pog2' ])) {
$tr .= '<br>Магический барьер способен поглотить еще <strong>' . $ed [ 'add_pog2' ] . '</strong> ед. урона <small>(' . $ed [ 'add_pog2p' ] . '%)</small>' ;
}
2022-12-19 20:22:19 +00:00
2023-03-31 16:54:33 +00:00
if ( $tr != '' ) {
$ei .= $tr ;
}
if ( $eff [ $i ][ 'info' ] != '' ) {
$ei .= '<br><i>Информация:</i><br>' . $eff [ $i ][ 'info' ];
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
$efcol = $eff [ $i ][ 'x' ];
$efimg = $eff [ $i ][ 'img' ];
$ef .= <<< HTML
< div class = " pimg " pog = " $efix " col = " $efcol " stl = " 0 " stt = " $ei " >
< img src = " $img /i/eff/ $efimg " alt = " " >
</ div >
HTML ;
unset ( $efix , $efcol , $efimg );
2023-03-31 16:54:33 +00:00
}
} elseif ( $eff [ $i ] != 'delete' ) {
$i = - 2 ;
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
$i ++ ;
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
} else {
2023-12-17 02:32:09 +00:00
$ef = <<< HTML
< div class = " pimg " pog = " 0 " col = " 0 " stl = " 0 " stt = " Развернуть " >
< img src = " $img /i/eff/effs_show.gif " alt = " "
onclick = " top.useMagicBattle('Развернуть',5555,'effs_hide.gif',1,2) "
onmouseover = " top.hi(this,'<strong>Развернуть</strong>',event,3,1,1,1,''); "
onmouseout = " top.hic(); " onmousedown = " top.hic(); "
>
</ div >
HTML ;
2023-03-31 16:54:33 +00:00
}
2023-12-17 02:32:09 +00:00
2023-03-31 16:54:33 +00:00
$ca = '' ;
2023-12-17 02:32:09 +00:00
2023-03-31 16:54:33 +00:00
if ( $ur [ 'clan' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$clanName = ClanInfo :: getNameById ( $ur [ 'clan' ]);
if ( ! empty ( $clanName )) {
$ca = " <img src=' $img /i/clan/ $clanName .gif' title=' $clanName ' alt=' $clanName '> " ;
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
2023-12-17 02:32:09 +00:00
2023-03-31 16:54:33 +00:00
if ( $ur [ 'align' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$ca = " <img src=' $img /i/align/align { $ur [ 'align' ] } .gif' alt='Склонность'> $ca " ;
2023-03-31 16:54:33 +00:00
}
2023-12-17 02:32:09 +00:00
2023-03-31 16:54:33 +00:00
if ( $ur [ 'login2' ] == '' ) {
$ur [ 'login2' ] = $ur [ 'login' ];
}
2023-12-17 02:32:09 +00:00
2023-03-31 16:54:33 +00:00
if ( floor ( $st [ 'hpNow' ]) > $st [ 'hpAll' ]) {
$st [ 'hpNow' ] = $st [ 'hpAll' ];
}
2023-12-17 02:32:09 +00:00
2023-03-31 16:54:33 +00:00
if ( floor ( $st [ 'mpNow' ]) > $st [ 'mpAll' ]) {
$st [ 'mpNow' ] = $st [ 'mpAll' ];
}
2023-12-17 02:32:09 +00:00
2023-03-31 16:54:33 +00:00
$stsua = '<strong>' . $ur [ 'login2' ] . '</strong>' ;
$stsua .= '<br>Сила: ' . $st [ 's1' ];
$stsua .= '<br>Ловкость: ' . $st [ 's2' ];
$stsua .= '<br>Интуиция: ' . $st [ 's3' ];
$stsua .= '<br>Выносливость: ' . $st [ 's4' ];
if ( $st [ 's5' ] != 0 ) {
$stsua .= '<br>Интелект: ' . $st [ 's5' ];
}
if ( $st [ 's6' ] != 0 ) {
$stsua .= '<br>Мудрость: ' . $st [ 's6' ];
}
if ( $st [ 's7' ] != 0 ) {
$stsua .= '<br>Духовность: ' . $st [ 's7' ];
}
2023-12-17 02:32:09 +00:00
if ( $u -> isAdmin ()) {
2023-03-31 16:54:33 +00:00
$align = $ur [ 'align' ];
}
2023-12-17 02:32:09 +00:00
$tpImg = [
2023-03-31 16:54:33 +00:00
1 => 4 ,
2 => 5 ,
14 => 6 ,
3 => 7 ,
5 => 8 ,
7 => 9 ,
17 => 10 ,
16 => 11 ,
13 => 12 ,
10 => 13 ,
9 => 14 ,
8 => 15 ,
11 => 17 , //кольцо 2
12 => 18 , //кольцо 3
];
2023-03-31 18:30:14 +00:00
$info = 'info_reflesh(' . $t . ',' . $ur [ 'id' ] . ',"' . $ca . '<a href=\"javascript:void(0)\" onclick=\"top.chat.addto(\'' . $ur [ 'login2' ] . '\',\'to\');return false;\">' . $ur [ 'login2' ] . '</a> [' . $ur [ 'level' ] . ']<a href=\"info/' . $ur [ 'id' ] . '\" target=\"_blank\"><img src=\"//img.new-combats.tech/i/inf_' . $ur [ 'cityreg' ] . '.gif\" title=\"Инф. о ' . $ur [ 'login2' ] . '\"></a> ","' . $ur [ 'obraz' ] . '",' . floor (
2023-03-31 16:54:33 +00:00
$st [ 'hpNow' ]
) . ',' . floor ( $st [ 'hpAll' ]) . ',' . floor (
$st [ 'mpNow' ]
) . ',' . floor (
$st [ 'mpAll' ]
) . ',0,' . $ur [ 'sex' ] . ',"' . $ef . '","' . $stsua . '", "' . $align . '", "' . $ur [ 'zag' ] . '");shpb();' ;
$i = 0 ;
if ( is_array ( $itm )) {
while ( $i < count ( $itm )) {
//
2023-12-17 02:32:09 +00:00
if ( isset ( $st [ 'items_img' ][ $tpImg [ $itm [ $i ][ 'inOdet' ]]])) {
$itm [ $i ][ 'img' ] = $st [ 'items_img' ][ $tpImg [ $itm [ $i ][ 'inOdet' ]]];
2023-03-31 16:54:33 +00:00
}
//генерируем предметы
$ttl = '<strong>' . $itm [ $i ][ 'name' ] . '</strong>' ;
2023-08-14 15:15:05 +00:00
$td = Conversion :: dataStringToArray ( $itm [ $i ][ 'data' ]);
2023-03-31 16:54:33 +00:00
$lvar = '' ;
if ( $td [ 'add_hpAll' ] > 0 ) {
$td [ 'add_hpAll' ] = '+' . $td [ 'add_hpAll' ];
2023-12-17 02:32:09 +00:00
$lvar .= '<br>Уровень жизни: ' . $td [ 'add_hpAll' ];
2023-03-31 16:54:33 +00:00
}
if ( $td [ 'sv_yron_max' ] > 0 || $td [ 'sv_yron_min' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$lvar .= '<br>Урон: ' . ( 0 + $td [ 'sv_yron_min' ]) . '-' . ( 0 + $td [ 'sv_yron_max' ]);
2023-03-31 16:54:33 +00:00
}
if ( $td [ 'add_mab1' ] > 0 ) {
2023-12-17 02:32:09 +00:00
if ( $td [ 'add_mib1' ] == $td [ 'add_mab1' ]) {
2023-03-31 16:54:33 +00:00
$m1l = '+' ;
2023-12-17 02:32:09 +00:00
$lvar .= $armor1 . $m1l . ( 0 + $td [ 'add_mab1' ]);
2023-03-31 16:54:33 +00:00
} else {
2023-12-17 02:32:09 +00:00
$lvar .= $armor1 . ( 0 + $td [ 'add_mib1' ]) . '-' . ( 0 + $td [ 'add_mab1' ]);
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
if ( $td [ 'add_mab2' ] > 0 ) {
2023-12-17 02:32:09 +00:00
if ( $td [ 'add_mib2' ] == $td [ 'add_mab2' ]) {
2023-03-31 16:54:33 +00:00
$m1l = '+' ;
2023-12-17 02:32:09 +00:00
$lvar .= $armor2 . $m1l . ( 0 + $td [ 'add_mab2' ]);
2023-03-31 16:54:33 +00:00
} else {
2023-12-17 02:32:09 +00:00
$lvar .= $armor2 . ( 0 + $td [ 'add_mib2' ]) . '-' . ( 0 + $td [ 'add_mab2' ]);
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
if ( $td [ 'add_mab3' ] > 0 ) {
2023-12-17 02:32:09 +00:00
if ( $td [ 'add_mib3' ] == $td [ 'add_mab3' ]) {
2023-03-31 16:54:33 +00:00
$m1l = '+' ;
2023-12-17 02:32:09 +00:00
$lvar .= $armor3 . $m1l . ( 0 + $td [ 'add_mab3' ]);
2023-03-31 16:54:33 +00:00
} else {
2023-12-17 02:32:09 +00:00
$lvar .= $armor3 . ( 0 + $td [ 'add_mib3' ]) . '-' . ( 0 + $td [ 'add_mab3' ]);
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
if ( $td [ 'add_mab4' ] > 0 ) {
2023-12-17 02:32:09 +00:00
if ( $td [ 'add_mib4' ] == $td [ 'add_mab4' ]) {
2023-03-31 16:54:33 +00:00
$m1l = '+' ;
2023-12-17 02:32:09 +00:00
$lvar .= $armor4 . $m1l . ( 0 + $td [ 'add_mab4' ]);
2023-03-31 16:54:33 +00:00
} else {
2023-12-17 02:32:09 +00:00
$lvar .= $armor4 . ( 0 + $td [ 'add_mib4' ]) . '-' . ( 0 + $td [ 'add_mab4' ]);
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
if ( $itm [ $i ][ 'iznosMAX' ] > 0 ) {
if ( $itm [ $i ][ 'iznosMAXi' ] == 999999999 ) {
2023-12-17 02:32:09 +00:00
$lvar .= '<br>Долговечность: <span style="color: brown;">неразрушимо</span>' ;
2023-03-31 16:54:33 +00:00
} else {
$lvar .= '<br>Долговечность: ' . floor (
$itm [ $i ][ 'iznosNOW' ]
) . '/' . floor (
$itm [ $i ][ 'iznosMAX' ]
);
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
}
$ttl .= $lvar ;
$ccv = '' ;
2022-12-19 20:22:19 +00:00
2023-03-31 16:54:33 +00:00
if ( $itm [ $i ][ 'magic_inci' ] != '' || $itm [ $i ][ 'magic_inc' ] != '' ) {
if ( $itm [ $i ][ 'magic_inc' ] == '' ) {
$itm [ $i ][ 'magic_inc' ] = $itm [ $i ][ 'magic_inci' ];
}
$mgi = Db :: getRow ( 'select * from eff_main where id2 = ? and type1 = 12345' , [ $itm [ $i ][ 'magic_inc' ]]);
if ( isset ( $mgi [ 'id2' ])) {
$ccv .= 'top.useMagicBattle(\'' . $mgi [ 'mname' ] . '\',' . $itm [ $i ][ 'id' ] . ',\'' . $mgi [ 'img' ] . '\',1,2);' ;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
}
2022-12-19 20:22:19 +00:00
2023-12-17 02:32:09 +00:00
$var1 = ( int ) $t ;
$var2 = ( int ) $itm [ $i ][ 'uid' ];
$var3 = ( int ) $itm [ $i ][ 'id' ];
$var4 = ( int ) $itm [ $i ][ 'inOdet' ];
$var5 = $itm [ $i ][ 'name' ];
$var6 = $ttl ;
$var7 = $itm [ $i ][ 'img' ];
$var8 = $ccv ;
$info .= " abitms( $var1 , $var2 , $var3 , $var4 ,' $var5 ',' $var6 ',' $var7 ',' $var8 '); " ;
unset ( $var1 , $var2 , $var3 , $var4 , $var5 , $var6 , $var7 , $var8 );
2023-03-31 16:54:33 +00:00
$i ++ ;
}
2022-12-19 20:22:19 +00:00
}
2023-03-31 16:54:33 +00:00
return $info ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Проводим удар
2023-03-31 16:54:33 +00:00
/**
* Проверка на выживших .
* Проклято и сломано .
* @ return bool
*/
2022-12-30 19:03:37 +00:00
public function testUsersLive () : bool
2022-12-19 20:22:19 +00:00
{
$r = false ;
$tl = 0 ;
$i = 0 ;
$j = 0 ;
while ( $i < count ( $this -> uids )) {
if ( $this -> stats [ $i ][ 'id' ] > 0 ) {
if ( floor ( $this -> stats [ $i ][ 'hpNow' ]) < 1 ) {
$this -> stats [ $i ][ 'hpNow' ] = 0 ;
}
$hp [ $this -> users [ $i ][ 'team' ]] += floor ( $this -> stats [ $i ][ 'hpNow' ]);
if ( ! isset ( $tml [ $this -> users [ $i ][ 'team' ]]) && floor ( $this -> stats [ $i ][ 'hpNow' ]) >= 1 ) {
$tml [ $this -> users [ $i ][ 'team' ]] = 1 ;
$tmv [ $j ] = $this -> users [ $i ][ 'team' ];
$tl ++ ;
}
}
$i ++ ;
}
if ( $tl > 1 ) {
$r = true ;
}
return $r ;
}
2023-08-10 14:51:16 +00:00
//Запускаем магические предметы, если в них что-то встроено
2022-12-19 20:22:19 +00:00
2023-12-17 02:32:09 +00:00
public function testFinish () : void
2022-12-19 20:22:19 +00:00
{
global $u ;
2023-12-17 02:32:09 +00:00
[
'id' => $check ,
'team_win' => $tw ,
] = Db :: getRow ( 'select id, team_win from battle where id = ?' , [ $this -> info [ 'id' ]]);
if ( empty ( $check )) {
return ;
}
if ( $tw === - 1 ) {
2022-12-19 20:22:19 +00:00
$hp = [];
$tml = [];
$tmv = [];
$tl = 0 ;
$i = 0 ;
$j = 0 ;
while ( $i < count ( $this -> uids )) {
if ( $this -> stats [ $i ][ 'id' ] > 0 ) {
if ( floor ( $this -> stats [ $i ][ 'hpNow' ]) < 1 ) {
$this -> stats [ $i ][ 'hpNow' ] = 0 ;
}
$hp [ $this -> users [ $i ][ 'team' ]] += floor ( $this -> stats [ $i ][ 'hpNow' ]);
if ( ! isset ( $tml [ $this -> users [ $i ][ 'team' ]]) && floor ( $this -> stats [ $i ][ 'hpNow' ]) >= 1 ) {
$tml [ $this -> users [ $i ][ 'team' ]] = 1 ;
$tmv [ $j ] = $this -> users [ $i ][ 'team' ];
$tl ++ ;
}
}
$i ++ ;
}
if ( $tl <= 1 ) {
2023-01-10 16:29:32 +00:00
//Доп.проверка
2022-12-19 20:22:19 +00:00
$tmHpNow = [];
$tmNow = [];
2023-12-17 02:32:09 +00:00
foreach (
Db :: getRow ( 'select team, hpNow from users left join stats on users.id = stats.id where battle = ?' , [ $this -> info [ 'id' ]])
as $pl
) {
2022-12-19 20:22:19 +00:00
if ( ! isset ( $tmHpNow [ $pl [ 'team' ]])) {
$tmHpNow [ $pl [ 'team' ]] = 0 ;
$tmNow [] = $pl [ 'team' ];
}
$hpTm = floor ( $pl [ 'hpNow' ]);
if ( $hpTm < 0 ) {
$hpTm = 0 ;
}
if ( $hpTm > 0 ) {
$tmHpNow [ $pl [ 'team' ]] += $pl [ 'hpNow' ];
}
}
2023-12-17 02:32:09 +00:00
2022-12-19 20:22:19 +00:00
$gdj = 0 ;
$i = 0 ;
while ( $i < count ( $tmNow )) {
if ( isset ( $tmNow [ $i ])) {
$j = $tmNow [ $i ];
if ( $tmHpNow [ $j ] > 0 ) {
$gdj ++ ;
}
}
$i ++ ;
}
if ( $gdj > 1 ) {
$tl = $gdj ;
2023-01-10 16:29:32 +00:00
echo 'Поединок может завершиться не корректно... (Сообщите Администрации о б этом)' ;
2022-12-19 20:22:19 +00:00
}
}
if ( $tl <= 1 ) {
2023-01-10 16:29:32 +00:00
//завершаем поединок, кто-то один победил, либо ничья
2022-12-19 20:22:19 +00:00
$i = 0 ;
$tmwin = 0 ;
while ( $i < count ( $tmv )) {
if ( $tmv [ $i ] >= 1 && $tml [ $tmv [ $i ]] > 0 ) {
$tmwin = $tmv [ $i ];
}
$i ++ ;
}
2023-12-17 02:32:09 +00:00
$ir = 0 ;
$bi = 0 ;
if ( $this -> info [ 'id' ] > 0 ) {
if ( $this -> info [ 'izlom' ] == 0 ) {
2023-01-10 16:29:32 +00:00
//данные о игроках в бою
2022-12-30 19:03:37 +00:00
$trl = mysql_query (
2023-12-17 02:32:09 +00:00
'SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`money3`,`u`.`money2`,`u`.`bot_id` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`battle` = "' . $this -> info [ 'id' ] . '" ORDER BY `st`.`bot` DESC'
2022-12-30 19:03:37 +00:00
);
2023-12-17 02:32:09 +00:00
$this -> users = [];
$this -> stats = [];
$this -> uids = [];
$this -> bots = [];
$this -> iBots = [];
2022-12-19 20:22:19 +00:00
while ( $pl = mysql_fetch_array ( $trl )) {
2023-01-10 16:29:32 +00:00
//записываем данные
2022-12-19 20:22:19 +00:00
if ( $pl [ 'login2' ] == '' ) {
$pl [ 'login2' ] = $pl [ 'login' ];
}
$this -> users [ $ir ] = $pl ;
$this -> uids [ $pl [ 'id' ]] = $ir ;
if ( $pl [ 'bot' ] > 0 ) {
$this -> bots [ $bi ] = $pl [ 'id' ];
$this -> iBots [ $pl [ 'id' ]] = $bi ;
$bi ++ ;
}
2023-01-10 16:29:32 +00:00
//записываем статы
2023-12-17 02:32:09 +00:00
$this -> stats [ $ir ] = $u -> getStats ( $pl [ 'id' ], 0 , 0 , false , false , true );
2022-12-19 20:22:19 +00:00
$ir ++ ;
}
2023-12-17 02:32:09 +00:00
} elseif ( ! isset ( $this -> uids [ $u -> info [ 'id' ]])) {
2023-01-10 16:29:32 +00:00
//данные о игроках в бою
2022-12-30 19:03:37 +00:00
$trl = mysql_query (
2023-12-17 02:32:09 +00:00
'SELECT `u`.`no_ip`,`u`.`id`,`u`.`notrhod`,`u`.`login`,`u`.`login2`,`u`.`sex`,`u`.`online`,`u`.`admin`,`u`.`align`,`u`.`align_lvl`,`u`.`align_exp`,`u`.`clan`,`u`.`level`,`u`.`battle`,`u`.`obraz`,`u`.`win`,`u`.`lose`,`u`.`nich`,`u`.`animal`,`st`.`stats`,`st`.`hpNow`,`st`.`mpNow`,`st`.`exp`,`st`.`dnow`,`st`.`team`,`st`.`battle_yron`,`st`.`battle_exp`,`st`.`enemy`,`st`.`battle_text`,`st`.`upLevel`,`st`.`timeGo`,`st`.`timeGoL`,`st`.`bot`,`st`.`lider`,`st`.`btl_cof`,`st`.`tactic1`,`st`.`tactic2`,`st`.`tactic3`,`st`.`tactic4`,`st`.`tactic5`,`st`.`tactic6`,`st`.`tactic7`,`st`.`x`,`st`.`y`,`st`.`battleEnd`,`st`.`priemslot`,`st`.`priems`,`st`.`priems_z`,`st`.`bet`,`st`.`clone`,`st`.`atack`,`st`.`bbexp`,`st`.`res_x`,`st`.`res_y`,`st`.`res_s`,`st`.`id`,`st`.`last_hp`,`st`.`last_pr`,`u`.`sex`,`u`.`money`,`u`.`bot_id`,`u`.`money3`,`u`.`money2` FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON (`u`.`id` = `st`.`id`) WHERE `u`.`id` = ' . $this -> info [ 'id' ]
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
$pl = mysql_fetch_array ( $trl );
2023-01-10 16:29:32 +00:00
//записываем данные
2022-12-19 20:22:19 +00:00
if ( $pl [ 'login2' ] == '' ) {
$pl [ 'login2' ] = $pl [ 'login' ];
}
2022-12-30 19:03:37 +00:00
$this -> users [] = $pl ;
2022-12-19 20:22:19 +00:00
$this -> uids [ $pl [ 'id' ]] = $ir ;
if ( $pl [ 'bot' ] > 0 ) {
2022-12-30 19:03:37 +00:00
$this -> bots [] = $pl [ 'id' ];
2022-12-19 20:22:19 +00:00
$this -> iBots [ $pl [ 'id' ]] = $bi ;
}
2023-01-10 16:29:32 +00:00
//записываем статы
2023-12-17 02:32:09 +00:00
$this -> stats [] = $u -> getStats ( $pl [ 'id' ], 0 , 0 , false , false , true );
2022-12-19 20:22:19 +00:00
}
}
if ( $this -> info [ 'izlom' ] > 0 && $tmwin == 1 ) {
2023-01-10 16:29:32 +00:00
// выкидываем ботов из боя
2022-12-19 20:22:19 +00:00
$i = 0 ;
2023-12-17 02:32:09 +00:00
$botsIds = Db :: getColumn ( 'select users.id from users left join stats on users.id = stats.id where battle = ? and bot = 1 and team != ?' , [ $this -> info [ 'id' ], $u -> info [ 'team' ]]);
Db :: sql ( 'delete from users where id in (?)' , [ implode ( ',' , $botsIds )]);
Db :: sql ( 'delete from stats where id in (?)' , [ implode ( ',' , $botsIds )]);
Db :: sql ( 'delete from items_users where uid in (?)' , [ implode ( ',' , $botsIds )]);
Db :: sql ( 'delete from eff_users where uid in (?)' , [ implode ( ',' , $botsIds )]);
2022-12-19 20:22:19 +00:00
$j = 0 ;
$obr = 0 ;
2023-12-17 02:32:09 +00:00
$bots = [];
2023-01-10 16:29:32 +00:00
//Это излом, добавляем еще ботов
2023-12-19 01:58:37 +00:00
if ( Helper :: getChanse ( 20 )) {
2023-01-10 16:29:32 +00:00
//Уникальные монстры
2023-12-17 02:32:09 +00:00
2022-12-19 20:22:19 +00:00
if ( $this -> info [ 'izlomLvl' ] == 8 ) {
$bots = [
2023-01-10 16:29:32 +00:00
'Валентайский Охотник' ,
'Шипокрыл Х а о с а ' ,
'Шипокрыл' ,
'Лик Х а о с а ' ,
'Фанатик Х а о с а ' ,
2022-12-19 20:22:19 +00:00
];
}
2023-12-17 02:32:09 +00:00
echo '<div style="font-weight: bold; color: crimson; text-align: center">Приближается нечто...</div>' ;
$this -> addIzlomBot ( $bots , $j , $obr , $this -> users [ $i ][ 'id' ]);
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//Обычные монстры
2022-12-19 20:22:19 +00:00
if ( $this -> info [ 'izlomLvl' ] == 8 ) {
$bots = [
2023-01-10 16:29:32 +00:00
'Литейщик' ,
'Проклятие Глубин' ,
'Пустынник Маньяк' ,
'Пустынник Убийца' ,
'Рабочий Мглы' ,
'Смотритель Мглы' ,
'Сторож Мглы' ,
2022-12-19 20:22:19 +00:00
];
}
2023-12-17 02:32:09 +00:00
$this -> addIzlomBot ( $bots , $j , $obr );
$this -> addIzlomBot ( $bots , $j , $obr );
2022-12-19 20:22:19 +00:00
if ( rand ( 0 , 100 ) < 70 ) {
2023-12-17 02:32:09 +00:00
$this -> addIzlomBot ( $bots , $j , $obr );
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
//Каждые 10 волн = +1 монстр
2022-12-19 20:22:19 +00:00
$irb = floor ( $this -> info [ 'izlomRoundSee' ] / 10 );
while ( $irb > 0 ) {
2023-12-17 02:32:09 +00:00
$this -> addIzlomBot ( $bots , $j , $obr );
2022-12-19 20:22:19 +00:00
$irb -- ;
}
}
2023-12-17 02:32:09 +00:00
2022-12-19 20:22:19 +00:00
if ( $j == 0 ) {
2023-01-10 16:29:32 +00:00
//конец излома
2023-09-30 20:17:25 +00:00
$this -> finishBattle ( $tml , $tmv , null );
2023-12-17 02:32:09 +00:00
mysql_query (
'INSERT INTO `izlom_rating` (`uid`,`time`,`voln`,`level`,`bots`,`rep`,`obr`,`btl`) VALUES ("' . $u -> info [ 'id' ] . '","' . time (
) . '","' . $this -> info [ 'izlomRoundSee' ] . '","' . $this -> info [ 'izlomLvl' ] . '","0","0","' . ( $this -> info [ 'izlomObr' ] - $this -> info [ 'izlomObrNow' ]) . '","' . $this -> info [ 'id' ] . '")'
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
} else {
$this -> info [ 'izlomRound' ] = $iz [ 'round' ];
2022-12-30 19:03:37 +00:00
mysql_query (
'UPDATE `battle` SET `izlomObrNow` = ' . $obr . ',`izlomObr` = `izlomObr` + ' . $obr . ',`timeout` = (`timeout`+5),`izlomRound` = "' . ( $this -> info [ 'izlomRound' ] + 1 ) . '",`izlomRoundSee` = `izlomRoundSee`+1 WHERE `id` = "' . $this -> info [ 'id' ] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
$this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'hpNow' ] += $this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'hpAll' ] * 0.25 ;
$this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'mpNow' ] += $this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'mpAll' ] * 0.25 ;
$this -> users [ $this -> uids [ $u -> info [ 'id' ]]][ 'hpNow' ] = $this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'hpAll' ];
$this -> users [ $this -> uids [ $u -> info [ 'id' ]]][ 'mpNow' ] = $this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'mpAll' ];
2023-12-17 02:32:09 +00:00
//где это брать??
$vLog = 'at1=00000||at2=00000||zb1=' . $this -> stats [ $this -> uids [ $u1 ]][ 'zonb' ] .
'||zb2=' . $this -> stats [ $this -> uids [ $u2 ]][ 'zonb' ] .
'||bl1=' . $this -> atacks [ $id ][ 'b' . $a ] .
'||bl2=' . $this -> atacks [ $id ][ 'b' . $b ] .
'||time1=' . $this -> atacks [ $id ][ 'time' ] .
'||time2=' . $this -> atacks [ $id ][ 'time2' ] .
'||s2=' . $this -> users [ $this -> uids [ $u2 ]][ 'sex' ] .
'||s1=' . $this -> users [ $this -> uids [ $u1 ]][ 'sex' ] .
'||t2=' . $this -> users [ $this -> uids [ $u2 ]][ 'team' ] .
'||t1=' . $this -> users [ $this -> uids [ $u1 ]][ 'team' ] .
'||login1=' . $this -> users [ $this -> uids [ $u1 ]][ 'login2' ] .
'||login2=' . $this -> users [ $this -> uids [ $u2 ]][ 'login2' ];
2022-12-19 20:22:19 +00:00
$mas = [
'battle' => $this -> info [ 'id' ],
'id_hod' => ( $this -> hodID + 1 ),
'vars' => $vLog ,
'type' => 1 ,
];
2023-12-17 02:32:09 +00:00
$textpart1 = $u -> info [ 'sex' ] == 1 ? 'воспользовалась' : 'воспользовался' ;
$mas [ 'text' ] = '<span class=date>' . date ( 'H:i' ) .
'</span> <strong>' . $u -> info [ 'login' ] .
'</strong> ' . $textpart1 . ' приемом "<strong>Передышка</strong>".' ;
2022-12-19 20:22:19 +00:00
if ( $u -> stats [ 'hpNow' ] < $u -> stats [ 'hpAll' ]) {
$hpSks = floor (( $u -> stats [ 'hpAll' ] * (( rand ( 15 , 25 )) / 100 )));
if ( $hpSks > floor ( $u -> stats [ 'hpAll' ] - $u -> stats [ 'hpNow' ])) {
$hpSks = floor ( $u -> stats [ 'hpAll' ] - $u -> stats [ 'hpNow' ]);
}
2023-12-17 02:32:09 +00:00
$textpart2 = " + $hpSks " ;
2022-12-19 20:22:19 +00:00
} else {
$hpSks = 0 ;
2023-12-17 02:32:09 +00:00
$textpart2 = '--' ;
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
$mas [ 'text' ] .= ' <strong style="color: #06a;">+' . $textpart2 . '</strong>' ;
2022-12-19 20:22:19 +00:00
$mas [ 'text' ] .= ' [' . floor ( $u -> info [ 'hpNow' ] + $hpSks ) . '/' . $u -> stats [ 'hpAll' ] . ']' ;
2023-12-17 02:32:09 +00:00
2022-12-19 20:22:19 +00:00
$this -> add_log ( $mas );
2023-12-17 02:32:09 +00:00
Db :: sql (
'update stats set hpNow = ?, mpNow = ? where id = ?' ,
[
$u -> info [ 'hpNow' ] + $u -> stats [ 'hpAll' ] * (( rand ( 15 , 25 )) / 100 ),
$u -> info [ 'mpNow' ] + $u -> stats [ 'mpAll' ] * 0.25 ,
$u -> info [ 'id' ],
]
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
2022-12-19 20:22:19 +00:00
} else {
2023-01-10 16:29:32 +00:00
//завершаем бой
2023-09-30 20:17:25 +00:00
$this -> finishBattle ( $tml , $tmv , null );
2022-12-19 20:22:19 +00:00
if ( $this -> info [ 'izlom' ] > 0 ) {
2023-12-17 02:32:09 +00:00
Db :: sql (
'insert into izlom_rating (uid, time, voln, level, obr, btl) values (?,unix_timestamp(),?,?,?,?)' ,
[
$u -> info [ 'id' ],
$this -> info [ 'izlomRoundSee' ],
$this -> info [ 'izlomLvl' ],
$this -> info [ 'izlomObr' ] - $this -> info [ 'izlomObrNow' ],
$this -> info [ 'id' ],
]
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
2023-01-28 02:24:37 +00:00
2023-12-17 02:32:09 +00:00
Effects :: addById ( $u -> info [ 'id' ], 31 );
$cmsg = new ChatMessage ();
$cmsg -> setRoom ( $u -> info [ 'room' ]);
$cmsg -> setTo ( $u -> info [ 'login' ]);
$cmsg -> setType ( 6 );
$cmsg -> setText (
'Вы создали предмет "Образец" x' . (( $this -> info [ 'izlomObr' ] - $this -> info [ 'izlomObrNow' ]) * 7 )
);
( new Chat ()) -> sendMsg ( $cmsg );
$i01 = 1 ;
while ( $i01 <= (( $this -> info [ 'izlomObr' ] - $this -> info [ 'izlomObrNow' ])) * 7 ) {
ItemsModel :: addItem ( 1226 , $u -> info [ 'id' ], '|sudba=' . $u -> info [ 'login' ]);
$i01 ++ ;
2022-12-19 20:22:19 +00:00
}
2023-12-17 02:32:09 +00:00
Db :: sql (
" insert into actions (uid, time, city, room, vars, ip, vals, val) values (?,unix_timestamp(),'capitalcity',?,'izlom','','','') " ,
[ $u -> info [ 'id' ], $u -> info [ 'room' ]]
);
2022-12-19 20:22:19 +00:00
}
} else {
2023-12-17 02:32:09 +00:00
$this -> finishBattle ( null , null , 10 );
}
}
/**
* @ param array $botLogins
* @ param int $counter
* @ param int $obr
* @ param int $unique для совместимости с непонятным вызовом User -> addAction
* при вызове уникального монстра .
* @ return void
*/
private function addIzlomBot ( array $botLogins , int & $counter , int & $obr , int $unique = 0 ) : void
{
global $u ;
if ( empty ( $botLogins ) || mt_rand ( 0 , count ( $botLogins ) - 1 ) === 0 ) {
return ;
}
[
'id' => $id ,
'align' => $align ,
'clan' => $clan ,
'level' => $level ,
'sex' => $gender ,
'login' => $login ,
] = Db :: getRow (
" select id, align, clan, level, sex, login from test_bot where login = ? and pishera != '' and active = 1 and level <= ? order by level desc limit 1 " ,
[ $botLogins [ array_rand ( $botLogins )], $u -> info [ 'level' ]]
);
$bot = $u -> addNewbot ( id : $id , round : round ( $this -> info [ 'izlomRoundSee' ]) * mt_rand ( 1 , 2 ));
if ( empty ( $bot )) {
return ;
}
$imgBase = Config :: img () . DIRECTORY_SEPARATOR . 'i' ;
$alignStr = empty ( $align ) ? '' : " <img src=' $imgBase /align/align $align .gif' alt=''> " ;
$clanStr = empty ( $clan ) ? '' : " <img src=' $imgBase /clan/ $clan .gif' alt=' $clan '> " ;
$spacedLogin = str_replace ( ' ' , '%20' , $login );
$loginLink = " <a href='/inf.php?login= $spacedLogin ' target='_blank'><img src='img/inf.gif' title='Инф. о $login ' alt='Инф. о $login '></a> " ;
$btxt = " $alignStr $clanStr <strong> $login </strong> [ $level ] $loginLink " ;
$btxt .= $gender == 1 ? ' вмешалась в поединок.' : ' вмешался в поединок.' ;
2023-12-19 01:58:37 +00:00
Log :: add (
[
'text' => " { tm1} $btxt " ,
'battle' => $this -> info [ 'id' ],
'id_hod' => ( $this -> hodID + 1 ),
'vars' => 'at1=00000||at2=00000||zb1=0||zb2=0||bl1=0||bl2=0||time1=' . time () .
'||time2=' . time () .
'||s1=' . $gender .
'||t1=0' .
'||login1=' . $login ,
'type' => 1 ,
]
);
2023-08-10 14:51:16 +00:00
2023-12-19 01:58:37 +00:00
Db :: sql ( 'update users left join stats on users.id = stats.id set battle = ?, team = 2 where users.id = ?' , [ $this -> info [ 'id' ], $bot [ 'id' ]]);
2023-08-10 14:51:16 +00:00
2023-12-19 01:58:37 +00:00
if ( $unique ) {
$u -> addAction ( time (), 'win_bot_' . $id , '' , $unique );
}
2023-08-10 14:51:16 +00:00
2023-12-19 01:58:37 +00:00
$counter ++ ;
if ( mt_rand ( 0 , 10000 ) < 1500 ) {
$obr ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
}
2023-12-19 01:58:37 +00:00
//Поглощение урона
/** Запись в лог боя с шансом реплики комментатора .
* @ param array $mass
2023-08-10 14:51:16 +00:00
* @ return void
*/
2023-12-19 01:58:37 +00:00
public function add_log ( array $mass ) : void
2023-08-10 14:51:16 +00:00
{
2023-12-19 01:58:37 +00:00
if ( empty ( $mass [ 'text' ])) {
return ;
}
Log :: add ( $mass );
if ( Helper :: getChanse ( 12 )) {
Log :: addComment ( $this );
}
2023-08-10 14:51:16 +00:00
}
2023-12-19 01:58:37 +00:00
//Иг р о к1 наносит удар Иг р о к2
private function finishBattle ( $t , $v , $nl ) : void
{
$this -> finish -> finishBattle ( $t , $v , $nl );
}
2023-08-10 14:51:16 +00:00
//Проверка ухода удара в игрока
public function addTravm ( $uid , $type , $lvl )
{
2023-12-19 01:58:37 +00:00
$stat = rand ( 1 , 3 ); // пока без духовности
$img = " eff_travma $type .gif " ;
$timeEnd = 0 ;
if ( $type == 1 ) {
2023-08-10 14:51:16 +00:00
$name = 'Легкая травма' ;
$timeEnd = rand ( 1 , 3 ); // время травмы от 1.30 до 6 часов
$data = 'add_s' . $stat . '=-' . $lvl ;
2023-12-19 01:58:37 +00:00
} elseif ( $type == 2 ) {
2023-08-10 14:51:16 +00:00
$name = 'Средняя травма' ;
$timeEnd = rand ( 3 , 5 ); // время травмы от 6 до 12 часов
$data = 'add_s' . $stat . '=-' . ( $lvl * 2 );
2023-12-19 01:58:37 +00:00
} elseif ( $type == 3 ) {
2023-08-10 14:51:16 +00:00
$name = 'Тяжелая травма' ;
$timeEnd = rand ( 5 , 7 ); // время травмы от 12 до 6 часов
$data = 'add_s' . $stat . '=-' . ( $lvl * 3 );
2023-12-19 01:58:37 +00:00
} elseif ( $type == 4 ) {
2023-08-10 14:51:16 +00:00
$name = 'Неизлечимая травма' ;
$timeEnd = 24 ; // время травмы от 24 часа
$data = 'add_s' . $stat . '=-' . ( $lvl * 50 );
}
$timeEnd *= 3600 ;
2023-09-30 20:17:25 +00:00
mysql_query (
2023-12-17 02:32:09 +00:00
'INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time (
2023-12-19 01:58:37 +00:00
) . '","-1","' . $name . '","' . $data . '","' . $uid . '", "4", "' . $img . '","' . $timeEnd . '", "' . $type . '")'
2023-08-10 14:51:16 +00:00
);
2023-09-30 20:17:25 +00:00
mysql_query (
2023-12-17 02:32:09 +00:00
'INSERT INTO `eff_users` (`overType`,`timeUse`,`hod`,`name`,`data`,`uid`, `id_eff`, `img2`, `timeAce`, `v1`) VALUES ("0","' . time (
) . '","-1","Иммунитет: Защита от травм","add_notravma=1","' . $uid . '", "263", "cure1.gif","21600", "")'
2023-08-10 14:51:16 +00:00
);
}
//Расчет уворота игроков
//Расчет крита игроков
//Расчет блока щитом игроков
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
public function priemAddLogFast ( $u1 , $u2 , $prm , $text , $hodID , $tm ) : void
2023-08-10 14:51:16 +00:00
{
2023-12-19 01:58:37 +00:00
$vLog =
'prm=' . $prm .
'||time1=' . $tm .
'||time2=' . $tm .
'||s1=' . $this -> users [ $this -> uids [ $u1 ]][ 'sex' ] .
'||s2=' . $this -> users [ $this -> uids [ $u2 ]][ 'sex' ] .
'||t2=' . $this -> users [ $this -> uids [ $u2 ]][ 'team' ] .
'||t1=' . $this -> users [ $this -> uids [ $u1 ]][ 'team' ] .
'||login1=' . $this -> users [ $this -> uids [ $u1 ]][ 'login2' ] .
'||login2=' . $this -> users [ $this -> uids [ $u2 ]][ 'login2' ];
$arr = [
2023-08-10 14:51:16 +00:00
'text' => $text ,
'battle' => $this -> info [ 'id' ],
2023-12-19 01:58:37 +00:00
'id_hod' => $this -> hodID + $hodID ,
2023-08-10 14:51:16 +00:00
'vars' => $vLog ,
'type' => 1 ,
];
2023-12-19 01:58:37 +00:00
$this -> add_log ( $arr );
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
//Расчет контрудара игроков
2023-09-30 20:17:25 +00:00
/** Осторожно ! Подключаются файлы !!!
2023-08-10 14:51:16 +00:00
* Трогать очень осторожно . Этот шайтан как - то проверяет приёмы на враге
* и рассчитывает урон учитывая и эти приёмы тоже .
* @ param $uid1
* @ param $uid2
* @ param $priem
* @ param $yron
* @ param $profil
* @ param $stabil
* @ param $test
* @ param $inlog
* @ return float | int | mixed
*/
public function testYronPriem ( $uid1 , $uid2 , $priem , $yron , $profil , $stabil , $test = false , $inlog = 0 )
{
/*
profil = {
- 1 - урон оружием
- 2 - урон магией
0 - неизвестно
1 - 4 - профильный оружия
5 - 12 - профильный магия
}
stabil - урон не подвержен мощностям и т . д
*/
//Проверка
$a = 1 ;
$b = 2 ;
$u1 = $uid1 ;
$u2 = $uid2 ;
//Проверяем приемы защиты игрока $u1 на урон игрока $u2
//Получаем приемы и смотрим когда какой действует
if ( ! isset ( $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ])) {
$eff = $this -> stats [ $this -> uids [ $u2 ]][ 'effects' ];
$j = 0 ;
while ( $j <= count ( $eff )) {
if ( isset ( $eff [ $j ]) && $eff [ $j ][ 'id_eff' ] == 22 && $eff [ $j ][ 'v1' ] == 'priem' && $eff [ $j ][ 'v2' ] > 0 ) {
$this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][] = [
$j ,
$eff [ $j ][ 'v2' ],
$this -> prm [ $eff [ $j ][ 'v2' ]][ 'act' ],
$eff [ $j ][ 'id' ],
$this -> prm [ $eff [ $j ][ 'v2' ]][ 'type_of' ],
$this -> prm [ $eff [ $j ][ 'v2' ]][ 'moment' ],
];
}
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
unset ( $eff );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Приемы защиты
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 4 ] == 4 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_momental_this = $u2 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$yron = $fx_moment ( $u2 , $u1 , $j , $yron , $profil );
2023-11-02 13:57:39 +00:00
unset ( $fx_moment );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 5 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_momental_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
if ( isset ( $fx_moment )) {
$yron = $fx_moment ( $u1 , $u2 , $j , $yron , $profil , $inlog );
}
2023-11-02 13:57:39 +00:00
unset ( $fx_moment );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Прочие приемы (влияет на урон от моментальных приемов)
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 7 ] == 5 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_momental_this_seven = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
if ( isset ( $fx_moment_seven )) {
$yron = $fx_moment_seven ( $u1 , $u2 , $j , $yron , $profil , $inlog );
}
2023-11-02 13:57:39 +00:00
unset ( $fx_moment_seven );
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] == 180 ) {
// Переохлаждение (снижает урон на 10%). Пан или пропал.
$x = Db :: getValue ( 'select x from eff_users where v2 = 180 and uid = ?' , [ $u1 ]);
$yron = 0.1 * $x ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$j ++ ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 4 ] == 8 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_momental_this = $u2 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
if ( isset ( $fx_moment )) {
$yron = $fx_moment ( $u2 , $u1 , $j , $yron , $profil , $inlog );
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
unset ( $fx_moment );
2023-08-10 14:51:16 +00:00
}
}
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 4 ] == 9 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_momental_this = $u2 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
if ( isset ( $fx_moment )) {
$yron = $fx_moment ( $u2 , $u1 , $j , $yron , $profil , $inlog );
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
unset ( $fx_moment );
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'zaproc' ] > 0 ) {
$yron = round ( $yron - $yron * $this -> stats [ $this -> uids [ $uid2 ]][ 'zaproc' ] / 100 );
if ( $yron < 1 ) {
$yron = 1 ;
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
return $yron ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
//Добавляем статистику
2023-12-19 01:58:37 +00:00
public function priemYronSave ( $u1 , $u2 , $yron , $type ) : void
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
//$type 0 - урон , 1 - хил
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$this -> testUserInfoBattle ( $u1 );
$this -> testUserInfoBattle ( $u2 );
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( isset ( $this -> uids [ $u1 ])) {
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'hpAll' ] <= 1000 ) {
$adt6 = round ( 0.1 * ( floor ( $yron ) / $this -> stats [ $this -> uids [ $u2 ]][ 'hpAll' ] * 100 ), 10 );
} else {
$adt6 = round ( 0.1 * ( floor ( $yron ) / 1000 * 100 ), 10 );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $yron > $this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ]) {
$yron = $this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ];
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $yron > 0 ) {
$this -> users [ $this -> uids [ $u1 ]][ 'battle_yron' ] += $yron ;
$this -> users [ $this -> uids [ $u1 ]][ 'battle_exp' ] += round (
$this -> testExp ( $yron , $this -> stats [ $this -> uids [ $u2 ]])
);
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u1 ]][ 'tactic6' ] += $adt6 ;
$this -> stats [ $this -> uids [ $u1 ]][ 'tactic6' ] += $adt6 ;
} else {
$this -> users [ $this -> uids [ $u1 ]][ 'tactic6' ] += $adt6 / 3 ;
$this -> stats [ $this -> uids [ $u1 ]][ 'tactic6' ] += $adt6 / 3 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
} else {
$adt6 = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//
$this -> users [ $this -> uids [ $u2 ]][ 'last_hp' ] = - $yron ;
//
mysql_query (
' UPDATE `stats` SET
`tactic6` = `tactic6` + " ' . $adt6 . ' " ,
`battle_yron` = `battle_yron` + " ' . $yron . ' " ,
`battle_exp` = `battle_exp` + " ' . round(
$this -> testExp ( $yron , $this -> stats [ $this -> uids [ $u2 ]])
) . ' "
WHERE `id` = " ' . $u1 . ' " LIMIT 1 '
);
//
mysql_query (
' UPDATE `stats` SET
`last_hp` = " ' . $this->users [ $this->uids [ $u2 ]]['last_hp'] . ' "
WHERE `id` = " ' . $u2 . ' " LIMIT 1 '
);
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$this -> addNewStat (
[
1 => [
'battle' => $this -> info [ 'id' ],
'uid1' => $this -> users [ $this -> uids [ $u1 ]][ 'id' ],
'uid2' => $this -> users [ $this -> uids [ $u2 ]][ 'id' ],
'time' => time (),
'type' => 0 ,
'a' => '10000' ,
'b' => 0 ,
'type_a' => 1 ,
'type_b' => 0 ,
'ma' => 1 ,
'mb' => 1 ,
'yrn' => $yron ,
'yrn_krit' => 0 ,
'tm1' => $this -> users [ $this -> uids [ $u1 ]][ 'team' ],
'tm2' => $this -> users [ $this -> uids [ $u2 ]][ 'team' ],
],
]
);
}
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
public function testUserInfoBattle ( $uid ) : void
2023-08-10 14:51:16 +00:00
{
global $u ;
2023-12-19 01:58:37 +00:00
if ( isset ( $this -> uids [ $uid ])) {
return ;
}
//Заносим данные о б игроке снова (видимо он погиб и е г о стерло с инфо)
2023-08-10 14:51:16 +00:00
if ( ! isset ( $this -> uids [ $uid ])) {
2023-12-19 01:58:37 +00:00
$this -> uids [ $uid ] = count ( $this -> users );
2023-08-10 14:51:16 +00:00
}
2023-12-19 01:58:37 +00:00
$this -> users [ $this -> uids [ $uid ]] = mysql_fetch_array (
mysql_query (
' SELECT
`u` . `id` , `u` . `login` , `u` . `login2` , `u` . `online` , `u` . `admin` , `u` . `city` , `u` . `cityreg` , `u` . `align` , `u` . `align_lvl` , `u` . `align_exp` , `u` . `clan` ,
`u` . `level` , `u` . `money` , `u` . `money3` , `u` . `money2` , `u` . `money4` , `u` . `battle` , `u` . `sex` , `u` . `obraz` , `u` . `win` , `u` . `win_t` ,
`u` . `lose` , `u` . `lose_t` , `u` . `nich` , `u` . `timeMain` , `u` . `invis` , `u` . `bot_id` , `u` . `animal` , `u` . `type_pers` ,
`u` . `notrhod` , `u` . `bot_room` , `u` . `inUser` , `u` . `inTurnir` , `u` . `inTurnirnew` , `u` . `stopexp` , `u` . `real` ,
`st` .*
FROM `users` AS `u` LEFT JOIN `stats` AS `st` ON ( `u` . `id` = `st` . `id` ) WHERE `u` . `id` = " ' . $uid . ' " LIMIT 1 '
)
);
$stats = new Stats ( $u );
$this -> stats [ $this -> uids [ $uid ]] = $stats -> getStats (); //getStats($this->users[$this->uids[$uid]])
//fixme много чего повторно берется
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
//Добавляем статистику ударов
2023-08-10 14:51:16 +00:00
2023-08-14 15:15:05 +00:00
/**
* Расчет опыта
* @ param $y
* @ param $s2
* @ return int
*/
private function testExp ( $y , $s2 ) : int
{
if ( $s2 [ 'levels' ] == 'undefined' || $this -> users [ $this -> uids [ $s2 [ 'id' ]]][ 'pass' ] == 'saintlucia' ) {
return 0 ;
}
$y = max ( 0 , ( int ) $y );
$expmultiplier = 1 ;
if ( $this -> users [ $this -> uids [ $s2 [ 'id' ]]][ 'level' ] >= 8 ) {
$expmultiplier = $this -> users [ $this -> uids [ $s2 [ 'id' ]]][ 'level' ] - 5 ;
}
if ( $s2 [ 'hpNow' ] < 0 ) {
$y = 0 ;
}
if ( $s2 [ 'hpNow' ] < $y ) {
$y = max ( 0 , $s2 [ 'hpNow' ]);
}
$addExp = $y * $expmultiplier ;
if ( $s2 [ 'hpAll' ] - $y <= 0 ) {
$addExp = 100 ;
}
if ( $this -> info [ 'razdel' ] != 5 && Config :: get ( 'exp_limit_many' )) {
$texp = Db :: getValue (
'select count(*) from battle_users as a where uid = ? and battle in (select battle from battle_users where uid = ? and team != a.team and time_enter > unix_timestamp() - 86400)'
);
//
if ( $texp > 5 ) {
$addExp = 0 ;
} elseif ( $texp > 4 ) {
$addExp = $addExp * 0.50 ;
} elseif ( $texp > 3 ) {
$addExp = $addExp * 0.75 ;
} elseif ( $texp > 2 ) {
$addExp = $addExp * 1.00 ;
} elseif ( $texp > 1 ) {
$addExp = $addExp * 1.00 ;
} else {
$addExp = $addExp * 1.00 ;
}
}
return ( int ) round ( $addExp );
}
2023-11-02 13:57:39 +00:00
//Добавляем размены в лог
2023-08-14 15:15:05 +00:00
2023-12-19 01:58:37 +00:00
public function addNewStat ( $stat ) : void
2023-08-14 15:15:05 +00:00
{
if ( isset ( $stat [ 1 ])) {
mysql_query (
' INSERT INTO `battle_stat`
( `battle` , `uid1` , `uid2` , `time` , `type` , `a` , `b` , `ma` , `mb` , `type_a` , `type_b` , `yrn` , `yrn_krit` , `tm1` , `tm2` ) VALUES (
" ' . $this->info ['id'] . ' " ,
" ' . $stat[1] ['uid1'] . ' " ,
" ' . $stat[1] ['uid2'] . ' " ,
" ' . $stat[1] ['time'] . ' " ,
" ' . $stat[1] ['type'] . ' " ,
" ' . $stat[1] ['a'] . ' " ,
" ' . $stat[1] ['b'] . ' " ,
" ' . $stat[1] ['ma'] . ' " ,
" ' . $stat[1] ['mb'] . ' " ,
" ' . $stat[1] ['type_a'] . ' " ,
" ' . $stat[1] ['type_b'] . ' " ,
" ' . $stat[1] ['yrn'] . ' " ,
" ' . $stat[1] ['yrn_krit'] . ' " ,
" ' . $stat[1] ['tm1'] . ' " ,
" ' . $stat[1] ['tm2'] . ' "
) '
);
}
if ( isset ( $stat [ 2 ])) {
mysql_query (
' INSERT INTO `battle_stat`
( `battle` , `uid1` , `uid2` , `time` , `type` , `a` , `b` , `ma` , `mb` , `type_a` , `type_b` , `yrn` , `yrn_krit` , `tm1` , `tm2` ) VALUES (
" ' . $this->info ['id'] . ' " ,
" ' . $stat[2] ['uid1'] . ' " ,
" ' . $stat[2] ['uid2'] . ' " ,
" ' . $stat[2] ['time'] . ' " ,
" ' . $stat[2] ['type'] . ' " ,
" ' . $stat[2] ['a'] . ' " ,
" ' . $stat[2] ['b'] . ' " ,
" ' . $stat[1] ['ma'] . ' " ,
" ' . $stat[2] ['mb'] . ' " ,
" ' . $stat[2] ['type_a'] . ' " ,
" ' . $stat[2] ['type_b'] . ' " ,
" ' . $stat[2] ['yrn'] . ' " ,
" ' . $stat[2] ['yrn_krit'] . ' " ,
" ' . $stat[2] ['tm1'] . ' " ,
" ' . $stat[2] ['tm2'] . ' "
) '
);
}
}
2023-11-02 13:57:39 +00:00
//Добавляем в лог действия приема
2023-08-10 14:51:16 +00:00
public function lookLog () : string
{
2023-09-30 20:17:25 +00:00
global $u ;
2023-08-10 14:51:16 +00:00
$hodID = mysql_fetch_array (
mysql_query (
'SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this -> info [ 'id' ] . '" ORDER BY `time` ASC LIMIT 1'
)
);
if ( $hodID [ 'id_hod' ] <= 1 ) {
$u -> info [ 'alog' ] = 0 ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$js = '' ;
$pll = 0 ;
if ( $_POST [ 'idlog' ] < 1 ) {
$_POST [ 'idlog' ] = 0 ;
}
$talog = mysql_fetch_array (
mysql_query ( 'SELECT `alog` FROM `stats` WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1' )
);
$sp = mysql_query (
' SELECT
`id` , `type` , `time` , `battle` , `id_hod` , `text` , `vars` , `zona1` , `zona2` , `zonb1` , `zonb2`
FROM `battle_logs`
WHERE `battle` = " ' . $this->info ['id'] . ' " AND `id_hod` >= ' . $talog[' alog '] . ' ORDER BY `id` DESC '
);
if ( isset ( $sp ) && $this -> info [ 'team_win' ] != - 1 ) {
$sp = mysql_query (
' SELECT
`id` , `type` , `time` , `battle` , `id_hod` , `text` , `vars` , `zona1` , `zona2` , `zonb1` , `zonb2`
FROM `battle_logs_save`
WHERE `battle` = " ' . $this->info ['id'] . ' " AND `id_hod` >= ' . $talog[' alog '] . ' ORDER BY `id` DESC '
);
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$jin = 0 ;
$forYou2 = 0 ;
if ( is_array ( $sp )) {
while ( $pl = mysql_fetch_array ( $sp )) {
if ( $jin == 0 ) {
$u -> info [ 'alog' ] = $pl [ 'id_hod' ];
}
$jin ++ ;
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$rt = $pl [ 'text' ];
$pl [ 'vars' ] = str_replace ( '^^^^' , 'rvnO' , $pl [ 'vars' ]);
$rt = str_replace (
'{tm1}' , '<span class=\"date {fru}\">' . date ( 'H:i' , $pl [ 'time' ]) . '</span>' ,
$rt
);
$rt = str_replace (
'{tm2}' , '<span class=\"date {fru}\">' . date ( 'H:i' , $pl [ 'time' ]) . '</span>' ,
$rt
);
$rt = str_replace (
'{tm3}' ,
'<span class=\"date {fru}\">' . date ( 'd.m.Y H:i' , $pl [ 'time' ]) . '</span>' , $rt
);
$rt = str_replace (
'{tm4}' ,
'<span class=\"date {fru}\">' . date ( 'd.m.Y H:i' , $pl [ 'time' ]) . '</span>' , $rt
);
$pl [ 'text' ] = $rt ;
unset ( $rt );
if ( $pll < $pl [ 'id' ]) {
$pll = $pl [ 'id' ];
}
$js = 'add_log(' . $pl [ 'id' ] . ',' . $forYou2 . ',"' . $pl [ 'text' ] . '",' . $pl [ 'id_hod' ] . ',0,0,"' . str_replace (
'"' ,
'"' , $pl [ 'vars' ]
) . '");' . $js ;
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
mysql_query (
'UPDATE `stats` SET `alog`="' . $u -> info [ 'alog' ] . '" WHERE `id` ="' . $u -> info [ 'id' ] . '" LIMIT 1'
);
$js .= 'id_log=' . $pll . ';' ;
return $js ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
//Считаем контру
2023-08-14 15:15:05 +00:00
2023-08-10 14:51:16 +00:00
public function lookmLog () : string
{
2023-09-30 20:17:25 +00:00
global $u ;
2023-08-10 14:51:16 +00:00
$js = '' ;
$pll = 0 ;
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( $this -> info [ 'type' ] != 9 ) {
$hodID = mysql_fetch_array (
mysql_query (
'SELECT `id`,`id_hod` FROM `battle_logs` WHERE `battle` = "' . $this -> info [ 'id' ] . '" ORDER BY `time` ASC LIMIT 1'
)
2022-12-30 19:03:37 +00:00
);
2023-08-10 14:51:16 +00:00
if ( $hodID [ 'id_hod' ] <= 1 ) {
$u -> info [ 'mlog' ] = 0 ;
}
if ( isset ( $hodID [ 'id' ]) && $this -> info [ 'team_win' ] != - 1 ) {
$hodID = mysql_fetch_array (
mysql_query (
'SELECT `id` FROM `battle_logs_save` WHERE `battle` = "' . $this -> info [ 'id' ] . '" ORDER BY `time` ASC LIMIT 1'
)
);
}
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
$tmlog = mysql_fetch_array (
mysql_query ( 'SELECT `mlog` FROM `stats` WHERE `id` = "' . $u -> info [ 'id' ] . '" LIMIT 1' )
);
$spm = mysql_query (
' SELECT
`id` , `type` , `time` , `battle` , `id_hod` , `text` , `vars` , `zona1` , `zona2` , `zonb1` , `zonb2`
FROM `battle_logs`
WHERE `battle` = " ' . $this->info ['id'] . ' " AND `id_hod` >= ' . $tmlog[' mlog '] . ' AND `vars` LIKE " %' . $u->info ['login'] . '% " ORDER BY `id` DESC '
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( isset ( $spm ) && $this -> info [ 'team_win' ] != - 1 ) {
$spm = mysql_query (
' SELECT
`id` , `type` , `time` , `battle` , `id_hod` , `text` , `vars` , `zona1` , `zona2` , `zonb1` , `zonb2`
FROM `battle_logs_save`
WHERE `battle` = " ' . $this->info ['id'] . ' " AND `id_hod` >= ' . $tmlog[' mlog '] . ' AND `vars` LIKE " %' . $u->info ['login'] . '% " ORDER BY `id` DESC '
);
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$jin = 0 ;
$forYou2 = 0 ;
if ( is_array ( $spm )) {
while ( $plm = mysql_fetch_array ( $spm )) {
if ( $jin == 0 ) {
$u -> info [ 'mlog' ] = $plm [ 'id_hod' ];
}
$jin ++ ;
$rt = $plm [ 'text' ];
$plm [ 'vars' ] = str_replace ( '^^^^' , 'rvnO' , $plm [ 'vars' ]);
$rt = str_replace (
'{tm1}' , '<span class=\"date {fru}\">' . date ( 'H:i' , $plm [ 'time' ]) . '</span>' , $rt
);
$rt = str_replace (
'{tm2}' , '<span class=\"date {fru}\">' . date ( 'H:i' , $plm [ 'time' ]) . '</span>' , $rt
);
$rt = str_replace (
'{tm3}' , '<span class=\"date {fru}\">' . date ( 'd.m.Y H:i' , $plm [ 'time' ]) . '</span>' ,
$rt
);
$rt = str_replace (
'{tm4}' , '<span class=\"date {fru}\">' . date ( 'd.m.Y H:i' , $plm [ 'time' ]) . '</span>' ,
$rt
);
$plm [ 'text' ] = $rt ;
unset ( $rt );
if ( $pll < $plm [ 'id' ]) {
$pll = $plm [ 'id' ];
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$js = 'add_mlog(' . $plm [ 'id' ] . ',' . $forYou2 . ',"' . $plm [ 'text' ] . '",' . $plm [ 'id_hod' ] . ',0,0,"' . str_replace (
'"' ,
'"' , $plm [ 'vars' ]
) . '");' . $js ;
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
$js .= 'id_mlog=' . $pll . ';' ;
mysql_query (
'UPDATE `stats` SET `mlog`="' . $u -> info [ 'mlog' ] . '" WHERE `id` ="' . $u -> info [ 'id' ] . '" LIMIT 1'
);
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
return $js ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
//Расчитываем статы для конкретной зоны атаки
2023-08-10 14:51:16 +00:00
public function weaponAt22 ( $item , $st ) : array
2022-12-19 20:22:19 +00:00
{
2023-12-19 01:58:37 +00:00
if ( ! isset ( $item [ 'id' ])) {
return [ 0 , 0 ];
}
$itm = Conversion :: dataStringToArray ( $item [ 'data' ]);
//начинаем расчет урона
return [
$itm [ 'sv_yron_min' ] + $itm [ 'yron_min' ] + $st [ 'minAtack' ],
$itm [ 'sv_yron_max' ] + $itm [ 'yron_max' ] + $st [ 'maxAtack' ],
];
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
//Считаем урон
2023-08-10 14:51:16 +00:00
2023-12-19 01:58:37 +00:00
public function autoSmena () : void
2022-12-19 20:22:19 +00:00
{
global $u ;
2023-08-10 14:51:16 +00:00
$ms = [];
$ms_ansf = [];
$i = 0 ;
$j = 0 ;
$z = 0 ;
while ( $i < count ( $this -> users )) {
if ( isset ( $this -> users [ $i ]) && $this -> users [ $i ][ 'id' ] != $u -> info [ 'id' ] && $this -> users [ $i ][ 'team' ] != $u -> info [ 'team' ] && $this -> stats [ $i ][ 'hpNow' ] > 0 && - ( $u -> info [ 'enemy' ]) != $this -> users [ $i ][ 'id' ]) {
if ( ! isset ( $this -> ga [ $u -> info [ 'id' ]][ $this -> users [ $i ][ 'id' ]])) {
$ms [ $j ] = $this -> users [ $i ][ 'id' ];
$j ++ ;
}
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
if ( isset ( $this -> ga [ $this -> users [ $i ][ 'id' ]][ $u -> info [ 'id' ]])) {
$ms_ansf [ $z ] = $this -> users [ $i ][ 'id' ];
$z ++ ;
}
}
$i ++ ;
}
$msh = [];
if ( $j == 0 && $z == 0 ) {
$enemydie = 0 ;
if ( isset ( $this -> stats [ $this -> uids [ $u -> info [ 'enemy' ]]])) {
$u -> info [ 'enemy' ] = 0 ;
$enemydie = 1 ;
}
if (( ! isset ( $this -> uids [( - ( $u -> info [ 'enemy' ]))]) || $this -> stats [ $this -> uids [( - ( $u -> info [ 'enemy' ]))]][ 'hpNow' ] < 1 ) && ( $u -> info [ 'enemy' ] < 0 || $enemydie == 1 )) {
$i = 0 ;
$j = 0 ;
while ( $i < count ( $this -> users )) {
if ( isset ( $this -> users [ $i ]) && $this -> users [ $i ][ 'id' ] != $u -> info [ 'id' ] && $this -> users [ $i ][ 'team' ] != $u -> info [ 'team' ] && $this -> stats [ $i ][ 'hpNow' ] >= 1 && - ( $u -> info [ 'enemy' ]) != $this -> users [ $i ][ 'id' ]) {
$ms [ $j ] = $this -> users [ $i ][ 'id' ];
$msh [ $ms [ $j ]] = true ;
$j ++ ;
}
$i ++ ;
}
}
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$ms = $ms [ rand ( 0 , $j - 1 )];
$ms_ansf = $ms_ansf [ rand ( 0 , $z - 1 )];
if ( $z > 0 ) {
$this -> smena ( $ms_ansf , true );
} elseif ( $j > 0 ) {
if ( isset ( $msh [ $ms ])) {
$this -> smena ( $ms , true , true );
2022-12-19 20:22:19 +00:00
} else {
2023-08-10 14:51:16 +00:00
$this -> smena ( $ms , true );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
} else {
if ( $u -> info [ 'enemy' ] < 0 ) {
$smnr5 = $this -> smena ( - ( $u -> info [ 'enemy' ]), true );
unset ( $smnr5 );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
}
}
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
//Добавляем новую статистику игрока
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
public function smena ( $uid , $auto = false , $lastdie = false ) : int | string
2023-08-10 14:51:16 +00:00
{
global $u ;
2023-12-19 01:58:37 +00:00
if (( $auto || $u -> info [ 'smena' ] <= 0 ) && ! $auto ) {
2023-08-10 14:51:16 +00:00
return 'У вас закончились смены противника' ;
}
2023-12-19 01:58:37 +00:00
if ( $this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'hpNow' ] < 1 ) {
return 'Для вас поединок закончен, ожидайте пока завершат другие...' ;
}
if ( ! isset ( $this -> uids [ $uid ]) || $uid == $u -> info [ 'id' ] || $this -> users [ $this -> uids [ $uid ]][ 'team' ] == $this -> users [ $this -> uids [ $u -> info [ 'id' ]]][ 'team' ]) {
return 'Нельзя сменить на выбранную цель []' ;
}
if ( isset ( $this -> ga [ $u -> info [ 'id' ]][ $uid ]) && ! $lastdie ) {
return 'Нельзя сменить на выбранную цель!' ;
}
if ( ceil ( $this -> stats [ $this -> uids [ $uid ]][ 'hpNow' ]) < 1 ) {
return 'Нельзя сменить, противник уже мертв' ;
}
//меняем противника
if ( ! $auto ) {
$u -> info [ 'smena' ] -- ;
}
Db :: sql ( 'update stats set enemy = ?, smena = ? where id = ?' , [ $uid , $u -> info [ 'smena' ], $u -> info [ 'id' ]]);
$u -> info [ 'enemy' ] = $uid ;
$this -> users [ $this -> uids [ $uid ]][ 'smena' ] = $u -> info [ 'smena' ];
$this -> users [ $this -> uids [ $u -> info [ 'id' ]]][ 'enemy' ] = $uid ;
return 1 ;
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
//Проверяем приемы
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
public function testActions ()
{
2023-09-30 20:17:25 +00:00
global $u ;
2023-08-10 14:51:16 +00:00
//проверяем удары
2023-09-30 20:17:25 +00:00
$m = mysql_query ( 'SELECT * FROM `battle_act` WHERE `battle` = "' . $this -> info [ 'id' ] . '" ORDER BY `id`' );
2023-08-10 14:51:16 +00:00
$i = 0 ;
while ( $pl = mysql_fetch_array ( $m )) {
$pluids = mysql_fetch_array (
mysql_query (
'SELECT `hpNow` FROM `stats` WHERE (`id` = "' . $pl [ 'uid1' ] . '" AND `hpNow` <= 0) OR (`id` = "' . $pl [ 'uid2' ] . '" AND `hpNow` <= 0) LIMIT 1'
)
);
$pltest = mysql_fetch_array (
mysql_query ( 'SELECT * FROM `battle_act` WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' )
);
if ( isset ( $pltest [ 'id' ])) {
if ( isset ( $pluids [ 'hpNow' ])) {
mysql_query ( 'DELETE FROM `battle_act` WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
} elseif ( $pl [ 'time' ] + $this -> info [ 'timeout' ] > time ()) {
//удар не пропущен по тайму, просто заносим данные
$this -> atacks [ $pl [ 'id' ]] = $pl ;
$this -> ga [ $pl [ 'uid1' ]][ $pl [ 'uid2' ]] = $pl [ 'id' ];
$this -> ag [ $pl [ 'uid2' ]][ $pl [ 'uid1' ]] = $pl [ 'id' ];
2023-09-30 20:17:25 +00:00
//ударили бота и он не ответил
if ( isset ( $this -> iBots [ $pl [ 'uid2' ]]) && $this -> users [ $this -> uids [ $pl [ 'uid2' ]]][ 'timeGo' ] < time ()) {
$this -> botAtack ( $pl [ 'uid1' ], $pl , 2 );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
} else {
//пропуск по тайму
$pl [ 'time' ] = time ();
if ( $pl [ 'a1' ] == 0 && $pl [ 'a2' ] == 0 ) {
//игрок 1 пропустил по тайму
$pl [ 'out1' ] = time ();
$pl [ 'tout1' ] = 1 ;
//игрок 2 пропустил по тайму
$pl [ 'out2' ] = time ();
$pl [ 'tout2' ] = 1 ;
} elseif ( $pl [ 'a1' ] == 0 ) {
//игрок 1 пропустил по тайму
$pl [ 'out1' ] = time ();
$pl [ 'tout1' ] = 1 ;
} elseif ( $pl [ 'a2' ] == 0 ) {
//игрок 2 пропустил по тайму
$pl [ 'out2' ] = time ();
$pl [ 'tout2' ] = 1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//наносим удар по пропуску
$this -> atacks [ $pl [ 'id' ]] = $pl ;
$this -> startAtack ( $pl [ 'id' ]);
mysql_query ( 'DELETE FROM `battle_act` WHERE `id` = "' . $pl [ 'id' ] . '"' );
}
}
}
//тест удара
2023-12-17 02:32:09 +00:00
if ( $this -> uAtc [ 'id' ] > 0 ) {
2023-08-10 14:51:16 +00:00
if ( $pl [ 'out1' ] == 0 && $pl [ 'out2' ] == 0 ) {
//Может разменяться только тот кто бил
if ( $pl [ 'uid1' ] == $u -> info [ 'id' ] || $pl [ 'uid2' ] == $u -> info [ 'id' ]) {
2023-12-19 01:58:37 +00:00
$this -> addNewAtack ( $u );
2022-12-19 20:22:19 +00:00
}
} else {
2023-12-19 01:58:37 +00:00
$this -> addNewAtack ( $u );
2023-08-10 14:51:16 +00:00
}
}
//тест, бот делает удары
while ( $i < count ( $this -> bots )) {
$bot = $this -> bots [ $i ];
if ( isset ( $bot ) && $this -> stats [ $this -> uids [ $bot ]][ 'hpNow' ] >= 1 && $this -> stats [ $this -> uids [ $bot ]][ 'pass' ] != 'saintlucia' ) { //Тут проверка на бота saintlucia
2022-12-19 20:22:19 +00:00
$j = 0 ;
2023-08-10 14:51:16 +00:00
while ( $j < count ( $this -> users )) {
if ( $this -> info [ 'razdel' ] == 0 ) {
$tnbot = time () + rand ( 1 , 1 );
} else {
$tnbot = time () + rand ( 1 , 2 );
2022-12-19 20:22:19 +00:00
}
2023-12-19 01:58:37 +00:00
if ( $this -> users [ $j ][ 'timeGo' ] < time () && $this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] < time (
) && $this -> users [ $j ][ 'hpNow' ] >= 1 && $this -> users [ $this -> uids [ $bot ]][ 'hpNow' ] >= 1 && $this -> users [ $this -> uids [ $bot ]][ 'team' ] != $this -> users [ $j ][ 'team' ]) {
if ( isset ( $this -> users [ $j ]) && $this -> stats [ $j ][ 'hpNow' ] >= 1 && $this -> stats [ $this -> uids [ $bot ]][ 'hpNow' ] >= 1 && ! isset ( $this -> ga [ $bot ][ $this -> users [ $j ][ 'id' ]]) && ! isset ( $this -> ag [ $bot ][ $this -> users [ $j ][ 'id' ]]) && $this -> users [ $j ][ 'id' ] != $bot && $this -> users [ $j ][ 'team' ] != $this -> users [ $this -> uids [ $bot ]][ 'team' ]) {
if ( $this -> users [ $j ][ 'timeGo' ] < time () && $this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] < time ()) {
$this -> botAtack ( $this -> users [ $j ][ 'id' ], $bot , 1 );
mysql_query (
'UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this -> users [ $this -> uids [ $bot ]][ 'id' ] . '" LIMIT 1'
);
}
} elseif ( isset ( $this -> users [ $i ]) && $this -> users [ $i ][ 'bot' ] > 0 && $this -> stats [ $i ][ 'hpNow' ] >= 1 && $this -> stats [ $this -> uids [ $bot ]][ 'hpNow' ] >= 1 && $this -> users [ $i ][ 'id' ] != $bot && $this -> users [ $i ][ 'team' ] != $this -> users [ $this -> uids [ $bot ]][ 'team' ]) {
if ( $this -> users [ $j ][ 'timeGo' ] < time () && $this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] < time () && $this -> botAct ( $bot )) {
if ( ! isset ( $this -> ga [ $bot ][ $this -> users [ $i ][ 'id' ]]) && $this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] < time () && ! isset ( $this -> ag [ $bot ][ $this -> users [ $i ][ 'id' ]])) {
$this -> botAtack ( $this -> users [ $i ][ 'id' ], $bot , 1 );
mysql_query (
'UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this -> users [ $this -> uids [ $bot ]][ 'id' ] . '" LIMIT 1'
);
} elseif ( ! isset ( $this -> ag [ $bot ][ $this -> users [ $i ][ 'id' ]]) && isset ( $this -> ga [ $bot ][ $this -> users [ $i ][ 'id' ]]) && $this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] < time ()) {
$this -> botAtack ( $bot , $this -> users [ $i ][ 'id' ], 1 );
2023-08-10 14:51:16 +00:00
mysql_query (
'UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this -> users [ $this -> uids [ $bot ]][ 'id' ] . '" LIMIT 1'
);
}
2023-12-19 01:58:37 +00:00
}
} else {
//Удары между ботами
if ( $this -> users [ $j ][ 'timeGo' ] < time () && $this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] < time (
) && $this -> users [ $j ][ 'hpNow' ] >= 1 && $this -> users [ $this -> uids [ $bot ]][ 'hpNow' ] >= 1 ) {
$this -> atacks [ $this -> ga [ $bot ][ $this -> users [ $j ][ 'id' ]]][ 'a1' ] = rand (
1 , 5
) . '' . rand (
1 ,
5
) . rand ( 1 , 5 ) . rand ( 1 , 5 ) . rand ( 1 , 5 );
$this -> atacks [ $this -> ga [ $bot ][ $this -> users [ $j ][ 'id' ]]][ 'b1' ] = rand ( 1 , 5 );
$this -> atacks [ $this -> ga [ $bot ][ $this -> users [ $j ][ 'id' ]]][ 'a2' ] = rand (
1 , 5
) . '' . rand (
1 ,
5
) . rand ( 1 , 5 ) . rand ( 1 , 5 ) . rand ( 1 , 5 );
$this -> atacks [ $this -> ga [ $bot ][ $this -> users [ $j ][ 'id' ]]][ 'b2' ] = rand ( 1 , 5 );
$this -> atacks [ $this -> ag [ $bot ][ $this -> users [ $j ][ 'id' ]]][ 'a1' ] = rand (
1 , 5
) . '' . rand (
1 ,
5
) . rand ( 1 , 5 ) . rand ( 1 , 5 ) . rand ( 1 , 5 );
$this -> atacks [ $this -> ag [ $bot ][ $this -> users [ $j ][ 'id' ]]][ 'b1' ] = rand ( 1 , 5 );
$this -> atacks [ $this -> ag [ $bot ][ $this -> users [ $j ][ 'id' ]]][ 'a2' ] = rand (
1 , 5
) . '' . rand (
1 ,
5
) . rand ( 1 , 5 ) . rand ( 1 , 5 ) . rand ( 1 , 5 );
$this -> atacks [ $this -> ag [ $bot ][ $this -> users [ $j ][ 'id' ]]][ 'b2' ] = rand ( 1 , 5 );
if ( isset ( $this -> ga [ $bot ][ $this -> users [ $j ][ 'id' ]]) && $this -> users [ $j ][ 'bot' ] > 0 ) {
if ( $this -> users [ $j ][ 'timeGo' ] < time () && $this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] < time ()) {
$tnbot = time () + rand ( 3 , 7 );
if ( $this -> info [ 'type' ] == 329 ) { // тестовый бой
$tnbot = time () - 1 ;
}
$this -> startAtack ( $this -> ga [ $bot ][ $this -> users [ $j ][ 'id' ]]);
$this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] = $tnbot ;
2023-08-10 14:51:16 +00:00
mysql_query (
'UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this -> users [ $this -> uids [ $bot ]][ 'id' ] . '" LIMIT 1'
);
2023-12-19 01:58:37 +00:00
}
} elseif ( isset ( $this -> ag [ $bot ][ $this -> users [ $j ][ 'id' ]]) && $this -> users [ $j ][ 'bot' ] > 0 ) {
if ( $this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] < time () && $this -> users [ $j ][ 'timeGo' ] < time ()) {
$this -> startAtack ( $this -> ag [ $bot ][ $this -> users [ $j ][ 'id' ]]);
$tnbot = time () + rand ( 3 , 7 );
if ( $this -> info [ 'type' ] == 329 ) { // тестовый бой
$tnbot = time () - 1 ;
}
$this -> users [ $this -> uids [ $bot ]][ 'timeGo' ] = $tnbot ;
2023-08-10 14:51:16 +00:00
mysql_query (
'UPDATE `stats` SET `timeGo` = "' . $tnbot . '" WHERE `id` = "' . $this -> users [ $this -> uids [ $bot ]][ 'id' ] . '" LIMIT 1'
);
}
}
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
}
$j ++ ;
}
}
$i ++ ;
}
}
2023-11-02 13:57:39 +00:00
//Приемы которые используются моментально
2023-08-10 14:51:16 +00:00
2023-09-30 20:17:25 +00:00
private function botAtack ( $uid , $pl , $tp )
2023-08-10 14:51:16 +00:00
{
$test_atack = mysql_fetch_array (
mysql_query (
'SELECT `id` FROM `battle_act` WHERE `battle` = "' . $this -> info [ 'id' ] . ' " AND ((
`uid1` = " ' . $pl . ' " AND `uid2` = " ' . $uid . ' "
) OR (
`uid2` = " ' . $pl . ' " AND `uid1` = " ' . $uid . ' "
)) LIMIT 1 '
)
);
if ( $tp == 1 && ! isset ( $test_atack [ 'id' ])) {
$test_uid = mysql_fetch_array (
mysql_query ( 'SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1' )
);
$test_pl = mysql_fetch_array (
mysql_query ( 'SELECT * FROM `stats` WHERE `id` = "' . $pl . '" AND `hpNow` >= 1 LIMIT 1' )
);
if ( isset ( $test_uid [ 'id' ]) && isset ( $test_pl [ 'id' ]) && $test_uid [ 'id' ] != $test_pl [ 'id' ]) {
2023-12-17 02:32:09 +00:00
$a = rand ( 1 , 5 ) . '' . rand ( 1 , 5 ) . rand ( 1 , 5 ) . rand ( 1 , 5 ) . rand ( 1 , 5 );
2023-08-10 14:51:16 +00:00
$b = rand ( 1 , 5 );
2023-09-30 20:17:25 +00:00
mysql_query (
2023-08-10 14:51:16 +00:00
'INSERT INTO `battle_act` (`battle`,`time`,`uid1`,`uid2`,`a1`,`b1`) VALUES ("' . $this -> info [ 'id' ] . '","' . time () . '","' . $pl . '","' . $uid . '","' . $a . '","' . $b . '")'
);
}
} elseif ( $tp == 2 ) {
//бот отвечает на удар
$test_uid = mysql_fetch_array (
mysql_query ( 'SELECT * FROM `stats` WHERE `id` = "' . $uid . '" AND `hpNow` >= 1 LIMIT 1' )
);
$test_pl = mysql_fetch_array (
mysql_query ( 'SELECT * FROM `stats` WHERE `id` = "' . $pl [ 'uid2' ] . '" AND `hpNow` >= 1 LIMIT 1' )
);
if ( isset ( $test_uid [ 'id' ]) && isset ( $test_pl [ 'id' ]) && $test_uid [ 'id' ] != $test_pl [ 'id' ]) {
2023-09-30 20:17:25 +00:00
$na = [];
2023-08-10 14:51:16 +00:00
$a222 = rand ( 1 , 5 ) . '_' . rand ( 1 , 5 ) . '_' . rand ( 1 , 5 ) . '_' . rand ( 1 , 5 ) . '_' . rand ( 1 , 5 );
$a = explode ( '_' , $a222 );
$i = 1 ;
while ( $i <= 5 ) {
if ( isset ( $a [ $i - 1 ])) {
$a [ $i - 1 ] = intval ( round ( $a [ $i - 1 ]));
if ( $a [ $i - 1 ] >= 1 && $a [ $i - 1 ] <= 5 ) {
$na [ 'a' ][ $i ] = $a [ $i - 1 ];
2022-12-19 20:22:19 +00:00
} else {
2023-08-10 14:51:16 +00:00
$na [ 'a' ][ $i ] = 0 ;
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
$i ++ ;
}
$na [ 'b' ] = rand ( 1 , 5 );
//Проводим удар
$this -> atacks [ $pl [ 'id' ]][ 'a2' ] = $a222 ;
$this -> atacks [ $pl [ 'id' ]][ 'b2' ] = $na [ 'b' ];
$this -> startAtack ( $pl [ 'id' ]);
}
}
}
2023-11-02 13:57:39 +00:00
//Приемы которые используются моментально (в конце хода)
2023-08-10 14:51:16 +00:00
public function startAtack ( $id )
{
2023-09-30 20:17:25 +00:00
global $u , $priem ;
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
if ( ! isset ( $this -> atacks [ $id ]) || $this -> atacks [ $id ][ 'lock' ] != 0 ) {
return ;
}
//Прием разгадать тактику
$i = 1 ;
$j = 2 ;
while ( $i <= 2 ) {
$untac = mysql_fetch_array (
mysql_query (
'SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 217 AND `uid` = "' . $this -> atacks [ $id ][ 'uid' . $i ] . '" AND `delete` = 0 LIMIT 1'
)
);
$agrs = mysql_fetch_array (
mysql_query (
'SELECT `id` FROM `eff_users` WHERE `v1` = "priem" AND `v2` = 211 AND `uid` = "' . $this -> atacks [ $id ][ 'uid' . $j ] . '" AND `delete` = 0 LIMIT 1'
)
);
if ( isset ( $untac [ 'id' ]) && ! isset ( $agrs [ 'id' ])) {
$pvr [ 'sp' ] = mysql_query (
'SELECT `a`.* FROM `eff_users` AS `a` WHERE `a`.`uid` = "' . $this -> atacks [ $id ][ 'uid' . $j ] . ' " AND `a`.`delete` = 0 AND `a`.`v1` = " priem "
and v2 not in ( 29 , 30 , 31 , 32 , 36 , 49 , 85 , 86 , 87 , 88 , 89 , 90 , 139 , 174 , 175 , 176 , 177 , 178 , 179 , 187 , 188 , 191 , 201 , 206 , 207 , 208 , 209 , 210 , 211 , 217 , 220 , 222 , 226 ,
227 , 228 , 229 , 233 , 236 , 238 , 245 , 248 , 249 , 256 , 258 , 261 , 262 , 263 , 269 , 270 , 276 , 277 , 284 , 285 , 324 , 332 , 333 , 334 , 335 )
AND `name` NOT LIKE " %Иммунитет% "
LIMIT 30 '
2023-08-10 14:51:16 +00:00
);
2023-11-02 13:57:39 +00:00
while ( $pvr [ 'pl' ] = mysql_fetch_array ( $pvr [ 'sp' ])) {
$pvr [ 'pl' ][ 'priem' ] = mysql_fetch_array (
mysql_query ( 'SELECT * FROM `priems` WHERE `id` = "' . $pvr [ 'pl' ][ 'v2' ] . '" LIMIT 1' )
2023-08-10 14:51:16 +00:00
);
2023-11-02 13:57:39 +00:00
if ( isset ( $pvr [ 'pl' ][ 'priem' ][ 'id' ]) && $pvr [ 'pl' ][ 'priem' ][ 'neg' ] == 0 ) {
$this -> delPriem ( $pvr [ 'pl' ], $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid' . $j ]]], 100 );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
}
}
2023-11-02 13:57:39 +00:00
$j -- ;
$i ++ ;
}
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
//Восстановление манны 1% за ход
if ( $this -> atacks [ $id ][ 'out1' ] == 0 ) {
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 's6' ] / 4 < $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'level' ]) {
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'mpNow' ] += floor (
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'level' ] + $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'hod_minmana' ]
);
} else {
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'mpNow' ] += floor (
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 's6' ] / 4 + $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'hod_minmana' ]
2023-08-10 14:51:16 +00:00
);
}
2023-11-02 13:57:39 +00:00
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'mpNow' ] = $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'mpNow' ];
}
//
if ( $this -> atacks [ $id ][ 'out2' ] == 0 ) {
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 's6' ] / 4 < $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'level' ]) {
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'mpNow' ] += floor (
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'level' ] + $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'hod_minmana' ]
);
} else {
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'mpNow' ] += floor (
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 's6' ] / 4 + $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'hod_minmana' ]
2023-08-10 14:51:16 +00:00
);
}
2023-11-02 13:57:39 +00:00
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'mpNow' ] = $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'mpNow' ];
}
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
//Антистаты
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'antm3' ] != 0 ) {
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'm3' ] -= round (
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'antm3' ]
);
}
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'antm3' ] != 0 ) {
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'm3' ] -= round (
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'antm3' ]
);
}
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
//Расчет количества блоков и противников
$this -> testZonb ( $this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ]);
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
//Запускаем магию предметов
$this -> magicItems ( $this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ], $id );
$this -> magicItems ( $this -> atacks [ $id ][ 'uid2' ], $this -> atacks [ $id ][ 'uid1' ], $id );
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
// Получаем приемы игроков
$this -> priemsRazmen ( $id , $at );
$this -> priemsRazmenMoment ( $id , $at );
$this -> priemsRazmen ( $id , $at );
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
$at = $this -> newRazmen ( $id );
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
// Тестируем какие еще могут быть варианты при ударе
// Уворот, парирование, крит, пробить блок, блок щитом
// Блок щитом (если есть щит, конечно)
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
$at = $this -> mf2Razmen ( $at ); //крит
$at = $this -> mf3Razmen ( $id , $at , $v ); //парирование
$at = $this -> mf4Razmen ( $id , $at , $v ); //блок щитом
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
$at = $this -> mf1Razmen ( $id , $at , $v ); //уворот
$at = $this -> mf5Razmen ( $id , $at , $v ); //контрудар
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
$at = $this -> yronRazmen ( $id , $at ); //расчет урона
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
// Проверяем приемы
// Получаем приемы игроков
$at = $this -> priemsTestRazmen ( $id , $at );
// Собираем размен (пересчитываем и расчитываем урон и т.д)
$at = $this -> priemsRestartRazmen ( $id , $at ); //Повторная проверка приемов (если требуется)
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
//Минусуем поглощенный урон
if ( count ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'set_pog' ]) > 0 ) {
$this -> testPogB ( $this -> atacks [ $id ][ 'uid1' ], 1 , $id , 1 );
}
if ( count ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'set_pog' ]) > 0 ) {
$this -> testPogB ( $this -> atacks [ $id ][ 'uid2' ], 1 , $id , 1 );
}
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
// Обновляем Н Р и добавляем тактики
$at = $this -> updateHealth ( $id , $at );
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
// Заносим в логи + записываем статистику боя
$this -> addlogRazmen ( $id , $at );
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
//Запускаем магию предметов
$this -> magicItems ( $this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ], $id );
$this -> magicItems ( $this -> atacks [ $id ][ 'uid2' ], $this -> atacks [ $id ][ 'uid1' ], $id );
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
//Возращаем зоны блока
$this -> restZonb ( $this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ]);
//обновляем задержки приемов
$zd1 = explode ( '|' , $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'priems_z' ]);
$zd2 = explode ( '|' , $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'priems_z' ]);
$prmos = [];
$i5 = 0 ;
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
while ( $i5 < 51 ) {
if ( isset ( $zd1 [ $i5 ]) && $zd1 [ $i5 ] > 0 ) {
//Если приемы не требуют ход
$zd1 [ $i5 ] -= 1 ;
} else {
$zd1 [ $i5 ] = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
if ( isset ( $zd2 [ $i5 ]) && $zd2 [ $i5 ] > 0 ) {
//Если приемы не требуют ход
$zd2 [ $i5 ] -= 1 ;
} else {
$zd2 [ $i5 ] = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
$i5 ++ ;
}
unset ( $prmos );
if ( $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'enemy' ] == $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'id' ]) {
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'enemy' ] = - $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'enemy' ];
}
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
if ( $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'enemy' ] == $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'id' ]) {
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'enemy' ] = - $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'enemy' ];
}
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'priems_z' ] = implode ( '|' , $zd1 );
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'priems_z' ] = implode ( '|' , $zd2 );
if ( $this -> atacks [ $id ][ 'uid1' ] == $u -> info [ 'id' ]) {
$u -> info [ 'priems_z' ] = implode ( '|' , $zd1 );
} elseif ( $this -> atacks [ $id ][ 'uid2' ] == $u -> info [ 'id' ]) {
$u -> info [ 'priems_z' ] = implode ( '|' , $zd2 );
}
//Проверяем тактики
$i = 1 ;
while ( $i <= 6 ) {
if ( $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'tactic' . $i ] > 25 ) {
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'tactic' . $i ] = 25 ;
} elseif ( $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'tactic' . $i ] <= 0 ) {
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'tactic' . $i ] = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
if ( $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'tactic' . $i ] > 25 ) {
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'tactic' . $i ] = 25 ;
} elseif ( $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'tactic' . $i ] <= 0 ) {
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'tactic' . $i ] = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
$i ++ ;
}
//Обновляем задержки предметов
mysql_query (
'UPDATE `items_users` SET `btl_zd` = `btl_zd` - 1 WHERE (`uid` = "' . $this -> atacks [ $id ][ 'uid1' ] . '" OR `uid` = "' . $this -> atacks [ $id ][ 'uid2' ] . '") AND `btl_zd` > 0 AND `inOdet` > 0 LIMIT 100'
);
mysql_query (
'UPDATE `users` SET `notrhod` = "-1" WHERE `id` = "' . $this -> atacks [ $id ][ 'uid1' ] . '" OR `id` = "' . $this -> atacks [ $id ][ 'uid2' ] . '" LIMIT 2'
);
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
//Обновляем задержки пирожков
mysql_query (
'UPDATE `pirogi` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this -> info [ 'id' ] . '" AND (`uid` = "' . $this -> atacks [ $id ][ 'uid1' ] . '" OR `uid` = "' . $this -> atacks [ $id ][ 'uid2' ] . '")'
);
mysql_query (
'UPDATE `tactic` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this -> info [ 'id' ] . '" AND (`uid` = "' . $this -> atacks [ $id ][ 'uid1' ] . '" OR `uid` = "' . $this -> atacks [ $id ][ 'uid2' ] . '")'
);
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
//Тактики
mysql_query ( 'DELETE FROM `pirogi` WHERE `btl` = "' . $this -> info [ 'id' ] . '" AND `hod` < 1' );
mysql_query ( 'DELETE FROM `tactic` WHERE `btl` = "' . $this -> info [ 'id' ] . '" AND `hod` < 1' );
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
//Обновляем задержки пирожков
mysql_query (
'UPDATE `spells` SET `hod` = `hod` - 1 WHERE `btl` = "' . $this -> info [ 'id' ] . '" AND (`uid` = "' . $this -> atacks [ $id ][ 'uid1' ] . '" OR `uid` = "' . $this -> atacks [ $id ][ 'uid2' ] . '")'
);
mysql_query ( 'DELETE FROM `spells` WHERE `btl` = "' . $this -> info [ 'id' ] . '" AND `hod` < 1' );
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
//Обновляем данные в battle_users
mysql_query (
'UPDATE `battle_users` SET `hp` = "' . $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'hpNow' ] . ' "
WHERE `battle` = " ' . $this->info ['id'] . ' " AND `uid` = " ' . $this->atacks [ $id ]['uid1'] . ' " LIMIT 1 '
);
mysql_query (
'UPDATE `battle_users` SET `hp` = "' . $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'hpNow' ] . ' "
WHERE `battle` = " ' . $this->info ['id'] . ' " AND `uid` = " ' . $this->atacks [ $id ]['uid2'] . ' " LIMIT 1 '
);
//Восстановление манны 25% от мудрости за ход
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ] > 0 ) {
$this -> save_stats (
$this -> yhod_user (
$this -> atacks [ $id ][ 'uid2' ], $this -> atacks [ $id ][ 'uid1' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ]
)
2023-08-10 14:51:16 +00:00
);
2023-11-02 13:57:39 +00:00
} elseif ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ] > 0 ) {
$this -> save_stats (
$this -> yhod_user (
$this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ]
)
2023-08-10 14:51:16 +00:00
);
2023-11-02 13:57:39 +00:00
}
mysql_query (
' UPDATE `stats` SET
`hpNow` = " ' . $this->stats [ $this->uids [ $this->atacks [ $id ]['uid1']]]['hpNow'] . ' " ,
`mpNow` = " ' . $this->stats [ $this->uids [ $this->atacks [ $id ]['uid1']]]['mpNow'] . ' " ,
`tactic1` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['tactic1'] . ' " ,
`tactic2` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['tactic2'] . ' " ,
`tactic3` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['tactic3'] . ' " ,
`tactic4` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['tactic4'] . ' " ,
`tactic5` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['tactic5'] . ' " ,
`tactic6` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['tactic6'] . ' " ,
`tactic7` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['tactic7'] . ' " ,
`enemy` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['enemy'] . ' " ,
`battle_yron` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['battle_yron'] . ' " ,
`last_hp` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['last_hp'] . ' " ,
`battle_exp` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['battle_exp'] . ' " ,
`priems_z` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid1']]]['priems_z'] . ' "
WHERE `id` = " ' . $this->atacks [ $id ]['uid1'] . ' " LIMIT 1 '
);
mysql_query (
' UPDATE `stats` SET
`hpNow` = " ' . $this->stats [ $this->uids [ $this->atacks [ $id ]['uid2']]]['hpNow'] . ' " ,
`mpNow` = " ' . $this->stats [ $this->uids [ $this->atacks [ $id ]['uid2']]]['mpNow'] . ' " ,
`tactic1` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['tactic1'] . ' " ,
`tactic2` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['tactic2'] . ' " ,
`tactic3` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['tactic3'] . ' " ,
`tactic4` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['tactic4'] . ' " ,
`tactic5` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['tactic5'] . ' " ,
`tactic6` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['tactic6'] . ' " ,
`tactic7` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['tactic7'] . ' " ,
`enemy` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['enemy'] . ' " ,
`battle_yron` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['battle_yron'] . ' " ,
`last_hp` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['last_hp'] . ' " ,
`battle_exp` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['battle_exp'] . ' " ,
`priems_z` = " ' . $this->users [ $this->uids [ $this->atacks [ $id ]['uid2']]]['priems_z'] . ' "
WHERE `id` = " ' . $this->atacks [ $id ]['uid2'] . ' " LIMIT 1 '
);
$this -> priemsRazmenMomentEnd ( $id , $at );
//Минусуем заряд приема \ эффекта
$j = 1 ;
while ( $j <= 2 ) {
$eff = $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid' . $j ]]][ 'effects' ];
$i = 0 ;
while ( $i < count ( $eff )) {
if ( isset ( $eff [ $i ])) {
if ( $eff [ $i ][ 'timeUse' ] == 77 && $eff [ $i ][ 'hod' ] > - 1 ) {
$eff [ $i ][ 'hod' ] -- ;
$eff [ $i ][ 'priem' ] = mysql_fetch_array (
mysql_query ( 'SELECT * FROM `priems` WHERE `id` = "' . $eff [ $i ][ 'v2' ] . '" LIMIT 1' )
);
if ( round ( $eff [ $i ][ 'priem' ][ 'minmana' ] * $eff [ $i ][ 'x' ]) != 0 ) {
//Отнимаем ману у того кто кастовал
$priem -> minMana (
$eff [ $i ][ 'user_use' ],
round ( $eff [ $i ][ 'priem' ][ 'minmana' ] * $eff [ $i ][ 'x' ])
2023-08-10 14:51:16 +00:00
);
2023-11-02 13:57:39 +00:00
if ( $this -> stats [ $this -> uids [ $eff [ $i ][ 'user_use' ]]][ 'mpNow' ] <= 0 ) {
$eff [ $i ][ 'hod' ] = 0 ;
2023-08-10 14:51:16 +00:00
}
2023-11-02 13:57:39 +00:00
}
if ( strripos ( $eff [ $i ][ 'data' ], 'minprocmanahod' )) {
$pvr = [
'x1' => 0 ,
'x2' => 0 ,
'i' => 0 ,
'uid' => $eff [ $i ][ 'uid' ],
'color' => '' ,
'color2' => '' ,
'effx' => '' ,
'x' => $eff [ $i ][ 'name' ],
];
$pvr [ 'd' ] = explode ( '|' , $eff [ $i ][ 'data' ]);
while ( $pvr [ 'i' ] < count ( $pvr [ 'd' ])) {
if ( isset ( $pvr [ 'd' ][ $pvr [ 'i' ]])) {
$pvr [ 'd1' ] = explode ( '=' , $pvr [ 'd' ][ $pvr [ 'i' ]]);
if ( $pvr [ 'd1' ][ 0 ] == 'minprocmanahod' ) {
$pvr [ 'd1' ] = explode ( 'x' , $pvr [ 'd1' ][ 1 ]);
$pvr [ 'x1' ] = $pvr [ 'd1' ][ 0 ];
$pvr [ 'x2' ] = $pvr [ 'd1' ][ 1 ];
2023-08-10 14:51:16 +00:00
}
}
2023-11-02 13:57:39 +00:00
$pvr [ 'i' ] ++ ;
}
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
$pvr [ 'mp' ] = round (
$this -> stats [ $this -> uids [ $pvr [ 'uid' ]]][ 'mpAll' ] / 100 * rand (
$pvr [ 'x1' ],
$pvr [ 'x2' ]
)
);
$pvr [ 'mpSee' ] = 0 ;
$pvr [ 'mpNow' ] = floor ( $this -> stats [ $this -> uids [ $pvr [ 'uid' ]]][ 'mpNow' ]);
$pvr [ 'mpAll' ] = $this -> stats [ $this -> uids [ $pvr [ 'uid' ]]][ 'mpAll' ];
$pvr [ 'mpTr' ] = $pvr [ 'mpAll' ] - $pvr [ 'mpNow' ];
if ( $pvr [ 'mpTr' ] > 0 ) {
//Требуется хилл
if ( $pvr [ 'mpTr' ] < $pvr [ 'mp' ]) {
$pvr [ 'mp' ] = $pvr [ 'mpTr' ];
2023-08-10 14:51:16 +00:00
}
2023-11-02 13:57:39 +00:00
$pvr [ 'mpSee' ] = '+' . $pvr [ 'mp' ];
$pvr [ 'mpNow' ] += $pvr [ 'mp' ];
}
if ( $pvr [ 'mpNow' ] > $pvr [ 'mpAll' ]) {
$pvr [ 'mpNow' ] = $pvr [ 'mpAll' ];
} elseif ( $pvr [ 'mpNow' ] < 0 ) {
$pvr [ 'mpNow' ] = 0 ;
}
if ( $pvr [ 'mpSee' ] == 0 ) {
$pvr [ 'mpSee' ] = '--' ;
}
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
$btl -> stats [ $btl -> uids [ $pvr [ 'uid' ]]][ 'mpNow' ] = $pvr [ 'mpNow' ];
$btl -> users [ $btl -> uids [ $pvr [ 'uid' ]]][ 'mpNow' ] = $pvr [ 'mpNow' ];
mysql_query (
'UPDATE `stats` SET `mpNow` = "' . $btl -> stats [ $btl -> uids [ $pvr [ 'uid' ]]][ 'mpNow' ] . '" WHERE `id` = "' . $pvr [ 'uid' ] . '" LIMIT 1'
);
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
$pvr [ 'text' ] = $this -> addlt ( 1 , 21 , $this -> users [ $this -> uids [ $pvr [ 'uid' ]]][ 'sex' ], null );
$pvr [ 'text2' ] = '{tm1} ' . $pvr [ 'text' ] . ' на <font Color=#006699><strong>' . $pvr [ 'mpSee' ] . '</strong></font> [' . $pvr [ 'mpNow' ] . '/' . $pvr [ 'mpAll' ] . '] (Мана)' ;
$this -> priemAddLog (
$id , 1 , 2 , $pvr [ 'uid' ], 0 ,
'<font color^^^^#' . $pvr [ 'color2' ] . '>' . $pvr [ 'x' ] . '</font>' ,
$pvr [ 'text2' ],
( $this -> hodID + 0 )
);
unset ( $pvr );
}
if ( isset ( $this -> rehodeff [ $eff [ $i ][ 'id' ]])) {
$eff [ $i ][ 'hod' ] = $this -> rehodeff [ $eff [ $i ][ 'id' ]];
}
if ( $eff [ $i ][ 'hod' ] > 0 ) {
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid' . $j ]]][ 'effects' ][ 'hod' ] = $eff [ $i ][ 'hod' ];
mysql_query (
'UPDATE `eff_users` SET `hod` = "' . $eff [ $i ][ 'hod' ] . '" WHERE `id` = "' . $eff [ $i ][ 'id' ] . '" LIMIT 1'
);
} else {
//удаляем прием
if ( $eff [ $i ][ 'v2' ] > 0 ) {
if ( $j == 1 ) {
$jn = 2 ;
} else {
$jn = 1 ;
}
$this -> delPriem (
$eff [ $i ], $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid' . $j ]]],
3 , $this -> atacks [ $id ][ 'uid' . $jn ]
2023-08-10 14:51:16 +00:00
);
}
2023-11-02 13:57:39 +00:00
}
} elseif ( $eff [ $i ][ 'timeUse' ] == 77 && $eff [ $i ][ 'hod' ] == - 2 ) {
$eff [ $i ][ 'priem' ] = mysql_fetch_array (
mysql_query ( 'SELECT * FROM `priems` WHERE `id` = "' . $eff [ $i ][ 'v2' ] . '" LIMIT 1' )
);
$priem -> hodUsePriem ( $eff [ $i ], $eff [ $i ][ 'priem' ]);
} else {
$eff [ $i ][ 'priem' ] = mysql_fetch_array (
mysql_query ( 'SELECT * FROM `priems` WHERE `id` = "' . $eff [ $i ][ 'v2' ] . '" LIMIT 1' )
);
if ( isset ( $eff [ $i ][ 'priem' ][ 'minmana' ]) && round (
$eff [ $i ][ 'priem' ][ 'minmana' ] * $eff [ $i ][ 'x' ]
) != 0 ) {
//Отнимаем ману у того кто кастовал
$priem -> minMana (
$eff [ $i ][ 'user_use' ],
round ( $eff [ $i ][ 'priem' ][ 'minmana' ] * $eff [ $i ][ 'x' ])
);
if ( $this -> stats [ $this -> uids [ $eff [ $i ][ 'user_use' ]]][ 'mpNow' ] <= 0 ) {
$eff [ $i ][ 'hod' ] = 0 ;
if ( isset ( $this -> rehodeff [ $eff [ $i ][ 'id' ]])) {
$eff [ $i ][ 'hod' ] = $this -> rehodeff [ $eff [ $i ][ 'id' ]];
}
if ( $eff [ $i ][ 'v2' ] > 0 ) {
if ( $j == 1 ) {
$jn = 2 ;
} else {
$jn = 1 ;
}
$this -> delPriem (
$eff [ $i ],
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid' . $j ]]], 3 ,
$this -> atacks [ $id ][ 'uid' . $jn ]
);
}
}
} elseif ( $eff [ $i ][ 'timeUse' ] > 100 && $eff [ $i ][ 'hod' ] > - 1 && Config :: get ( 'effz' ) > 0 ) {
$eff [ $i ][ 'hod' ] -- ;
2023-08-10 14:51:16 +00:00
if ( isset ( $this -> rehodeff [ $eff [ $i ][ 'id' ]])) {
$eff [ $i ][ 'hod' ] = $this -> rehodeff [ $eff [ $i ][ 'id' ]];
}
if ( $eff [ $i ][ 'hod' ] > 0 ) {
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid' . $j ]]][ 'effects' ][ 'hod' ] = $eff [ $i ][ 'hod' ];
mysql_query (
'UPDATE `eff_users` SET `hod` = "' . $eff [ $i ][ 'hod' ] . '" WHERE `id` = "' . $eff [ $i ][ 'id' ] . '" LIMIT 1'
);
} else {
//удаляем прием
if ( $eff [ $i ][ 'v2' ] > 0 ) {
if ( $j == 1 ) {
$jn = 2 ;
} else {
$jn = 1 ;
}
$this -> delPriem (
2023-11-02 13:57:39 +00:00
$eff [ $i ],
$this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid' . $j ]]], 3 ,
$this -> atacks [ $id ][ 'uid' . $jn ]
2023-08-10 14:51:16 +00:00
);
2022-12-19 20:22:19 +00:00
}
}
}
}
}
2023-11-02 13:57:39 +00:00
$i ++ ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
$j ++ ;
}
//Проверяем
if ( Config :: get ( 'propsk_die' ) > 0 && $this -> info [ 'razdel' ] == 0 && $this -> info [ 'dn_id' ] == 0 && $this -> info [ 'izlom' ] == 0 ) {
$cn1 = mysql_fetch_array (
mysql_query (
'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this -> info [ 'id' ] . '" AND `uid1` = "' . $this -> atacks [ $id ][ 'uid1' ] . '" LIMIT 1'
)
);
$cn2 = mysql_fetch_array (
mysql_query (
'SELECT COUNT(*) FROM `battle_out` WHERE `battle` = "' . $this -> info [ 'id' ] . '" AND `uid1` = "' . $this -> atacks [ $id ][ 'uid2' ] . '" LIMIT 1'
)
);
if ( $cn1 [ 0 ] > 3 ) {
$pvr [ 'text2' ] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.' ;
$this -> priemAddLog (
$id , 1 , 2 , $this -> atacks [ $id ][ 'uid1' ], 0 , '' ,
$pvr [ 'text2' ],
( $this -> hodID + 0 )
2023-08-10 14:51:16 +00:00
);
2023-11-02 13:57:39 +00:00
unset ( $pvr );
mysql_query (
'UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this -> atacks [ $id ][ 'uid1' ] . '" LIMIT 1'
2023-08-10 14:51:16 +00:00
);
2023-11-02 13:57:39 +00:00
}
if ( $cn2 [ 0 ] > Config :: get ( 'propsk_die' )) {
$pvr [ 'text2' ] = '{tm1} Персонаж {u1} был убит из-за большого количества пропусков хода.' ;
$this -> priemAddLog (
$id , 1 , 2 , $this -> atacks [ $id ][ 'uid2' ], 0 , '' ,
$pvr [ 'text2' ],
( $this -> hodID + 0 )
);
unset ( $pvr );
mysql_query (
'UPDATE `stats` SET `hpNow` = 0 WHERE `id` = "' . $this -> atacks [ $id ][ 'uid2' ] . '" LIMIT 1'
);
}
}
//
//Обновляем текущего противника
if ( $u -> info [ 'id' ] == $this -> atacks [ $id ][ 'uid1' ]) {
$u -> info [ 'enemy' ] = $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'enemy' ];
}
if ( $u -> info [ 'id' ] == $this -> atacks [ $id ][ 'uid2' ]) {
$u -> info [ 'enemy' ] = $this -> users [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'enemy' ];
}
//Удаляем размен из базы //Т У Т возможен лаг удаления
mysql_query (
'DELETE FROM `battle_act` WHERE ( `uid1` = "' . $this -> atacks [ $id ][ 'uid1' ] . '" AND `uid2` = "' . $this -> atacks [ $id ][ 'uid2' ] . ' " ) OR
( `uid2` = " ' . $this->atacks [ $id ]['uid1'] . ' " AND `uid1` = " ' . $this->atacks [ $id ]['uid2'] . ' " ) '
);
unset ( $old_s1 , $old_s2 );
unset ( $this -> ga [ $this -> atacks [ $id ][ 'uid1' ]][ $this -> atacks [ $id ][ 'uid2' ]], $this -> ga [ $this -> atacks [ $id ][ 'uid2' ]][ $this -> atacks [ $id ][ 'uid1' ]]);
unset ( $this -> ag [ $this -> atacks [ $id ][ 'uid1' ]][ $this -> atacks [ $id ][ 'uid2' ]], $this -> ag [ $this -> atacks [ $id ][ 'uid2' ]][ $this -> atacks [ $id ][ 'uid1' ]]);
unset ( $this -> atacks [ $id ]);
mysql_query ( 'DELETE FROM `battle_act` WHERE `id` = "' . $id . '" LIMIT 1' );
}
//Используем приемы
/** Осторожно ! Подключаются файлы !!!
* @ param $pl
* @ param $u1
* @ param $t
* @ param $u2
* @ param $rznm
* @ param $k2nm
* @ param $yrn
* @ param $yrnt
* @ return void
*/
public function delPriem (
$pl ,
$u1 ,
$t = 1 ,
$u2 = false ,
$rznm = 'Очиститься Кровью' ,
$k2nm = null ,
$yrn = null ,
$yrnt = null
2023-12-17 02:32:09 +00:00
) {
2023-11-02 13:57:39 +00:00
global $u , $priem ;
if ( ! isset ( $pl [ 'priem' ][ 'id' ]) || isset ( $this -> del_val [ 'eff' ][ $pl [ 'priem' ][ 'id' ]])) {
return ;
}
if ( $pl [ 'x' ] > 1 ) {
2023-12-17 02:32:09 +00:00
$pl [ 'name' ] = $pl [ 'name' ] . ' x' . $pl [ 'x' ];
2023-11-02 13:57:39 +00:00
}
if ( $pl [ 'timeUse' ] == 77 ) {
//завершаем прием
mysql_query ( 'DELETE FROM `eff_users` WHERE `id` = "' . $pl [ 'id' ] . '" LIMIT 1' );
}
2023-12-17 02:32:09 +00:00
$vLog = 'time1=' . time () . '||s1=' . $u1 [ 'sex' ] . '||t1=' . $u1 [ 'team' ] . '||login1=' . $u1 [ 'login' ];
2023-11-02 13:57:39 +00:00
if ( isset ( $u2 [ 'id' ])) {
2023-12-17 02:32:09 +00:00
$vLog .= '||s2=' . $u2 [ 'sex' ] . '||t2=' . $u2 [ 'team' ] . '||login2=' . $u2 [ 'login' ];
2023-11-02 13:57:39 +00:00
}
$mas1 = [
'time' => time (),
'battle' => $this -> info [ 'id' ],
'id_hod' => $this -> hodID ,
'text' => '' ,
'vars' => $vLog ,
'zona1' => '' ,
'zonb1' => '' ,
'zona2' => '' ,
'zonb2' => '' ,
'type' => '1' ,
];
if ( $t == 4 ) {
$mas1 [ 'id_hod' ] ++ ;
$t = 2 ;
}
if ( $t == 1 ) {
$mas1 [ 'id_hod' ] ++ ;
if ( $pl [ 'priem' ][ 'file' ] != '0' ) {
if ( file_exists ( '../../_incl_data/class/priems/' . $pl [ 'priem' ][ 'file' ] . '.php' )) {
require ( 'priems/' . $pl [ 'priem' ][ 'file' ] . '.php' );
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
} elseif ( $pl [ 'priem' ][ 'file3' ] != '0' ) {
if ( file_exists ( '../../_incl_data/class/priems/' . $pl [ 'priem' ][ 'file3' ] . '.php' )) {
require ( 'priems/' . $pl [ 'priem' ][ 'file3' ] . '.php' );
2023-08-10 14:51:16 +00:00
}
2023-11-02 13:57:39 +00:00
} else {
$mas1 [ 'text' ] = '{tm1} {u1} {1x16x0} прием "<strong>' . $pl [ 'name' ] . '</strong>".' ;
$this -> del_val [ 'eff' ][ $pl [ 'priem' ][ 'id' ]] = true ;
2023-08-10 14:51:16 +00:00
}
2023-11-02 13:57:39 +00:00
} elseif ( $t == 2 ) {
$mas1 [ 'text' ] = '{tm1} У персонажа {u1} закончилось действие магии "<strong>' . $pl [ 'name' ] . '</strong>".' ;
} elseif ( $t == 99 ) {
$mas1 [ 'text' ] = '{u1} Снял эфект "<strong>' . $pl [ 'name' ] . '</strong>" с помощью <strong>' . $rznm . '</strong> .' ;
} else {
if ( $t == 100 ) {
$mas1 [ 'id_hod' ] ++ ;
2023-08-10 14:51:16 +00:00
}
2023-11-02 13:57:39 +00:00
$mas1 [ 'text' ] = '{tm1} Закончилось действие эффекта "<strong>' . $pl [ 'name' ] . '</strong>" для {u1}.' ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
if ( $pl [ 'priem' ][ 'id' ] != 24 ) {
$this -> add_log ( $mas1 );
}
$this -> stats [ $this -> uids [ $pl [ 'uid' ]]] = $u -> getStats ( $pl [ 'uid' ], 0 , 0 , false , false , true );
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
2023-08-14 15:15:05 +00:00
//Повторная проверка приемов
2022-12-19 20:22:19 +00:00
2023-09-30 20:17:25 +00:00
private function testZonb ( $uid , $uid2 )
2023-08-10 14:51:16 +00:00
{
$zba = [];
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( $this -> stnZb [ $uid ] == 0 ) {
$zba [ 1 ] = $this -> stats [ $this -> uids [ $uid ]][ 'zonb' ];
$this -> stnZb [ $uid ] = $zba [ 1 ];
} else {
$zba [ 1 ] = $this -> stnZb [ $uid ];
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( $this -> stnZb [ $uid2 ] == 0 ) {
$zba [ 2 ] = $this -> stats [ $this -> uids [ $uid2 ]][ 'zonb' ];
$this -> stnZb [ $uid ] = $zba [ 2 ];
2022-12-19 20:22:19 +00:00
} else {
2023-08-10 14:51:16 +00:00
$zba [ 2 ] = $this -> stnZb [ $uid2 ];
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $zba [ 1 ] > 3 ) {
$zba [ 1 ] = 3 ;
}
if ( $zba [ 2 ] > 3 ) {
$zba [ 2 ] = 3 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Блоки игрока 1
if (
(
$this -> stats [ $this -> uids [ $uid2 ]][ 'weapon1' ] == 1 ||
$this -> stats [ $this -> uids [ $uid2 ]][ 'weapon2' ] == 1
) &&
$this -> stats [ $this -> uids [ $uid ]][ 'weapon1' ] != 1 &&
$this -> stats [ $this -> uids [ $uid ]][ 'weapon2' ] != 1
) {
$zba [ 1 ] -= 1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Блоки игрока 2
if (
(
$this -> stats [ $this -> uids [ $uid ]][ 'weapon1' ] == 1 ||
$this -> stats [ $this -> uids [ $uid ]][ 'weapon2' ] == 1
) &&
$this -> stats [ $this -> uids [ $uid2 ]][ 'weapon1' ] != 1 &&
$this -> stats [ $this -> uids [ $uid2 ]][ 'weapon2' ] != 1
) {
$zba [ 2 ] -= 1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $zba [ 1 ] < 1 ) {
$zba [ 1 ] = 1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $zba [ 2 ] < 1 ) {
$zba [ 2 ] = 1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$this -> stats [ $this -> uids [ $uid ]][ 'zonb' ] = $zba [ 1 ];
$this -> stats [ $this -> uids [ $uid2 ]][ 'zonb' ] = $zba [ 2 ];
if (
$this -> stats [ $this -> uids [ $uid ]][ 'min_zonb' ] > 0 &&
$this -> stats [ $this -> uids [ $uid ]][ 'zonb' ] < $this -> stats [ $this -> uids [ $uid ]][ 'min_zonb' ]
) {
$this -> stats [ $this -> uids [ $uid ]][ 'zonb' ] = $this -> stats [ $this -> uids [ $uid ]][ 'min_zonb' ];
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if (
$this -> stats [ $this -> uids [ $uid2 ]][ 'min_zonb' ] > 0 &&
$this -> stats [ $this -> uids [ $uid2 ]][ 'zonb' ] < $this -> stats [ $this -> uids [ $uid2 ]][ 'min_zonb' ]
) {
$this -> stats [ $this -> uids [ $uid2 ]][ 'zonb' ] = $this -> stats [ $this -> uids [ $uid2 ]][ 'min_zonb' ];
2022-12-19 20:22:19 +00:00
}
}
2023-08-14 15:15:05 +00:00
//Проверка действия приема
2023-08-10 14:51:16 +00:00
2023-09-30 20:17:25 +00:00
/** Осторожно ! Подключаются файлы !!!
* @ param $uid1
* @ param $uid2
* @ param $end
* @ return void
*/
private function magicItems ( $uid1 , $uid2 , $end )
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
if ( ! isset ( $this -> stats [ $this -> uids [ $uid1 ]])) {
return ;
}
$i = 0 ;
while ( $i < count ( $this -> stats [ $this -> uids [ $uid1 ]][ 'items' ])) {
$itm = $this -> stats [ $this -> uids [ $uid1 ]][ 'items' ][ $i ];
if ( isset ( $itm [ 'id' ])) {
2023-08-14 15:15:05 +00:00
$e = Conversion :: dataStringToArray ( $itm [ 'data' ]);
2023-08-10 14:51:16 +00:00
if ( isset ( $e [ 'bm_a1' ])) {
if ( $end > 0 ) {
if ( file_exists ( '../../_incl_data/class/priems/' . $e [ 'bm_a1' ] . '.end.php' )) {
require ( '../../_incl_data/class/priems/' . $e [ 'bm_a1' ] . '.end.php' );
}
} else {
if ( file_exists ( '../../_incl_data/class/priems/' . $e [ 'bm_a1' ] . '.php' )) {
require ( '../../_incl_data/class/priems/' . $e [ 'bm_a1' ] . '.php' );
}
}
}
}
$i ++ ;
}
unset ( $itm );
}
2023-08-14 15:15:05 +00:00
//Проверка урона приемов
2023-08-10 14:51:16 +00:00
public function priemsRazmen ( $id , $at )
{
if ( $at == 'fast' ) {
$uid1 = $id [ 0 ];
$uid2 = $id [ 1 ];
2022-12-19 20:22:19 +00:00
} else {
2023-08-10 14:51:16 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
}
$i = 1 ;
while ( $i <= 2 ) {
2023-09-30 20:17:25 +00:00
$u1 = $i == 1 ? $uid1 : $uid2 ;
2023-08-10 14:51:16 +00:00
//Получаем приемы и смотрим когда какой действует
$eff = $this -> stats [ $this -> uids [ $u1 ]][ 'effects' ];
$this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ] = [];
$j = 0 ;
while ( $j <= count ( $eff )) {
if ( isset ( $eff [ $j ]) && $eff [ $j ][ 'id_eff' ] == 22 && $eff [ $j ][ 'v1' ] == 'priem' && $eff [ $j ][ 'v2' ] > 0 ) {
$this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][] = [
$j ,
$eff [ $j ][ 'v2' ],
$this -> prm [ $eff [ $j ][ 'v2' ]][ 'act' ],
$eff [ $j ][ 'id' ],
$this -> prm [ $eff [ $j ][ 'v2' ]][ 'type_of' ],
$this -> prm [ $eff [ $j ][ 'v2' ]][ 'moment' ],
$this -> prm [ $eff [ $j ][ 'v2' ]][ 'moment_end' ],
$this -> prm [ $eff [ $j ][ 'v2' ]][ 'type_sec' ],
];
}
$j ++ ;
}
$i ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
}
2023-09-30 20:17:25 +00:00
/** Осторожно ! Подключаются файлы !!!
* @ param $id
* @ param $at
* @ return mixed
*/
private function priemsRazmenMoment ( $id , $at )
2023-08-10 14:51:16 +00:00
{
2022-12-19 20:22:19 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2022-12-19 20:22:19 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( ! isset ( $at [ 'p' ][ 'p_cast' ])) {
$at [ 'p' ] = $at ;
$at [ 'p' ][ 'p_cast' ] = true ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Приемы ухода от удара
if ( ! isset ( $this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ]) || $this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ] == 0 ) {
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 5 ] == 1 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
$this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ] -- ;
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
$j ++ ;
}
}
//Приемы крита
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 5 ] == 2 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
//Приемы атаки
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 5 ] == 3 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
if ( isset ( $fx_priem )) {
$at = $fx_priem ( $id , $at , $u1 , $j );
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
}
$j ++ ;
}
//Приемы защиты
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 5 ] == 4 ) {
2023-09-30 20:17:25 +00:00
if ( file_exists (
2023-08-10 14:51:16 +00:00
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 5 ] == 5 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
$i ++ ;
}
return $at ;
}
2023-08-14 15:15:05 +00:00
//Наносим удар между игроками
2023-09-30 20:17:25 +00:00
private function newRazmen ( $id , $at = null )
2023-08-10 14:51:16 +00:00
{
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
if ( $this -> atacks [ $id ][ 'out1' ] == 0 ) {
$at [ 1 ] = $this -> usersTestAtack ( $id , $uid1 , $uid2 );
} else {
$at [ 1 ] = [ 0 ];
}
if ( $this -> atacks [ $id ][ 'out2' ] == 0 ) {
$at [ 2 ] = $this -> usersTestAtack ( $id , $uid2 , $uid1 );
} else {
$at [ 2 ] = [ 0 ];
}
return $at ;
}
2023-09-30 20:17:25 +00:00
private function usersTestAtack ( $id , $uid1 , $uid2 ) : array
2023-08-10 14:51:16 +00:00
{
$r = [];
$block = [
0 ,
0 ,
0 ,
0 ,
0 ,
0 ,
];
//Проверка блоков
$i = 1 ;
if ( $uid1 == $this -> atacks [ $id ][ 'uid1' ]) {
$a = 2 ;
$j = $this -> atacks [ $id ][ 'b2' ];
$atack = [
0 ,
$this -> atacks [ $id ][ 'a1' ][ 0 ],
$this -> atacks [ $id ][ 'a1' ][ 1 ],
$this -> atacks [ $id ][ 'a1' ][ 2 ],
$this -> atacks [ $id ][ 'a1' ][ 3 ],
$this -> atacks [ $id ][ 'a1' ][ 4 ],
];
} elseif ( $uid2 == $this -> atacks [ $id ][ 'uid1' ]) {
$a = 1 ;
$j = $this -> atacks [ $id ][ 'b1' ];
$atack = [
0 ,
$this -> atacks [ $id ][ 'a2' ][ 0 ],
$this -> atacks [ $id ][ 'a2' ][ 1 ],
$this -> atacks [ $id ][ 'a2' ][ 2 ],
$this -> atacks [ $id ][ 'a2' ][ 3 ],
$this -> atacks [ $id ][ 'a2' ][ 4 ],
];
}
if ( $this -> atacks [ $id ][ 'out' . $a ] == 0 ) {
while ( $i <= $this -> stats [ $this -> uids [ $uid2 ]][ 'zonb' ]) {
$block [ $j ] = 1 ;
$j ++ ;
if ( $j > 5 || $j < 1 ) {
$j = 1 ;
}
$i ++ ;
}
}
//Проверка ударов
$i = 1 ;
while ( $i <= $this -> stats [ $this -> uids [ $uid1 ]][ 'zona' ]) {
if ( ! isset ( $atack [ $i ]) || $atack [ $i ] == 0 ) {
$atack [ $i ] = rand ( 1 , 5 );
}
if ( $atack [ $i ] > 0 ) {
if ( $block [ $atack [ $i ]] == 1 ) {
//удар был заблокирован
// КУДА БИЛ , ТИП УДАРА
$r [ 'atack' ][] = [ $atack [ $i ], 3 , 0 ];
} else {
//Удар прошел
// КУДА БИЛ , ТИП УДАРА
$r [ 'atack' ][] = [ $atack [ $i ], 1 , 0 ];
2022-12-19 20:22:19 +00:00
}
}
$i ++ ;
}
2023-08-10 14:51:16 +00:00
return $r ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
/** Критический размен
* @ param $at
* @ param $pat
* @ param $rjd
* @ return array | false | mixed
*/
2023-09-30 20:17:25 +00:00
private function mf2Razmen ( $at , $pat = false , $rjd = 0 )
2023-08-10 14:51:16 +00:00
{
if ( $pat ) {
$pat = $at ;
$at = $pat [ 'p' ];
2022-12-19 20:22:19 +00:00
} else {
2023-08-10 14:51:16 +00:00
unset ( $pat );
}
2023-11-02 13:57:39 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid1 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid2' ], $this -> atacks [ $id ][ 'uid1' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
} elseif ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid2 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
}
2022-12-19 20:22:19 +00:00
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2022-12-19 20:22:19 +00:00
} else {
$a = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-14 15:15:05 +00:00
//Расчет крита Атакующего (u1) по Цели (u2)
2022-12-19 20:22:19 +00:00
$j = 0 ;
2023-08-14 15:15:05 +00:00
$wp01 = 0 ;
2023-08-10 14:51:16 +00:00
$k01 = 0 ;
if ( $rjd > 0 ) {
$j = $rjd - 1 ;
}
2023-08-14 15:15:05 +00:00
2023-08-10 14:51:16 +00:00
if ( is_array ( $at [ $a ][ 'atack' ])) {
2023-08-14 15:15:05 +00:00
while ( $j < count ( $at [ $a ][ 'atack' ]) && $j <= 8 ) {
2023-08-10 14:51:16 +00:00
// КУДА БИЛ , ТИП УДАРА
if ( $k01 == 0 && isset ( $this -> stats [ $this -> uids [ $u1 ]][ 'wp3id' ])) {
//Левая рука
$wp01 = 3 ;
$k01 = 1 ;
} else {
//Правая рука
if ( isset ( $this -> stats [ $this -> uids [ $u1 ]][ 'wp14id' ]) && $this -> stats [ $this -> uids [ $u1 ]][ 'items' ][ $this -> stats [ $this -> uids [ $u1 ]][ 'wp14id' ]][ 'type' ] != 13 ) {
$wp01 = 14 ;
} else {
$wp01 = 3 ;
}
$k01 = 0 ;
}
$witm_type01 = 0 ;
$witm01 = $this -> stats [ $this -> uids [ $u1 ]][ 'items' ][ $this -> stats [ $this -> uids [ $u1 ]][ 'wp' . $wp01 . 'id' ]];
2023-08-14 15:15:05 +00:00
$witm_data01 = Conversion :: dataStringToArray ( $witm01 [ 'data' ]);
if ( $this -> mfs (
2023-09-30 20:17:25 +00:00
1 ,
[
'u1' => $u1 ,
'u2' => $u2 ,
'mf' => $this -> stats [ $this -> uids [ $u1 ]][ 'm1' ] + $witm_data01 [ 'sv_m1' ],
'amf' => $this -> stats [ $this -> uids [ $u1 ]][ 'm14' ],
'smf' => $this -> stats [ $this -> uids [ $u2 ]][ 'm2' ],
'aamf1' => ( int ) $this -> stats [ $this -> uids [ $u2 ]][ 'enemy_am1' ],
]
2023-08-14 15:15:05 +00:00
) == 1 ) {
//кританул, гад :)
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 3 ) {
//в блок
$at [ $a ][ 'atack' ][ $j ][ 1 ] = 4 ; //Тут тест
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] != 2 && $at [ $a ][ 'atack' ][ $j ][ 1 ] != 6 && $at [ $a ][ 'atack' ][ $j ][ 1 ] != 7 && $at [ $a ][ 'atack' ][ $j ][ 1 ] != 8 ) {
//обычный крит
$at [ $a ][ 'atack' ][ $j ][ 1 ] = 5 ;
} else {
$at [ $a ][ 'atack' ][ $j ][ 1 ] = 1 ;
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
}
$i ++ ;
}
2023-08-14 15:15:05 +00:00
unset ( $witm01 , $witm_type01 , $k01 , $wp01 );
2023-08-10 14:51:16 +00:00
if ( isset ( $pat ) && $pat ) {
$pat [ 'p' ] = $at ;
$at = $pat ;
}
2023-08-14 15:15:05 +00:00
2023-08-10 14:51:16 +00:00
return $at ;
}
2023-09-30 20:17:25 +00:00
private function yhod_user ( $uid1 , $uid2 , $type )
2023-08-10 14:51:16 +00:00
{
// 1 - кто бьет . 2 - в кого бьют . тип
//Удал летит прямо в противника
2023-12-17 02:32:09 +00:00
if ( $this -> importUser == 0 ) {
2023-08-10 14:51:16 +00:00
$r = $uid1 ;
$rand_user = false ;
if ( $type == 2 ) {
//Случайный персонаж из своей команды (в том числе игрок)
$i = 0 ;
while ( $i < count ( $this -> users )) {
if ( $this -> users [ $i ][ 'team' ] == $this -> users [ $this -> uids [ $uid2 ]][ 'team' ]) {
$rand_user [] = $this -> users [ $i ][ 'id' ];
}
$i ++ ;
}
} elseif ( $type == 4 ) {
//Случайный персонаж, любой
$i = 0 ;
while ( $i < count ( $this -> users )) {
$rand_user [] = $this -> users [ $i ][ 'id' ];
$i ++ ;
}
} elseif ( $type == 5 ) {
//Случайный персонаж, любой (кроме игрока)
$i = 0 ;
while ( $i < count ( $this -> users )) {
if ( $this -> users [ $i ][ 'team' ] == $this -> users [ $this -> uids [ $uid2 ]][ 'team' ] && $uid2 != $this -> users [ $i ][ 'id' ]) {
$rand_user [] = $this -> users [ $i ][ 'id' ];
}
$i ++ ;
}
} elseif ( $type == 6 ) {
//Случайный персонаж из команды противника
$i = 0 ;
while ( $i < count ( $this -> users )) {
if ( $this -> users [ $i ][ 'team' ] != $this -> users [ $this -> uids [ $uid2 ]][ 'team' ]) {
$rand_user [] = $this -> users [ $i ][ 'id' ];
}
$i ++ ;
}
} elseif ( $type > 100 ) {
//Удар идет в конкретного игрока
if ( ! isset ( $this -> users [ $this -> uids [ $type ]]) || $this -> users [ $this -> uids [ $type ]][ 'id' ] != $type ) {
$r = $uid2 ;
} else {
$r = $type ;
}
}
if ( $rand_user && count ( $rand_user ) > 0 ) {
$r = $rand_user [ rand ( 0 , ( count ( $rand_user ) - 1 ))];
}
2023-12-17 02:32:09 +00:00
$this -> importUser = $r ;
2023-08-10 14:51:16 +00:00
} else {
2023-12-17 02:32:09 +00:00
$r = $this -> importUser ;
2023-08-10 14:51:16 +00:00
}
return $r ;
}
2023-11-02 13:57:39 +00:00
private function mfs ( int $type , array | int $mf ) : int
2023-08-10 14:51:16 +00:00
{
$rval = 0 ;
switch ( $type ) {
case 1 :
//Крит
if ( $mf [ 'amf' ] < 0 ) {
$mf [ 'amf' ] = 0 ;
}
if ( $mf [ 'mf' ] < 0 ) {
$mf [ 'mf' ] = 0 ;
}
if ( $mf [ 'mf' ] > $mf [ 'smf' ]) {
$rval = 100 - floor (((( $mf [ 'smf' ]) / ( $mf [ 'mf' ] + 1 )) * 100 ));
}
if ( $rval < 1 ) {
$rval = 0 ;
}
if ( $rval > 75 ) {
$rval = 75 ;
}
if ( $mf [ 'amf' ] >= 1 ) {
if ( $mf [ 'amf' ] > 100 ) {
$mf [ 'amf' ] = 100 ;
}
if (( $mf [ 'amf' ] * 100 ) >= mt_rand ( 1 , 10000 )) {
$rval = 100 ;
}
}
break ;
case 2 :
if ( $mf [ 'mf' ] < 0 ) {
$mf [ 'mf' ] = 0 ;
}
if ( $mf [ 'amf' ] < 0 ) {
$mf [ 'amf' ] = 0 ;
}
if ( $mf [ 'smf' ] < 0 ) {
$mf [ 'smf' ] = 0 ;
}
if ( $mf [ 'asmf' ] < 0 ) {
$mf [ 'asmf' ] = 0 ;
}
if ( $mf [ 'mf' ] > $mf [ 'smf' ]) {
$rval = 100 - floor (((( $mf [ 'smf' ]) / ( $mf [ 'mf' ] + 1 )) * 100 )); //2.5
}
if ( $rval < 1 ) {
$rval = 0 ;
}
if ( $rval > 75 ) {
$rval = 75 ;
}
if ( $mf [ 'asmf' ] >= 0 ) {
if ( $mf [ 'asmf' ] > 100 ) {
$mf [ 'asmf' ] = 100 ;
}
if ( $mf [ 'asmf' ] >= rand ( 1 , 100 )) {
$rval = 0 ;
}
}
if ( $mf [ 'amf' ] >= 0 ) {
if ( $mf [ 'amf' ] > 100 ) {
$mf [ 'amf' ] = 100 ;
}
if ( $mf [ 'amf' ] >= rand ( 1 , 100 )) {
$rval = 100 ;
}
}
break ;
case 3 :
if ( $mf [ 1 ] < 1 ) {
$mf [ 1 ] = 1 ;
}
if ( $mf [ 2 ] < 1 ) {
$mf [ 2 ] = 1 ;
}
$rval = $mf [ 1 ] - $mf [ 2 ] / 2 ;
if ( $rval > 75 ) {
$rval = 75 ;
}
if ( $rval < 1 ) {
$rval = 1 ;
}
break ;
case 4 :
$mf = round ( $mf * 0.6 );
if ( $mf < 1 ) {
$mf = 0 ;
}
if ( $mf > 100 ) {
$mf = 100 ;
}
$rval = min ( $mf , 100 ); //пробой брони
break ;
case 5 :
if ( $mf < 1 ) {
$mf = 0 ;
}
$rval = min ( $mf , 85 ); //блок щитом
break ;
case 6 :
//Контрудар
if ( $mf [ 'a' ] > 0 ) {
if ( $mf [ 'b' ] > 0 ) {
$rval = round ( $mf [ 'a' ] - ( $mf [ 'b' ] / 2 ));
} else {
$rval = $mf [ 'a' ];
}
}
if ( $rval < 1 ) {
$rval = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $rval > 75 ) {
$rval = 75 ;
}
break ;
2022-12-19 20:22:19 +00:00
}
2023-12-19 01:58:37 +00:00
return Helper :: getChanse ( $rval ) ? 1 : 0 ;
2022-12-19 20:22:19 +00:00
}
2023-08-14 15:15:05 +00:00
//Сохранение данные
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
/** Парирование размен
* @ param $id
* @ param $at
* @ param $v
* @ param $pat
* @ param $rjd
* @ return array | false | mixed
*/
2023-09-30 20:17:25 +00:00
private function mf3Razmen ( $id , $at , $v , $pat = false , $rjd = 0 )
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
if ( $pat ) {
$pat = $at ;
$at = $pat [ 'p' ];
} else {
unset ( $pat );
}
2023-11-02 13:57:39 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid1 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid2' ], $this -> atacks [ $id ][ 'uid1' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
} elseif ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid2 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
}
2022-12-19 20:22:19 +00:00
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2022-12-19 20:22:19 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Расчет парирования Цели (u2) от Атакующего (u1)
2022-12-19 20:22:19 +00:00
$j = 0 ;
2023-08-10 14:51:16 +00:00
if ( $rjd > 0 ) {
$j = $rjd - 1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( is_array ( $at [ $a ][ 'atack' ])) {
while ( $j < count ( $at [ $a ][ 'atack' ]) && $j < 8 ) {
// КУДА БИЛ , ТИП УДАРА
if (( ! isset ( $this -> stats [ $this -> uids [ $u2 ]][ 'no_pr1' ]) || $this -> stats [ $this -> uids [ $u2 ]][ 'no_pr1' ] == 0 ) && $at [ $a ][ 'atack' ][ $j ][ 2 ] == $v ) {
if ( $this -> mfs (
2023-09-30 20:17:25 +00:00
3 ,
[
'u1' => $u1 ,
'u2' => $u2 ,
'1' => $this -> stats [ $this -> uids [ $u2 ]][ 'm7' ],
'2' => $this -> stats [ $this -> uids [ $u1 ]][ 'm7' ],
]
2023-08-10 14:51:16 +00:00
) == 1 && $this -> atacks [ $id ][ 'out' . $b ] == 0 ) {
//Парировал, гад :)
$this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ] = floor (
0 + ( int ) $this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ]
);
if (( ! isset ( $this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ]) || $this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ] == 0 ) && $this -> stats [ $this -> uids [ $u1 ]][ 'nopryh_act' ] < 1 ) {
$at [ $a ][ 'atack' ][ $j ][ 1 ] = 6 ;
$this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ] -- ;
$this -> stats [ $this -> uids [ $u1 ]][ 'nopryh_act' ] ++ ;
}
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
$j ++ ;
2022-12-19 20:22:19 +00:00
}
}
$i ++ ;
}
2023-08-10 14:51:16 +00:00
if ( isset ( $pat ) && $pat ) {
$pat [ 'p' ] = $at ;
$at = $pat ;
}
2022-12-19 20:22:19 +00:00
return $at ;
}
2023-08-14 15:15:05 +00:00
//Отображение Н Р
2023-08-10 14:51:16 +00:00
2023-09-30 20:17:25 +00:00
private function mf4Razmen ( $id , $at , $v , $pat = false )
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
if ( $pat ) {
$pat = $at ;
$at = $pat [ 'p' ];
} else {
unset ( $pat );
}
2023-11-02 13:57:39 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid1 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid2' ], $this -> atacks [ $id ][ 'uid1' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
} elseif ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid2 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
}
2023-08-10 14:51:16 +00:00
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2023-08-10 14:51:16 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'sheld1' ] > 0 ) {
//Расчет блока щитом Цели (u2) от Атакующего (u1)
$j = 0 ;
while ( $j < count ( $at [ $a ][ 'atack' ]) && $j < 8 ) {
// КУДА БИЛ , ТИП УДАРА
if ( $at [ $a ][ 'atack' ][ $j ][ 2 ] == $v ) {
if ( $this -> mfs (
5 ,
2023-09-30 20:17:25 +00:00
( $this -> stats [ $this -> uids [ $u2 ]][ 'm8' ] / 2 + $this -> stats [ $this -> uids [ $u2 ]][ 'm18' ])
2023-08-10 14:51:16 +00:00
) == 1 && $this -> atacks [ $id ][ 'out' . $b ] == 0 ) {
//блокировал щитом, гад :)
$at [ $a ][ 'atack' ][ $j ][ 1 ] = 7 ;
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$j ++ ;
2022-12-19 20:22:19 +00:00
}
}
$i ++ ;
}
2023-08-10 14:51:16 +00:00
if ( isset ( $pat ) && $pat ) {
$pat [ 'p' ] = $at ;
$at = $pat ;
}
2022-12-19 20:22:19 +00:00
return $at ;
}
2023-08-14 15:15:05 +00:00
//Выводим лог боя
2023-09-30 20:17:25 +00:00
private function mf1Razmen ( $id , $at , $v , $pat = false , $rjd = 0 )
2023-08-14 15:15:05 +00:00
{
if ( $pat ) {
$pat = $at ;
$at = $pat [ 'p' ];
} else {
unset ( $pat );
}
2023-11-02 13:57:39 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid1 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid2' ], $this -> atacks [ $id ][ 'uid1' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
} elseif ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid2 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
}
2023-08-14 15:15:05 +00:00
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2023-08-14 15:15:05 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2023-08-14 15:15:05 +00:00
}
//Расчет уворота Цели (u2) от Атакующего (u1)
$j = 0 ;
$wp01 = 3 ;
$k01 = 0 ;
if ( $rjd > 0 ) {
$j = $rjd - 1 ;
}
if ( is_array ( $at [ $a ][ 'atack' ])) {
while ( $j < count ( $at [ $a ][ 'atack' ]) && $j < 8 ) {
// КУДА БИЛ , ТИП УДАРА
if ( $k01 == 0 && isset ( $this -> stats [ $this -> uids [ $u1 ]][ 'wp3id' ])) {
//Левая рука
$wp01 = 3 ;
$k01 = 1 ;
} else {
//Правая рука
if ( isset ( $this -> stats [ $this -> uids [ $u1 ]][ 'wp14id' ]) && $this -> stats [ $this -> uids [ $u1 ]][ 'items' ][ $this -> stats [ $this -> uids [ $u1 ]][ 'wp14id' ]][ 'type' ] != 13 ) {
$wp01 = 14 ;
} else {
$wp01 = 3 ;
}
$k01 = 0 ;
}
$witm_type01 = 0 ;
$witm01 = $this -> stats [ $this -> uids [ $u1 ]][ 'items' ][ $this -> stats [ $this -> uids [ $u1 ]][ 'wp' . $wp01 . 'id' ]];
$witm_data01 = Conversion :: dataStringToArray ( $witm01 [ 'data' ]);
if ( $at [ $a ][ 'atack' ][ $j ][ 2 ] == $v ) {
$tyv = $this -> mfs (
2023-09-30 20:17:25 +00:00
2 ,
[
'u1' => $u1 ,
'u2' => $u2 ,
'mf' => $this -> stats [ $this -> uids [ $u2 ]][ 'm4' ],
'amf' => ( int ) $this -> stats [ $this -> uids [ $u2 ]][ 'm15' ],
'smf' => ( $this -> stats [ $this -> uids [ $u1 ]][ 'm5' ] + $witm_data01 [ 'sv_m5' ]),
'asmf' => $this -> stats [ $this -> uids [ $u1 ]][ 'm21' ],
]
2023-08-14 15:15:05 +00:00
);
if ( $tyv == 1 && $this -> atacks [ $id ][ 'out' . $b ] == 0 ) {
//увернулся, гад :)
$this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ] = floor (
2023-09-30 20:17:25 +00:00
( int ) $this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ]
2023-08-14 15:15:05 +00:00
);
if ( ! isset ( $this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ]) || $this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ] <= 0 ) {
$at [ $a ][ 'atack' ][ $j ][ 1 ] = 2 ;
} else {
$this -> stats [ $this -> uids [ $u1 ]][ 'nopryh' ] -- ;
$this -> stats [ $this -> uids [ $u1 ]][ 'nopryh_act' ] ++ ;
}
}
}
$j ++ ;
}
}
$i ++ ;
}
unset ( $witm01 , $witm_type01 , $wp01 , $k01 );
if ( isset ( $pat ) && $pat ) {
$pat [ 'p' ] = $at ;
$at = $pat ;
}
return $at ;
}
2023-08-10 14:51:16 +00:00
//Новый лог Мой Лог
2023-09-30 20:17:25 +00:00
private function mf5Razmen ( $id , $at , $v )
2022-12-19 20:22:19 +00:00
{
2023-09-30 20:17:25 +00:00
$rjd = 0 ;
2023-08-10 14:51:16 +00:00
2023-11-02 13:57:39 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid1 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid2' ], $this -> atacks [ $id ][ 'uid1' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
} elseif ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid2 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
}
2022-12-19 20:22:19 +00:00
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2022-12-19 20:22:19 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-14 15:15:05 +00:00
//Расчет контрудара Цели (u2) по Атакующему (u1)
2022-12-19 20:22:19 +00:00
$j = 0 ;
2023-08-10 14:51:16 +00:00
if ( $rjd > 0 ) {
$j = $rjd - 1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-14 15:15:05 +00:00
while ( $j < count ( $at [ $a ][ 'atack' ]) && $j < 8 ) {
// КУДА БИЛ , ТИП УДАРА
if ( $at [ $a ][ 'atack' ][ $j ][ 2 ] == $v ) {
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 2 ) {
if ( $this -> mfs (
2023-09-30 20:17:25 +00:00
6 ,
[
'u1' => $u1 ,
'u2' => $u2 ,
'a' => $this -> stats [ $this -> uids [ $u2 ]][ 'm6' ],
'b' => $this -> stats [ $this -> uids [ $u1 ]][ 'm6' ],
]
2023-08-14 15:15:05 +00:00
) == 1 ) {
//контрудар, гад :)
$at [ $a ][ 'atack' ][ $j ][ 1 ] = 8 ;
$rnd_a = rand ( 1 , 5 );
$rjd = count ( $at [ $b ][ 'atack' ]);
if ( ! $this -> testRazmenblock1 ( $id , $u2 , $u1 , $rnd_a )) {
$at [ $b ][ 'atack' ][] = [ $rnd_a , 1 , 0 , 1 ]; // 3 , 0 , 1
} else {
$at [ $b ][ 'atack' ][] = [ $rnd_a , 3 , 0 , 1 ]; // 3 , 0 , 1
}
$at = $this -> contrRestart ( $id , $at , 1 , $rjd );
2022-12-19 20:22:19 +00:00
}
}
}
2023-08-14 15:15:05 +00:00
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$i ++ ;
}
2023-08-14 15:15:05 +00:00
return $at ;
}
2022-12-19 20:22:19 +00:00
2023-08-14 15:15:05 +00:00
public function testRazmenblock1 ( $id , $uid1 , $uid2 , $atack ) : bool
{
$r = false ;
2023-09-30 20:17:25 +00:00
$block = [];
$j = 0 ;
2023-08-14 15:15:05 +00:00
//Проверка блоков
$i = 1 ;
if ( $uid1 == $this -> atacks [ $id ][ 'uid1' ]) {
$j = $this -> atacks [ $id ][ 'b2' ];
} elseif ( $uid2 == $this -> atacks [ $id ][ 'uid1' ]) {
$j = $this -> atacks [ $id ][ 'b1' ];
}
if ( $this -> atacks [ $id ][ 'out2' ] == 0 ) {
while ( $i <= $this -> stats [ $this -> uids [ $uid2 ]][ 'zonb' ]) {
$block [ $j ] = 1 ;
$j ++ ;
if ( $j > 5 || $j < 1 ) {
$j = 1 ;
}
$i ++ ;
}
}
//Проверка ударов
if ( $atack > 0 ) {
$r = $block [ $atack ] == 1 ;
2023-08-10 14:51:16 +00:00
}
2023-08-14 15:15:05 +00:00
return $r ;
}
///Комментатор
2022-12-19 20:22:19 +00:00
2023-09-30 20:17:25 +00:00
private function contrRestart ( $id , $at , $v , $rjd = 0 )
2023-08-14 15:15:05 +00:00
{
//уворот
$at = $this -> mf1Razmen ( $id , $at , $v , true , $rjd );
//парирование
$at = $this -> mf3Razmen ( $id , $at , $v , true , $rjd );
//блок щитом (если есть щит, конечно)
2023-09-30 20:17:25 +00:00
$at = $this -> mf4Razmen ( $id , $at , $v , true );
2023-08-14 15:15:05 +00:00
//крит
2023-09-30 20:17:25 +00:00
$at = $this -> mf2Razmen ( $at , true , $rjd );
return $this -> yronRazmen ( $id , $at , true , $rjd );
2023-08-10 14:51:16 +00:00
}
2023-08-14 15:15:05 +00:00
//Расчет типа удара от оружия
2023-08-10 14:51:16 +00:00
2023-09-30 20:17:25 +00:00
private function yronRazmen ( $id , $at , $pat = false , $rjd = 0 )
2023-08-10 14:51:16 +00:00
{
if ( $pat ) {
$pat = $at ;
$at = $pat [ 'p' ];
} else {
unset ( $pat );
}
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ] > 0 ) {
$yhod = [ 1 => 1 , 2 => 0 ];
} elseif ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ] > 0 ) {
$yhod = [ 1 => 0 , 2 => 1 ];
2022-12-19 20:22:19 +00:00
}
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2022-12-19 20:22:19 +00:00
} else {
$a = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$j = 0 ;
$k = 0 ;
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
if ( $rjd > 0 ) {
$j = $rjd - 1 ;
}
if ( is_array ( $at [ $a ][ 'atack' ])) {
while ( $j < count ( $at [ $a ][ 'atack' ]) && $j < 8 ) {
if ( $k == 0 && isset ( $this -> stats [ $this -> uids [ $u1 ]][ 'wp3id' ])) {
//Левая рука
$wp = 3 ;
$k = 1 ;
} else {
//Правая рука
if ( isset ( $this -> stats [ $this -> uids [ $u1 ]][ 'wp14id' ]) && $this -> stats [ $this -> uids [ $u1 ]][ 'items' ][ $this -> stats [ $this -> uids [ $u1 ]][ 'wp14id' ]][ 'type' ] != 13 ) {
$wp = 14 ;
} else {
2023-09-30 20:17:25 +00:00
$wp = 3 ;
2023-08-10 14:51:16 +00:00
}
$k = 0 ;
}
$witm = $this -> stats [ $this -> uids [ $u1 ]][ 'items' ][ $this -> stats [ $this -> uids [ $u1 ]][ 'wp' . $wp . 'id' ]];
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
$at [ $a ][ 'atack' ][ $j ][ 'wt' ] = $witm [ 'type' ];
$at [ $a ][ 'atack' ][ $j ][ 'yhod' ] = $yhod [ $a ];
if ( ! isset ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ]) && (
$at [ $a ][ 'atack' ][ $j ][ 1 ] == 1 ||
$at [ $a ][ 'atack' ][ $j ][ 1 ] == 4 ||
$at [ $a ][ 'atack' ][ $j ][ 1 ] == 5 )
) {
2023-09-30 20:17:25 +00:00
$at [ $a ][ 'atack' ][ $j ][ 'yron' ] = $this -> yronGetrazmen ( $u1 , $u2 , $wp );
2023-08-10 14:51:16 +00:00
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 4 ) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y_old' ] = $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ];
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ] = round ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'k' ] / 2 );
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 5 ) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y_old' ] = $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ];
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ] = $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'k' ];
}
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ '2h' ] = $witm [ '2h' ];
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'w' ] = $wp ;
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ] < 1 ) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'r' ] = '--' ;
} else {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'r' ] = '-' . $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ];
}
} else {
2023-09-30 20:17:25 +00:00
$at [ $a ][ 'atack' ][ $j ][ 'block' ] = $this -> yronGetrazmen ( $u1 , $u2 , $wp );
2023-08-10 14:51:16 +00:00
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 4 ) {
$at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'y_old' ] = $at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'y' ];
$at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'y' ] = round ( $at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'k' ] / 2 );
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 5 ) {
$at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'y_old' ] = $at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'y' ];
$at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'y' ] = $at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'k' ];
}
$at [ $a ][ 'atack' ][ $j ][ 'block' ][ '2h' ] = $witm [ '2h' ];
$at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'w' ] = $wp ;
if ( $at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'y' ] < 1 ) {
$at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'r' ] = '--' ;
} else {
$at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'r' ] = '-' . $at [ $a ][ 'atack' ][ $j ][ 'block' ][ 'y' ];
}
}
$j ++ ;
}
}
$i ++ ;
}
if ( isset ( $pat ) && $pat ) {
$pat [ 'p' ] = $at ;
$at = $pat ;
}
return $at ;
}
2023-08-14 15:15:05 +00:00
//Расчет урона от оружия
2023-08-10 14:51:16 +00:00
2023-09-30 20:17:25 +00:00
public function yronGetrazmen ( $uid1 , $uid2 , $wp ) : array
2023-08-10 14:51:16 +00:00
{
2023-09-30 20:17:25 +00:00
$r = [ 'r' => '--' ,];
/**
* Определяем тип урона
* Колющий
* Рубящий
* Режущий
* Дробящий
*/
2023-08-10 14:51:16 +00:00
$witm = 0 ;
$witm_type = 0 ;
if ( $wp > 0 ) {
$witm = $this -> stats [ $this -> uids [ $uid1 ]][ 'items' ][ $this -> stats [ $this -> uids [ $uid1 ]][ 'wp' . $wp . 'id' ]];
2023-08-14 15:15:05 +00:00
$witm_data = Conversion :: dataStringToArray ( $witm [ 'data' ]);
2023-08-10 14:51:16 +00:00
$witm_type = $this -> weaponTx ( $witm );
}
if ( $witm_type == 0 || $witm_type == 12 ) {
$witm_type2 = '' ;
} else {
$witm_type2 = $witm_type ;
}
$r [ 't' ] = $witm_type2 ;
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
//Увеличиваем параметры от текущего оружия которым бьем
$iii = 1 ;
while ( $iii <= 7 ) {
if ( isset ( $witm_data [ 'sv_a' . $iii ]) && $witm_data [ 'sv_a' . $iii ] != 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'a' . $iii ] += $witm_data [ 'sv_a' . $iii ];
}
if ( isset ( $witm_data [ 'sv_mg' . $iii ]) && $witm_data [ 'sv_mg' . $iii ] != 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'mg' . $iii ] += $witm_data [ 'sv_mg' . $iii ];
}
$iii ++ ;
}
$iii = 1 ;
while ( $iii <= 4 ) {
if ( isset ( $witm_data [ 'sv_aall' ]) && $witm_data [ 'sv_aall' ] != 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'a' . $iii ] += $witm_data [ 'sv_aall' ];
}
$iii ++ ;
}
$iii = 1 ;
while ( $iii <= 4 ) {
if ( isset ( $witm_data [ 'sv_mall' ]) && $witm_data [ 'sv_mall' ] != 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'mg' . $iii ] += $witm_data [ 'sv_mall' ];
}
$iii ++ ;
}
$iii = 1 ;
while ( $iii <= 7 ) {
if ( isset ( $witm_data [ 'sv_m2all' ]) && $witm_data [ 'sv_m2all' ] != 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'mg' . $iii ] += $witm_data [ 'sv_m2all' ];
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$iii ++ ;
}
if ( isset ( $witm_data [ 'sv_m3' ]) && $witm_data [ 'sv_m3' ] != 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'm3' ] += $witm_data [ 'sv_m3' ];
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$iii = 1 ;
while ( $iii <= 7 ) {
if ( isset ( $witm_data [ 'sv_pa' . $iii ]) && $witm_data [ 'sv_pa' . $iii ] != 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'pa' . $iii ] += $witm_data [ 'sv_pa' . $iii ] + $witm_data [ 'sv_m10' ];
}
if ( isset ( $witm_data [ 'sv_pm' . $iii ]) && $witm_data [ 'sv_pm' . $iii ] != 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'pm' . $iii ] += $witm_data [ 'sv_pm' . $iii ] + $witm_data [ 'sv_m11a' ];
if ( $iii < 5 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'pm' . $iii ] += $witm_data [ 'sv_m11' ];
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
$iii ++ ;
}
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
//мощность + подавление мощности противником
$wAp = 0 ;
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( $witm_type == 12 ) {
//удар кулаком
$wAp += $this -> stats [ $this -> uids [ $uid1 ]][ 'm10' ];
if ( $this -> users [ $this -> uids [ $uid1 ]][ 'align' ] == 7 ) {
$wAp += 15 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
} elseif ( $witm_type < 5 ) {
2023-09-30 20:17:25 +00:00
$wAp += $this -> stats [ $this -> uids [ $uid1 ]][ 'pa' . $witm_type ];
$wAp -= $this -> stats [ $this -> uids [ $uid2 ]][ 'antpa' . $witm_type ];
2023-08-10 14:51:16 +00:00
} else {
2023-09-30 20:17:25 +00:00
$wAp += $this -> stats [ $this -> uids [ $uid1 ]][ 'm10' ] + $this -> stats [ $this -> uids [ $uid1 ]][ 'pm' . ( $witm_type - 4 )] + $this -> stats [ $this -> uids [ $uid1 ]][ 'm11a' ] + $witm_data [ 'sv_pm' . ( $witm_type - 4 )];
$wAp -= $this -> stats [ $this -> uids [ $uid2 ]][ 'antpm' . ( $witm_type - 4 )];
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Пробой брони
$proboi = 0 ;
$witm_data [ 'm9' ] = $this -> stats [ $this -> uids [ $uid1 ]][ 'm9' ];
if ( rand ( 1 , 100 ) < floor ( $witm_data [ 'm9' ] / 2 )) {
$proboi = floor ( $witm_data [ 'm9' ] / 2 );
$r [ 'pb' ] = 1 ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$y = $this -> yrn (
$this -> stats [ $this -> uids [ $uid1 ]],
$this -> stats [ $this -> uids [ $uid2 ]],
$this -> users [ $this -> uids [ $uid1 ]],
$this -> users [ $this -> uids [ $uid2 ]],
$witm_type ,
2023-09-30 20:17:25 +00:00
$wAp , //мощность урона
2023-08-10 14:51:16 +00:00
$proboi , //пробой брони
( $witm_data [ 'sv_yron_min' ] + $this -> stats [ $this -> uids [ $uid1 ]][ 'yron_min' ]),
( $witm_data [ 'sv_yron_max' ] + $this -> stats [ $this -> uids [ $uid1 ]][ 'yron_max' ]),
$witm [ 'type' ],
);
$r [ 'y' ] = round ( rand ( $y [ 'min' ] + $proboi , $y [ 'max' ] + round ( $proboi / 2 )));
$r [ 'k' ] = round ( rand ( $y [ 'Kmin' ] + round ( $proboi / 4 ), $y [ 'Kmax' ] + round ( $proboi / 8 )));
$r [ 'm_y' ] = $y [ 'max' ];
$r [ 'm_k' ] = $y [ 'Kmax' ];
$r [ 'bRND' ] = $y [ 'bRND' ];
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$r [ 'w_type' ] = $witm_type ;
//тип от оружия
if ( $witm [ 'type' ] == 18 ) {
$tp = 1 ;
} elseif ( $witm [ 'type' ] == 19 ) {
$tp = 2 ;
} elseif ( $witm [ 'type' ] == 20 ) {
$tp = 3 ;
} elseif ( $witm [ 'type' ] == 21 ) {
$tp = 4 ;
} else {
$tp = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $tp != $witm_type && $wp > 0 ) // Т У Т
{
( int ) $r [ 'y' ] = round (( int ) $r [ 'y' ] / 3 );
$r [ 'r' ] = round ( $r [ 'r' ] / 3 );
$r [ 'k' ] = round ( $r [ 'k' ] / 3 );
$r [ 'm_k' ] = round ( $r [ 'm_k' ] / 3 );
$r [ 'm_y' ] = round ( $r [ 'm_y' ] / 3 );
}
2022-12-30 19:03:37 +00:00
2023-08-10 14:51:16 +00:00
if ( isset ( $this -> stats [ $this -> uids [ $uid2 ]][ 'zaproc' ])) {
$r [ 'y' ] = round ( $r [ 'y' ] - $r [ 'y' ] * $this -> stats [ $this -> uids [ $uid2 ]][ 'zaproc' ] / 100 );
( int ) $r [ 'r' ] = round (( int ) $r [ 'r' ] - ( int ) $r [ 'r' ] * ( int ) $this -> stats [ $this -> uids [ $uid2 ]][ 'zaproc' ] / 100 );
$r [ 'k' ] = round ( $r [ 'k' ] - $r [ 'k' ] * $this -> stats [ $this -> uids [ $uid2 ]][ 'zaproc' ] / 100 );
$r [ 'm_k' ] = round ( $r [ 'm_k' ] - $r [ 'm_k' ] * $this -> stats [ $this -> uids [ $uid2 ]][ 'zaproc' ] / 100 );
$r [ 'm_y' ] = round ( $r [ 'm_y' ] - $r [ 'm_y' ] * $this -> stats [ $this -> uids [ $uid2 ]][ 'zaproc' ] / 100 );
if ( $r [ 'k' ] < 1 ) {
$r [ 'k' ] = 2 ;
}
}
if ( $r [ 'y' ] < 1 ) {
$r [ 'y' ] = 1 ;
}
if ( $r [ 'r' ] >= 0 ) {
$r [ 'r' ] = - 1 ;
}
if ( $r [ 'k' ] < 1 ) {
$r [ 'k' ] = 1 ;
}
if ( $r [ 'm_k' ] < 1 ) {
$r [ 'm_k' ] = 1 ;
}
if ( $r [ 'm_y' ] < 1 ) {
$r [ 'm_y' ] = 1 ;
}
return $r ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
//Расчет урона от оружия
public function weaponTx ( $item )
{
$itm = Conversion :: dataStringToArray ( $item [ 'data' ]);
$t [ 0 ][ 'z' ] = 0 ;
$t [ 0 ][ 't' ] = 0 ;
//колящий урон
$t [ 1 ][ 'z' ] = round ( 0 + $itm [ 'tya1' ]);
$t [ 1 ][ 't' ] = 1 ;
//рубящий урон
$t [ 2 ][ 'z' ] = round ( 0 + $itm [ 'tya2' ]);
$t [ 2 ][ 't' ] = 2 ;
//дробящий урон
$t [ 3 ][ 'z' ] = round ( 0 + $itm [ 'tya3' ]);
$t [ 3 ][ 't' ] = 3 ;
//режущий урон
$t [ 4 ][ 'z' ] = round ( 0 + $itm [ 'tya4' ]);
$t [ 4 ][ 't' ] = 4 ;
//урон огня
$t [ 5 ][ 'z' ] = round ( 0 + $itm [ 'tym1' ]);
$t [ 5 ][ 't' ] = 5 ;
//урон воздуха
$t [ 6 ][ 'z' ] = round ( 0 + $itm [ 'tym2' ]);
$t [ 6 ][ 't' ] = 6 ;
//урон воды
$t [ 7 ][ 'z' ] = round ( 0 + $itm [ 'tym3' ]);
$t [ 7 ][ 't' ] = 7 ;
//урон земли
$t [ 8 ][ 'z' ] = round ( 0 + $itm [ 'tym4' ]);
$t [ 8 ][ 't' ] = 8 ;
//урон света
$t [ 9 ][ 'z' ] = round ( 0 + $itm [ 'tym5' ]);
$t [ 9 ][ 't' ] = 9 ;
//урон тьмы
$t [ 10 ][ 'z' ] = round ( 0 + $itm [ 'tym6' ]);
$t [ 10 ][ 't' ] = 10 ;
//урон серой магией
$t [ 11 ][ 'z' ] = round ( 0 + $itm [ 'tym7' ]);
$t [ 11 ][ 't' ] = 11 ;
$tpt = $t [ 0 ][ 'z' ];
$tpmin = $t [ 0 ];
$tpmax = $t [ 0 ];
$i = 1 ;
$ii = 0 ;
while ( $i <= 11 ) {
if ( $t [ $i ][ 'z' ] > $tpt ) {
$tpt = $t [ $i ][ 'z' ];
$tpmax = $t [ $i ];
$ii = $i ;
}
$i ++ ;
}
$t [ $ii ][ 'z' ] = 0 ;
$tpt = $t [ 0 ][ 'z' ];
$i = 1 ;
while ( $i <= 11 ) {
if ( $t [ $i ][ 'z' ] > $tpt ) {
$tpt = $t [ $i ][ 'z' ];
$tpmin = $t [ $i ];
}
$i ++ ;
}
$setclass = rand ( 1 , 100 );
if ( $setclass > $tpmax [ 'z' ]) {
$tp = $tpmin [ 't' ];
} else {
$tp = $tpmax [ 't' ];
}
return $tp ;
}
2022-12-19 20:22:19 +00:00
2023-08-14 15:15:05 +00:00
//Расчет защиты
2023-08-10 14:51:16 +00:00
public function yrn (
2023-09-30 20:17:25 +00:00
array $st1 ,
array $st2 ,
array $u1 ,
array $u2 ,
int $type ,
int $power_yron = 0 ,
float $proboi = 0 ,
int $weapom_min = 0 ,
int $weapom_max = 0 ,
int $wp_type = 0 ,
2023-12-17 02:32:09 +00:00
) : array {
2023-09-30 20:17:25 +00:00
$level = $st1 [ 'lvl' ];
$power_krit = round ( $st1 [ 'm3' ]);
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( ! isset ( $type ) || $type == '' ) {
$type = 12 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Параметры для возврвата
2023-09-30 20:17:25 +00:00
$r = [ 'type' => $type ];
2023-08-10 14:51:16 +00:00
$p = [
'B' => [ 0 => 0 , 1 => 0 , 'rnd' => false ],
'M' => $power_yron , //мощность урона
'K' => $power_krit , //мощность крита
'T' => 1 , //Кф. оружия
];
//Расчет типа урона
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( $wp_type == 18 ) {
$r [ 'type' ] = 1 ;
} elseif ( $wp_type == 19 ) {
$r [ 'type' ] = 2 ;
} elseif ( $wp_type == 20 ) {
$r [ 'type' ] = 3 ;
} elseif ( $wp_type == 21 ) {
$r [ 'type' ] = 4 ;
}
2023-09-30 20:17:25 +00:00
/**
* ( S ) - влияние наших статов на профильный урон
* 1 Колющий : S = Сила * 0 , 3 + Ловкость * 0 , 7
* 2 Рубящий : S = Сила * 0 , 5 + Ловкость * 0 , 25 + Интуиция * 0 , 25
* 3 Дробящий : S = Сила * 1
* 4 Режущий : S = Сила * 0 , 3 + Интуиция * 0 , 7
* else кулак / магия
*/
2023-08-10 14:51:16 +00:00
if ( $r [ 'type' ] == 1 ) {
$p [ 'S' ] = $st1 [ 's1' ] * 0.25 + $st1 [ 's2' ] * 0.75 ;
$p [ 'U' ] = $st1 [ 'a1' ] * 1.00 ; //кинжалы
} elseif ( $r [ 'type' ] == 2 ) {
$p [ 'S' ] = $st1 [ 's1' ] * 1.20 ;
$p [ 'U' ] = $st1 [ 'a2' ] * 1.00 ; //топоры
} elseif ( $r [ 'type' ] == 3 ) {
$p [ 'S' ] = $st1 [ 's1' ] * 0.5 + $st1 [ 's4' ] * 1.00 ;
$p [ 'U' ] = $st1 [ 'a3' ] * 1.00 ; //дубины
} elseif ( $r [ 'type' ] == 4 ) {
$p [ 'S' ] = $st1 [ 's3' ] * 1.00 ;
$p [ 'U' ] = $st1 [ 'a4' ] * 1.00 ; //мечи
} else {
$p [ 'S' ] = 0 ;
2023-09-30 20:17:25 +00:00
$p [ 'U' ] = 0 ;
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$r [ 'bron' ][ 'rnd' ] = rand ( $r [ 'bron' ][ 0 ], $r [ 'bron' ][ 1 ]);
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Остальные расчеты (коэфицент)
$p [ 'B' ][ 0 ] = 2 + $level + $st1 [ 's1' ] - round ( $st1 [ 's1' ] / 5 );
$p [ 'B' ][ 1 ] = $p [ 'B' ][ 0 ] + 3 ;
$p [ 'B' ][ 'rnd' ] = rand ( $p [ 'B' ][ 0 ], $p [ 'B' ][ 1 ]);
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Обычный урон
if ( $r [ 'type' ] == 12 ) {
$r [ 'min' ] = ( $p [ 'B' ][ 0 ] + $weapom_min ) * $p [ 'T' ] * ( 1 + $p [ 'M' ] / 100 );
$r [ 'max' ] = ( $p [ 'B' ][ 1 ] + $weapom_max ) * $p [ 'T' ] * ( 1 + $p [ 'M' ] / 100 );
} else {
$r [ 'min' ] = (( $p [ 'B' ][ 0 ] + $p [ 'S' ] * 2 + $weapom_min * 2 + $p [ 'U' ] * 2 ) * $p [ 'T' ]) * ( 1 + $p [ 'M' ] / 100 );
$r [ 'max' ] = (( $p [ 'B' ][ 1 ] + $p [ 'S' ] * 2 + $weapom_max * 2 + $p [ 'U' ] * 2 ) * $p [ 'T' ]) * ( 1 + $p [ 'M' ] / 100 );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$r [ 'bRND' ] = $p [ 'B' ][ 'rnd' ];
2023-09-30 20:17:25 +00:00
$r [ 'Kmin' ] = ceil (( 2 + ( $p [ 'K' ] / 100 )) * $r [ 'min' ]);
$r [ 'Kmax' ] = ceil (( 2 + ( $p [ 'K' ] / 100 )) * $r [ 'max' ]);
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Расчет брони
//для обычного
if ( $r [ 'type' ] < 5 || $r [ 'type' ] == 12 ) {
$r [ 'min_abron' ] = round ( $r [ 'min' ] * 0.05 );
$r [ 'max_abron' ] = round ( $r [ 'max' ] * 0.05 );
if ( $proboi != 0 ) {
$r [ 'bron' ][ 'rndold' ] = $r [ 'bron' ][ 'rnd' ];
$r [ 'bron' ][ 'rnd' ] = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$r [ 'Kmin' ] -= $r [ 'bron' ][ 'rnd' ] * 2 ; //было умножить на 2
$r [ 'Kmax' ] -= $r [ 'bron' ][ 'rnd' ] * 2 ; //было умножить на 2
$r [ 'min' ] -= $r [ 'bron' ][ 'rnd' ]; //не было деления ни на чо.
$r [ 'max' ] -= $r [ 'bron' ][ 'rnd' ]; //не было деления ни на чо.
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Расчет защиты (не более 80%)
if ( $r [ 'type' ] < 5 || $r [ 'type' ] == 12 ) {
$r [ 'min' ] = round ( $r [ 'min' ] / 100 * ( 100 - $this -> zago ( $st2 [ 'za' ])));
$r [ 'max' ] = round ( $r [ 'max' ] / 100 * ( 100 - $this -> zago ( $st2 [ 'za' ])));
$r [ 'Kmin' ] = round ( $r [ 'Kmin' ] / 100 * ( 100 - $this -> zago ( $st2 [ 'za' ])));
$r [ 'Kmax' ] = round ( $r [ 'Kmax' ] / 100 * ( 100 - $this -> zago ( $st2 [ 'za' ])));
} else {
$r [ 'min' ] = round ( $r [ 'min' ] / 100 * ( 100 - $this -> zmgo ( $st2 [ 'zm' ])));
$r [ 'max' ] = round ( $r [ 'max' ] / 100 * ( 100 - $this -> zmgo ( $st2 [ 'zm' ])));
$r [ 'Kmin' ] = round ( $r [ 'Kmin' ] / 100 * ( 100 - $this -> zmgo ( $st2 [ 'zm' ])));
$r [ 'Kmax' ] = round ( $r [ 'Kmax' ] / 100 * ( 100 - $this -> zmgo ( $st2 [ 'zm' ])));
}
$r [ 'min' ] = round ( $r [ 'min' ]);
$r [ 'max' ] = round ( $r [ 'max' ]);
$r [ 'Kmin' ] = round ( $r [ 'Kmin' ]);
$r [ 'Kmax' ] = round ( $r [ 'Kmax' ]);
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$min_yrn = 0 ; //%
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( $u1 [ 'clone' ] > 0 ) {
$min_yrn = 75 ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$r [ 'min' ] -= floor ( $r [ 'min' ] / 100 * $min_yrn );
$r [ 'max' ] -= floor ( $r [ 'max' ] / 100 * $min_yrn );
$r [ 'Kmin' ] -= floor ( $r [ 'Kmin' ] / 100 * ( $min_yrn ));
$r [ 'Kmax' ] -= floor ( $r [ 'Kmax' ] / 100 * ( $min_yrn ));
$r [ 'min_' ] -= floor ( $r [ 'min_' ] / 100 * $min_yrn );
$r [ 'max_' ] -= floor ( $r [ 'max_' ] / 100 * $min_yrn );
$r [ 'Kmin_' ] -= floor ( $r [ 'Kmin_' ] / 100 * ( $min_yrn ));
$r [ 'Kmax_' ] -= floor ( $r [ 'Kmax_' ] / 100 * ( $min_yrn ));
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$defd = mysql_fetch_array (
mysql_query (
'SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this -> info [ 'id' ] . '" AND `vars` = "use_defteam' . $u2 [ 'team' ] . '" LIMIT 1'
)
);
if ( $defd [ 0 ] > 100 ) {
$defd [ 0 ] = 100 ;
}
$defd = 0 + $defd [ 0 ];
$powd = mysql_fetch_array (
mysql_query (
'SELECT SUM(`vals`) FROM `battle_actions` WHERE `btl` = "' . $this -> info [ 'id' ] . '" AND `vars` = "use_powteam' . $u1 [ 'team' ] . '" LIMIT 1'
)
);
if ( $powd [ 0 ] > 100 ) {
$powd [ 0 ] = 100 ;
}
$powd = 0 + $powd [ 0 ];
$defd = $defd - $powd ;
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$r [ 'min' ] -= floor ( $defd );
$r [ 'max' ] -= floor ( $defd );
$r [ 'Kmin' ] -= floor ( $defd * 2 );
$r [ 'Kmax' ] -= floor ( $defd * 2 );
$r [ 'min_' ] -= floor ( $defd );
$r [ 'max_' ] -= floor ( $defd );
$r [ 'Kmin_' ] -= floor ( $defd * 2 );
$r [ 'Kmax_' ] -= floor ( $defd * 2 );
$r [ 'min' ] += $st1 [ 'maxAtack' ];
$r [ 'max' ] += $st1 [ 'maxAtack' ];
$r [ 'Kmin' ] += $st1 [ 'maxAtack' ] * 2 ;
$r [ 'Kmin' ] += $st1 [ 'maxAtack' ] * 2 ;
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( $r [ 'min' ] < 1 ) {
$r [ 'min' ] = 1 ;
}
if ( $r [ 'max' ] < 1 ) {
$r [ 'max' ] = 1 ;
}
if ( $r [ 'Kmin' ] < 2 ) {
$r [ 'Kmin' ] = 2 ;
}
if ( $r [ 'Kmax' ] < 2 ) {
$r [ 'Kmax' ] = 2 ;
}
if ( $r [ 'Kmin_' ] < 2 ) {
$r [ 'Kmin_' ] = 2 ;
}
if ( $r [ 'Kmin_' ] < 2 ) {
$r [ 'Kmax_' ] = 2 ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$r [ 'm_k' ] = $r [ 'Kmax' ];
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
return $r ;
}
2022-12-19 20:22:19 +00:00
2023-08-14 15:15:05 +00:00
//Расчет защиты (магия)
2022-12-19 20:22:19 +00:00
2023-09-30 20:17:25 +00:00
private function zago ( $v ) : float
2023-08-10 14:51:16 +00:00
{
if ( $v > 1700 ) {
$v = 1700 ;
}
return round (( 1 - ( pow ( 0.5 , ( $v / 399.51 )))) * 100 , 2 );
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
public function zmgo ( $v )
{
return ( 1 - ( pow ( 0.5 , ( $v / 250 )))) * 100 ;
}
2023-09-30 20:17:25 +00:00
/** Осторожно ! Подключаются файлы !!!
* @ param $id
* @ param $at
* @ return array | mixed
*/
private function priemsTestRazmen ( $id , $at )
2023-08-10 14:51:16 +00:00
{
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2023-08-10 14:51:16 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( ! isset ( $at [ 'p' ][ 'p_cast' ])) {
$at [ 'p' ] = $at ;
$at [ 'p' ][ 'p_cast' ] = true ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//ставка
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] == 220 || $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] == 237
|| $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] == 286 || $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] == 287 || $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] == 288
|| $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] == 213 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Приемы ухода от удара
if ( ! isset ( $this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ]) || $this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ] == 0 ) {
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 1 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
$this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ] -- ;
}
}
$j ++ ;
}
}
//Приемы крита
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 2 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Приемы атаки
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 3 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
if ( isset ( $fx_priem )) {
$at = $fx_priem ( $id , $at , $u1 , $j );
}
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$j ++ ;
}
//Приемы защиты
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 4 ) {
2023-09-30 20:17:25 +00:00
if ( file_exists (
2023-08-10 14:51:16 +00:00
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
if ( isset ( $fx_priem )) {
$at = $fx_priem ( $id , $at , $u1 , $j );
}
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 5 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
if ( isset ( $fx_priem )) {
$at = $fx_priem ( $id , $at , $u1 , $j );
}
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$i ++ ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2023-08-10 14:51:16 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( ! isset ( $at [ 'p' ][ 'p_cast' ])) {
$at [ 'p' ] = $at ;
$at [ 'p' ][ 'p_cast' ] = true ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 8 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 9 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
$i ++ ;
}
return $at ;
}
2022-12-19 20:22:19 +00:00
2023-09-30 20:17:25 +00:00
/** Осторожно ! Подключаются файлы !!!
* @ param $id
* @ param $at
* @ return mixed
*/
private function priemsRestartRazmen ( $id , $at )
2023-08-10 14:51:16 +00:00
{
if ( isset ( $at [ 'p' ])) {
//Проверка
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
/*
Если возникнут проблемы с приемами , придется переписать алгоритм , сейчас он выглядит так :
Цикл 1. Проверяем пользователя
Цикл 2 внутри Цикла 1. Проверяем приемы поторые пользователь использовал
Придется сделать :
Цикл 1. Проверяем пользователя
Цикл 2 внутри Цикла 1. Проверяем приемы уворота
Цикл 3. Проверяем пользователя
Цикл 4 внутри Цикла 3. Проверяем приемы крита
и т . д .
*/
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2023-08-10 14:51:16 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( ! isset ( $at [ 'p' ][ 'p_cast' ])) {
$at [ 'p' ] = $at ;
$at [ 'p' ][ 'p_cast' ] = true ;
}
//Приемы ухода от удара
if ( ! isset ( $this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ]) || $this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ] == 0 ) {
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 1 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_tested_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
$this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ] -- ;
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
$j ++ ;
}
}
//Приемы крита
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 2 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_tested_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
//Приемы защиты
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 4 ) {
2023-09-30 20:17:25 +00:00
if ( file_exists (
2023-08-10 14:51:16 +00:00
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_tested_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
//Приемы атаки
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 3 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_tested_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 4 ] == 5 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_tested_this = $u1 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 4 ] == 8 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_tested_this = $u2 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u2 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 4 ] == 9 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_tested_this = $u2 ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u2 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u2 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$i ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$at = $at [ 'p' ];
unset ( $at [ 'p' ]);
}
return $at ;
}
public function testPogB ( $uid , $yr , $pliid , $test = 0 )
{
$yr2 = $yr ;
$checktuman = mysql_fetch_array (
mysql_query (
'SELECT * FROM `eff_users` WHERE `uid` = "' . $uid . ' "
AND ( `v2` = 273 OR `v2` = 286 OR `v2` = 287 OR `v2` = 288 )
AND `delete` = 0 LIMIT 1 '
)
); //проверка на туманный образ
if ( $yr > 0 && ! isset ( $checktuman [ 'id' ])) {
2023-09-30 20:17:25 +00:00
global $priem ;
2023-08-10 14:51:16 +00:00
$i = 0 ;
while ( $i < count ( $this -> stats [ $this -> uids [ $uid ]][ 'set_pog2' ])) {
$j = $this -> stats [ $this -> uids [ $uid ]][ 'set_pog2' ][ $i ];
if ( $this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'id' ] == $pliid || $test == 1 ) {
$this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'data' ] = str_replace (
'add_pog2=' . $j [ 'y' ],
'add_pog2=$' , $this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'data' ]
2022-12-30 19:03:37 +00:00
);
2023-08-14 15:15:05 +00:00
$dt3 = Conversion :: dataStringToArray ( $this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'data' ]);
2023-08-10 14:51:16 +00:00
$dt30 = floor ( $j [ 'y' ] / $yr2 * 100 );
if ( $dt30 < $dt3 [ 'add_pog2p' ]) {
$dt3 [ 'add_pog2p' ] = $dt30 ;
}
unset ( $dt30 );
if ( isset ( $dt3 [ 'add_pog2mp' ])) {
if (( round (
round ( $yr2 / 100 * ( 100 - $dt3 [ 'add_pog2p' ])) * $dt3 [ 'add_pog2mp' ]
)) > $this -> stats [ $this -> uids [ $uid ]][ 'mpNow' ]) {
//не хватило маны, считаем сколько хватит % от поглощенного урона
$j [ 'yhj' ] = $this -> stats [ $this -> uids [ $uid ]][ 'mpNow' ] / ( round (
round ( $yr2 / 100 * ( 100 - $dt3 [ 'add_pog2p' ])) * $dt3 [ 'add_pog2mp' ]
)) * 100 ;
$j [ 'yhj' ] = floor ( $j [ 'yhj' ]); //Сколько % мы можем поглотить
$dt3 [ 'add_pog2p' ] = floor ( $dt3 [ 'add_pog2p' ] / 100 * $j [ 'yhj' ]);
}
if ( $test == 1 ) {
$priem -> minMana ( $uid , round ( round ( $yr2 / 100 * $dt3 [ 'add_pog2p' ]) * $dt3 [ 'add_pog2mp' ]));
}
}
if ( ! isset ( $this -> poglast [ $uid ])) {
$this -> poglast [ $uid ] = 0 ;
}
$this -> poglast [ $uid ] += $yr2 ;
if ( $test == 1 ) {
2023-09-30 20:17:25 +00:00
// осталось для поглощения
2023-08-10 14:51:16 +00:00
$j [ 'y' ] -= round ( $this -> poglast [ $uid ] / 100 * $dt3 [ 'add_pog2p' ]);
$priem -> minMana (
$uid ,
round ( round ( $this -> poglast [ $uid ] / 100 * $dt3 [ 'add_pog2p' ]) * $dt3 [ 'add_pog2mp' ])
);
}
if ( isset ( $dt3 [ 'add_pog2p' ])) {
$yr2 = round ( $yr2 / 100 * ( 100 - $dt3 [ 'add_pog2p' ]));
}
if ( $j [ 'y' ] < 0 || ( $this -> stats [ $this -> uids [ $uid ]][ 'mpNow' ] <= 0 && $dt3 [ 'add_pog2mp' ] > 0 )) {
2023-08-14 15:15:05 +00:00
$dt2 = Conversion :: dataStringToArray ( $this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'data' ]);
2023-08-10 14:51:16 +00:00
if ( isset ( $dt2 [ 'endPog' ]) && $dt2 [ 'endPog' ] == 1 ) {
//удаляем прием
//Добавляем в лог
$this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'priem' ] = mysql_fetch_array (
mysql_query (
'SELECT * FROM `priems` WHERE `id` = "' . $this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'v2' ] . '" LIMIT 1'
)
);
$this -> delPriem (
$this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ],
$this -> users [ $this -> uids [ $uid ]], 4 , $uid
);
$this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ] = 'delete' ;
}
unset ( $dt2 );
$j [ 'y' ] = 0 ;
}
$this -> stats [ $this -> uids [ $uid ]][ 'set_pog' ][ $i ][ 'y' ] = $j [ 'y' ];
if ( isset ( $this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'data' ])) {
$this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'data' ] = str_replace (
'add_pog2=$' ,
'add_pog2=' . $j [ 'y' ], $this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'data' ]
);
$upd = mysql_query (
'UPDATE `eff_users` SET `data` = "' . $this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'data' ] . '" WHERE `id` = "' . $this -> stats [ $this -> uids [ $uid ]][ 'effects' ][ $j [ 'id' ] - 1 ][ 'id' ] . '" LIMIT 1'
);
}
if ( $j [ 'y' ] - $this -> poglast [ $uid ] + $yr2 < 0 ) {
$yr -= $yr + ( $j [ 'y' ] - $this -> poglast [ $uid ] + $yr2 );
$yr2 = $yr ;
$i = count ( $this -> stats [ $this -> uids [ $uid ]][ 'set_pog2' ]) + 1 ;
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$i ++ ;
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
unset ( $checktuman );
return $yr2 ;
2022-12-19 20:22:19 +00:00
}
2023-09-30 20:17:25 +00:00
private function updateHealth ( $id , $at ) : array
2022-12-19 20:22:19 +00:00
{
2023-11-02 13:57:39 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
if ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid1 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid2' ], $this -> atacks [ $id ][ 'uid1' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid1' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
} elseif ( $this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ] > 0 ) {
2023-12-17 02:32:09 +00:00
$uid2 = $this -> yhod_user (
$this -> atacks [ $id ][ 'uid1' ], $this -> atacks [ $id ][ 'uid2' ],
$this -> stats [ $this -> uids [ $this -> atacks [ $id ][ 'uid2' ]]][ 'yhod' ]
);
2023-11-02 13:57:39 +00:00
}
2023-08-10 14:51:16 +00:00
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2023-08-10 14:51:16 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Рассчет дополнительных тактик
if ( $this -> atacks [ $id ][ 'out' . $b ] > 0 ) {
//Игрок ${'u'.$a} получает тактики, возможно
if ( rand ( 0 , 100 ) < min ( floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'm6' ] / 5 ), 20 )) {
//выдаем тактику контрудара
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u1 ]][ 'tactic3' ] ++ ;
}
}
if ( rand ( 0 , 100 ) < min ( floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'm8' ] / 4 ), 20 )) {
//выдаем тактику щита
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u1 ]][ 'tactic4' ] ++ ;
}
}
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Расчет удара Цели (u2) по Атакующему (u1)
$j = 0 ;
while ( $j < count ( $at [ $a ][ 'atack' ]) && $j < 8 ) {
//Добавляем тактики
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 1 ) {
//u1 ударил обычным ударом u2
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u1 ]][ 'tactic1' ] ++ ;
}
//Двуручка
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ '2h' ] == 1 && $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u1 ]][ 'tactic1' ] += 2 ;
}
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] != 2 ) {
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 3 ) {
//u2 заблокировал удар u1
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u2 ]][ 'tactic4' ] ++ ;
}
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 4 ) {
//u1 пробил блок u2 критом
if ( ! isset ( $at [ $a ][ 'atack' ][ $j ][ 'notactic2' ])) {
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u1 ]][ 'tactic2' ] ++ ;
}
}
$this -> users [ $this -> uids [ $u2 ]][ 'tactic4' ] ++ ; //тактика за пробив блок
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 5 ) {
//u1 ударил критическим ударом u2
if ( ! isset ( $at [ $a ][ 'atack' ][ $j ][ 'notactic2' ])) {
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u1 ]][ 'tactic2' ] += 2 ;
}
//Двуручка
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ '2h' ] == 1 && $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u1 ]][ 'tactic2' ] += 1 ;
}
}
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 6 ) {
//u2 парировал удар u1
if ( ! isset ( $at [ $a ][ 'atack' ][ $j ][ 'notactic5' ]) && $this -> stats [ $this -> uids [ $u1 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u2 ]][ 'tactic5' ] ++ ;
}
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 7 ) {
//u2 блокировал щитом удар u1 //Т У Т ЩИТ
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u2 ]][ 'tactic4' ] ++ ;
}
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 8 ) {
//u2 увернулся от удара u1 и нанес по нему контрудар
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'this_animal' ] == 0 ) {
$this -> users [ $this -> uids [ $u2 ]][ 'tactic3' ] ++ ;
}
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
// КУДА БИЛ , ТИП УДАРА
if ( isset ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ]) && (
$at [ $a ][ 'atack' ][ $j ][ 1 ] == 1 ||
$at [ $a ][ 'atack' ][ $j ][ 1 ] == 4 ||
$at [ $a ][ 'atack' ][ $j ][ 1 ] == 5 )) {
//
2022-12-30 19:03:37 +00:00
2023-08-10 14:51:16 +00:00
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ] <= $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ]) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ] = $this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ];
}
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ] <= $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'k' ]) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'k' ] = $this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ];
}
2022-12-30 19:03:37 +00:00
2023-08-10 14:51:16 +00:00
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ] < 0 ) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ] = 1 ;
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'r' ] = - 1 ;
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'k' ] = 1 ;
}
if ( $this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ] < 1 ) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ] = 0 ;
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'r' ] = - 1 ;
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'k' ] = 0 ;
}
//Добавляем нанесенный урон и опыт
$this -> takeExp ( $u1 , $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ], $u1 , $u2 );
//Отнимаем Н Р
$this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ] -= $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ];
$this -> users [ $this -> uids [ $u2 ]][ 'last_hp' ] = - $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ];
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ] = $this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ];
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ] < 1 ) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ] = 0 ;
}
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hpAll' ] = $this -> stats [ $this -> uids [ $u2 ]][ 'hpAll' ];
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ] > $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hpAll' ]) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ] = $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hpAll' ];
}
//Травмирование
if ( rand ( 0 , 100 ) <= 50 ) {
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 4 || $at [ $a ][ 'atack' ][ $j ][ 1 ] == 5 ) {
if ( ! isset ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'travma' ]) && rand (
0 ,
1000
) < 500 && $this -> users [ $this -> uids [ $u2 ]][ 'level' ] > 1 && $this -> stats [ $this -> uids [ $u1 ]] > 1 ) {
$trvm_chns = floor ( rand ( 0 , 200 ) / 10 );
if ( $trvm_chns > 3 || $trvm_chns < 1 ) {
$trvm_chns = 0 ;
}
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'travma' ] = [ $trvm_chns , 'Обыкновенная травма' ];
unset ( $trvm_chns );
}
}
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$i ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
return $at ;
2022-12-19 20:22:19 +00:00
}
2023-08-14 15:15:05 +00:00
//Расчет МФ
2023-08-10 14:51:16 +00:00
/**
* Добавляем опыт \ нанесенный урон .
* Кривовсрато , на переделку .
2023-12-19 01:58:37 +00:00
* @ param $id
* @ param $y
* @ param $id1
* @ param $id2
* @ param bool $mgregen
* @ param bool $nobattle_uron
2023-08-10 14:51:16 +00:00
* @ return void
*/
2023-12-19 01:58:37 +00:00
public function takeExp ( $id , $y , $id1 , $id2 , bool $mgregen = false , bool $nobattle_uron = false ) : void
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
global $u ;
if ( isset ( $this -> users [ $this -> uids [ $id ]])) {
$s2 = $this -> stats [ $this -> uids [ $id2 ]];
if ( $id1 != $id2 ) {
$e = $this -> testExp ( $y , $s2 );
} else {
$e = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if (( int ) $this -> users [ $this -> uids [ $id1 ]][ 'bot_id' ] == 0 && $this -> users [ $this -> uids [ $id1 ]][ 'dnow' ] != 0 && $this -> info [ 'dungeon' ] != 1 ) {
$dun_limitForLevel = [ // Максимум для каждого уровня.
4 => 750 ,
5 => 1500 ,
6 => 3500 ,
7 => 8000 ,
8 => 25000 ,
9 => 50000 ,
10 => 75000 ,
11 => 125000 ,
12 => 250000 ,
13 => 500000 ,
14 => 750000 ,
];
$dun_expFactor = [ // Максимум для каждого уровня.
4 => 5 ,
5 => 5 ,
6 => 5 ,
7 => 5 ,
8 => 5 ,
9 => 3 ,
10 => 1 ,
11 => 1 ,
12 => 1 ,
13 => 1 ,
14 => 1 ,
];
if ( isset ( $dun_expFactor [( int ) $this -> users [ $this -> uids [ $id1 ]][ 'level' ]])) {
$e = $e * $dun_expFactor [( int ) $this -> users [ $this -> uids [ $id1 ]][ 'level' ]];
}
if ( $this -> info [ 'dungeon' ] > 1 && $this -> users [ $this -> uids [ $id1 ]][ 'battle' ] > 0 ) { // пещерный лимит
$dun_exp = []; // Текущий лимит опыта игрока в подземельях.
$rep = Db :: getValue (
'select dungeonexp from rep where id = ?' , [ $this -> users [ $this -> uids [ $id1 ]][ 'id' ]]
);
$rep = explode ( ',' , $rep );
foreach ( $rep as $key => $val ) {
$val = explode ( '=' , $val );
if ( isset ( $val [ 0 ]) && isset ( $val [ 1 ]) && $val [ 0 ] != '' && $val [ 1 ] != 0 ) {
$dun_exp [( int ) $val [ 0 ]] = ( int ) $val [ 1 ];
} // текущий лимит опыта в подземке
}
unset ( $rep );
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( ! isset ( $dun_exp [ $this -> info [ 'dungeon' ]])) {
$dun_exp [ $this -> info [ 'dungeon' ]] = 0 ;
2022-12-30 19:03:37 +00:00
}
2023-08-10 14:51:16 +00:00
if ( ! isset ( $dun_limitForLevel [( int ) $this -> users [ $this -> uids [ $id1 ]][ 'level' ]])) { // Если лимит не задан, опыт не даем.
$e = 0 ;
} elseif (
isset ( $dun_exp [ $this -> info [ 'dungeon' ]]) &&
$dun_exp [ $this -> info [ 'dungeon' ]] >= $dun_limitForLevel [( int ) $this -> users [ $this -> uids [ $id1 ]][ 'level' ]]
) { // Если лимит уже достигнут, опыт не даем.
$e = 0 ;
} elseif (
isset ( $dun_exp [ $this -> info [ 'dungeon' ]]) &&
$dun_limitForLevel [( int ) $this -> users [ $this -> uids [ $id1 ]][ 'level' ]] > $dun_exp [ $this -> info [ 'dungeon' ]]
) { // Если текущая репутация не достигла лимита.
if (( $dun_exp [ $this -> info [ 'dungeon' ]] + $e ) > $dun_limitForLevel [( int ) $this -> users [ $this -> uids [ $id1 ]][ 'level' ]]) {
// Если опыта набрано достаточно, для достижения лимита.
$e = abs (
$e - abs (
$dun_limitForLevel [( int ) $this -> users [ $this -> uids [ $id1 ]][ 'level' ]] - ( $e + $dun_exp [ $this -> info [ 'dungeon' ]])
)
);
$dun_exp [ $this -> info [ 'dungeon' ]] += $e ;
} elseif ( $dun_limitForLevel [( int ) $this -> users [ $this -> uids [ $id1 ]][ 'level' ]] > ( $dun_exp [ $this -> info [ 'dungeon' ]] + $e )) {
// Если опыта недостаточно, для достижения лимита.
$dun_exp [ $this -> info [ 'dungeon' ]] += $e ;
} else {
$e = 0 ;
}
} else { // В любой непонятной ситуцаии.
$e = 0 ;
2022-12-30 19:03:37 +00:00
}
2023-08-10 14:51:16 +00:00
}
// Опыт в пещерах.
if ( $this -> info [ 'dungeon' ] == 102 ) {
$e = floor ( $e * 0.002 );
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
$this -> users [ $this -> uids [ $id1 ]][ 'battle_exp' ] += floor ( $e );
if ( ! $mgregen && ! $nobattle_uron ) {
$this -> users [ $this -> uids [ $id1 ]][ 'battle_yron' ] += floor ( $y );
if ( $this -> stats [ $this -> uids [ $id1 ]][ 'notactic' ] != 1 ) {
if ( $s2 [ 'hpAll' ] <= 1000 ) {
if ( $this -> stats [ $this -> uids [ $id2 ]][ 'this_animal' ] == 0 ) {
2023-12-19 01:58:37 +00:00
$this -> users [ $this -> uids [ $id1 ]][ 'tactic6' ] +=
round ( 0.1 * ( floor ( $y ) / $s2 [ 'hpAll' ] * 100 ), 10 );
2023-08-10 14:51:16 +00:00
} else {
2023-12-19 01:58:37 +00:00
$this -> users [ $this -> uids [ $id1 ]][ 'tactic6' ] +=
round ( 0.1 * ( floor ( $y ) / $s2 [ 'hpAll' ] * 100 ), 10 ) / 3 ;
2023-08-10 14:51:16 +00:00
}
} else {
if ( $this -> stats [ $this -> uids [ $id2 ]][ 'this_animal' ] == 0 ) {
2023-12-19 01:58:37 +00:00
$this -> users [ $this -> uids [ $id1 ]][ 'tactic6' ] +=
round ( 0.1 * ( floor ( $y ) / 1000 * 100 ), 10 );
2023-08-10 14:51:16 +00:00
} else {
2023-12-19 01:58:37 +00:00
$this -> users [ $this -> uids [ $id1 ]][ 'tactic6' ] +=
round ( 0.1 * ( floor ( $y ) / 1000 * 100 ), 10 ) / 3 ;
2023-08-10 14:51:16 +00:00
}
}
}
}
Db :: sql (
2023-12-19 01:58:37 +00:00
'update stats set last_hp = ?, tactic6 = ?, battle_yron = ?, battle_exp = ? where id = ?' ,
[
$this -> users [ $this -> uids [ $id1 ]][ 'last_hp' ],
$this -> users [ $this -> uids [ $id1 ]][ 'tactic6' ],
$this -> users [ $this -> uids [ $id1 ]][ 'battle_yron' ],
$this -> users [ $this -> uids [ $id1 ]][ 'battle_exp' ],
( int ) $id1 ,
]
2023-08-10 14:51:16 +00:00
);
$this -> stats [ $this -> uids [ $id1 ]][ 'battle_exp' ] = $this -> users [ $this -> uids [ $id1 ]][ 'battle_exp' ];
2023-11-02 13:57:39 +00:00
$this -> clearCache ( $id1 );
2023-08-10 14:51:16 +00:00
$this -> stats [ $this -> uids [ $id1 ]][ 'tactic6' ] = $this -> users [ $this -> uids [ $id1 ]][ 'tactic6' ];
if ( $id1 == $u -> info [ 'id' ]) {
$u -> info [ 'tactic6' ] = $this -> users [ $this -> uids [ $id1 ]][ 'tactic6' ];
$u -> stats [ 'tactic6' ] = $this -> users [ $this -> uids [ $id1 ]][ 'tactic6' ];
$u -> info [ 'battle_exp' ] = $this -> users [ $this -> uids [ $id1 ]][ 'battle_exp' ];
$u -> info [ 'battle_yron' ] = $this -> users [ $this -> uids [ $id1 ]][ 'battle_yron' ];
$u -> info [ 'notactic' ] = $this -> users [ $this -> uids [ $id1 ]][ 'notactic' ];
$u -> stats [ 'notactic' ] = $this -> users [ $this -> uids [ $id1 ]][ 'notactic' ];
}
2022-12-19 20:22:19 +00:00
}
}
2023-11-02 13:57:39 +00:00
private function clearCache ( $uid ) : void
2023-08-10 14:51:16 +00:00
{
2023-12-19 01:58:37 +00:00
if ( $uid <= 0 || isset ( $this -> uclearc [ $uid ])) {
return ;
2022-12-19 20:22:19 +00:00
}
2023-12-19 01:58:37 +00:00
$this -> uclearc [ $uid ] = true ;
$this -> ucleari [] = $uid ;
2022-12-19 20:22:19 +00:00
}
2023-09-30 20:17:25 +00:00
private function addlogRazmen ( $id , $at ) : bool
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
$this -> hodID ++ ;
$dies = [
1 => 0 ,
2 => 0 ,
];
//массив для статистики
$stat = [
1 => [
'uid1' => 0 ,
'uid2' => 0 ,
'time' => time (),
'type' => 0 ,
'a' => '00000' ,
'b' => '0' ,
'type_a' => '' ,
'type_b' => '0' ,
'yrn' => 0 ,
'yrn_krit' => 0 ,
'ma' => 0 ,
'mb' => 0 ,
'tm1' => 0 ,
'tm2' => 0 ,
],
2 => [
'uid1' => 0 ,
'uid2' => 0 ,
'time' => time (),
'type' => 0 ,
'a' => '00000' ,
'b' => '0' ,
'type_a' => '' ,
'type_b' => '0' ,
'yrn' => 0 ,
'yrn_krit' => 0 ,
'ma' => 0 ,
'mb' => 0 ,
'tm1' => 0 ,
'tm2' => 0 ,
],
];
2022-12-19 20:22:19 +00:00
2023-11-02 13:57:39 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2023-08-10 14:51:16 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'yhod' ] <= 0 && $this -> stats [ $this -> uids [ $u2 ]][ 'yhod' ] > 0 ) {
$u2 = $this -> yhod_user ( $u1 , $u2 , $this -> stats [ $this -> uids [ $u2 ]][ 'yhod' ]);
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$s1 = $this -> users [ $this -> uids [ $u1 ]][ 'sex' ];
$s2 = $this -> users [ $this -> uids [ $u2 ]][ 'sex' ];
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$stat [ $a ][ 'uid1' ] = $u1 ;
$stat [ $a ][ 'uid2' ] = $u2 ;
$stat [ $a ][ 'ma' ] = $this -> stats [ $this -> uids [ $u1 ]][ 'zona' ];
$stat [ $a ][ 'mb' ] = $this -> stats [ $this -> uids [ $u1 ]][ 'zonb' ];
$stat [ $a ][ 'tm1' ] = $this -> users [ $this -> uids [ $u1 ]][ 'team' ];
$stat [ $a ][ 'tm2' ] = $this -> users [ $this -> uids [ $u2 ]][ 'team' ];
$stat [ $a ][ 'a' ] = $this -> atacks [ $id ][ 'a' . $a ];
$stat [ $a ][ 'b' ] = $this -> atacks [ $id ][ 'b' . $a ];
2022-12-19 20:22:19 +00:00
2023-12-17 02:32:09 +00:00
$vLog = 'at1=00000||at2=00000||zb1=' . $this -> stats [ $this -> uids [ $u1 ]][ 'zonb' ] . '||zb2=' . $this -> stats [ $this -> uids [ $u2 ]][ 'zonb' ] . '||bl1=' . $this -> atacks [ $id ][ 'b' . $a ] . '||bl2=' . $this -> atacks [ $id ][ 'b' . $b ] . '||time1=' . $this -> atacks [ $id ][ 'time' ] . '||time2=' . $this -> atacks [ $id ][ 'time2' ] . '||s' . $a . '=' . $s1 . '||s' . $b . '=' . $s2 . '||t2=' . $this -> users [ $this -> uids [ $u2 ]][ 'team' ] . '||t1=' . $this -> users [ $this -> uids [ $u1 ]][ 'team' ] . '||login1=' . $this -> users [ $this -> uids [ $u1 ]][ 'login2' ] . '||login2=' . $this -> users [ $this -> uids [ $u2 ]][ 'login2' ];
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$mas = [
'text' => '' ,
'time' => time (),
'battle' => $this -> info [ 'id' ],
'id_hod' => $this -> hodID ,
'vars' => $vLog ,
'type' => 1 ,
];
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( ! isset ( $at [ $a ][ 'atack' ])) { //Т У Т тест пропуска
if ( $this -> atacks [ $id ][ 'tpo' . $a ] == 2 ) {
$mas [ 'text' ] .= '{u1} потратил свой ход на магию.' ;
} else {
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
if ( $this -> info [ 'razdel' ] == 0 && $this -> info [ 'dn_id' ] == 0 && $this -> info [ 'izlom' ] == 0 ) {
mysql_query (
' INSERT INTO `battle_out` ( `battle` , `uid1` , `uid2` , `time` , `out` ) VALUES (
" ' . $this->info ['id'] . ' " , " ' . $u1 . ' " , " ' . $u2 . ' " , " ' . time() . ' " , " 1 "
) '
);
}
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
if ( isset ( $u1 )) {
$mas [ 'text' ] .= '{u1} пропустил свой ход.' ;
//Проверка с б р о с туманок
mysql_query (
2023-12-17 02:32:09 +00:00
'UPDATE `eff_users` SET `delete` = "' . time (
) . '" WHERE `uid` = "' . $u1 . '" AND `delete` = 0 AND `v1` = "priem" AND (`v2`=288 OR `v2`=287 OR `v2`=286 OR `v2`=273) LIMIT 1'
2023-08-10 14:51:16 +00:00
);
}
}
$mas [ 'text' ] = '{tm1} ' . $mas [ 'text' ];
$this -> add_log ( $mas );
} else {
$j = 0 ;
while ( $j < count ( $at [ $a ][ 'atack' ]) && $j < 8 ) {
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
$mas [ 'text' ] = '' ;
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
$wt = [
21 => 4 ,
22 => 5 ,
20 => 2 ,
28 => 2 ,
19 => 3 ,
18 => 1 ,
26 => 22 ,
];
$par = [
'zona' => '{zn2_' . $at [ $a ][ 'atack' ][ $j ][ 0 ] . '} ' ,
2023-12-17 02:32:09 +00:00
'kyda' => $this -> lgZon [ $at [ $a ][ 'atack' ][ $j ][ 0 ]][ rand (
2023-08-10 14:51:16 +00:00
0 ,
2023-12-17 02:32:09 +00:00
( count ( $this -> lgZon [ $at [ $a ][ 'atack' ][ $j ][ 0 ]]) - 1 )
2023-08-10 14:51:16 +00:00
)],
2023-12-17 02:32:09 +00:00
'chem' => $this -> lgItm [ $wt [ $at [ $a ][ 'atack' ][ $j ][ 'wt' ]]][ rand (
2023-08-10 14:51:16 +00:00
0 ,
2023-12-17 02:32:09 +00:00
( count ( $this -> lgItm [ $wt [ $at [ $a ][ 'atack' ][ $j ][ 'wt' ]]]) - 1 )
2023-08-10 14:51:16 +00:00
)],
];
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
$this -> atacks [ $id ][ 'uid_' . $u1 . '_t' . $at [ $a ][ 'atack' ][ $j ][ 1 ]] ++ ;
2023-09-30 20:17:25 +00:00
2023-08-10 14:51:16 +00:00
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 1 ) {
//u1 ударил обычным ударом u2
2023-09-30 20:17:25 +00:00
$mas [ 'text' ] .= $par [ 'zona' ] . '{u2} ' . $this -> addlt ( $b , 1 , $s2 ) . $this -> addlt ( $b , 2 , $s2 ) . $this -> addlt ( $a , 3 , $s1 ) .
' {u1} ' . $this -> addlt ( $a , 4 , $s1 ) . $this -> addlt ( $a , 5 , $s1 ) . $this -> addlt ( $a , 6 , $s1 ) .
' ' . $this -> addlt ( 1 , 7 , $s1 , $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 't' ]) . ' ' . $par [ 'chem' ] . ' ' . $par [ 'kyda' ] . '. ' ;
2023-08-10 14:51:16 +00:00
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 2 ) {
//u2 увернулся от u1
2023-09-30 20:17:25 +00:00
$mas [ 'text' ] .= $par [ 'zona' ] . '{u1} ' . $this -> addlt ( $a , 8 , $s1 ) . $this -> addlt ( $a , 9 , $s1 ) .
' {u2} <strong style="color:#0071a3;">' . $this -> addlt ( $b , 11 , $s2 ) . '</strong> ' . $par [ 'chem' ] . ' ' . $par [ 'kyda' ] . '. ' ;
2023-08-10 14:51:16 +00:00
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 3 ) {
//u2 заблокировал удар u1
2023-09-30 20:17:25 +00:00
$mas [ 'text' ] .= $par [ 'zona' ] . '{u1} ' . $this -> addlt ( $a , 8 , $s1 ) . $this -> addlt ( $a , 9 , $s1 ) .
' {u2} <strong style="color:#356d37;">' . $this -> addlt ( $b , 10 , $s2 ) . '</strong> ' . $this -> addlt ( 1 , 7 , 0 , $s1 ) .
' ' . $par [ 'chem' ] . ' ' . $par [ 'kyda' ] . '. ' ;
2023-08-10 14:51:16 +00:00
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 4 ) {
//u1 пробил блок u2 критом
if ( isset ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 't' ])) {
2023-09-30 20:17:25 +00:00
$mas [ 'text' ] .= $par [ 'zona' ] . '{u2} ' . $this -> addlt ( $b , 1 , $s2 ) . $this -> addlt ( $b , 2 , $s2 ) . $this -> addlt ( $a , 3 , $s1 ) .
' {u1} ' . $this -> addlt ( $a , 4 , $s1 ) . $this -> addlt ( $a , 5 , $s1 ) . ', <u style="color:red;">пробив блок</u>, ' . $this -> addlt ( $a , 6 , $s1 ) .
' ' . $this -> addlt ( 1 , 7 , $s1 , $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 't' ]) . ' ' . $par [ 'chem' ] . ' ' . $par [ 'kyda' ] . '. ' ;
2023-08-10 14:51:16 +00:00
}
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 5 ) {
//u1 ударил критическим ударом u2
2023-09-30 20:17:25 +00:00
$mas [ 'text' ] .= $par [ 'zona' ] . '{u2} ' . $this -> addlt ( $b , 1 , $s2 ) . $this -> addlt ( $b , 2 , $s2 ) . $this -> addlt ( $a , 3 , $s1 ) .
' {u1} ' . $this -> addlt ( $a , 4 , $s1 ) . $this -> addlt ( $a , 5 , $s1 ) . $this -> addlt ( $a , 6 , $s1 ) .
' ' . $this -> addlt ( 1 , 7 , $s1 , $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 't' ]) . ' ' . $par [ 'chem' ] . ' ' . $par [ 'kyda' ] . '. ' ;
2023-08-10 14:51:16 +00:00
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 6 ) {
//u2 парировал удар u1
2023-09-30 20:17:25 +00:00
$mas [ 'text' ] .= $par [ 'zona' ] . '{u1} ' . $this -> addlt ( $a , 8 , $s1 ) . $this -> addlt ( $a , 9 , $s1 ) .
' {u2} неожиданно <strong style="color:#c59400;">парировал</strong> ' . $this -> addlt ( 1 , 7 , 0 , $s1 ) . ' ' . $par [ 'chem' ] . ' ' . $par [ 'kyda' ] . '. ' ;
2023-08-10 14:51:16 +00:00
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 7 ) {
//u2 блокировал щитом удар u1
2023-09-30 20:17:25 +00:00
$mas [ 'text' ] .= $par [ 'zona' ] . '{u1} ' . $this -> addlt ( $a , 8 , $s1 ) . $this -> addlt ( $a , 9 , $s1 ) .
' {u2}, воспользовавшись <u style="color:#356d37;">своим щитом</u>, ' . $this -> addlt ( $b , 10 , $s2 ) . ' ' . $this -> addlt ( 1 , 7 , 0 , $s1 ) .
' ' . $par [ 'chem' ] . ' ' . $par [ 'kyda' ] . '. ' ;
2023-08-10 14:51:16 +00:00
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 8 ) {
//u2 увернулся от удара u1 и нанес по нему контрудар
2023-09-30 20:17:25 +00:00
$mas [ 'text' ] .= $par [ 'zona' ] . '{u1} ' . $this -> addlt ( $a , 8 , $s1 ) . $this -> addlt ( $a , 9 , $s1 ) .
' {u2} <strong style="color:#0071a3;">' . $this -> addlt ( $b , 11 , $s2 ) . '</strong> ' . $par [ 'chem' ] . ' ' . $par [ 'kyda' ] . ' и нанес контрудар. ' ;
2023-08-10 14:51:16 +00:00
}
2022-12-19 20:22:19 +00:00
2023-09-30 20:17:25 +00:00
$stat [ $a ][ 'type_a' ] .= '' . $at [ $a ][ 'atack' ][ $j ][ 1 ];
2023-08-10 14:51:16 +00:00
if (( ! isset ( $this -> stats [ $this -> uids [ $u2 ]][ 'notravma' ]) || $this -> stats [ $this -> uids [ $u2 ]][ 'notravma' ] == 0 ) && isset ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'travma' ]) && $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'travma' ][ 0 ] > 0 && floor (
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ]
) <= 0 ) {
$tr_pl = mysql_fetch_array (
mysql_query (
'SELECT `id`,`v1` FROM `eff_users` WHERE `id_eff` = 4 AND `uid` = "' . $u2 . '" AND `delete` = "0" ORDER BY `v1` DESC LIMIT 1'
)
);
if ( ! isset ( $tr_pl [ 'id' ]) || $tr_pl [ 'v1' ] < 3 ) {
//263
if ( isset ( $tr_pl [ 'id' ])) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'travma' ][ 0 ] = rand (( $tr_pl [ 'v1' ] + 1 ), 3 );
}
$tr_pl2 = mysql_fetch_array (
mysql_query (
'SELECT `id` FROM `eff_users` WHERE `uid` = "' . $u2 . '" AND `delete` = "0" AND `name` LIKE "%Защита от травм%" LIMIT 1'
)
);
if ( ! isset ( $tr_pl2 [ 'id' ]) && $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'travma' ][ 0 ] <= 3 ) {
$mas [ 'text' ] = rtrim ( $mas [ 'text' ], '. ' );
$mas [ 'text' ] .= ', <font color=red>нанеся противнику <strong>' ;
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'travma' ][ 0 ] == 1 ) {
$mas [ 'text' ] .= 'Легкую' ;
$this -> addTravm ( $u2 , 1 , rand ( 3 , 5 ));
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'travma' ][ 0 ] == 2 ) {
$mas [ 'text' ] .= 'Среднюю' ;
$this -> addTravm ( $u2 , 2 , rand ( 3 , 5 ));
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'travma' ][ 0 ] == 3 ) {
$mas [ 'text' ] .= 'Тяжелую' ;
$this -> addTravm ( $u2 , 3 , rand ( 3 , 5 ));
}
$mas [ 'text' ] .= ' травму</strong></font>. ' ;
}
}
unset ( $tr_pl );
}
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'pb' ] == 1 && isset ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ])) {
$mas [ 'text' ] = rtrim ( $mas [ 'text' ], '. ' );
$mas [ 'text' ] .= ' <i>пробив броню</i>. ' ;
}
if ( $at [ $a ][ 'atack' ][ $j ][ 3 ] == 1 ) {
$mas [ 'text' ] .= '(контрудар) ' ;
}
if ( isset ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ])) {
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'w' ] == 3 ) {
$mas [ 'textWP' ] = '(правая рука)' ;
} elseif ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'w' ] == 14 ) {
$mas [ 'textWP' ] = '(левая рука)' ;
} else {
$mas [ 'textWP' ] = '(непонятно чем)' ;
}
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 4 || $at [ $a ][ 'atack' ][ $j ][ 1 ] == 5 || $at [ $a ][ 'atack' ][ $j ][ 1 ] == 1 ) {
if ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'y' ] < 1 ) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'r' ] = '--' ;
}
}
if ( $at [ $a ][ 'atack' ][ $j ][ 1 ] == 4 || $at [ $a ][ 'atack' ][ $j ][ 1 ] == 5 ) {
$stat [ $a ][ 'yrn_krit' ] += - $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'r' ];
$mas [ 'text' ] .= ' <font title=' . $mas [ 'textWP' ] . ' color=#ff0000><strong>' . $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'r' ] . '</strong></font>' ;
} else {
$mas [ 'text' ] .= ' <font title=' . $mas [ 'textWP' ] . ' color=#0066aa><strong>' . $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'r' ] . '</strong></font>' ;
}
$stat [ $a ][ 'yrn' ] += - $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'r' ];
}
if ( isset ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ])) {
if ( $this -> users [ $this -> uids [ $u2 ]][ 'align' ] == 9 ) {
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ] = $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ] / ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hpAll' ] / 100 );
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hpAll' ] = '100%' ;
}
$mas [ 'text' ] .= ' [' . floor ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hp' ]) . '/' . floor (
$at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'hpAll' ]
) . ']' ;
}
if ( $mas [ 'text' ] != '' ) {
$mas [ 'text' ] = '{tm1} ' . $mas [ 'text' ];
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( is_array ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'plog' ])) {
$il = 0 ;
while ( $il <= count ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'plog' ])) {
if ( isset ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'plog' ][ $il ])) {
eval ( $at [ $a ][ 'atack' ][ $j ][ 'yron' ][ 'plog' ][ $il ]);
}
$il ++ ;
}
}
$this -> add_log ( $mas );
$j ++ ;
}
}
$i ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Добавляем статистику + записываем в б а ттл_юзе р с Н Р игроков
$this -> addNewStat ( $stat );
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
//Вывод в лог смерти персонажа
if ( floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ]) < 1 ) {
$dies [ 1 ] = 1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( floor ( $this -> stats [ $this -> uids [ $u2 ]][ 'hpNow' ]) < 1 ) {
$dies [ 2 ] = 1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $dies [ 1 ] > 0 || $dies [ 2 ] > 0 ) {
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
$rtngwin = [ 1 , 2 , 3 , 5 , 10 , 20 , 40 , 80 , 160 ];
$rtnglos = [ 0 , 0 , 0 , - 1 , - 2 , - 5 , - 10 , - 20 , - 40 ];
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( $this -> info [ 'typeBattle' ] == 99 ) {
if ( $btlstatus [ 0 ] == 0 ) {
//Кровавые бои обычные
$rtngwin = [ 2 , 4 , 6 , 10 , 20 , 40 , 80 , 160 , 320 ];
if ( $this -> info [ 'razdel' ] == 5 ) {
//не хаот
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
} else {
//хаот
$rtnglos = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ];
}
} elseif ( $btlstatus [ 0 ] == 25 ) {
//Кровавая битва
$rtngwin = [ 3 , 6 , 9 , 15 , 30 , 60 , 120 , 240 , 480 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
} elseif ( $btlstatus [ 0 ] == 50 ) {
//Кровавая резня
$rtngwin = [ 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
} elseif ( $btlstatus [ 0 ] == 75 ) {
//Кровавая сеча
$rtngwin = [ 5 , 10 , 20 , 40 , 80 , 160 , 320 , 640 , 1280 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
} elseif ( $btlstatus [ 0 ] == 100 ) {
//Кровавое побоище
$rtngwin = [ 6 , 12 , 24 , 48 , 98 , 196 , 392 , 784 , 1568 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
} elseif ( $btlstatus [ 0 ] == 150 ) {
//Судный день
$rtngwin = [ 7 , 14 , 28 , 56 , 112 , 224 , 448 , 896 , 1792 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
}
} else {
if ( $btlstatus [ 0 ] == 0 ) {
//Обычный поединок
2023-12-19 01:58:37 +00:00
if ( $this -> info [ 'razdel' ] != 5 ) {
2023-08-10 14:51:16 +00:00
//хаот
$rtnglos = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ];
}
} elseif ( $btlstatus [ 0 ] == 25 ) {
//великая битва
$rtngwin = [ 2 , 4 , 6 , 10 , 20 , 40 , 80 , 160 , 320 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
} elseif ( $btlstatus [ 0 ] == 50 ) {
//величайшая битва
$rtngwin = [ 3 , 6 , 9 , 15 , 30 , 60 , 120 , 240 , 480 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
} elseif ( $btlstatus [ 0 ] == 75 ) {
//историческая битва сеча
$rtngwin = [ 4 , 8 , 16 , 32 , 64 , 128 , 256 , 512 , 1024 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
} elseif ( $btlstatus [ 0 ] == 100 ) {
//эпохальная битва
$rtngwin = [ 5 , 10 , 20 , 40 , 80 , 160 , 320 , 640 , 1280 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
} elseif ( $btlstatus [ 0 ] == 150 ) {
//судный день
$rtngwin = [ 7 , 14 , 28 , 56 , 112 , 224 , 448 , 896 , 1792 ];
$rtnglos = [ 0 , 0 , 0 , - 2 , - 4 , - 10 , - 20 , - 40 , - 80 ];
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $this -> info [ 'dn_id' ] > 0 || $this -> info [ 'izlom' ] != 0 || $this -> info [ 'turnir' ] != 0 ) {
//Пещерные бои не считаются и Изломы тоже, ну и Турниры
$rtngwin = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ];
$rtnglos = [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ];
} elseif ( $this -> info [ 'clan1' ] > 0 && $this -> info [ 'clan2' ] > 0 ) {
//Клановая война
$rtngwin = [ 3 , 6 , 9 , 15 , 30 , 60 , 120 , 240 , 480 ];
$rtnglos = [ - 1 , - 2 , - 4 , - 8 , - 16 , - 32 , - 64 , - 128 , - 256 ];
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
if ( $dies [ 1 ] == 1 ) {
if ( $this -> info [ 'dn_id' ] <= 0 && $this -> users [ $this -> uids [ $u1 ]][ 'level' ] >= 4 ) {
$rtng1 += $rtnglos [ $this -> users [ $this -> uids [ $u1 ]][ 'level' ] - 4 ];
$rtng2 += $rtngwin [ $this -> users [ $this -> uids [ $u1 ]][ 'level' ] - 4 ];
}
//Персонаж 1 погиб от рук персонаж 2
$this -> spaCheck ( $this -> users [ $this -> uids [ $u1 ]][ 'id' ]);
}
if ( $dies [ 2 ] == 1 ) {
if ( $this -> info [ 'dn_id' ] <= 0 && $this -> users [ $this -> uids [ $u1 ]][ 'level' ] >= 4 ) {
$rtng1 += $rtnglos [ $this -> users [ $this -> uids [ $u1 ]][ 'level' ] - 4 ];
$rtng2 += $rtngwin [ $this -> users [ $this -> uids [ $u1 ]][ 'level' ] - 4 ];
}
//Персонаж 2 погиб от рук персонаж 1
$this -> spaCheck ( $this -> stats [ $this -> uids [ $u2 ]][ 'id' ]);
}
//Записываем рейтинг
//
if ( $this -> info [ 'type' ] != 564 && $this -> stats [ $this -> uids [ $u1 ]][ 'inTurnir' ] == 0 && $this -> stats [ $this -> uids [ $u2 ]][ 'inTurnir' ] == 0 && $this -> info [ 'dn_id' ] == 0 && $this -> info [ 'izlom' ] == 0 ) {
//
if ( $this -> users [ $this -> uids [ $u2 ]][ 'bot' ] == 0 ) {
mysql_query (
' INSERT INTO `users_reting` ( `uid` , `time` , `val` , `align` , `clan` ) VALUES (
" ' . $u1 . ' " , " ' . time() . ' " , " ' . $rtng1 . ' " , " ' . $this->users [ $this->uids [ $u1 ]]['align'] . ' " , " ' . $this->users [ $this->uids [ $u1 ]]['clan'] . ' " ) '
);
}
unset ( $rtng );
if ( $this -> users [ $this -> uids [ $u1 ]][ 'bot' ] == 0 ) {
mysql_query (
' INSERT INTO `users_reting` ( `uid` , `time` , `val` , `align` , `clan` ) VALUES (
" ' . $u2 . ' " , " ' . time() . ' " , " ' . $rtng2 . ' " , " ' . $this->users [ $this->uids [ $u2 ]]['align'] . ' " , " ' . $this->users [ $this->uids [ $u2 ]]['clan'] . ' " ) '
);
}
}
unset ( $rtng1 , $rtng2 );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
return true ;
}
2022-12-19 20:22:19 +00:00
2023-08-10 14:51:16 +00:00
public function addlt ( $a , $id , $s , $rnd = null ) : string
{
global $log_text ;
if ( $rnd === null ) {
$rnd = rand ( 0 , ( count ( $log_text [ $s ][ $id ]) - 1 ));
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
return '{' . $a . 'x' . $id . 'x' . $rnd . '}' ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Действия бота (атака)
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
public function spaCheck ( $u1 ) : void
2022-12-19 20:22:19 +00:00
{
2023-12-19 01:58:37 +00:00
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] >= 1 ) {
return ;
}
2023-08-10 14:51:16 +00:00
2023-12-19 01:58:37 +00:00
mysql_query ( 'DELETE FROM `battle_act` WHERE `uid1` = "' . $u1 . '" OR `uid2` = "' . $u1 . '"' );
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'spasenie' ] > 0 && $this -> users [ $this -> uids [ $u1 ]][ 'tactic7' ] >= 25 ) {
//Свиток спасения
if ( $this -> stats [ $this -> uids [ $u1 ]][ 's7' ] > 49 && $this -> stats [ $this -> uids [ $u1 ]][ 's7' ] < 75 ) {
//Даем призрачку
2023-08-10 14:51:16 +00:00
mysql_query (
2023-12-19 01:58:37 +00:00
" INSERT INTO `eff_users`
( `id_eff` , `uid` , `name` , `data` , `overType` , `timeUse` , `timeAce` , `user_use` , `delete` , `v1` , `v2` , `img2` , `x` , `hod` , `bj` , `sleeptime` , `no_Ace` , `file_finish` , `tr_life_user` , `deactiveTime` , `deactiveLast` , `mark` , `bs` ) VALUES
( 22 , '" . $u1 . "' , 'Призрачная защита' , 'add_zmproc=75|add_zaproc=75' , 0 , 77 , 0 , '" . $u1 . "' , 0 , 'priem' , 141 , 'spirit_block25.gif' , 1 , 1 , '0' , 0 , 0 , '' , 0 , 0 , 0 , 0 , 0 ); "
2023-08-10 14:51:16 +00:00
);
2023-12-19 01:58:37 +00:00
$this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] = floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'hpAll' ] * 0.5 );
$this -> stats [ $this -> uids [ $u1 ]][ 'mpNow' ] = floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'mpAll' ] * 0.5 );
} elseif ( $this -> stats [ $this -> uids [ $u1 ]][ 's7' ] > 74 && $this -> stats [ $this -> uids [ $u1 ]][ 's7' ] < 100 ) {
//Абсолютная защита
2023-08-10 14:51:16 +00:00
mysql_query (
2023-12-19 01:58:37 +00:00
" INSERT INTO `eff_users`
( `id_eff` , `uid` , `name` , `data` , `overType` , `timeUse` , `timeAce` , `user_use` , `delete` , `v1` , `v2` , `img2` , `x` , `hod` , `bj` , `sleeptime` , `no_Ace` , `file_finish` , `tr_life_user` , `deactiveTime` , `deactiveLast` , `mark` , `bs` ) VALUES
( 22 , '" . $u1 . "' , 'Абсолютная защита' , 'add_zmproc=100|add_zaproc=100' , 0 , 77 , 0 , '" . $u1 . "' , 0 , 'priem' , 358 , 'block_absolute.gif' , 1 , 1 , '0' , 0 , 0 , '' , 0 , 0 , 0 , 0 , 0 ); "
2023-08-10 14:51:16 +00:00
);
2023-12-19 01:58:37 +00:00
$this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] = floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'hpAll' ] * 0.75 );
$this -> stats [ $this -> uids [ $u1 ]][ 'mpNow' ] = floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'mpAll' ] * 0.75 );
} elseif ( $this -> stats [ $this -> uids [ $u1 ]][ 's7' ] > 99 ) {
//Абсолютная защита x2
mysql_query (
" INSERT INTO `eff_users`
( `id_eff` , `uid` , `name` , `data` , `overType` , `timeUse` , `timeAce` , `user_use` , `delete` , `v1` , `v2` , `img2` , `x` , `hod` , `bj` , `sleeptime` , `no_Ace` , `file_finish` , `tr_life_user` , `deactiveTime` , `deactiveLast` , `mark` , `bs` ) VALUES
( 22 , '" . $u1 . "' , 'Защита Мироздателя' , 'add_zmproc=100|add_zaproc=100' , 0 , 77 , 0 , '" . $u1 . "' , 0 , 'priem' , 358 , 'wis_white_shield.gif' , 1 , 2 , '0' , 0 , 0 , '' , 0 , 0 , 0 , 0 , 0 ); "
2023-08-10 14:51:16 +00:00
);
2023-12-19 01:58:37 +00:00
$this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] = floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'hpAll' ]);
$this -> stats [ $this -> uids [ $u1 ]][ 'mpNow' ] = floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'mpAll' ]);
}
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] < 1 ) {
$this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] = 1 ;
2023-08-10 14:51:16 +00:00
}
2023-12-19 01:58:37 +00:00
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'mpNow' ] < 1 ) {
$this -> stats [ $this -> uids [ $u1 ]][ 'mpNow' ] = 1 ;
}
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] > $this -> stats [ $this -> uids [ $u1 ]][ 'hpAll' ]) {
$this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] = floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'hpAll' ]);
}
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'mpNow' ] > $this -> stats [ $this -> uids [ $u1 ]][ 'mpAll' ]) {
$this -> stats [ $this -> uids [ $u1 ]][ 'mpNow' ] = floor ( $this -> stats [ $this -> uids [ $u1 ]][ 'mpAll' ]);
}
mysql_query (
'DELETE FROM `eff_users` WHERE `uid` = "' . $u1 . '" AND `id_eff` = 22 AND `v1` = "priem" AND `v2` = 324'
);
mysql_query (
'UPDATE `stats` SET `hpNow` = "' . $this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] . '",`mpNow` = "' . $this -> stats [ $this -> uids [ $u1 ]][ 'mpNow' ] . '", `tactic7` = `tactic7` - 25 WHERE `id` = "' . $u1 . '" LIMIT 1'
);
$mas [ 'text' ] = '{tm1} <strong>' . $this -> stats [ $this -> uids [ $u1 ]][ 'login' ] . '</strong> убит...<strong>' . $this -> stats [ $this -> uids [ $u1 ]][ 'login' ] . '</strong> был спасен. ' ;
$this -> priemAddLog (
$id , 1 , 2 , $u -> info [ 'id' ], $u1 ,
' ' ,
$mas [ 'text' ],
( $this -> hodID + 0 )
);
} elseif ( isset ( $this -> stats [ $this -> uids [ $u1 ]][ 'login' ])) {
mysql_query ( 'UPDATE `stats` SET `hpNow` = "0",`mpNow` = "0" WHERE `id` = "' . $u1 . '" LIMIT 1' );
$this -> stats [ $this -> uids [ $u1 ]][ 'hpNow' ] = 0 ;
$this -> users [ $this -> uids [ $u1 ]][ 'hpNow' ] = 0 ;
$mas [ 'text' ] = '{tm1} <strong>' . $this -> stats [ $this -> uids [ $u1 ]][ 'login' ] . '</strong> погиб.' ;
$this -> priemAddLog (
$id , 1 , 2 , $u -> info [ 'id' ], $u1 ,
' ' ,
$mas [ 'text' ],
( $this -> hodID + 1 )
//Удаляем размен из базы //Т У Т возможен лаг удаления
);
mysql_query (
'DELETE FROM `battle_act` WHERE `uid1` = "' . $this -> stats [ $this -> uids [ $u1 ]][ 'id' ] . '" OR `uid2` = "' . $this -> stats [ $this -> uids [ $u1 ]][ 'id' ] . '" OR `uid2` = "-' . $this -> stats [ $this -> uids [ $u1 ]][ 'id' ] . '"'
);
mysql_query (
'DELETE FROM `eff_users` WHERE `uid` = "' . $this -> stats [ $this -> uids [ $u1 ]][ 'id' ] . '" AND `v1` = "priem" AND `delete` =0'
);
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
//Проверяем удары, приемы, свитки, зверей
2023-12-19 01:58:37 +00:00
public function priemAddLog ( $id , $a , $b , $u1 , $u2 , $prm , $text , $hodID , $tm1 = 0 , $tm2 = 0 ) : void
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
$time = time ();
if ( $tm1 == 0 ) {
$tm1 = isset ( $this -> atacks [ $id ]) ? $this -> atacks [ $id ][ 'time' ] : $time ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( $tm2 == 0 ) {
$tm2 = isset ( $this -> atacks [ $id ]) ? $this -> atacks [ $id ][ 'time2' ] : $time ;
}
$prm = str_replace ( '=' , '^^^^' , $prm );
$vLog =
'prm=' . $prm .
'||at1=00000||at2=00000||zb1=' . $this -> stats [ $this -> uids [ $u1 ]][ 'zonb' ] .
'||zb2=' . $this -> stats [ $this -> uids [ $u2 ]][ 'zonb' ] .
'||bl1=' . $this -> atacks [ $id ][ 'b' . $a ] .
'||bl2=' . $this -> atacks [ $id ][ 'b' . $b ] .
'||time1=' . $tm1 .
'||time2=' . $tm2 .
'||s' . $a . '=' . $this -> users [ $this -> uids [ $u1 ]][ 'sex' ] .
'||s' . $b . '=' . $this -> users [ $this -> uids [ $u2 ]][ 'sex' ] .
'||t2=' . $this -> users [ $this -> uids [ $u2 ]][ 'team' ] .
'||t1=' . $this -> users [ $this -> uids [ $u1 ]][ 'team' ] .
'||login1=' . $this -> users [ $this -> uids [ $u1 ]][ 'login2' ] .
'||login2=' . $this -> users [ $this -> uids [ $u2 ]][ 'login2' ];
$mas = [
'text' => $text ,
'battle' => $this -> info [ 'id' ],
'id_hod' => $hodID ,
'vars' => $vLog ,
'type' => 1 ,
];
$this -> add_log ( $mas );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Действия бота
2023-12-19 01:58:37 +00:00
private function restZonb ( $uid1 , $uid2 ) : void
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
if ( $this -> stnZbVs [ $uid1 ] > 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'zonb' ] = $this -> stnZbVs [ $uid1 ];
}
if ( $this -> stnZbVs [ $uid2 ] > 0 ) {
$this -> stats [ $this -> uids [ $uid1 ]][ 'zonb' ] = $this -> stnZbVs [ $uid2 ];
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
//получаем данные о поединке
2023-12-19 01:58:37 +00:00
private function save_stats ( $uid ) : void
2022-12-19 20:22:19 +00:00
{
2023-12-19 01:58:37 +00:00
Stats :: saveBattleStats ( $this -> stats [ $this -> uids [ $uid ]], $uid );
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//наносим удар противнику
2023-09-30 20:17:25 +00:00
/** Осторожно ! Подключаются файлы !!!
* @ param $id
* @ param $at
* @ return mixed
*/
private function priemsRazmenMomentEnd ( $id , $at )
2022-12-19 20:22:19 +00:00
{
2023-08-10 14:51:16 +00:00
$uid1 = $this -> atacks [ $id ][ 'uid1' ];
$uid2 = $this -> atacks [ $id ][ 'uid2' ];
$i = 1 ;
while ( $i <= 2 ) {
if ( $i == 1 ) {
$a = 1 ;
$b = 2 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid1 ;
$u2 = $uid2 ;
2023-08-10 14:51:16 +00:00
} else {
$a = 2 ;
$b = 1 ;
2023-11-02 13:57:39 +00:00
$u1 = $uid2 ;
$u2 = $uid1 ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
if ( ! isset ( $at [ 'p' ][ 'p_cast' ])) {
$at [ 'p' ] = $at ;
$at [ 'p' ][ 'p_cast' ] = true ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Приемы ухода от удара
if ( ! isset ( $this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ]) || $this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ] == 0 ) {
2022-12-19 20:22:19 +00:00
$j = 0 ;
2023-08-10 14:51:16 +00:00
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 6 ] == 1 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
$this -> stats [ $this -> uids [ $u2 ]][ 'nopryh' ] -- ;
}
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$j ++ ;
2022-12-19 20:22:19 +00:00
}
}
2023-08-10 14:51:16 +00:00
//Приемы крита
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 6 ] == 2 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Приемы атаки
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 6 ] == 3 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
if ( isset ( $fx_priem )) {
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2022-12-19 20:22:19 +00:00
}
}
}
2023-08-10 14:51:16 +00:00
$j ++ ;
}
//Приемы защиты
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 6 ] == 4 ) {
2023-09-30 20:17:25 +00:00
if ( file_exists (
2023-11-02 13:57:39 +00:00
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
2023-08-10 14:51:16 +00:00
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
}
//Прочие приемы
$j = 0 ;
while ( $j <= count ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ])) {
if ( $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 2 ] > 0 && $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 6 ] == 5 ) {
if ( file_exists (
'../../_incl_data/class/priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php'
)) {
$pr_used_this = $u1 ;
$pr_moment = true ;
require ( 'priem/' . $this -> stats [ $this -> uids [ $u1 ]][ 'u_priem' ][ $j ][ 1 ] . '.php' );
$at = $fx_priem ( $id , $at , $u1 , $j );
2023-11-02 13:57:39 +00:00
unset ( $fx_priem );
2023-08-10 14:51:16 +00:00
}
}
$j ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
$i ++ ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
return $at ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//выделяем пользователей
2023-12-19 01:58:37 +00:00
private function addNewAtack ( User $u ) : void
2022-12-19 20:22:19 +00:00
{
2023-11-02 13:57:39 +00:00
if ( isset ( $this -> ga [ $u -> info [ 'id' ]][ $u -> info [ 'enemy' ]])) {
return ;
}
2023-12-19 01:58:37 +00:00
2023-11-02 13:57:39 +00:00
if ( $this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'hpNow' ] <= 0 ) {
$this -> e = 'Для вас поединок закончен, ожидайте пока завершат другие...' ;
return ;
}
2023-12-19 01:58:37 +00:00
2023-11-02 13:57:39 +00:00
$us = $this -> stats [ $this -> uids [ $u -> info [ 'id' ]]];
2023-12-19 01:58:37 +00:00
$no = false ;
2023-08-10 14:51:16 +00:00
2023-12-19 01:58:37 +00:00
for ( $j = 1 ; $j <= $us [ 'zona' ]; $j ++ ) {
if ( $this -> uAtc [ 'a' ][ $j ] != 0 ) {
continue ;
2023-11-02 13:57:39 +00:00
}
2023-12-19 01:58:37 +00:00
$no = true ;
2023-11-02 13:57:39 +00:00
}
2023-12-19 01:58:37 +00:00
2023-11-02 13:57:39 +00:00
if ( $this -> uAtc [ 'b' ] == 0 ) {
2023-12-19 01:58:37 +00:00
$no = true ;
2023-11-02 13:57:39 +00:00
}
2023-12-19 01:58:37 +00:00
if ( $no ) {
2023-11-02 13:57:39 +00:00
$this -> e = 'Выберите зоны удара и блока' ;
2023-12-19 01:58:37 +00:00
return ;
}
//наносим удар
if ( $u -> info [ 'enemy' ] <= 0 ) {
return ;
}
if ( ! isset ( $this -> ga [ $u -> info [ 'enemy' ]][ $u -> info [ 'id' ]])) {
if (
$this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'hpNow' ] < 1 ||
$this -> stats [ $this -> uids [ $u -> info [ 'enemy' ]]][ 'hpNow' ] < 1
) {
return ;
}
//наносим новый удар
$a = $this -> uAtc [ 'a' ][ 1 ] . $this -> uAtc [ 'a' ][ 2 ] . $this -> uAtc [ 'a' ][ 3 ] . $this -> uAtc [ 'a' ][ 4 ] . $this -> uAtc [ 'a' ][ 5 ];
$b = $this -> uAtc [ 'b' ];
Db :: sql (
'delete from battle_act where battle = ? and uid1 in (?,?) and uid2 in (?,?)' ,
[
$this -> info [ 'id' ],
$u -> info [ 'id' ],
$u -> info [ 'enemy' ],
$u -> info [ 'id' ],
$u -> info [ 'enemy' ],
]
);
Db :: sql (
" insert into battle_act (battle,uid1,uid2,a1,b1,time,a2,b2,invis1,invis2) values (?,?,?,?,?,unix_timestamp(),'',0,0,0) " ,
[
$this -> info [ 'id' ],
$u -> info [ 'id' ],
$u -> info [ 'enemy' ],
$a ,
$b ,
]
);
$this -> ga [ $u -> info [ 'id' ]][ $u -> info [ 'enemy' ]] = Db :: lastInsertId ();
2023-11-02 13:57:39 +00:00
} else {
2023-12-19 01:58:37 +00:00
//отвечаем на удар противника
if (
$this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'hpNow' ] >= 1 &&
$this -> stats [ $this -> uids [ $u -> info [ 'enemy' ]]][ 'hpNow' ] >= 1
&& isset ( $this -> atacks [ $this -> ga [ $u -> info [ 'enemy' ]][ $u -> info [ 'id' ]]][ 'id' ])
) {
$this -> atacks [ $this -> ga [ $u -> info [ 'enemy' ]][ $u -> info [ 'id' ]]][ 'a2' ] = $this -> uAtc [ 'a' ][ 1 ] . '' . $this -> uAtc [ 'a' ][ 2 ] . $this -> uAtc [ 'a' ][ 3 ] . $this -> uAtc [ 'a' ][ 4 ] . $this -> uAtc [ 'a' ][ 5 ];
$this -> atacks [ $this -> ga [ $u -> info [ 'enemy' ]][ $u -> info [ 'id' ]]][ 'b2' ] = $this -> uAtc [ 'b' ];
$this -> startAtack ( $this -> atacks [ $this -> ga [ $u -> info [ 'enemy' ]][ $u -> info [ 'id' ]]][ 'id' ]);
2022-12-19 20:22:19 +00:00
}
}
2023-12-19 01:58:37 +00:00
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//Возращаем зоны блока по умолчанию
2023-09-30 20:17:25 +00:00
private function botAct ( $uid ) : bool
2022-12-19 20:22:19 +00:00
{
$r = false ;
if ( $this -> users [ $this -> uids [ $uid ]][ 'bot' ] > 0 ) {
if ( $this -> users [ $this -> uids [ $uid ]][ 'online' ] < time () - 3 ) {
$r = true ;
$this -> users [ $this -> uids [ $uid ]][ 'online' ] = time ();
2022-12-30 19:03:37 +00:00
User :: setOnline (( int ) $uid );
2023-12-19 01:58:37 +00:00
} elseif ( mt_rand ( 0 , 2 ) === 0 ) {
2022-12-30 19:03:37 +00:00
$r = true ;
2022-12-19 20:22:19 +00:00
}
}
return $r ;
}
2023-08-10 14:51:16 +00:00
//проверка блока (Визуальная)
2023-12-19 01:58:37 +00:00
public function battleInfo ( $id ) : array
2022-12-19 20:22:19 +00:00
{
2023-11-02 13:57:39 +00:00
$b = Db :: getRow ( 'select * from battle where id = ?' , [ $id ]);
if ( ! isset ( $b [ 'id' ])) {
2023-12-19 01:58:37 +00:00
return [];
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
$this -> hodID = Db :: getValue ( 'select id_hod from battle_logs where battle = ? order by id desc limit 1' , [ $b [ 'id' ]]);
$this -> hodID = $this -> hodID [ 'id_hod' ] ? ? 0 ;
return $b ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
2023-08-10 14:51:16 +00:00
//проверка блока
2023-12-19 01:58:37 +00:00
public function addAtack () : void
2022-12-19 20:22:19 +00:00
{
global $js ;
2023-12-19 01:58:37 +00:00
if ( ! isset ( $_POST [ 'atack' ], $_POST [ 'block' ])) {
$this -> e = 'Выберите зоны удара и блока' ;
return ;
}
$na = [ 'a' => [ 1 => 0 , 2 => 0 , 3 => 0 , 4 => 0 , 5 => 0 ]];
$a = explode ( '_' , $_POST [ 'atack' ]);
$na [ 'id' ] = time ();
for ( $i = 1 ; $i <= 5 ; $i ++ ) {
if ( ! isset ( $a [ $i - 1 ])) {
continue ;
2022-12-19 20:22:19 +00:00
}
2023-12-19 01:58:37 +00:00
$a [ $i - 1 ] = intval ( round ( $a [ $i - 1 ]));
if ( $a [ $i - 1 ] >= 1 && $a [ $i - 1 ] <= 5 ) {
$na [ 'a' ][ $i ] = $a [ $i - 1 ];
} else {
$na [ 'a' ][ $i ] = 0 ;
}
}
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
$na [ 'b' ] = intval ( round ( $_POST [ 'block' ]));
if ( $na [ 'b' ] < 1 || $na [ 'b' ] > 5 ) {
$na [ 'b' ] = 0 ;
2022-12-19 20:22:19 +00:00
}
2023-12-19 01:58:37 +00:00
$this -> uAtc = $na ;
$js .= 'testClearZone();' ;
2022-12-19 20:22:19 +00:00
}
2023-08-10 14:51:16 +00:00
//генерируем команды
2023-12-19 01:58:37 +00:00
public function teamsTake ( User $u ) : void
2022-12-19 20:22:19 +00:00
{
2023-12-19 01:58:37 +00:00
if ( $this -> info [ 'id' ] < 1 ) {
return ;
}
$r = '' ;
2022-12-19 20:22:19 +00:00
$rs = '' ;
$ts = [];
$tsi = 0 ;
2023-12-19 01:58:37 +00:00
//данные о игроках в бою
$usersInBattle = Db :: getRows (
" select
room , no_ip , twink , stopexp , users . id , notrhod , login , if ( login2 != '' , login2 , login ) as login2 , sex , online , admin ,
align , align_lvl , align_exp , clan , level , battle , obraz , win , lose , nich , animal , stats , hpNow , mpNow , exp , dnow , team ,
battle_yron , battle_exp , enemy , battle_text , upLevel , timeGo , timeGoL , bot , lider , btl_cof ,
tactic1 , tactic2 , tactic3 , tactic4 , tactic5 , tactic6 , tactic7 , x , y , battleEnd , priemslot , priems , priems_z , bet , clone ,
atack , bbexp , res_x , res_y , res_s , last_hp , last_pr , sex , money , bot_id , money3 , money2
from users left join stats on users . id = stats . id where battle = ? " , [ $this->info ['id']]
);
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
$i = 0 ;
$bi = 0 ;
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
if ( $this -> info [ 'start2' ] == 0 ) {
if ( Db :: getValue ( 'select count(id) from battle where id = ? and start2 = 0' , [ $this -> info [ 'id' ]]) === 1 ) {
Db :: sql ( 'update battle set start2 = unix_timestamp() where id = ?' , [ $this -> info [ 'id' ]]);
} else {
$this -> info [ 'start2' ] = time ();
}
}
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
foreach ( $usersInBattle as $user ) {
//записываем данные
$this -> users [ $i ] = $user ;
$this -> uids [ $user [ 'id' ]] = $i ;
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
if ( $user [ 'bot' ] > 0 ) {
$this -> bots [ $bi ] = $user [ 'id' ];
$this -> iBots [ $user [ 'id' ]] = $bi ;
$bi ++ ;
}
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
//записываем статы
$stats = new Stats ( $u );
$this -> stats [ $i ] = $stats -> getStats ( btl_cache : $this -> cached );
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
//Заносим старт
if ( $this -> info [ 'start2' ] == 0 ) {
Db :: sql ( 'update users set notrhod = default where id = ?' , [ $this -> users [ $i ][ 'id' ]]);
$this -> users [ $i ][ 'notrhod' ] = - 1 ;
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
if ( ! isset ( $ts [ $this -> users [ $i ][ 'team' ]])) {
$tsi ++ ;
$ts [ $this -> users [ $i ][ 'team' ]] = $tsi ;
}
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
$tactic7LevelModifier = 10 ;
if ( $this -> users [ $i ][ 'level' ] == 8 ) {
$tactic7LevelModifier = 20 ;
} elseif ( $this -> users [ $i ][ 'level' ] == 9 ) {
$tactic7LevelModifier = 30 ;
} elseif ( $this -> users [ $i ][ 'level' ] >= 10 ) {
$tactic7LevelModifier = 40 + $this -> stats [ $i ][ 's7' ];
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
2023-12-19 01:58:37 +00:00
$this -> users [ $i ][ 'tactic7' ] =
floor ( $tactic7LevelModifier / $this -> stats [ $i ][ 'hpAll' ] * $this -> stats [ $i ][ 'hpNow' ]);
if ( $this -> stats [ $i ][ 's7' ] >= 50 ) {
Effects :: addSpasenie ( $this -> users [ $i ][ 'id' ]);
2022-12-19 20:22:19 +00:00
}
2023-12-19 01:58:37 +00:00
// Бафф Зверя animal_bonus
$this -> addAnimalBuff ( $i , $u );
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
Db :: sql (
'update stats set last_hp = 0, tactic1 = 0, tactic2 = 0, tactic3 = 0, tactic4 = 0, tactic5 = 0, tactic6 = 0, tactic7 = ? where id = ?' ,
[ $this -> users [ $i ][ 'tactic7' ], $this -> users [ $i ][ 'id' ]]
2022-12-30 19:03:37 +00:00
);
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
$rs [ $this -> users [ $i ][ 'team' ]] = $rs [ $this -> users [ $i ][ 'team' ]] . User :: getLogin ( $this -> users [ $i ][ 'id' ]) . ', ' ;
}
2022-12-19 20:22:19 +00:00
2023-12-19 01:58:37 +00:00
//battle-user (статистика, начальная)
$mybu = Db :: getValue ( 'select id from battle_users where battle = ? and uid = ? limit 1' , [ $this -> info [ 'id' ], $user [ 'id' ]]);
if ( ! $mybu ) {
//Пустое значение статистики для данного персонажа за текущий бой
$this -> addstatuser ( $user [ 'id' ]);
}
$i ++ ;
}
//Заносим в лог начало поединка
if ( $this -> info [ 'start1' ] != 0 ) {
return ;
}
if ( Db :: getValue ( 'select count(id) from battle where id = ? and start1 = 0' , [ $this -> info [ 'id' ]]) !== 1 ) {
return ;
}
Db :: sql ( 'update battle set start1 = unix_timestamp() where id = ?' , [ $this -> info [ 'id' ]]);
for ( $j = 0 ; $j <= $tsi ; $j ++ ) {
if ( empty ( $rs [ $j ])) {
continue ;
2022-12-19 20:22:19 +00:00
}
2023-12-19 01:58:37 +00:00
$r .= rtrim ( $rs [ $j ], ', ' ) . ' и ' ;
2022-12-19 20:22:19 +00:00
}
2023-12-19 01:58:37 +00:00
$r = rtrim ( $r , ' и' );
$r = str_replace ( '"' , '\\\\\"' , $r );
$this -> hodID ++ ;
Log :: add (
[
'text' => 'Часы показывали <span class=\\\\\"date\\\\\">' .
date ( 'd.m.Y H:i' , $this -> info [ 'time_start' ]) .
'</span>, когда ' . $r . ' бросили вызов друг другу.' ,
'battle' => $this -> info [ 'id' ],
'id_hod' => $this -> hodID ,
'vars' => 'time1=' . time () . '||' ,
'type' => '1' ,
]
);
$this -> info [ 'start1' ] = time ();
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
private function addstatuser ( $uid ) : void
2022-12-19 20:22:19 +00:00
{
2023-11-02 13:57:39 +00:00
if ( $uid <= 0 ) {
return ;
2022-12-19 20:22:19 +00:00
}
2023-11-02 13:57:39 +00:00
$id = $this -> uids [ $uid ];
if ( empty ( $this -> stats [ $id ][ 'hp' ])) {
$this -> stats [ $id ][ 'hp' ] = $this -> stats [ $id ][ 'hpNow' ];
}
2023-12-17 02:32:09 +00:00
Db :: sql (
'insert into battle_users (battle,uid,time_enter,login,level,align,clan,hpAll,hp,hpStart,team) values (?,?,unix_timestamp(),?,?,?,?,?,?,?,?)' ,
2023-11-02 13:57:39 +00:00
[
$this -> info [ 'id' ],
$uid ,
$this -> users [ $id ][ 'login' ],
$this -> users [ $id ][ 'align' ],
$this -> users [ $id ][ 'clan' ],
$this -> stats [ $id ][ 'hpAll' ],
$this -> stats [ $id ][ 'hp' ],
$this -> stats [ $id ][ 'hpNow' ],
$this -> users [ $id ][ 'team' ],
2023-12-17 02:32:09 +00:00
]
);
2022-12-19 20:22:19 +00:00
}
public function testZonbVis ()
{
global $u ;
if ( $this -> stnZbVs == 0 ) {
$zb = $this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'zonb' ];
$this -> stnZbVs = $zb ;
} else {
$zb = $this -> stnZb ;
}
$eu = $this -> users [ $this -> uids [ $u -> info [ 'id' ]]][ 'enemy' ];
if ( $zb > 3 ) {
$zb = 3 ;
}
if (
$eu != 0 &&
(
$this -> stats [ $this -> uids [ $eu ]][ 'weapon1' ] == 1 ||
$this -> stats [ $this -> uids [ $eu ]][ 'weapon2' ] == 1
) &&
$this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'weapon1' ] != 1 &&
$this -> stats [ $this -> uids [ $u -> info [ 'id' ]]][ 'weapon2' ] != 1
) {
$zb -= 1 ;
}
if ( $zb < 1 ) {
$zb = 1 ;
}
return $zb ;
}
2023-08-10 14:51:16 +00:00
///----Спасение функция
2022-12-19 20:22:19 +00:00
2022-12-30 19:03:37 +00:00
public function genTeams ( $you ) : string
2022-12-19 20:22:19 +00:00
{
$ret = '' ;
$teams = [];
2023-01-10 16:29:32 +00:00
//выделяем пользователей
2022-12-19 20:22:19 +00:00
$i = 0 ;
$j = 1 ;
$tms = [];
$teams [ $this -> users [ $this -> uids [ $you ]][ 'team' ]] = '' ;
$tms [ 0 ] = $this -> users [ $this -> uids [ $you ]][ 'team' ];
while ( $i < count ( $this -> uids )) {
if ( $this -> stats [ $i ][ 'hpNow' ] > 0 ) {
if ( ! isset ( $teams [ $this -> users [ $i ][ 'team' ]])) {
$tms [ $j ] = $this -> users [ $i ][ 'team' ];
$j ++ ;
}
if ( $this -> stats [ $i ][ 'hpNow' ] < 0 ) {
$this -> stats [ $i ][ 'hpNow' ] = 0 ;
}
if ( $this -> stats [ $i ][ 'hpAll' ] < $this -> stats [ $i ][ 'hpNow' ]) {
$this -> stats [ $i ][ 'hpNow' ] = $this -> stats [ $i ][ 'hpAll' ];
}
$a1ms = '' ;
2022-12-30 19:03:37 +00:00
if ( isset ( $this -> ga [ $this -> users [ $i ][ 'id' ]][ $you ]) && $this -> ga [ $this -> users [ $i ][ 'id' ]][ $you ]) {
2022-12-19 20:22:19 +00:00
$a1mc = '' ;
2022-12-30 19:03:37 +00:00
$ac = mysql_fetch_array (
mysql_query (
'SELECT * FROM `battle_act` WHERE `id` = "' . $this -> ga [ $this -> users [ $i ][ 'id' ]][ $you ] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if ( isset ( $ac ) && $ac [ 'time' ] + $this -> info [ 'timeout' ] - 15 < time ()) {
$a1mc = 'color:red;' ;
}
$a1ms = 'style=\"text-decoration: underline; ' . $a1mc . '\"' ;
2022-12-30 19:03:37 +00:00
} elseif ( isset ( $this -> ag [ $this -> users [ $i ][ 'id' ]][ $you ]) && $this -> ag [ $this -> users [ $i ][ 'id' ]][ $you ]) {
2022-12-19 20:22:19 +00:00
$a1mc = '' ;
2022-12-30 19:03:37 +00:00
$ac = mysql_fetch_array (
mysql_query (
'SELECT * FROM `battle_act` WHERE `id` = "' . $this -> ag [ $this -> users [ $i ][ 'id' ]][ $you ] . '" LIMIT 1'
)
);
2022-12-19 20:22:19 +00:00
if ( isset ( $ac ) && $ac [ 'time' ] + $this -> info [ 'timeout' ] - 15 < time ()) {
$a1mc = 'color:green;' ;
}
$a1ms = 'style=\"text-decoration: overline; ' . $a1mc . '\"' ;
}
if ( $this -> users [ $i ][ 'login2' ] == '' ) {
$this -> users [ $i ][ 'login2' ] = $this -> users [ $i ][ 'login' ];
}
if ( $this -> users [ $i ][ 'align' ] == 9 ) {
$this -> stats [ $i ][ 'hpNow' ] = $this -> stats [ $i ][ 'hpNow' ] / ( $this -> stats [ $i ][ 'hpAll' ] / 100 );
$this -> stats [ $i ][ 'hpAll' ] = '100%' ;
}
$ldr = '' ;
if ( $this -> users [ $i ][ 'lider' ] == $this -> info [ 'id' ]) {
2023-03-31 18:30:14 +00:00
$ldr = '<img width=24 height=15 title=Лидер группы src=//img.new-combats.tech/i/lead' . $this -> users [ $i ][ 'team' ] . '.gif \>' ;
2022-12-19 20:22:19 +00:00
}
2022-12-30 19:03:37 +00:00
$teams [ $this -> users [ $i ][ 'team' ]] .= ', ' . $ldr . '<span ' . $a1ms . ' class=\"CSSteam' . $this -> users [ $i ][ 'team' ] . '\" onClick=\"top.chat.addto(\'' . $this -> users [ $i ][ 'login2' ] . '\',\'to\'); return false;\" oncontextmenu=\"top.infoMenu(\'' . $this -> users [ $i ][ 'login2' ] . '\',event,\'main\'); return false;\">' . $this -> users [ $i ][ 'login2' ] . '</span><small> [' . floor (
$this -> stats [ $i ][ 'hpNow' ]
) . '/' . $this -> stats [ $i ][ 'hpAll' ] . ']</small>' ;
2022-12-19 20:22:19 +00:00
}
$i ++ ;
}
2023-01-10 16:29:32 +00:00
//генерируем команды
2022-12-19 20:22:19 +00:00
$i = 0 ;
while ( $i < count ( $tms )) {
$teams [ $tms [ $i ]] = ltrim ( $teams [ $tms [ $i ]], ', ' );
if ( $teams [ $tms [ $i ]] != '' ) {
2023-03-31 18:30:14 +00:00
$teams [ $tms [ $i ]] = '<img src=\"//img.new-combats.tech/i/lock3.gif\" style=\"cursor:pointer\" width=\"20\" height=\"15\" onClick=\"top.chat.addto(\'team' . $tms [ $i ] . '\',\'private\'); return false;\"> ' . $teams [ $tms [ $i ]];
2022-12-19 20:22:19 +00:00
$ret .= $teams [ $tms [ $i ]];
if ( count ( $tms ) > $i + 1 ) {
2023-01-10 16:29:32 +00:00
$ret .= ' <span class=\"CSSvs\"> против </span> ' ;
2022-12-19 20:22:19 +00:00
}
}
$i ++ ;
}
return 'genteam("' . $ret . '");' ;
}
2023-12-19 01:58:37 +00:00
public function setIBotsValue ( $key , $value ) : void
{
$this -> iBots [ $key ] = $value ;
}
/**
* @ param int $i
* @ param User $u
* @ return void
*/
private function addAnimalBuff ( int $i , User $u ) : void
{
if ( $this -> users [ $i ][ 'animal' ] <= 0 ) {
return ;
}
$animal = Db :: getRow ( 'select id, eda, type, level, name from users_animal where id = ? and uid = ? and pet_in_cage = 0' , [ $this -> users [ $i ][ 'animal' ], $this -> users [ $i ][ 'id' ]]);
if ( ! isset ( $animal [ 'id' ]) || $animal [ 'eda' ] < 1 ) {
return ;
}
$animalBonusDataString =
Db :: getValue ( 'select bonus from levels_animal where type = ? and level = ?' , [ $animal [ 'type' ], $animal [ 'level' ]]);
$tpa = [
1 => 'cat' ,
2 => 'owl' ,
3 => 'wisp' ,
4 => 'demon' ,
5 => 'dog' ,
6 => 'pig' ,
7 => 'dragon' ,
];
$tpa3 = [
1 => 'Кошачья Ловкость' ,
2 => 'Интуиция Совы' ,
3 => 'Сила Стихий' ,
4 => 'Демоническая Сила' ,
5 => 'Друг' ,
6 => 'Полная Броня' ,
7 => 'Инферно' ,
];
Effects :: removeByOverType ( $this -> users [ $i ][ 'id' ], 100 );
Effects :: addCustom (
[
'id_eff' => 22 ,
'uid' => $this -> users [ $i ][ 'id' ],
'name' => " { $tpa [ $animal [ 'type' ]] } [ { $animal [ 'level' ] } ] " ,
'timeUse' => 77 ,
'v1' => 'priem' ,
'v2' => 201 ,
'img2' => " summon_pet_ { $tpa [ $animal [ 'type' ]] } .gif " ,
'overType' => 100 ,
'user_use' => $this -> users [ $i ][ 'id' ],
'data' => $animalBonusDataString ,
]
);
//добавление духа от дракона
if ( $animal [ 'type' ] == 7 ) {
$dragonBonus = 0 ;
if ( $animal [ 'level' ] == 10 ) {
$dragonBonus = ( 50 + $this -> stats [ $i ][ 's7' ]) / $this -> stats [ $i ][ 'hpAll' ] * $this -> stats [ $i ][ 'hpNow' ];
} elseif ( $animal [ 'level' ] == 11 ) {
$dragonBonus = ( 65 + $this -> stats [ $i ][ 's7' ]) / $this -> stats [ $i ][ 'hpAll' ] * $this -> stats [ $i ][ 'hpNow' ];
} elseif ( $animal [ 'level' ] == 12 ) {
$dragonBonus = ( 90 + $this -> stats [ $i ][ 's7' ]) / $this -> stats [ $i ][ 'hpAll' ] * $this -> stats [ $i ][ 'hpNow' ];
}
$this -> users [ $i ][ 'tactic7' ] = $dragonBonus ;
}
$animalBonusData = Conversion :: dataStringToArray ( $animalBonusDataString );
$bonusString = '' ;
foreach ( $u -> items [ 'add' ] as $itemBonusSysName ) {
if (
! isset ( $animalBonusData [ 'add_' . $itemBonusSysName ]) ||
$animalBonusData [ 'add_' . $itemBonusSysName ] <= 0
) {
continue ;
}
$bonusString .= match ( $itemBonusSysName ) {
'mib1' => 'Броня головы: +' . $animalBonusData [ 'add_' . $itemBonusSysName ] . ', ' ,
'mib2' => 'Броня корпуса: +' . $animalBonusData [ 'add_' . $itemBonusSysName ] . ', ' ,
'mib3' => 'Броня пояса: +' . $animalBonusData [ 'add_' . $itemBonusSysName ] . ', ' ,
'mib4' => 'Броня ног: +' . $animalBonusData [ 'add_' . $itemBonusSysName ] . ', ' ,
default => $u -> is [ $itemBonusSysName ] . ': +' . $animalBonusData [ 'add_' . $itemBonusSysName ] . ', ' ,
};
}
$bonusString = trim ( $bonusString , ', ' );
if ( $bonusString == '' ) {
$bonusString = 'Эффект отсутсвует' ;
}
Log :: add (
[
'battle' => $this -> info [ 'id' ],
'id_hod' => 1 ,
'vars' =>
'time1=' . time () .
'||s1=' . $this -> users [ $i ][ 'sex' ] .
'||t1=' . $this -> users [ $i ][ 'team' ] .
'||login1=' . $this -> users [ $i ][ 'login' ] .
'||s2=1||t2=' . $this -> users [ $i ][ 'team' ] .
'||login2=' . $animal [ 'name' ] . ' (Зверь ' . $this -> users [ $i ][ 'login' ] . ')' ,
'type' => '1' ,
'text' => '{tm1} {u2} очнулся от медитации, и призвал заклятье "<strong>' .
$tpa3 [ $animal [ 'type' ]] . ' [' . $animal [ 'level' ] . ']</strong>" на {u1}. (' . $bonusString . ')' ,
]
);
Db :: sql ( 'update users_animal set eda = eda - 1 where id = ?' , [ $animal [ 'id' ]]);
Log :: addComment ( $this );
}
2022-12-19 20:22:19 +00:00
}