function discover($schmode = 0) { global $art, $pls, $now, $log, $mode, $command, $cmd, $event_obbs, $weather, $pls, $club, $pose, $tactic, $inf, $item_obbs, $enemy_obbs, $trap_min_obbs, $trap_max_obbs, $bid, $db, $tablepre, $gamestate, $corpseprotect, $action, $skills, $rp, $aidata; $event_dice = rand(0, 99); if ($event_dice < $event_obbs || $art != "Untainted Glory" && $pls == 34 && $gamestate != 50) { include_once GAME_ROOT . './include/game/event.func.php'; event(); $mode = 'command'; return; } include_once GAME_ROOT . './include/game/aievent.func.php'; //AI事件 $aidata = false; //用于判断天然呆AI(冴冴这样的)是否已经来到你身后并且很生气 aievent(20); //触发AI事件的概率 if (is_array($aidata)) { include_once GAME_ROOT . './include/game/attr.func.php'; $active_r = get_active_r($weather, $pls, $pose, $tactic, $club, $inf, $aidata['pose']); include_once GAME_ROOT . './include/game/clubskills.func.php'; $active_r *= get_clubskill_bonus_active($club, $skills, $aidata['club'], $aidata['skills']); if ($active_r > 96) { $active_r = 96; } $bid = $aidata['pid']; $active_dice = rand(0, 99); if ($active_dice < $active_r) { $action = 'enemy' . $aidata['pid']; include_once GAME_ROOT . './include/game/battle.func.php'; findenemy($aidata); return; } else { include_once GAME_ROOT . './include/game/combat.func.php'; combat(0); return; } } $trap_dice = rand(0, 99); //随机数,开始判断是否踩陷阱 if ($trap_dice < $trap_max_obbs) { //踩陷阱概率最大值 $trapresult = $db->query("SELECT * FROM {$tablepre}maptrap WHERE pls = '{$pls}' ORDER BY itmk DESC"); // $traplist = Array(); // while($trap0 = $db->fetch_array($result)){ // $traplist[$trap0['tid']] = $trap0; // if($trap0['itmk'] == 'TOc'){ // $xtrap = true; // $xtrapid = $ // } // } $xtrp = $db->fetch_array($trapresult); $xtrpflag = false; //echo $xtrp['itm']; if ($xtrp['itmk'] == 'TOc') { $xtrpflag = true; } $trpnum = $db->num_rows($trapresult); if ($trpnum) { //看地图上有没有陷阱 //echo "踩陷阱概率:{$real_trap_obbs}%"; if ($xtrpflag) { global $itm0, $itmk0, $itme0, $itms0, $itmsk0; $itm0 = $xtrp['itm']; $itmk0 = $xtrp['itmk']; $itme0 = $xtrp['itme']; $itms0 = $xtrp['itms']; $itmsk0 = $xtrp['itmsk']; $tid = $xtrp['tid']; $db->query("DELETE FROM {$tablepre}maptrap WHERE tid='{$tid}'"); include_once GAME_ROOT . './include/game/itemmain.func.php'; itemfind(); return; } else { $real_trap_obbs = $trap_min_obbs + $trpnum / 4; //Anti-Meta RP System Version 2.00 ~ Nemo //冴冴我喜欢你! //17rp/177rp+1% if ($gamestate >= 50) { $real_trap_obbs = $real_trap_obbs + $rp / 177; } else { $real_trap_obbs = $real_trap_obbs + $rp / 30; } if ($pose == 1) { $real_trap_obbs += 1; } elseif ($pose == 3) { $real_trap_obbs += 3; } //攻击和探索姿势略容易踩陷阱 if ($gamestate >= 40) { $real_trap_obbs += 3; } //连斗以后略容易踩陷阱 if ($pls == 0) { $real_trap_obbs += 15; } //在后台非常容易踩陷阱 if ($club == 6) { $real_trap_obbs -= 5; } //人肉搜索称号遭遇陷阱概率减少 if ($trap_dice < $real_trap_obbs) { //踩陷阱判断 $itemno = rand(0, $trpnum - 1); $db->data_seek($trapresult, $itemno); $mi = $db->fetch_array($trapresult); global $itm0, $itmk0, $itme0, $itms0, $itmsk0; $itm0 = $mi['itm']; $itmk0 = $mi['itmk']; $itme0 = $mi['itme']; $itms0 = $mi['itms']; $itmsk0 = $mi['itmsk']; $tid = $mi['tid']; $db->query("DELETE FROM {$tablepre}maptrap WHERE tid='{$tid}'"); if ($itms0) { include_once GAME_ROOT . './include/game/itemmain.func.php'; itemfind(); return; } } } } } // $trap_dice = rand(0,99); // if($pose==1){$trap_dice-=5;} // elseif($pose==3){$trap_dice-=8;}//攻击和探索姿势略容易踩陷阱 // if($gamestate >= 40){$trap_dice-=5;}//连斗以后略容易踩陷阱 // if($trap_dice < $trap_obbs){ // $result = $db->query("SELECT * FROM {$tablepre}{$pls}mapitem WHERE itmk = 'TO'"); // $trpnum = $db->num_rows($result); // if($trpnum){ // $itemno = rand(0,$trpnum-1); // $db->data_seek($result,$itemno); // $mi=$db->fetch_array($result); // global $itm0,$itmk0,$itme0,$itms0,$itmsk0; // $itm0=$mi['itm']; // $itmk0=$mi['itmk']; // $itme0=$mi['itme']; // $itms0=$mi['itms']; // $itmsk0=$mi['itmsk']; // $iid=$mi['iid']; // $db->query("DELETE FROM {$tablepre}{$pls}mapitem WHERE iid='$iid'"); // if($itms0){ // include_once GAME_ROOT.'./include/game/itemmain.func.php'; // itemfind(); // return; // } // } // } include_once GAME_ROOT . './include/game/attr.func.php'; $mode_dice = rand(0, 99); if ($mode_dice < $schmode) { global $pid, $corpse_obbs, $teamID, $fog, $bid, $gamestate; // if($gamestate < 40) { // $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='$pls' AND pid!='$pid' AND pid!='$bid'"); // } else { // $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='$pls' AND pid!='$pid'"); // } $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='{$pls}' AND pid!='{$pid}'"); if (!$db->num_rows($result)) { $log .= '<span class="yellow">周围一个人都没有。</span><br>'; if (CURSCRIPT == 'botservice') { echo "noenemy=1\n"; } $mode = 'command'; return; } $enemynum = $db->num_rows($result); $enemyarray = range(0, $enemynum - 1); shuffle($enemyarray); $find_r = get_find_r($weather, $pls, $pose, $tactic, $club, $inf); $find_obbs = $enemy_obbs + $find_r; foreach ($enemyarray as $enum) { $db->data_seek($result, $enum); $edata = $db->fetch_array($result); if (!$edata['type'] || $gamestate < 50) { if ($edata['hp'] > 0) { global $art, $artk, $name; if (!$edata['type'] && $artk == 'XX' && ($edata['artk'] != 'XX' || $edata['art'] != $name) && $gamestate < 50) { continue; } if ($artk != 'XX' && $edata['artk'] == 'XX' && $gamestate < 50) { continue; } $hide_r = get_hide_r($weather, $pls, $edata['pose'], $edata['tactic'], $edata['club'], $edata['inf']); include_once GAME_ROOT . './include/game/clubskills.func.php'; $hide_r *= get_clubskill_bonus_hide($edata['club'], $edata['skills']); $enemy_dice = rand(0, 99); if ($enemy_dice < $find_obbs - $hide_r) { if ($teamID && !$fog && $gamestate < 40 && $teamID == $edata['teamID']) { $bid = $edata['pid']; $action = 'team' . $edata['pid']; include_once GAME_ROOT . './include/game/battle.func.php'; findteam($edata); return; } else { $active_r = get_active_r($weather, $pls, $pose, $tactic, $club, $inf, $edata['pose']); include_once GAME_ROOT . './include/game/clubskills.func.php'; $active_r *= get_clubskill_bonus_active($club, $skills, $edata['club'], $edata['skills']); if ($active_r > 96) { $active_r = 96; } $bid = $edata['pid']; $active_dice = rand(0, 99); if ($active_dice < $active_r) { $action = 'enemy' . $edata['pid']; include_once GAME_ROOT . './include/game/battle.func.php'; findenemy($edata); return; } else { if (CURSCRIPT == 'botservice') { echo "passive_battle=1\n"; echo "passive_w_name={$edata['name']}\n"; echo "passive_w_type={$edata['type']}\n"; echo "passive_w_sNo={$edata['sNo']}\n"; } include_once GAME_ROOT . './include/game/combat.func.php'; combat(0); return; } } } else { $hideflag = true; } } else { $corpse_dice = rand(0, 99); if ($corpse_dice < $corpse_obbs) { if ($gamestate < 40 && $edata['endtime'] < $now - $corpseprotect && ($edata['weps'] && $edata['wepe'] || $edata['arbs'] && $edata['arbe'] || $edata['arhs'] || $edata['aras'] || $edata['arfs'] || $edata['arts'] || $edata['itms0'] || $edata['itms1'] || $edata['itms2'] || $edata['itms3'] || $edata['itms4'] || $edata['itms5'] || $edata['money'])) { $bid = $edata['pid']; $action = 'corpse' . $edata['pid']; include_once GAME_ROOT . './include/game/battle.func.php'; findcorpse($edata); return; } else { //这看上去是个bug…… 会导致地图上最后一个兵很难摸到…… //改成discover(100)应该就能解决问题…… 但修复了可能导致平衡性问题…… 所以暂时留在这…… discover(50); return; } } } } } if ($hideflag == true) { $log .= '似乎有人隐藏着……<br>'; } else { $log .= '<span class="yellow">周围一个人都没有。</span><br>'; } $mode = 'command'; return; } else { $find_r = get_find_r($weather, $pls, $pose, $tactic, $club, $inf); $find_obbs = $item_obbs + $find_r; $item_dice = rand(0, 99); if ($item_dice < $find_obbs) { //$mapfile = GAME_ROOT."./gamedata/mapitem/{$pls}mapitem.php"; //$mapitem = openfile($mapfile); //$itemnum = sizeof($mapitem) - 1; // $result = $db->query("SELECT * FROM {$tablepre}mapitem WHERE map='$pls'"); // $itemnum = $db->num_rows($result); $result = $db->query("SELECT * FROM {$tablepre}mapitem WHERE pls = '{$pls}'"); $itemnum = $db->num_rows($result); if ($itemnum <= 0) { $log .= '<span class="yellow">周围找不到任何物品。</span><br>'; $mode = 'command'; return; } $itemno = rand(0, $itemnum - 1); $db->data_seek($result, $itemno); $mi = $db->fetch_array($result); global $itm0, $itmk0, $itme0, $itms0, $itmsk0; $itm0 = $mi['itm']; $itmk0 = $mi['itmk']; $itme0 = $mi['itme']; $itms0 = $mi['itms']; $itmsk0 = $mi['itmsk']; $iid = $mi['iid']; $db->query("DELETE FROM {$tablepre}mapitem WHERE iid='{$iid}'"); //list($itm0,$itmk0,$itme0,$itms0,$itmsk0) = explode(',', $mapitem[$itemno]); //array_splice($mapitem,$itemno,1); //writeover($mapfile,implode('', $mapitem),'wb'); //unset($mapitem); if ($itms0) { include_once GAME_ROOT . './include/game/itemmain.func.php'; itemfind(); return; } else { $log .= "但是什么都没有发现。可能是因为道具有天然呆属性。<br>"; } } else { $log .= "但是什么都没有发现。<br>"; } } $mode = 'command'; return; }
function discover($schmode = 0) { global $log, $mode, $command, $cmd, $event_obbs, $weather, $pls, $club, $pose, $tactic, $inf, $item_obbs, $enemy_obbs, $active_obbs; $event_dice = rand(0, 99); if ($event_dice < $event_obbs) { include_once GAME_ROOT . './include/game/event.func.php'; event(); $mode = 'command'; return; } include_once GAME_ROOT . './include/game/attr.func.php'; $mode_dice = rand(0, 99); if ($mode_dice < $schmode) { global $db, $tablepre, $pid, $corpse_obbs, $teamID, $fog, $gamestate, $bid; if ($gamestate < 40) { $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='{$pls}' AND pid!='{$pid}' AND pid!='{$bid}'"); } else { $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='{$pls}' AND pid!='{$pid}'"); } if (!$db->num_rows($result)) { $log .= '这里似乎已经没有人在了。<br>'; $mode = 'command'; return; } $enemynum = $db->num_rows($result); $enemyarray = range(0, $enemynum - 1); shuffle($enemyarray); $find_r = get_find_r($weather, $pls, $pose, $tactic, $club, $inf); $find_obbs = $enemy_obbs + $find_r; foreach ($enemyarray as $enum) { $db->data_seek($result, $enum); $edata = $db->fetch_array($result); if ($edata['hp'] > 0) { $hide_r = get_hide_r($weather, $pls, $edata['pose'], $edata['tactic'], $edata['club'], $edata['inf']); $enemy_dice = rand(0, 99); if ($enemy_dice < $find_obbs - $hide_r) { if ($teamID && !$fog && $teamID == $edata['teamID']) { include_once GAME_ROOT . './include/game/battle.func.php'; findteam($edata); return; } else { $active_r = get_active_r($weather, $pls, $pose, $tactic, $club, $inf); $active_dice = rand(0, 99); if ($active_dice < $active_obbs + $active_r) { include_once GAME_ROOT . './include/game/battle.func.php'; findenemy($edata); return; } else { include_once GAME_ROOT . './include/game/combat.func.php'; combat($edata, 0); return; } } } } else { $corpse_dice = rand(0, 99); if ($corpse_dice < $corpse_obbs) { if ($gamestate < 40 && ($edata['weps'] && $edata['wepe'] || $edata['arbs'] && $edata['arbe'] || $edata['arhs'] || $edata['aras'] || $edata['arfs'] || $edata['arts'] || $edata['itms0'] || $edata['itms1'] || $edata['itms2'] || $edata['itms3'] || $edata['itms4'] || $edata['itms5'] || $edata['money'])) { include_once GAME_ROOT . './include/game/battle.func.php'; findcorpse($edata); return; } else { discover(50); return; } } } } $log .= '似乎有什么人潜藏着┅┅士兵吗?<br>'; $mode = 'command'; return; } else { $find_r = get_find_r($weather, $pls, $pose, $tactic, $club, $inf); $find_obbs = $item_obbs + $find_r; $item_dice = rand(0, 99); if ($item_dice < $find_obbs) { $mapfile = GAME_ROOT . "./gamedata/mapitem/{$pls}mapitem.php"; $mapitem = openfile($mapfile); $itemnum = sizeof($mapitem) - 1; if ($itemnum <= 0) { $log .= "这里似乎什么都没有了。<br>"; $mode = 'command'; return; } $itemno = rand(1, $itemnum); global $itm0, $itmk0, $itme0, $itms0, $itmsk0; list($itm0, $itmk0, $itme0, $itms0, $itmsk0) = explode(',', $mapitem[$itemno]); array_splice($mapitem, $itemno, 1); writeover($mapfile, implode('', $mapitem), 'wb'); unset($mapitem); if ($itms0) { include_once GAME_ROOT . './include/game/itemmain.func.php'; itemfind(); return; } else { $log .= "但是什么都没有发现。<br>"; } } else { $log .= "但是什么都没有发现。<br>"; } } $mode = 'command'; return; }