Tokiwa Battle Royale  GE777
A PHP Battle Royale inspired game
 All Data Structures Namespaces Files Functions Variables Pages
amarillo.func.php
Go to the documentation of this file.
1 <?php
2 
3 if(!defined('IN_GAME')) {
4  exit('Access Denied');
5 }
6 
7 function move($moveto = 99) {
8  global $log,$pls,$plsinfo,$inf,$hp,$sp,$club,$arealist,$areanum,$hack,$areainfo,$gamestate,$pose,$weather;
9 
10  $plsnum = sizeof($plsinfo);
11  if(($moveto == 'main')||($moveto < 0 )||($moveto >= $plsnum)){
12  $log .= '请选择正确的移动地点。<br>';
13  return;
14  } elseif($pls == $moveto){
15  $log .= '相同地点,不需要移动。<br>';
16  return;
17  } elseif(array_search($moveto,$arealist) <= $areanum && !$hack){
18  $log .= $plsinfo[$moveto].'是禁区,还是离远点吧!';
19  return;
20  }
21 
22  //足部受伤,20;足球社,12;正常,15;
23 
24  if(strpos($inf, 'f') !== false){ $movesp = 20; }
25  elseif($club == 6){ $movesp = 12; }
26  else{ $movesp = 15; }
27 
28  if($sp <= $movesp){
29  $log .= '体力不足,不能移动,还是先睡会儿吧!';
30  return;
31  }
32 
33  $sp -= $movesp;
34  if($weather == 11) {
35  if($hack){$pls = rand(0,sizeof($plsinfo)-1);}
36  else {$pls = rand($areanum+1,sizeof($plsinfo)-1);}
37  $log = ($log . "你刚迈出脚步,就被一阵龙卷风吹到了 <span class=\"yellow\">$plsinfo[$pls]</span> !<br>");
38  } elseif($weather == 13) {
39  $damage = rand(1,3);
40  $hp -= $damage;
41  $log .= "被 <span class=\"blue\">冰雹</span> 击中,导致生命减少了 <span class=\"red\">$damage</span> 点!<br>";
42  if($hp <= 0 ) {
43  include_once GAME_ROOT.'./include/state.func.php';
44  death('hsmove');
45  return;
46  } else {
47  $pls = $moveto;
48  $log .= "移动到了 <span class=\"yellow\">$plsinfo[$pls]</span> 。<br>";
49  }
50  } else {
51  $pls = $moveto;
52  $log .= "移动到了 <span class=\"yellow\">$plsinfo[$pls]</span> 。<br>";
53  }
54 
55  if(strpos($inf, 'p') !== false){
56  $damage = rand(4,77);
57  $hp -= $damage;
58  $log .= "毒发导致生命减少了 <span class=\"red\">$damage</span> 点!<br>";
59  if($hp <= 0 ){
60  include_once GAME_ROOT.'./include/state.func.php';
61  death('pmove');
62  return;
63  }
64  }
65  $log .= $areainfo[$pls];
66  if(($gamestate>=40)&&($pose!=3)){
67  discover(100);
68  } else {
69  discover(70);
70  }
71  return;
72 
73 }
74 
75 function search(){
76  global $log,$pls,$arealist,$areanum,$hack,$plsinfo,$club,$sp,$gamestate,$pose,$weather,$hp;
77 
78  if(array_search($pls,$arealist) <= $areanum && !$hack){
79  $log .= $plsinfo[$pls].'是禁区,还是赶快逃跑吧!';
80  return;
81  }
82 
83  //腕部受伤,20;侦探社,12;正常,15;
84 
85  if(strpos($inf, 'a') !== false){ $schsp = 20; }
86  elseif($club == 10){ $schsp = 12; }
87  else{ $schsp = 15; }
88 
89  if($sp <= $schsp){
90  $log .= '体力不足,不能探索,还是先睡会儿吧!';
91  return;
92  }
93 
94  if($weather == 13) {
95  $hp --;
96  $log .= "被 <span class=\"blue\">冰雹</span> 击中,导致生命减少了 <span class=\"red\">1</span> 点!<br>";
97  if($hp <= 0 ) {
98  include_once GAME_ROOT.'./include/state.func.php';
99  death('hsmove');
100  return;
101  }
102  }
103  $sp -= $schsp;
104  $log .= '你仔细搜索着周围的一切。。。<br>';
105  if(($gamestate>=40)&&($pose!=3)) {
106  discover(100);
107  } else {
108  discover(30);
109  }
110  return;
111 
112 }
113 
114 function discover($schmode = 0) {
115  global $log,$mode,$command,$cmd,$event_obbs,$weather,$pls,$club,$pose,$tactic,$inf,$item_obbs,$enemy_obbs,$active_obbs;
116 
117  $event_dice = rand(0,99);
118  if($event_dice < $event_obbs){
119  include_once GAME_ROOT.'./include/game/event.func.php';
120  event();
121  $mode = 'command';
122  return;
123  }
124 
125  include_once GAME_ROOT.'./include/game/attr.func.php';
126 
127  $mode_dice = rand(0,99);
128  if($mode_dice < $schmode ) {
129  global $db,$tablepre,$pid,$corpse_obbs,$teamID,$fog,$gamestate,$bid;
130  if($gamestate < 40) {
131  $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='$pls' AND pid!='$pid' AND pid!='$bid'");
132  } else {
133  $result = $db->query("SELECT * FROM {$tablepre}players WHERE pls='$pls' AND pid!='$pid'");
134  }
135  if(!$db->num_rows($result)){
136  $log .= '这里似乎已经没有人在了。<br>';
137  $mode = 'command';
138  return;
139  }
140 
141  $enemynum = $db->num_rows($result);
142  $enemyarray = range(0, $enemynum - 1);
143  shuffle($enemyarray);
144  $find_r = get_find_r($weather,$pls,$pose,$tactic,$club,$inf);
145  $find_obbs = $enemy_obbs + $find_r;
146 
147  foreach($enemyarray as $enum){
148  $db->data_seek($result, $enum);
149  $edata = $db->fetch_array($result);
150  if($edata['hp'] > 0) {
151  $hide_r = get_hide_r($weather,$pls,$edata['pose'],$edata['tactic'],$edata['club'],$edata['inf']);
152  $enemy_dice = rand(0,99);
153  if($enemy_dice < ($find_obbs - $hide_r)) {
154  if($teamID&&(!$fog)&&($teamID == $edata['teamID'])){
155  include_once GAME_ROOT.'./include/game/battle.func.php';
156  findteam($edata);
157  return;
158  } else {
159  $active_r = get_active_r($weather,$pls,$pose,$tactic,$club,$inf);
160  $active_dice = rand(0,99);
161  if($active_dice < $active_obbs + $active_r) {
162  include_once GAME_ROOT.'./include/game/battle.func.php';
163  findenemy($edata);
164  return;
165  } else {
166  include_once GAME_ROOT.'./include/game/combat.func.php';
167  combat($edata,0);
168  return;
169  }
170  }
171  }
172  } else {
173  $corpse_dice = rand(0,99);
174  if($corpse_dice < $corpse_obbs) {
175  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'])){
176  include_once GAME_ROOT.'./include/game/battle.func.php';
177  findcorpse($edata);
178  return;
179  } else {
180  discover(50);
181  return;
182  }
183  }
184  }
185  }
186  $log .= '似乎有什么人潜藏着┅┅士兵吗?<br>';
187  $mode = 'command';
188  return;
189  } else {
190  $find_r = get_find_r($weather,$pls,$pose,$tactic,$club,$inf);
191  $find_obbs = $item_obbs + $find_r;
192  $item_dice = rand(0,99);
193  if($item_dice < $find_obbs) {
194  $mapfile = GAME_ROOT."./gamedata/mapitem/{$pls}mapitem.php";
195  $mapitem = openfile($mapfile);
196  $itemnum = sizeof($mapitem) - 1;
197  if($itemnum <= 0){
198  $log .= "这里似乎什么都没有了。<br>";
199  $mode = 'command';
200  return;
201  }
202  $itemno = rand(1,$itemnum);
203  global $itm0,$itmk0,$itme0,$itms0,$itmsk0;
204  list($itm0,$itmk0,$itme0,$itms0,$itmsk0) = explode(',', $mapitem[$itemno]);
205  array_splice($mapitem,$itemno,1);
206  writeover($mapfile,implode('', $mapitem),'wb');
207  unset($mapitem);
208 
209  if($itms0){
210  include_once GAME_ROOT.'./include/game/itemmain.func.php';
211  itemfind();
212  return;
213  } else {
214  $log .= "但是什么都没有发现。<br>";
215  }
216  } else {
217  $log .= "但是什么都没有发现。<br>";
218  }
219  }
220  $mode = 'command';
221  return;
222 
223 }
224 
225 
226 
227 ?>
$inf
Definition: botservice.php:49
$tablepre
Definition: config.inc.php:58
if(!defined('IN_GAME')) findenemy(&$w_pdata)
Definition: battle.func.php:9
get_active_r($weather=0, $pls=0, $pose=0, $tactic=0, $club=0, $inf= '', $wpose=0)
Definition: attr.func.php:51
writeover($filename, $data, $method="rb+", $iflock=1, $check=1, $chmod=1)
$areainfo
$event_obbs
Definition: gamecfg_1.php:82
$areanum
Definition: gameinfo.php:9
findcorpse(&$w_pdata)
Definition: battle.func.php:80
$corpse_obbs
Definition: gamecfg_1.php:92
findteam(&$w_pdata)
Definition: battle.func.php:45
if(!defined('IN_GAME')) event()
Definition: event.func.php:6
itemfind()
$plsinfo
get_find_r($weather=0, $pls=0, $pose=0, $tactic=0, $club=0, $inf= '')
Definition: attr.func.php:17
$active_obbs
Definition: gamecfg_1.php:94
discover($schmode=0)
$db
Definition: clear.php:32
【生存者数:<?php echo $alivenum?> 人】< input type="button"value="显示全部幸存者"onClick="$('alivemode').value='all';$('gbmode').value='none';postCmd('alive','alive.php');"></p > if($gamblingon &&$gamestate >=20) elseif($gamblingon &&$gamestate<=10)
Definition: 1_alive.tpl.php:18
const GAME_ROOT
Definition: clear.php:6
$log
Definition: botservice.php:34
$weather
Definition: gameinfo.php:11
openfile($filename)
$hack
Definition: gameinfo.php:12
$arealist
Definition: gameinfo.php:8
$gamestate
Definition: gameinfo.php:4
search()
get_hide_r($weather=0, $pls=0, $pose=0, $tactic=0, $club=0, $inf= '')
Definition: attr.func.php:36
$cmd
Definition: botservice.php:51
$enemy_obbs
Definition: gamecfg_1.php:90
$item_obbs
Definition: gamecfg_1.php:88
if(!defined( 'IN_GAME')) death($death, $kname= '', $ktype=0, $annex= '')
Definition: state.func.php:7
if(!$cuser||!$cpass) $result
Definition: admin.php:25
if(!defined( 'IN_GAME')) combat($active=1, $wep_kind= '')
Definition: combat.func.php:7
if(!defined('IN_GAME')) move($moveto=99)