This commit is contained in:
wangwei01 2019-07-25 21:28:47 +08:00
parent 269a107ee9
commit a0b5efdba5

View File

@ -15,6 +15,18 @@ class MatchController{
return $r;
}
protected function getParameter($para_id)
{
$parameter_meta_cluster = require('../res/parameter@parameter.php');
$parameter_meta = getParameterConfig($parameter_meta_cluster, $para_id);
$p = array(
'id' => $parameter_meta['id'],
'param_name' => $parameter_meta['param_name'],
'param_value' => $parameter_meta['param_value'],
);
return $p;
}
protected function getRobot($robot_id, $num)
{
$address = '../res/robot@robot' . $num . '.php';
@ -122,7 +134,14 @@ class MatchController{
} else if (count($room_db['member_list']) < 10) {
//判断是否添加机器人
if ($flag == 1) {
$p_min = $this->getParameter(16);
$min_num = $p_min['param_value'];
$p_max = $this->getParameter(17);
$max_num = $p_max['param_value'];
$randrobot_num = Rand($min_num, $max_num);
$robot_num = min((10 - count($room_db['member_list'])), $randrobot_num);
if (time() >= $join_time + $room_db['last_join_time']) {
for ($i = 0; $i < $robot_num; $i++) {
//添加机器人
$num = count($room_db['member_list']);
$random = Rand(1, 100);
@ -136,6 +155,7 @@ class MatchController{
'tank_id' => $tank_id,
'tankskin_id' => 0
));
}
$room_db['last_join_time'] = time();
}
} else {