<commit_before><?php
/**
*
* @package Cold Zone
* @copyright (c) 2009-2011 <NAME>, http://coldzone.ru
* @license GNU Affero General Public License, version 3 http://www.gnu.org/licenses/agpl-3.0.html
*
*/

if (!defined('IN_GAME'))
{
	exit;
}                                                       

ini_set('max_execution_time', '120');

define('BATTLE_DRAW', -1);
define('BATTLE_FLEET_ATTACKER', 0);
define('BATTLE_FLEET_DEFENDER', 1);
define('BATTLE_PRECISION',	100000);
define('BATTLE_MAX_ACCURACY',	200);

define('BATTLE_LOG_CONSOLE',	0);
define('BATTLE_LOG_FILE',	1);

class Battle extends Report
{
	public $original_fleet		= array(); // [fleet_type][fleet_id][element] = count
	public $fleet			= array(); // [fleet_type][fleet_id][element] = count
	public $tech			= array(); // [fleet_type][fleet_id][tech] = level
	public $fleet_count		= array(); // [fleet_type][fleet_id] = count
						   // [fleet_type]['total']  = count
	public $fleet_count_real	= array(); // dynamic

	public $shield			= array(); // [fleet_type][fleet_id][element][hull_percent][shield_percent] = count
	public $damage_percent		= array(); // [fleet_type][fleet_id][element] = percent

	public $round			= 0;
	public static $max_rounds	= 6;

	public $round_info		= array();
	public $users			= array(); // [fleet_type][fleet_id]['username'] = username;
						   // [fleet_type][fleet_id]['coords'] = coords;
	public $winner			= -1;
	public $first_round_loose	= array(); // index = fleet_id
	public $debris			= array(
						'total' => array(
							BATTLE_FLEET_ATTACKER => array(
								'metal' => 0,
								'crystal' => 0),
							BATTLE_FLEET_DEFENDER => array(
								'metal' => 0,
								'crystal' => 0)
						),
						'nondefence' => array(
							BATTLE_FLEET_DEFENDER => array(
								'metal' => 0,
								'crystal' => 0)
						),
						'metal' => 0,
						'crystal' => 0
	);
	public $moon_chance		= 0;
	public $errors			= array();
	private static $debug		= false;
	public $logs			= array();
	private static $log_type	= BATTLE_LOG_FILE;
	private static $log_file	= './class.battle.log';

	function __construct($attacker, $defender)
	{
		if(self::$debug)
		{
			global $lang;

			$this->log('Класс боя создан');
			$this->log('Cold Zone версия ' . VERSION);
			$this->log('Модуль боя версия \'$Rev $\'');
			$this->log('Номера кораблей:');
			foreach(vars::get_resources('fleet') as $fleet_id)
			{
				$this->log($fleet_id . ': ' . $lang['TECH'][$fleet_id]);
			}
			$this->log('Точность брони и щитов: ' . BATTLE_PRECISION);
		}

		if(!empty($attacker))
			$this->fill_fleet($attacker, BATTLE_FLEET_ATTACKER);

		if(!empty($defender))
			$this->fill_fleet($defender, BATTLE_FLEET_DEFENDER);<commit_msg>Keyworded<commit_after><?php
/**
*
* @package Cold Zone
* @copyright (c) 2009-2011 <NAME>, http://coldzone.ru
* @license GNU Affero General Public License, version 3 http://www.gnu.org/licenses/agpl-3.0.html
*
*/

if (!defined('IN_GAME'))
{
	exit;
}                                                       

ini_set('max_execution_time', '120');

define('BATTLE_DRAW', -1);
define('BATTLE_FLEET_ATTACKER', 0);
define('BATTLE_FLEET_DEFENDER', 1);
define('BATTLE_PRECISION',	100000);
define('BATTLE_MAX_ACCURACY',	200);

define('BATTLE_LOG_CONSOLE',	0);
define('BATTLE_LOG_FILE',	1);

class Battle extends Report
{
	public $original_fleet		= array(); // [fleet_type][fleet_id][element] = count
	public $fleet			= array(); // [fleet_type][fleet_id][element] = count
	public $tech			= array(); // [fleet_type][fleet_id][tech] = level
	public $fleet_count		= array(); // [fleet_type][fleet_id] = count
						   // [fleet_type]['total']  = count
	public $fleet_count_real	= array(); // dynamic

	public $shield			= array(); // [fleet_type][fleet_id][element][hull_percent][shield_percent] = count
	public $damage_percent		= array(); // [fleet_type][fleet_id][element] = percent

	public $round			= 0;
	public static $max_rounds	= 6;

	public $round_info		= array();
	public $users			= array(); // [fleet_type][fleet_id]['username'] = username;
						   // [fleet_type][fleet_id]['coords'] = coords;
	public $winner			= -1;
	public $first_round_loose	= array(); // index = fleet_id
	public $debris			= array(
						'total' => array(
							BATTLE_FLEET_ATTACKER => array(
								'metal' => 0,
								'crystal' => 0),
							BATTLE_FLEET_DEFENDER => array(
								'metal' => 0,
								'crystal' => 0)
						),
						'nondefence' => array(
							BATTLE_FLEET_DEFENDER => array(
								'metal' => 0,
								'crystal' => 0)
						),
						'metal' => 0,
						'crystal' => 0
	);
	public $moon_chance		= 0;
	public $errors			= array();
	private static $debug		= false;
	public $logs			= array();
	private static $log_type	= BATTLE_LOG_FILE;
	private static $log_file	= './class.battle.log';

	function __construct($attacker, $defender)
	{
		if(self::$debug)
		{
			global $lang;

			$this->log('Класс боя создан');
			$this->log('Cold Zone версия ' . VERSION);
			$this->log('Модуль боя версия $Rev $');
			$this->log('Номера кораблей:');
			foreach(vars::get_resources('fleet') as $fleet_id)
			{
				$this->log($fleet_id . ': ' . $lang['TECH'][$fleet_id]);
			}
			$this->log('Точность брони и щитов: ' . BATTLE_PRECISION);
		}

		if(!empty($attacker))
			$this->fill_fleet($attacker, BATTLE_FLEET_ATTACKER);

		if(!empty($defender))
			$this->fill_fleet($defender, BATTLE_FLEET_DEFENDER);
{'fraction_non_alphanumeric': 0.17603275027912169, 'fraction_numerical': 0.0148864905098623, 'mean_word_length': 3.40935192780968, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 47, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 4, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2859427', 'n_tokens_mistral': 2504, 'n_tokens_neox': 2088, 'n_words': 373}