<?
if(!defined('GAME')) {
	die();
}
/*
	Прием: Разведка боем
	Показывает все активные приемы на противнике 5 ходов
*/
$pvr = array();
if( isset($pr_tested_this) ) {
		$fx_priem = function(  $id , $at , $uid, $j_id ) {
		// -- начало приема
		global $u, $btl;	
		//
		//Параметры приема
		$pvr['used'] = 0;
		//		
		$uid1 = $btl->atacks[$id]['uid1'];
		$uid2 = $btl->atacks[$id]['uid2'];			
		if( $uid == $uid1 ) {
			$a = 1;
			$b = 2;
			$u1 = ${'uid1'};
			$u2 = ${'uid2'};
		}elseif( $uid == $uid2 ) {
			$a = 2;
			$b = 1;
			$u1 = ${'uid2'};
			$u2 = ${'uid1'};
		}
		if( isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) {	
			mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$btl->stats[$btl->uids[$uid]]['u_priem'][$j_id][3].'" AND `uid` = "'.$uid.'" LIMIT 1');
			unset($btl->stats[$btl->uids[$uid]]['u_priem'][$j_id]);
		}
		//
		// -- конец приема
		return $at;
	};
	unset( $pr_used_this );
}elseif( isset($pr_used_this) ) { 
	$fx_priem = function(  $id , $at , $uid, $j_id ) {
		// -- начало приема
		global $u, $btl, $priem;	
		//
		//Параметры приема
		$pvr['used'] = 0;
		//		
		$uid1 = $btl->atacks[$id]['uid1'];
		$uid2 = $btl->atacks[$id]['uid2'];	
		//echo '['.$uid1.'|'.$uid2.'|*'.$uid.'*]';		
		if( $uid == $uid1 ) {
			$a = 1;
			$b = 2;
			$u1 = ${'uid1'};
			$u2 = ${'uid2'};
			$uid1 = $btl->atacks[$id]['uid1'];
			$uid2 = $btl->atacks[$id]['uid2'];
		}elseif( $uid == $uid2 ) {
			$a = 2;
			$b = 1;
			$u1 = ${'uid2'};
			$u2 = ${'uid1'};
			$uid1 = $btl->atacks[$id]['uid2'];
			$uid2 = $btl->atacks[$id]['uid1'];
		}
		if( $a > 0 ) {
			$j = 0; $k = 0; $wp = 3;
			$pvrt = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$uid2.'" AND `v2` = "45" AND `delete` = 0 LIMIT 1'));
			while($j < count($at['p'][$a]['atack'])) {
				if( isset($at['p'][$a]['atack'][$j]['yron']) && (
				$at['p'][$a]['atack'][$j][1] == 1 ||
				$at['p'][$a]['atack'][$j][1] == 4 ||
				$at['p'][$a]['atack'][$j][1] == 5 ))
				{
					    
						$pvr['hp'] =6 * $btl->users[$btl->uids[$u1]]['level'];
						$pvr['hp'] = $btl->testYronPriem( $u1, $u2, 12, $pvr['hp'], -1, true, false, 0 );
						$pvr['mg'] = mysql_fetch_array(mysql_query('SELECT * FROM `eff_users` WHERE `uid` = "'.$uid2.'" AND `v2` = "249" AND `delete` = 0 LIMIT 1'));
						if( $pvr['hp'] <= 1 && !isset($pvr['mg'])) 
						{
						$pvr['hp'] = 0;
						$at['p'][$a]['atack'][$j]['yron']['y'] = 1;
						$at['p'][$a]['atack'][$j]['yron']['r'] = -1;
						$at['p'][$a]['atack'][$j]['yron']['k'] = 1;
						$at['p'][$a]['atack'][$j]['yron']['m_k'] = 1;
						$at['p'][$a]['atack'][$j]['yron']['m_y'] = 1;
						}

					
					if( $pvr['used'] == 0 && !isset($at['p'][$a]['priems']['kill'][$uid][$j_id]) ) {
						//
						
						$btl->priemAddLogFast( $uid1, 0, "Разведка боем",
							'{tm1} '.$btl->addlt(1 , 17 , $btl->users[$btl->uids[$uid1]]['sex'] , NULL).'',
						1, time() );					
						//
						//mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `id` = "'.$btl->stats[$btl->uids[$uid1]]['u_priem'][$j_id][3].'" AND `uid` = "'.$uid1.'" LIMIT 1');
						mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `delete` = "0" AND `uid` = "'.$uid1.'" AND `v2`= "237" LIMIT 1');
						unset($btl->stats[$btl->uids[$uid1]]['u_priem'][$j_id]);
						mysql_query('UPDATE `eff_users` SET `delete` = "'.time().'" WHERE `v2` = "238" AND `uid` = "'.$uid2.'" ');
						$priem->addPriem($uid2,238,'add_seeAllEff=1',0,77,6,$uid1,5,'разведкабоем',0,0,0,0,0,1);
						$at['p'][$a]['priems']['kill'][$uid][$j_id] = true;
						
						
						if(isset($pvrt['id'])) 
						{
						$pvr['hp'] = 0;
						$at['p'][$a]['atack'][$j]['yron']['y'] = 1;
						$at['p'][$a]['atack'][$j]['yron']['r'] = -1;
						$at['p'][$a]['atack'][$j]['yron']['k'] = 1;
						$at['p'][$a]['atack'][$j]['yron']['m_k'] = 1;
						$at['p'][$a]['atack'][$j]['yron']['m_y'] = 1;
						}
						
						
						//
					}
				}
				$j++;
			}
		}
		// -- конец приема
		return $at;
	};
	unset( $pr_used_this );
}else{
	//Действие при клике
	$this->addEffPr($pl,$id);
}
unset($pvr);
?>