400 lines
9.4 KiB
PHP
400 lines
9.4 KiB
PHP
<?php
|
|
|
|
class BotPriemLogic
|
|
{
|
|
|
|
private static $p = [];
|
|
|
|
public static function start($i, $id)
|
|
{
|
|
|
|
self::$p = mysql_fetch_array(mysql_query('SELECT * FROM `priems` WHERE `id` = "' . $id . '" LIMIT 1'));
|
|
|
|
$test = self::testpriem(self::$p);
|
|
|
|
if (isset(self::$p['id']) && $test == 0) {
|
|
//Èñïîëüçóåì ïðèåì ïîä íîìåðîì $id
|
|
if ($id == 1) {
|
|
self::priem1($i);
|
|
} //Ïðèêðûòüñÿ 1|2|3|4|5|6|7|8|9|10|11|13|14|45|47|48|49|188|204|211|217|220|223|232|235|240|0|0|0|0|0|0|0|0|0|0|0|0|0|0
|
|
elseif ($id == 2) {
|
|
self::priem2($i);
|
|
} //Âëîìèòü
|
|
elseif ($id == 3) {
|
|
self::priem3($i);
|
|
} //Ñîáðàòü çóáû
|
|
elseif ($id == 4) {
|
|
self::priem4($i);
|
|
} //Ñèëüíûé óäàð
|
|
elseif ($id == 5) {
|
|
self::priem5($i);
|
|
} //Óòåðåòü ïîò
|
|
elseif ($id == 6) {
|
|
self::priem6($i);
|
|
} //Âîëÿ ê ïîáåäå
|
|
elseif ($id == 7) {
|
|
self::priem7($i);
|
|
} //Àêòèâíàÿ çàùèòà
|
|
elseif ($id == 8) {
|
|
self::priem8($i);
|
|
} //Òàíåö âåòðà
|
|
elseif ($id == 9) {
|
|
self::priem9($i);
|
|
} //Äèêàÿ óäà÷à
|
|
elseif ($id == 10) {
|
|
self::priem10($i);
|
|
} //Ïðåäâèäèíèå
|
|
elseif ($id == 11) {
|
|
self::priem11($i);
|
|
} //Óäà÷íûé óäàð
|
|
elseif ($id == 13) {
|
|
self::priem13($i);
|
|
} //Ñòîéêîñòü
|
|
elseif ($id == 14) {
|
|
self::priem14($i);
|
|
} //ßðîñòü
|
|
elseif ($id == 45) {
|
|
self::priem45($i);
|
|
} //Ïîëíàÿ çàùèòà
|
|
elseif ($id == 47) {
|
|
self::priem47($i);
|
|
} //Ñëåïàÿ óäà÷à
|
|
elseif ($id == 48) {
|
|
self::priem48($i);
|
|
} //Òàíåö ëåçâèé
|
|
elseif ($id == 49) {
|
|
self::priem49($i);
|
|
} //Âòîðîå äûõàíèå
|
|
elseif ($id == 188) {
|
|
self::priem188($i);
|
|
} //Æàæäà êðîâè
|
|
elseif ($id == 204) {
|
|
self::priem204($i);
|
|
} //Îáðå÷åííîñòü
|
|
elseif ($id == 211) {
|
|
self::priem211($i);
|
|
} //Àãðåññèâíàÿ çàùèòà
|
|
elseif ($id == 217) {
|
|
self::priem217($i);
|
|
} //Ðàçãàäàòü òàêòèêó
|
|
elseif ($id == 220) {
|
|
self::priem220($i);
|
|
} //Ñòàâêà íà îïåðåæåíèå
|
|
elseif ($id == 223) {
|
|
self::priem223($i);
|
|
} //Ðûâîê
|
|
elseif ($id == 232) {
|
|
self::priem232($i);
|
|
} //Âûæèòü
|
|
elseif ($id == 235) {
|
|
self::priem235($i);
|
|
} //Øîêèðóþùèé óäàð
|
|
elseif ($id == 240) {
|
|
self::priem240($i);
|
|
} //Õëåáíóòü êðîâè
|
|
elseif ($id >= 175 && $id <= 179) {
|
|
self::priem175($i);
|
|
}
|
|
//*********************************
|
|
}
|
|
return true;
|
|
}
|
|
|
|
private static function usePriem($id, $on = null)
|
|
{
|
|
$go_txt = '&usepriem=' . $id;
|
|
if ($on != '') {
|
|
$on = str_replace(' ', '%20', $on);
|
|
$go_txt .= '&useon=' . $on;
|
|
}
|
|
BotLogic::inuser_go_btl(BotLogic::$bot, $go_txt);
|
|
}
|
|
|
|
//Ñòàâêà íà îïåðåæåíèå
|
|
private static function priem220($i)
|
|
{
|
|
if (rand(0, 100) < 30) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Ðàçãàäàòü òàêòèêó
|
|
private static function priem217($i)
|
|
{
|
|
if (rand(0, 100) < 30) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Îáðå÷åííîñòü
|
|
private static function priem204($i)
|
|
{
|
|
if (rand(0, 100) < 30) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Âûæèòü
|
|
private static function priem232($i)
|
|
{
|
|
if (self::hp() <= 30 && rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Æàæäà êðîâè
|
|
private static function priem188($i)
|
|
{
|
|
if (rand(0, 100) < 30) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Øîê óäàð
|
|
private static function priem235($i)
|
|
{
|
|
if (rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Õëåáíóòü êðîâè
|
|
private static function priem240($i)
|
|
{
|
|
if (self::hp() <= 70) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Ñèëîâîå ïîëå
|
|
private static function priem175($i)
|
|
{
|
|
self::usePriem($i);
|
|
}
|
|
|
|
//Ïðèêðûòüñÿ
|
|
private static function priem1($i)
|
|
{
|
|
if (rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Âëîìèòü
|
|
private static function priem2($i)
|
|
{
|
|
if (rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Ñîáðàòü çóáû
|
|
private static function priem3($i)
|
|
{
|
|
if (self::hp() <= 70 && rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Âîëÿ ê ïîáåäå
|
|
private static function priem6($i)
|
|
{
|
|
if (self::hp() <= 40 && rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Òàíåö âåòðà
|
|
private static function priem8($i)
|
|
{
|
|
if (rand(0, 100) < 30) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Òàíåö ëåçâèé
|
|
private static function priem48($i)
|
|
{
|
|
if (rand(0, 100) < 70) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Äèêàÿ óäà÷à
|
|
private static function priem9($i)
|
|
{
|
|
if (rand(0, 100) < 30) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Ñëåïàÿ óäà÷à
|
|
private static function priem47($i)
|
|
{
|
|
if (rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Ïðåäâèäåíüå
|
|
private static function priem10($i)
|
|
{
|
|
if (rand(0, 100) < 30) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Âòîðîå äûõàíèå
|
|
private static function priem49($i)
|
|
{
|
|
if (rand(0, 100) < 80 && self::hp() <= 60) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Ðûâîê
|
|
private static function priem223($i)
|
|
{
|
|
if (self::hp() <= 50 && rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Óäà÷íûé óäàð
|
|
private static function priem11($i)
|
|
{
|
|
if (rand(0, 100) < 30) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Ñòîéêîñòü
|
|
private static function priem13($i)
|
|
{
|
|
if (rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//ßðîñòü
|
|
private static function priem14($i)
|
|
{
|
|
if (rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Ñèëüíûé óäàð
|
|
private static function priem4($i)
|
|
{
|
|
if (rand(0, 100) < 60) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
//Óòåðåòü ïîò
|
|
private static function priem5($i)
|
|
{
|
|
if (self::hp() <= 95) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
|
|
//Àãðåññèâíàÿ çàùèòà
|
|
private static function priem211($i)
|
|
{
|
|
if (rand(0, 100) < 80) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
|
|
//Ïîëíàÿ çàùèòà
|
|
private static function priem45($i)
|
|
{
|
|
if (rand(0, 100) < 50) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
|
|
//Àêòèâíàÿ çàùèòà
|
|
private static function priem7($i)
|
|
{
|
|
if (rand(0, 100) < 30) {
|
|
self::usePriem($i);
|
|
}
|
|
}
|
|
|
|
|
|
private static function hp()
|
|
{
|
|
return round((BotLogic::$st['hpNow'] / BotLogic::$st['hpAll'] * 100), 2);
|
|
}
|
|
|
|
//Òåñò íà âîçìîæíîñòü èñïîëüçîâàíèÿ
|
|
private static function testpriem($pl)
|
|
{
|
|
global $u;
|
|
$notr = 0;
|
|
|
|
$tr = $u->lookStats($pl['tr']);
|
|
$d2 = $u->lookStats($pl['date2']);
|
|
|
|
$x = 1;
|
|
while ($x <= 7) {
|
|
if (BotLogic::$bot['tactic' . $x] < $pl['tt' . $x] && $x != 7 && $pl['tt' . $x] > 0) {
|
|
$notr++;
|
|
} elseif ($x == 7) {
|
|
if ($pl['tt' . $x] > 0 && BotLogic::$bot['tactic' . $x] <= 0) {
|
|
$notr++;
|
|
}
|
|
}
|
|
$x++;
|
|
}
|
|
|
|
if ($pl['xuse'] > 0) {
|
|
$xu = $u->testAction('`vars` = "use_priem_' . BotLogic::$bot['battle'] . '_' . BotLogic::$bot['id'] . '" AND `vals` = "' . $pl['id'] . '" LIMIT ' . $pl['xuse'] . '', 2);
|
|
if ($xu[0] >= $pl['xuse']) {
|
|
$notr++;
|
|
}
|
|
}
|
|
|
|
$x = 0;
|
|
$t = $u->items['tr'];
|
|
while ($x < count($t)) {
|
|
$n = $t[$x];
|
|
if (isset($tr['tr_' . $n])) {
|
|
if ($n == 'lvl') {
|
|
if ($tr['tr_' . $n] > BotLogic::$bot['level']) {
|
|
$notr++;
|
|
}
|
|
} elseif ($tr['tr_' . $n] > BotLogic::$st[$n]) {
|
|
$notr++;
|
|
}
|
|
}
|
|
$x++;
|
|
}
|
|
|
|
if (isset($tr['tr_mpNow']) && BotLogic::$st['mpNow'] < $tr['tr_mpNow']) {
|
|
$notr++;
|
|
}
|
|
|
|
if ($pl['trUser'] == 1) {
|
|
//òðåáóåò ÷òîáû ïîëüçîâàòåëü ñ êåì-òî ðàçìåíèâàëñÿ (ïðè îæèäàíèè ïðèåì ãàñíèò)
|
|
$ga = mysql_fetch_array(mysql_query('SELECT `id` FROM `battle_act` WHERE `battle` = "' . BotLogic::$bot['battle'] . '" AND `uid1` = "' . BotLogic::$bot['id'] . '" AND `uid2` = "' . BotLogic::$bot['enemy'] . '" LIMIT 1'));
|
|
if (isset($ga['id'])) {
|
|
$notr++;
|
|
}
|
|
}
|
|
|
|
//Åñëè ïðèåì óæå èñïîëüçîâàëè
|
|
if (BotLogic::$st['prsu'][$pl['id']] > 0) {
|
|
$notr++;
|
|
}
|
|
|
|
return $notr;
|
|
}
|
|
}
|