game/_incl_data/class/bot.priem.php
2022-06-07 00:30:34 +03:00

516 lines
12 KiB
PHP

<?php
if( !defined('GAME') ) {
die();
}
class botPriemLogic {
static $p = array();
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;
}
static function usePriem($id,$on = NULL) {
//if(self::$p['id'] > 7 && self::$p['id'] < 11) {
//botLogic::e(botLogic::$bot['login'].', èñïîëüçóþ ïðèåì &quot;'.self::$p['name'].'&quot; , battle: <a target=_blank href=https://new-combats.com/logs.php?log='.botLogic::$bot['battle'].'>Link</a>');
//}
$go_txt = '&usepriem='.$id;
if( $on != '') {
$on = str_replace(' ','%20',$on);
$go_txt .= '&useon='.$on;
}
botLogic::inuser_go_btl( botLogic::$bot , $go_txt );
}
//Ñòàâêà íà îïåðåæåíèå
static function priem220( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 30) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Ðàçãàäàòü òàêòèêó
static function priem217( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 30) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Îáðå÷åííîñòü
static function priem204( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 30) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Âûæèòü
static function priem232( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(self::hp() > 30 || rand(0,100) >= 50) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Æàæäà êðîâè
static function priem188( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 30) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Øîê óäàð
static function priem235( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 50) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Õëåáíóòü êðîâè
static function priem240( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
//if(botLogic::$st['tactic2'] < 7 || botLogic::$st['tactic4'] < 3 || self::hp() > 70) {
if(self::hp() > 70) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Ñèëîâîå ïîëå
static function priem175( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
/*if(botLogic::$st['hpNow'] >= botLogic::$st['hpAll']) {
$su = false;
}elseif(botLogic::$st['hpNow'] < 5) {
$su = false;
}elseif(rand(0,100) >= 50) {
$su = false;
}*/
if($su == true) {
self::usePriem( $i );
}
}
//Ïðèêðûòüñÿ
static function priem1( $i ) {
$su = true;
if(rand(0,100) >= 50) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Âëîìèòü
static function priem2( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 50) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Ñîáðàòü çóáû
static function priem3( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
/*if(botLogic::$st['hpNow'] >= botLogic::$st['hpAll']) {
$su = false;
}elseif(botLogic::$st['hpNow'] < 10) {
$su = false;
}elseif(isset(botLogic::$pr[1]) && botLogic::$pr[1] < 1) {
$su = false;
}*/
if(self::hp() > 70 || rand(0,100) >= 50) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Âîëÿ ê ïîáåäå
static function priem6( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(self::hp() > 40 || rand(0,100) >= 50) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Òàíåö âåòðà
static function priem8( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 30) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Òàíåö ëåçâèé
static function priem48( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 70) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Äèêàÿ óäà÷à
static function priem9( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 30) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Ñëåïàÿ óäà÷à
static function priem47( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 50) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Ïðåäâèäåíüå
static function priem10( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 30) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Âòîðîå äûõàíèå
static function priem49( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 80 || self::hp() > 60) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Ðûâîê
static function priem223( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(self::hp() > 50 || rand(0,100) >= 50) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Óäà÷íûé óäàð
static function priem11( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
//if(isset(botLogic::$pr[6]) && botLogic::$st['tactic7'] > 0 && self::hp() < 66 && botLogic::$st['tactic1'] < 14) {
if(rand(0,100) >= 30){
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Ñòîéêîñòü
static function priem13( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 50){
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//ßðîñòü
static function priem14( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(rand(0,100) >= 50){
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Ñèëüíûé óäàð
static function priem4( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
/*if(isset(botLogic::$pr[6]) && botLogic::$st['tactic7'] > 0 && self::hp() < 66 && botLogic::$st['tactic1'] < 14) {
$su = false;
}elseif((isset(botLogic::$pr[11]) || isset(botLogic::$pr[6])) && rand(0,100) <= 75) {*/
if(rand(0,100) >= 60){
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Óòåðåòü ïîò
static function priem5( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
if(self::hp() > 95) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Àãðåññèâíàÿ çàùèòà
static function priem211( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
//if( rand(0,100) >= 80 || (isset(botLogic::$pr[7]) && botLogic::$pr[7] < 1) || (isset(botLogic::$pr[45]) && botLogic::$pr[45] < 1) || self::hp() > 80 ) {
if( rand(0,100) >= 80){
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Ïîëíàÿ çàùèòà
static function priem45( $i ) {
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
//if( rand(0,100) >= 60 || (isset(botLogic::$pr[7]) && botLogic::$pr[7] < 1) || (isset(botLogic::$pr[211]) && botLogic::$pr[211] < 1) || self::hp() > 80 ) {
if( rand(0,100) >= 50){
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
//Àêòèâíàÿ çàùèòà
static function priem7( $i ) {
//if (rand(0,100) >= 50){$su = true;}else{$su = false;}
$su = true;
//Ëîãèêà èñïîëüçîâàíèÿ ïðèåìà
/* Åñëè åñòü àáñîëþòíàÿ çàùèòà (àãðåññèâíóþ) è å¸ âîçìîæíî èñîïëüçîâàòü, à òàê-æå ÍÐ ìåíåå 70% */
//if( rand(0,100) >= 50 || (isset(botLogic::$pr[45]) && botLogic::$pr[45] < 1) || (isset(botLogic::$pr[211]) && botLogic::$pr[211] < 1) || self::hp() > 80 ) {
if(rand(0,100) >= 30) {
$su = false;
}
if($su == true) {
self::usePriem( $i );
}
}
static function hp() {
$p = round((botLogic::$st['hpNow']/botLogic::$st['hpAll']*100),2);
return $p;
}
//Òåñò íà âîçìîæíîñòü èñïîëüçîâàíèÿ
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']))
{
if(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;
}
}
?>