Commit 659fc7e1 authored by hisuinohoshi's avatar hisuinohoshi

fix

修正:
- SANMA使用的旧数据结构会引起的一系列问题;

开发相关:
- 修正了部分在php8环境下会引起报错的问题;
- 将combat.func.php内残留的checkdmg()与addnoise()移至revcombat.func.php,彻底告别旧战斗文件;
- 部分tips内容移至tooltip_1.php;
parent d3e5903c
......@@ -530,7 +530,7 @@ if($hp > 0){
} elseif($mode == 'deathnote') {
if($dnname){
include_once GAME_ROOT.'./include/game/item2.func.php';
deathnote($item,$dnname,$dndeath,$dngender,$dnicon,$name);
deathnote($name,$item,$dnname,$dndeath,$dngender,$dnicon);
} else {
$log .= '嗯,暂时还不想杀人。<br>你合上了■DeathNote■。<br>';
$mode = 'command';
......
This diff is collapsed.
This diff is collapsed.
......@@ -200,7 +200,7 @@ class dbstuff {
foreach($fields as $val){
if(!empty(${$val.'qry'})){
${$val.'qry'} .= "END) ";
$query .= "$val = ${$val.'qry'},";
$query .= "$val = {${$val.'qry'}},";
}
}
......
......@@ -192,7 +192,7 @@ class dbstuff {
foreach($fields as $val){
if(!empty(${$val.'qry'})){
${$val.'qry'} .= "END) ";
$query .= "$val = ${$val.'qry'},";
$query .= "$val = {${$val.'qry'}},";
}
}
......
......@@ -58,9 +58,10 @@ function fetch_achievement_rev($which,$who)
if(!empty($ach))
{
$ach = print_achievement_rev($ach);
if(empty($ach[$which]['v'])) $ach[$which]['v'] = 0;
// 保存的成就进度 >= 9999999时 返回9999999 这是为了兼容旧版成就
if(isset($ach[$which]['v']) && !is_array($ach[$which]['v'])) $value = $ach[$which]['v'] >= 99999999 ? 99999999 : $ach[$which]['v'];
if(is_array($ach[$which]['v'])) $value = $ach[$which]['v'];
$value = $ach[$which]['v'];
if(!is_array($value)) $value = min(99999999,$value);
}
//echo "成就值检索阶段: 成就{$which} 的值 = {$value}<br>";
return $value;
......
......@@ -42,7 +42,9 @@ function aievent($rate){
//echo "静流已放出。";
$checkSanma = $db->query("SELECT * FROM {$tablepre}players WHERE type = 15 AND name = '【SANMA_TK】'");
$sdata = $db->fetch_array($checkSanma);
# 不准直接从数据库拉玩家数据了
$spid = $sdata['pid'];
$sdata = fetch_playerdata_by_pid($spid);
// $db->query("INSERT INTO {$tablepre}chat (type,`time`,send,recv,msg) VALUES ('2','$now','SANMA_TK','$splsinfo','……静流已抵达{$splsinfo}并待机。')");
if($sdata['hp'] <= 0){//若静流已死则中止循环,更新标签
$gamevars['sanmadead'] = 1;
......@@ -61,17 +63,21 @@ function aievent($rate){
}
$rplist[$rptopdata['pid']] = $rptopdata;
if(!$sdata['achievement']){//AI一些信息的储存位置
/*if(!$sdata['achievement']){//AI一些信息的储存位置
$sdata['achievement'] = Array('chatid' => 0, 'curenum' => 0);
}else{
$sdata['achievement'] = json_decode($sdata['achievement'],true);
}
$svars = & $sdata['achievement'];
$svars = & $sdata['achievement'];*/
# AI信息现在储存在clbpara内
if(empty($sdata['clbpara']['chatid'])) $sdata['clbpara']['chatid'] = 0;
if(empty($sdata['clbpara']['curenum'])) $sdata['clbpara']['curenum'] = 0;
$svars = & $sdata['clbpara'];
$chatid = & $svars['chatid'];
$curenum = & $svars['curenum'];
//AI聊天卖萌部分
//AI读取聊天记录
if(!$chatid){$chatid = 0;}
$chatdata = Array();
......@@ -226,13 +232,13 @@ function aievent($rate){
$sdata['pose'] = 2;$sdata['tactic'] = 3;//静流姿态变为强袭+反击
//$sdata['l']
$updflag = true;
$db->array_update("{$tablepre}players", $sdata, " pid = '$spid'");//先更为敬,虽然其实可以巧妙构筑流程减少这一次更新
//$db->array_update("{$tablepre}players", $sdata, " pid = '$spid'");//先更为敬,虽然其实可以巧妙构筑流程减少这一次更新
$splsinfo = $plsinfo[$sdata['pls']];
$cht = $sanmachat['move']; shuffle($cht); $cht = $cht[0]; $cht = str_replace('[pls]',$splsinfo,$cht);
$db->query("INSERT INTO {$tablepre}chat (type,`time`,send,recv,msg) VALUES ('2','$now','【SANMA_TK】','','{$cht}')");
}
if($cmbtflg){
if(is_array($sdata['achievement'])){$sdata['achievement'] = json_encode($sdata['achievement']);}
//if(is_array($sdata['achievement'])){$sdata['achievement'] = json_encode($sdata['achievement']);}
$aidata = $sdata;
//echo '静流开始对你实施追击。';
$sanmams = $name;
......@@ -259,9 +265,11 @@ function aievent($rate){
$db->query("INSERT INTO {$tablepre}chat (type,`time`,send,recv,msg) VALUES ('2','$now','【SANMA_TK】','','{$cht}')");
}
}
if($updflag){//前面所有需要更新的部分一并更新
if(is_array($sdata['achievement'])){$sdata['achievement'] = json_encode($sdata['achievement']);}
$db->array_update("{$tablepre}players", $sdata, " pid = '$spid'");
if($updflag)
{
//if(is_array($sdata['achievement'])){$sdata['achievement'] = json_encode($sdata['achievement']);}
//$db->array_update("{$tablepre}players", $sdata, " pid = '$spid'");
player_save($sdata);
}
}
}
......
......@@ -126,7 +126,7 @@ function itemuse($itmn,&$data=NULL) {
$itme = $itmet;
$itms = $itmst;
$itmsk = $itmskt;
$log .= "卸下了<span class=\"red\">$itm</span>,装备了<span class=\"yellow\">${$eqp}</span>。<br>";
$log .= "卸下了<span class=\"red\">$itm</span>,装备了<span class=\"yellow\">{${$eqp}}</span>。<br>";
}
} elseif (strpos ( $itmk, 'HS' ) === 0) {
//global $sp, $msp,$club;
......@@ -852,13 +852,13 @@ function itemuse($itmn,&$data=NULL) {
//global ${'itm' . $i}, ${'itmk' . $i}, ${'itme' . $i}, ${'itms' . $i};
if (${'itmk' . $i} == 'E'.$bat_kind && ${'itms' . $i}) {
if(${'itme' . $i} >= $elec_cap){
$log .= "包裹{$i}里的<span class=\"yellow\">${'itm'.$i}</span>已经充满电了。<br>";
$log .= "包裹{$i}里的<span class=\"yellow\">{${'itm'.$i}}</span>已经充满电了。<br>";
}else{
${'itme' . $i} += $itme;
if(${'itme' . $i} > $elec_cap){${'itme' . $i} = $elec_cap;}
$itms --;
$flag = true;
$log .= "为包裹{$i}里的<span class=\"yellow\">${'itm'.$i}</span>充了电。";
$log .= "为包裹{$i}里的<span class=\"yellow\">{${'itm'.$i}}</span>充了电。";
break;
}
}
......@@ -1040,7 +1040,7 @@ function itemuse($itmn,&$data=NULL) {
${'itme' . $i} += $itme;
$itms --;
$flag = true;
$log .= "为<span class=\"yellow\">${'itm'.$i}</span>充了电。";
$log .= "为<span class=\"yellow\">{${'itm'.$i}}</span>充了电。";
break;
}
}
......@@ -1200,7 +1200,7 @@ function itemuse($itmn,&$data=NULL) {
${'itme' . $i} += $itme;
$itms --;
$flag = true;
$log .= "为<span class=\"yellow\">${'itm'.$i}</span>充了电。";
$log .= "为<span class=\"yellow\">{${'itm'.$i}}</span>充了电。";
break;
}
}
......@@ -2134,7 +2134,7 @@ function itemuse($itmn,&$data=NULL) {
//global ${'itmsk' . $i};
if ((strpos ( ${'itmsk' . $i}, 'Z' ) !== false) && (strpos ( ${'itm' . $i}, '宝石』' ) === false)) {
//global ${'itm' . $i}, ${'itme' . $i}, ${'itms' . $i};
$cmd .= '<input type="radio" name="command" id="itm' . $i . '" value="itm' . $i . '"><a onclick=sl("itm' . $i . '"); href="javascript:void(0);" >' . "${'itm'.$i}/${'itme'.$i}/${'itms'.$i}" . '</a><br>';
$cmd .= '<input type="radio" name="command" id="itm' . $i . '" value="itm' . $i . '"><a onclick=sl("itm' . $i . '"); href="javascript:void(0);" >' . "{${'itm'.$i}}/{${'itme'.$i}}/{${'itms'.$i}}" . '</a><br>';
$flag = true;
}
}
......@@ -2154,14 +2154,14 @@ function itemuse($itmn,&$data=NULL) {
if ( strpos ( ${'itm' . $i} , $fruit ) !== false && strpos ( ${'itm' . $i} , '皮' ) === false && strpos ( ${'itm' . $i} , '■' ) === false && (strpos ( ${'itmk' . $i} , 'H' ) === 0 || strpos ( ${'itmk' . $i} , 'P' ) === 0 )) {
if($wk >= 120){
$log .= "练过刀就是好啊。你娴熟地削着果皮。<br><span class=\"yellow\">${'itm'.$i}</span>变成了<span class=\"yellow\">★残骸★</span>!<br>咦为什么会出来这种东西?算了还是不要吐槽了。<br>";
$log .= "练过刀就是好啊。你娴熟地削着果皮。<br><span class=\"yellow\">{${'itm'.$i}}</span>变成了<span class=\"yellow\">★残骸★</span>!<br>咦为什么会出来这种东西?算了还是不要吐槽了。<br>";
${'itm' . $i} = '★残骸★';
${'itme' . $i} *= rand(2,4);
${'itms' . $i} *= rand(3,5);
$flag = true;
$wk++;
}else{
$log .= "想削皮吃<span class=\"yellow\">${'itm'.$i}</span>,没想到削完发现只剩下一堆果皮……<br>手太笨拙了啊。<br>";
$log .= "想削皮吃<span class=\"yellow\">{${'itm'.$i}}</span>,没想到削完发现只剩下一堆果皮……<br>手太笨拙了啊。<br>";
${'itm' . $i} = str_replace($fruit, $fruit.'皮',${'itm' . $i} );
${'itmk' . $i} = 'TN';
${'itms' . $i} *= rand(2,4);
......
......@@ -47,8 +47,8 @@ function poison($itmn = 0) {
elseif($art == '毒物说明书'){$itmk = substr_replace($itmk,'1',2,1);};
if($art == '妖精的羽翼') {$itmk = substr_replace($itmk,'H',0,1);$log .= "一种神秘的力量净化了毒药,你的毒药变成了解毒剂!";}
$itmsk = $pid;
if($art == '妖精的羽翼') {$log .= "使用了 <span class=\"red\">$poison</span> ,<span class=\"yellow\">${'itm'.$itmn}</span> 被净化了!<br>";}
else {$log .= "使用了 <span class=\"red\">$poison</span> ,<span class=\"yellow\">${'itm'.$itmn}</span> 被下毒了!<br>";}
if($art == '妖精的羽翼') {$log .= "使用了 <span class=\"red\">$poison</span> ,<span class=\"yellow\">{${'itm'.$itmn}}</span> 被净化了!<br>";}
else {$log .= "使用了 <span class=\"red\">$poison</span> ,<span class=\"yellow\">{${'itm'.$itmn}}</span> 被下毒了!<br>";}
$poisons--;
if($poisons <= 0){
$log .= "<span class=\"red\">$poison</span> 用光了。<br>";
......@@ -253,7 +253,7 @@ function newradar($m = 0){
foreach ($npctplist as $j){
//${'npc'.$j.'num'}[$i] = "<span class=\"yellow b\">${'num'.$j}</span>";
if(${'num'.$j}){
${'npc'.$j.'num'}[$i] ="<span class=\"yellow b\">${'num'.$j}</span>";
${'npc'.$j.'num'}[$i] ="<span class=\"yellow b\">{${'num'.$j}}</span>";
} else {
${'npc'.$j.'num'}[$i] ='<span class="yellow b">-</span>';
}
......@@ -381,7 +381,7 @@ function divining2($u) {
return "$uphp,$upatt,$updef";
}
function deathnote($itmd=0,$dnname='',$dndeath='',$dngender='m',$dnicon=1,$sfn) {
function deathnote($sfn,$itmd=0,$dnname='',$dndeath='',$dngender='m',$dnicon=1) {
global $db,$tablepre,$log,$killnum,$mode,$achievement,$pdata;
global ${'itm'.$itmd},${'itms'.$itmd},${'itmk'.$itmd},${'itme'.$itmd},${'itmsk'.$itmd};
$dn = & ${'itm'.$itmd};
......
......@@ -320,7 +320,7 @@ function replace_itembag(&$keep){
}else{
$i = $r_flag;
global ${'itm'.$i},${'itmk'.$i},${'itme'.$i},${'itms'.$i},${'itmsk'.$i};
$db->query("INSERT INTO {$tablepre}mapitem (itm, itmk, itme, itms, itmsk ,pls) VALUES ('${'itm'.$i}', '${'itmk'.$i}', '${'itme'.$i}', '${'itms'.$i}', '${'itmsk'.$i}', '$pls')");
$db->query("INSERT INTO {$tablepre}mapitem (itm, itmk, itme, itms, itmsk ,pls) VALUES ({${'itm'.$i}}, {${'itmk'.$i}}, {${'itme'.$i}}, {${'itms'.$i}}, {${'itmsk'.$i}}, '$pls')");
${'itm'.$i} = $itm0;
${'itmk'.$i} = $itmk0;
${'itme'.$i} = $itme0;
......
......@@ -172,7 +172,7 @@
$gamevars['wth18pid'] = $pid;
save_gameinfo();
addnews($now, 'wthchange', $name, $weather, '自己积攒的善德');
include_once GAME_ROOT.'./include/game/combat.func.php';
include_once GAME_ROOT.'./include/game/revcombat.func.php';
$sn = 'song';
addnoise($sn,'__',$now,$pls,0,0,$sn);
$clbpara['event_bgmbook'] = Array('wth18');
......
......@@ -5,7 +5,7 @@
}
//include_once GAME_ROOT.'./include/game/dice.func.php';
include_once GAME_ROOT.'./include/game/attr.func.php';
include_once GAME_ROOT.'./include/game/combat.func.php';
//include_once GAME_ROOT.'./include/game/combat.func.php';
include_once GAME_ROOT.'./include/game/titles.func.php';
include_once GAME_ROOT.'./include/game/revcombat.calc.php';
include_once GAME_ROOT.'./include/game/revattr.func.php';
......@@ -1436,4 +1436,82 @@
}
}
function checkdmg($p1, $p2, $d) {
if ($d < 0) {
$words = "{$p1}{$p2}回复了<span class=\"lime\">".abs($d)."</span>点生命……这是咋回事呢?";
} elseif (($d >= 100) && ($d < 150)) {
$words = "{$p1}{$p2}施加了一定程度的伤害。(100-150)";
} elseif (($d >= 150) && ($d < 200)) {
$words = "{$p1}拿了什么神兵?{$p2}所受的损伤已经不可忽略了。(150-200)";
} elseif (($d >= 200) && ($d < 250)) {
$words = "{$p1}简直不是人!{$p2}只能狼狈招架。(200-250)";
} elseif (($d >= 250) && ($d < 300)) {
$words = "{$p1}发出会心一击!{$p2}瞬间损失了大量生命!(250-300)";
} elseif (($d >= 300) && ($d < 400)) {
$words = "{$p1}使出浑身解数奋力一击!{$p2}想必凶多吉少!(300-400)";
} elseif (($d >= 400) && ($d < 500)) {
$words = "{$p1}使出武器中内藏的力量!可怜的{$p2}已经承受不住凶残的攻击了!(400-500)";
} elseif (($d >= 500) && ($d < 600)) {
$words = "{$p1}眼色一变使出绝招!{$p2}无法抵挡,只能任人宰割!(500-600)";
} elseif (($d >= 600) && ($d < 750)) {
$words = "{$p1}手中的武器闪耀出七彩光芒!{$p2}的身躯几乎融化在光芒中!(600-750)";
} elseif (($d >= 750) && ($d < 1000)) {
$words = "{$p1}受到天神的加护,打出惊天动地的一击!{$p2}此刻已不成人形!(750-1000)";
} elseif (($d >= 1000) && ($d < 5000)) {
$words = "{$p1}燃烧自己的生命得到了不可思议的力量!{$p2},你还活着吗?(1000-5000)";
} elseif (($d >= 5000) && ($d < 10000)) {
$words = "{$p1}超越自己的极限爆发出了震天动地的力量!受此神力摧残的{$p2}化作了一颗流星!(5000-10000)";
} elseif (($d >= 10000) && ($d < 50000)) {
$words = "{$p1}运转百万匹周天,吐气扬声,一道霸气的光束直逼{$p2},后者的身躯瞬间被力量的洪流所吞没!(10000-50000)";
} elseif (($d >= 50000) && ($d < 200000)) {
$words = "{$p1}已然超越了人类的极限!【{$d}】点的伤害——疾风怒涛般的攻击令大地崩塌,而{$p2}几乎化为齑粉!";
} elseif (($d >= 200000) && ($d < 500000)) {
$words = "鬼哭神嚎!风暴既逝,{$p1}仍然屹立在战场上,而受到了【{$d}】点伤害的{$p2}想必已化为宇宙的尘埃了!";
} elseif ( $d >= 500000) {
$words = "残虐的攻击已经无法用言语形容!将{$p2}击飞出【{$d}】点伤害的英雄——{$p1}!让我们记住他的名字吧!";
} else {
$words = '';
}
if ($words) {
addnews ( 0, 'damage', $words );
}
return;
}
function addnoise($wp_kind, $wsk, $ntime, $npls, $nid1, $nid2, $nmode) {
//在隐藏地图内不会传出声音信息
global $plsinfo;
if(!array_key_exists($npls,$plsinfo)) return;
if ((($wp_kind == 'G') && (strpos ( $wsk, 'S' ) === false)) || ($wp_kind == 'F')) {
global $noisetime, $noisepls, $noiseid, $noiseid2, $noisemode;
$noisetime = $ntime;
$noisepls = $npls;
$noiseid = $nid1;
$noiseid2 = $nid2;
$noisemode = $nmode;
save_combatinfo ();
} elseif (strpos ( $wsk, 'd' ) !== false){
global $noisetime, $noisepls, $noiseid, $noiseid2, $noisemode;
$noisetime = $ntime;
$noisepls = $npls;
$noiseid = $nid1;
$noiseid2 = $nid2;
$noisemode = 'D';
save_combatinfo ();
}
if (strlen($wp_kind)>=3){
global $noisetime, $noisepls, $noiseid, $noiseid2, $noisemode,$wep;
$noisetime = $ntime;
$noisepls = $npls;
$noiseid = $nid1;
$noiseid2 = $nid2;
$noisemode = $wp_kind;
save_combatinfo ();
}
return;
}
?>
\ No newline at end of file
......@@ -368,7 +368,7 @@ function search(&$data=NULL){
}
function move_search_events(&$data=NULL,$act)
function move_search_events(&$data,$act)
{
global $log,$inf_move_hp,$inf_move_sp,$infwords,$weather,$gamevars,$now,$elements_info;
......
......@@ -16,7 +16,7 @@
//$log.=$sn.'_'.$now.'_'.$pls.'_'.$name."<br>";
$r=$arte;
include_once GAME_ROOT.'./include/game/combat.func.php';
include_once GAME_ROOT.'./include/game/revcombat.func.php';
if ($ss>=$r){
$ss-=$r;
......
......@@ -285,11 +285,11 @@ function load_gameinfo() {
global $hdamage,$hplayer,$noisetime,$noisepls,$noiseid,$noiseid2,$noisemode;
$result = $db->query("SELECT * FROM {$tablepre}game");
$gameinfo = $db->fetch_array($result);
extract($gameinfo);
if(!empty($gameinfo)) extract($gameinfo);
$arealist = explode(',',$gameinfo['arealist']);
$gamevars = json_decode($gamevars,true);
$noisevars = json_decode($noisevars,true);
extract($noisevars);
if(!empty($noisevars)) extract($noisevars);
if(isset($gamevars['sanmaact']) && isset($gamevars['sanmadead'])) unset($gamevars['sanmaact']);
/*$gamenum = $gameinfo['gamenum'];
$gamestate = $gameinfo['gamestate'];
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment