Commit 6026d5fd authored by satsuki8's avatar satsuki8

add octitem

parent c5336dbe
......@@ -215,6 +215,7 @@
18,5,390,0,【歌单】蓝凝,Z,1,1,,
18,5,390,0,【歌单】冰炎,Z,1,1,,
18,5,390,0,【歌单】芙蓉,Z,1,1,,
18,5,20,0,棱镜八面体,Z,1,1,,
18,5,200,1,【我太帅啦!】,Z,1,1,,
18,5,200,1,【我太棒啦!】,Z,1,1,,
18,5,200,1,【我太强啦!】,Z,1,1,,
......
......@@ -4145,6 +4145,10 @@ function itemuse($itmn,&$data=NULL) {
$itme = $itms = 0;
# Sign
$clbpara['iAmRich'] += 1;
} elseif ($itm == '棱镜八面体'){
$log .= "你使用了<span class=\"yellow b\">{$itm}</span>。<br>";
$theitem = array('itm' => &$itm, 'itmk' => &$itmk, 'itme' => &$itme,'itms' => &$itms,'itmsk' => &$itmsk);
octitem_rotate($theitem, $itmn, 1);
} else {
$log .= " <span class=\"yellow\">$itm</span> 该如何使用呢?<br>";
}
......@@ -4191,4 +4195,57 @@ function itemuse($itmn,&$data=NULL) {
return;
}
function octitem_rotate(&$theitem, $rotpos, $showlog = 0)
{
global $log;
$itm=&$theitem['itm']; $itmk=&$theitem['itmk'];
$itme=&$theitem['itme']; $itms=&$theitem['itms']; $itmsk=&$theitem['itmsk'];
$oct_colors_words = array('<span class="red">红</span>','<span class="lime">绿</span>','<span class="clan">蓝</span>','<span class="yellow">黄</span>','<span class="gold">金</span>','<span class="linen">银</span>','<span class="mtgblack">黑</span>','<span class="mtgwhite">白</span>');
if (strlen($itmsk) != 16)
{
$oct_seq = range(0, 7);
shuffle($oct_seq);
$oct_colors = range(0, 7);
shuffle($oct_colors);
}
else
{
$itmsk_arr = str_split($itmsk);
$oct_seq = array_slice($itmsk_arr, 0, 8);
$oct_colors = array_slice($itmsk_arr, 8);
}
//改变选中面和另两个面的颜色
$oct_colors[$rotpos] = ($oct_colors[$rotpos] + 1) % 8;
$rotpos2 = ($rotpos + 1) % 8;
$oct_colors[$rotpos2] = ($oct_colors[$rotpos2] + 1) % 8;
$rotpos3 = ($rotpos + 2) % 8;
$oct_colors[$rotpos3] = ($oct_colors[$rotpos3] + 1) % 8;
$itmsk = implode('', $oct_seq).implode('', $oct_colors);
if ($showlog)
{
$log .= "<br><span class=\"yellow b\">{$itm}</span>八个面的颜色为:<br>";
foreach ($oct_seq as $v)
{
$log .= $oct_colors_words[$oct_colors[$v]].' ';
}
//$log .= "测试:真实序列为".implode('', $oct_colors);
$log .= "<br>";
}
//结果检查
$oc_count = count(array_unique($oct_colors));
if ($oc_count == 1)
{
if ($showlog)
{
$log .= "<span class=\"yellow b\">{$itm}</span>的形状发生了变化……<br>";
}
$itm = '★棱镜八面体模样的彩色糖果★'; $itmk = 'HM';
$itme = 88; $itms = 8; $itmsk = 'x';
}
}
?>
......@@ -600,6 +600,15 @@ function itemdrop($item,&$data=NULL) {
$mode = 'command';
return;
}
if ((strpos ( $itmk, 'Y' ) === 0 || strpos ( $itmk, 'Z' ) === 0) && ($itm == '棱镜八面体'))
{
$theitem = array('itm' => &$itm, 'itmk' => &$itmk, 'itme' => &$itme,'itms' => &$itms,'itmsk' => &$itmsk);
$log .= "<span class=\"yellow b\">{$itm}</span>似乎发生了变化……<br>";
include_once GAME_ROOT . './include/game/item.func.php';
octitem_rotate($theitem, 7);
}
if(strpos($itmsk,'v')!==false)
{
$log .= "{$itm}在地上化作点点碎片,随风消逝了。<br>";
......
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