This commit is contained in:
libccy 2015-11-13 09:43:16 +08:00
parent d4670293c7
commit f3a87bed83
19 changed files with 503 additions and 45 deletions

View File

@ -396,6 +396,7 @@ character.woods={
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=player&&ai.get.attitude(player,game.players[i])<1) list.push(game.players[i]);
}
if(list.length==0) return -1;
list.sort(function(a,b){
return b.num('h')-a.num('h');
});

View File

@ -1374,11 +1374,13 @@
map.chess_treasure.hide();
map.chess_obstacle.hide();
map.tafang_size.show();
map.tafang_turn.show();
}
else{
map.chess_treasure.show();
map.chess_obstacle.show();
map.tafang_size.hide();
map.tafang_turn.hide();
}
if(config.chess_mode=='combat'||config.chess_mode=='tafang'){
map.ban_weak.show();
@ -1387,6 +1389,17 @@
map.ban_weak.hide();
}
},
tafang_turn:{
name:'游戏胜利',
init:'20',
frequent:true,
item:{
'10':'十回合',
'20':'二十回合',
'30':'三十回合',
'1000':'无限',
}
},
tafang_size:{
name:'战场大小',
init:'9',
@ -1656,7 +1669,11 @@
'金钱可以用来招募随机武将,招到已有武将,或遣返不需要的武将时可得到招募令<li>'+
'战斗中有君主出场时可招降敌将成功率取决于敌将的稀有度、剩余体力值以及手牌数。成功后战斗立即结束且没有金钱奖励。每发动一次招降无论成功还是失败都会扣除10招募令<li>'+
'挑战武将会与该武将以及与其强度相近的武将进行战斗敌方人数与我方出场人数相同但不少于3。胜利后可通过招募令招募该武将<li>'+
'竞技场:<br>随机选择9名武将每次派出1〜3名武将参战。战斗中阵亡的武将不能再次上场。<br><br>战斗后武将进入疲劳状态,若立即再次出场则初始体力值-1。<br><br>战斗中本方武将行动时可召唤后援,令一名未出场的已方武将加入战斗。后援武将在战斗结束后无论存活与否均不能再次出场<br><br>当取得12场胜利或所有武将全部阵亡后结束并根据胜场数获得随机奖励',
'竞技场:<br>随机选择9名武将每次派出1〜3名武将参战。战斗中阵亡的武将不能再次上场。<br><br>战斗后武将进入疲劳状态,若立即再次出场则初始体力值-1。<br><br>战斗中本方武将行动时可召唤后援,令一名未出场的已方武将加入战斗。后援武将在战斗结束后无论存活与否均不能再次出场<br><br>当取得12场胜利或所有武将全部阵亡后结束并根据胜场数获得随机奖励'+
'<div style="margin:10px">塔防模式</div><ul style="margin-top:0"><li>阻上敌人到达最下方的出口,坚持到给定的回合数即获得胜利<li>'+
'在1~10回合每轮将新增1名敌人11~20回合每轮将新增2名敌人20回合后每轮将增加3名敌人<li>'+
'每轮可分配10个行动点用来布置机关、招募武将或令武将行动。未用完的行动点将减半并累积到下一轮<li>'+
'战场上最多出现3个相同的机关每个机关在置入战场3轮后消失。战场上最多招募10名友方角色。',
'炉石模式':'<ul><li>游戏流程类似1v1场上有两名主将进行对抗'+
'<li>主将出牌阶段的出牌数量行动值有上限先手为2后手为3装备牌不计入出牌上限<li>游戏每进行一轮,主将的出牌上限+1超过6时减至2并重新累加'+
'<li>牌堆中随机加入总量1/3的随从牌使用之可召唤一个随从随从出场时背面朝上。每一方在场的随从数不能超过4<li>随从于摸牌阶段摸牌基数为1随从的随从牌均视为闪装备牌均视为杀<li>'+
@ -8262,6 +8279,25 @@
},500);
}
},
tafangMe:function(player){
if(player){
game.me=player;
ui.me.lastChild.show();
ui.create.fakeme();
ui.handcards1=player.node.handcards1.animate('start').fix();
ui.handcards2=player.node.handcards2.animate('start').fix();
ui.me.appendChild(ui.handcards1);
ui.me.appendChild(ui.handcards2);
ui.updateh(true);
game.setChessInfo();
}
},
deleteChessPlayer:function(player){
if(player){
player.delete();
delete game.playerMap[player.dataset.position];
}
},
addChessPlayer:function(content){
game.addChessPlayer.apply(this,content);
},
@ -8631,6 +8667,9 @@
var dialog=ui.create.dialog('hidden');
dialog.content.innerHTML=str;
dialog.open();
if(lib.config.mode=='chess'){
dialog.classList.add('center');
}
}
},
reload:function(){
@ -12984,7 +13023,7 @@
lib.status.dateDelayed=0;
while(lib.arenaReady.length){
(lib.arenaReady.shift())();
(lib.init.eval(lib.arenaReady.shift()))();
}
delete lib.arenaReady;

Binary file not shown.

After

Width:  |  Height:  |  Size: 24 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 56 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 43 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 59 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 19 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 103 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 48 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 40 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 21 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 84 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 109 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 51 KiB

View File

@ -87,6 +87,12 @@ mode.chess={
lib.posmap[pos]=this;
this.chessFocus();
}
if(get.config('chess_mode')=='tafang'&&!_status.video){
if(_status.tafangend.contains(this.dataset.position)){
game.over(false);
}
}
return this;
},
canMoveTowards:function(target){
@ -102,7 +108,17 @@ mode.chess={
},
moveTowards:function(target){
var fxy=this.getXY();
var txy=target.getXY();
var txy;
if(Array.isArray(target)){
txy=target;
}
else if(typeof target=='string'){
var pos=parseInt(target);
txy=[pos%ui.chesswidth,Math.floor(pos/ui.chesswidth)];
}
else{
txy=target.getXY();
}
var dx=txy[0]-fxy[0];
var dy=txy[1]-fxy[1];
if(Math.abs(dx)>Math.abs(dy)){
@ -259,6 +275,12 @@ mode.chess={
},
dieAfter:function(source){
var player=this;
if(_status.friends){
_status.friends.remove(this);
}
if(_status.enemies){
_status.enemies.remove(this);
}
delete lib.posmap[player.dataset.position];
setTimeout(function(){
player.delete();
@ -278,6 +300,7 @@ mode.chess={
return;
}
}
if(get.config('chess_mode')=='tafang') return;
game.over(game.me.side==game.players[0].side);
},
$draw:function(num){
@ -494,6 +517,29 @@ mode.chess={
var randomMove=['moveUp','moveDown','moveLeft','moveRight'];
for(var iwhile=0;iwhile<num;iwhile++){
var targets=[];
if(get.config('chess_mode')=='tafang'&&_status.enemies.contains(player)){
var targets2=[];
for(var i=0;i<ui.chesswidth;i++){
var tafangdes=ui.chesswidth*(ui.chessheight-1)+i;
if(!lib.posmap[tafangdes]){
targets2.push(tafangdes);
}
}
targets2.sort(function(a,b){
return Math.abs(a%ui.chesswidth-player.getXY()[0])-Math.abs(b%ui.chesswidth-player.getXY()[0]);
});
var tafangmoved=false;
for(var i=0;i<targets2.length;i++){
if(player.moveTowards(targets2[i].toString())){
tafangmoved=true;
break;
}
}
if(tafangmoved){
event.moved=true;
}
continue;
}
for(var i=0;i<game.players.length;i++){
if(game.players[i].side!=player.side){
targets.push(game.players[i]);
@ -505,7 +551,6 @@ mode.chess={
while(targets.length){
var target=targets.shift();
if(player.moveTowards(target)){
// player.moveTowards(target);
event.moved=true;break;
}
if(targets.length==0){
@ -663,7 +708,7 @@ mode.chess={
lib.posmap[player.dataset.position]=player;
game.addVideo('addChessPlayer',null,[name,enemy,num,player.dataset.position]);
player.init(name);
if(num){
if(num&&!_status.video){
player.directgain(get.cards(num));
}
game.arrangePlayers();
@ -785,6 +830,7 @@ mode.chess={
next.content=function(){
'step 0'
_status.turnCount++;
ui.turnCount.innerHTML='回合'+get.cnNumber(_status.turnCount);
var dialog=ui.create.dialog('剩余行动点:'+(10+_status.remainingCount),'hidden');
dialog.style.height='260px';
dialog.style.top='calc(50% - 140px)';
@ -798,8 +844,16 @@ mode.chess={
var button=map.bufang[i];
button.node.intro.classList.add('showintro');
button.node.intro.classList.add('tafang');
button.node.intro.innerHTML='三';
button.count=3;
if(button.link=='chess_mech_nengliangqiu'||
button.link=='chess_mech_guangmingquan'||
button.link=='chess_mech_jiguanren'){
button.node.intro.innerHTML='三';
button.count=3;
}
else{
button.node.intro.innerHTML='四';
button.count=4;
}
button._link='布防';
}
map.zhaomu=ui.create.buttons(list,'character',dialog.content);
@ -844,6 +898,18 @@ mode.chess={
else if(i=='zhaomu'&&_status.friends.length+selectedZhaomu>=ui.chesswidth){
map[i][j].classList.add('unselectable');
}
else if(i=='bufang'){
var numbufang=0;
for(var k=0;k<game.treasures.length;k++){
if(game.treasures[k].name==map[i][j].link){
numbufang++;
}
if(numbufang>=3){
map[i][j].classList.add('unselectable');
break;
}
}
}
}
}
ui.dialog.content.firstChild.innerHTML='剩余行动点:'+count;
@ -859,12 +925,14 @@ mode.chess={
}
event.custom.add.window=function(clicked){
if(clicked) return;
if(event.step>1) return;
for(var i in map){
for(var j=0;j<map[i].length;j++){
map[i][j].classList.remove('selected');
map[i][j].classList.remove('unselectable');
}
}
updateSelected();
}
var update=function(link){
for(var i in map){
@ -903,7 +971,8 @@ mode.chess={
_status.lastTafangCommand='行动';
}
}
event.done=ui.create.control('完成',function(){
_status.imchoosing=true;
var eventdong=function(){
var selected=dialog.querySelectorAll('.button.selected');
event.bufang=[];
event.zhaomu=[];
@ -926,7 +995,8 @@ mode.chess={
event.xingdong.push(xingdongs[i].link);
}
game.resume();
});
};
event.done=ui.create.control('完成',eventdong);
if(_status.lastTafangCommand){
update(_status.lastTafangCommand);
}
@ -938,8 +1008,15 @@ mode.chess={
}
setTimeout(function(){
dialog.open();
updateSelected();
},50);
game.pause();
event.switchToAuto=eventdong;
if(!_status.auto){
game.pause();
}
else{
eventdong();
}
'step 1'
event.dialog.close();
event.control.close();
@ -957,19 +1034,29 @@ mode.chess={
event.chooseObstacle=true;
event.currentBufang=event.bufang.shift();
event.dialog=ui.create.dialog('选择一个位置放置【'+get.translation(event.currentBufang)+'】');
game.pause();
if(!_status.auto){
game.pause();
}
else{
event.obstacle=event.obstacles.randomGet();
}
event.switchToAuto=function(){
event.obstacle=event.obstacles.randomGet();
game.resume();
};
}
else{
delete event.bufang;
}
'step 3'
_status.imchoosing=false;
if(event.dialog){
event.dialog.close();
delete event.dialog;
}
if(event.chooseObstacle){
game.removeObstacle(event.obstacle.dataset.position);
game.addChessPlayer(event.currentBufang,'treasure',0,event.obstacle.dataset.position);
game.addChessPlayer(event.currentBufang,'treasure',0,event.obstacle.dataset.position).life=3;
event.chooseObstacle=false;
event.goto(2);
}
@ -1005,6 +1092,7 @@ mode.chess={
ui.me.appendChild(ui.handcards2);
ui.updateh(true);
game.setChessInfo();
game.addVideo('tafangMe',player);
}
this.delete();
event.redo();
@ -1022,12 +1110,21 @@ mode.chess={
}
}
game.pause();
if(_status.auto){
setTimeout(function(){
clickGrid.call(event.playergrids.randomGet());
},50);
}
event.switchToAuto=function(){
clickGrid.call(event.playergrids.randomGet());
}
}
else{
delete event.zhaomu;
}
game.delay();
'step 5'
_status.imchoosing=false;
for(var i=7;i>=0;i--){
for(var j=0;j<ui.chesswidth;j++){
var player=lib.posmap[i*ui.chesswidth+j];
@ -1059,13 +1156,24 @@ mode.chess={
}
}
if(list1.length){
var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomGet());
var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomRemove());
_status.enemies.push(enemy);
event.justadded.push(enemy.name);
if(game.players.length==1){
ui.me.lastChild.show();
game.setChessInfo(game.players[0]);
}
game.delay();
}
if(_status.turnCount>=10&&list1.length){
var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomRemove());
_status.enemies.push(enemy);
event.justadded.push(enemy.name);
}
if(_status.turnCount>=20&&list1.length){
var enemy=game.addChessPlayer(_status.characterList.shift(),true,4,list1.randomRemove());
_status.enemies.push(enemy);
event.justadded.push(enemy.name);
}
}
}
@ -1088,10 +1196,45 @@ mode.chess={
}
event.redo();
}
else{
event.mechlist=game.treasures.slice(0);
}
'step 9'
if(event.mechlist.length){
var mech=event.mechlist.shift();
var info=lib.skill[mech.name+'_skill'];
if(!info.filter||info.filter(mech)){
var next=game.createEvent('chessMech');
next.player=mech;
next.content=info.content;
mech.chessFocus();
if(lib.config.animation){
mech.$epic2();
}
game.delay();
}
if(mech.life--<=0){
game.treasures.remove(mech);
setTimeout(function(){
mech.delete();
},500);
delete lib.posmap[mech.dataset.position];
game.addVideo('deleteChessPlayer',mech);
game.addObstacle(mech.dataset.position);
game.log(get.translation(mech)+'使用期限已到');
}
event.redo();
}
'step 10'
delete event.xingdong;
event.goto(0);
game.delay();
delete event.mechlist;
if(_status.turnCount>=_status.turnTotal){
game.over(true);
}
else{
event.goto(0);
game.delay();
}
}
},
phaseLoopOrdered:function(player){
@ -1722,9 +1865,19 @@ mode.chess={
_status.friends=[];
_status.enemies=[];
_status.turnCount=0;
_status.turnTotal=parseInt(get.config('tafang_turn'));
ui.turnCount=ui.create.system('',null,true);
_status.remainingCount=0;
game.me.side=true;
_status.tafangend=[];
for(var i=0;i<ui.chesswidth;i++){
var tafangdes=ui.chesswidth*(ui.chessheight-1)+i;
if(!lib.posmap[tafangdes]){
_status.tafangend.push(tafangdes.toString());
}
}
game.phaseLoopTafang();
}
else{
@ -3474,6 +3627,189 @@ mode.chess={
}
},
skill:{
chess_mech_weixingxianjing_skill:{
filter:function(player){
for(var i=0;i<_status.enemies.length;i++){
if(!_status.enemies[i].isTurnedOver()&&
get.chessDistance(player,_status.enemies[i])<=2){
return true;
}
}
return false;
},
content:function(){
var list=[];
for(var i=0;i<_status.enemies.length;i++){
if(!_status.enemies[i].isTurnedOver()&&
get.chessDistance(player,_status.enemies[i])<=2){
list.push(_status.enemies[i]);
}
}
if(list.length){
game.log('小型陷阱发动');
var target=list.randomGet();
target.turnOver();
player.line(target,'green');
}
}
},
chess_mech_nengliangqiu_skill:{
filter:function(player){
for(var i=0;i<_status.friends.length;i++){
if(get.chessDistance(player,_status.friends[i])<=3){
return true;
}
}
return false;
},
content:function(){
var list1=[],list2=[];
for(var i=0;i<_status.friends.length;i++){
if(get.chessDistance(player,_status.friends[i])<=1){
list2.push(_status.friends[i]);
}
else if(get.chessDistance(player,_status.friends[i])<=3){
list1.push(_status.friends[i]);
}
// else if(get.chessDistance(player,_status.friends[i])<=4){
// list2.push(_status.friends[i]);
// }
}
if(list2.length){
game.asyncDraw(list2,2);
player.line(list2,'green');
}
if(list1.length){
game.asyncDraw(list1);
player.line(list1,'green');
}
if(list1.length||list2.length){
game.log('能量球发动');
}
}
},
chess_mech_mutong_skill:{
filter:function(player){
for(var i=0;i<_status.enemies.length;i++){
if(get.chessDistance(player,_status.enemies[i])<=3){
return true;
}
}
return false;
},
content:function(){
var list=[];
for(var i=0;i<_status.enemies.length;i++){
if(get.chessDistance(player,_status.enemies[i])<=3){
list.push(_status.enemies[i]);
}
}
if(list.length){
game.log('木桶发动');
var targets=list.randomGets(1);
player.line(targets,'green');
for(var i=0;i<targets.length;i++){
targets[i].damage('nosource');
}
}
}
},
chess_mech_guangmingquan_skill:{
filter:function(player){
for(var i=0;i<_status.friends.length;i++){
if(_status.friends[i].hp<_status.friends[i].maxHp&&
get.chessDistance(player,_status.friends[i])<=2){
return true;
}
}
return false;
},
content:function(){
var list=[];
for(var i=0;i<_status.friends.length;i++){
if(_status.friends[i].hp<_status.friends[i].maxHp&&
get.chessDistance(player,_status.friends[i])<=2){
list.push(_status.friends[i]);
}
}
if(list.length){
game.log('光明泉发动');
var target=list.randomGet();
target.recover();
player.line(target,'green');
}
}
},
chess_mech_jiguanren_skill:{
filter:function(player){
for(var i=0;i<_status.enemies.length;i++){
if(get.chessDistance(player,_status.enemies[i])<=3){
return true;
}
}
return false;
},
content:function(){
'step 0'
var list=[];
for(var i=0;i<_status.enemies.length;i++){
if(get.chessDistance(player,_status.enemies[i])<=3){
list.push(_status.enemies[i]);
}
}
if(list.length){
game.log('机关人发动');
player.line(list,'green');
event.list=list;
}
else{
event.finish();
}
'step 1'
if(event.list.length){
var target=event.list.shift();
var he=target.get('he');
if(he.length){
target.discard(he.randomGets(Math.ceil(Math.random()*2)));
}
event.redo();
}
}
},
chess_mech_gongchengche_skill:{
filter:function(player){
for(var i=0;i<_status.enemies.length;i++){
if(get.chessDistance(player,_status.enemies[i])<=2){
return true;
}
}
return false;
},
content:function(){
'step 0'
var list=[];
for(var i=0;i<_status.enemies.length;i++){
if(get.chessDistance(player,_status.enemies[i])<=2){
list.push(_status.enemies[i]);
}
}
if(list.length){
game.log('攻城车发动');
event.target=list.randomGet();
player.playerfocus(1000);
player.line(event.target,'fire');
game.delay(2);
}
else{
event.finish();
}
'step 1'
if(event.target){
event.target.damage('fire','nosource');
event.target.moveUp();
}
}
},
_attackmove:{
trigger:{player:'damageEnd'},
forced:true,
@ -4627,6 +4963,9 @@ mode.chess={
order:5,
result:{
playerx:function(player){
if(get.config('chess_mode')=='tafang'&&_status.enemies.contains(player)){
return 1;
}
var nh=player.num('h');
if(!player.num('h','sha')&&
!player.num('h','shunshou')&&
@ -4978,6 +5317,25 @@ mode.chess={
mode_chess_character_config:'战棋模式',
mode_chess_card_config:'战棋模式',
chess_mech_weixingxianjing:'小型陷阱',
chess_mech_weixingxianjing_skill:'捕猎',
chess_mech_weixingxianjing_skill_info:'每一轮令距离你2格以内的一名随机敌人翻面',
chess_mech_mutong:'木桶',
chess_mech_mutong_skill:'飞滚',
chess_mech_mutong_skill_info:'每一轮对距离3格以内的一名随机敌人造成一点伤害',
chess_mech_nengliangqiu:'能量球',
chess_mech_nengliangqiu_skill:'充能',
chess_mech_nengliangqiu_skill_info:'每一轮令距离3格以内的所有友方角色摸1张牌距离1以内改为摸2张',
chess_mech_jiguanren:'机关人',
chess_mech_jiguanren_skill:'掠夺',
chess_mech_jiguanren_skill_info:'每一轮弃置3格以内的所有敌方角色各1~2张牌',
chess_mech_gongchengche:'攻城车',
chess_mech_gongchengche_skill:'攻坚',
chess_mech_gongchengche_skill_info:'每一轮对距离2格以内的一名随机敌方角色造成1点火焰伤害并将目标击退1格',
chess_mech_guangmingquan:'光明泉',
chess_mech_guangmingquan_skill:'圣疗',
chess_mech_guangmingquan_skill_info:'每一轮令距离2格以内的一名随机友方角色回复一点体力',
},
ui:{
create:{
@ -5235,12 +5593,12 @@ mode.chess={
treasure_shiyuansu:['','',0,['shiyuansu'],['boss']],
treasure_wuyashenxiang:['','',0,['wuyashenxiang'],['boss']],
chess_mech_nuche:['','',0,['dubiaoxianjing'],['boss']],
chess_mech_toushiche:['','',0,['jiqishi'],['boss']],
chess_mech_zhuangche:['','',0,['shenmidiaoxiang'],['boss']],
chess_mech_huopao:['','',0,['shenpanxianjing'],['boss']],
chess_mech_jidiche:['','',0,['shiyuansu'],['boss']],
chess_mech_gongchengzhui:['','',0,['wuyashenxiang'],['boss']],
chess_mech_guangmingquan:['','',0,['chess_mech_guangmingquan_skill'],['boss']],
chess_mech_nengliangqiu:['','',0,['chess_mech_nengliangqiu_skill'],['boss']],
chess_mech_jiguanren:['','',0,['chess_mech_jiguanren_skill'],['boss']],
chess_mech_weixingxianjing:['','',0,['chess_mech_weixingxianjing_skill'],['boss']],
chess_mech_mutong:['','',0,['chess_mech_mutong_skill'],['boss']],
chess_mech_gongchengche:['','',0,['chess_mech_gongchengche_skill'],['boss']],
leader_caocao:['male','wei',4,['leader_xiaoxiong']],
leader_liubei:['male','shu',4,['leader_renyi']],

View File

@ -41,11 +41,13 @@ mode.versus={
if(lib.storage.noreplace_end==undefined) game.save('noreplace_end',true);
if(lib.storage.die_stop==undefined) game.save('die_stop',true);
if(lib.storage.autoreplaceinnerhtml==undefined) game.save('autoreplaceinnerhtml',true);
if(lib.storage.only_zhu==undefined) game.save('only_zhu',true);
// if(lib.storage.only_zhu==undefined) game.save('only_zhu',true);
if(lib.storage.single_control==undefined) game.save('single_control',true);
if(lib.storage.control_all==undefined) game.save('control_all',true);
if(lib.storage.number==undefined) game.save('number',3);
if(lib.storage.replace_number==undefined) game.save('replace_number',3);
if(lib.storage.control_all==undefined) game.save('control_all',true);
game.save('only_zhu',true);
ui.create.arena();
ui.create.cards();
game.finishCards();
@ -68,10 +70,12 @@ mode.versus={
}
ui.autoreplace.listen(game.switchAutoreplace);
ui.versusreplace=ui.create.system('换人',null,true);
ui.versushs=ui.create.system('手牌',null,true);
lib.setPopped(ui.versusreplace,game.versusHoverReplace);
lib.setPopped(ui.versushs,game.versusHoverHandcards);
// ui.versusreplace=ui.create.system('换人',null,true);
// lib.setPopped(ui.versusreplace,game.versusHoverReplace);
if(game.players.length>2){
ui.versushs=ui.create.system('手牌',null,true);
lib.setPopped(ui.versushs,game.versusHoverHandcards);
}
}
_status.friendCount=ui.create.system('我方阵亡:'+get.cnNumber(0),null,true);
_status.enemyCount=ui.create.system('敌方阵亡:'+get.cnNumber(0),null,true);
@ -99,17 +103,18 @@ mode.versus={
for(var i=0;i<this.dialog.buttons.length;i++) this.dialog.buttons[i].style.opacity=1;
this.dialog.add('选项');
this.dialog.versus_zhu=this.dialog.add(ui.create.switcher('versus_zhu',lib.storage.zhu)).querySelector('.toggle');
this.dialog.versus_only_zhu=this.dialog.add(ui.create.switcher('versus_only_zhu',lib.storage.only_zhu)).querySelector('.toggle');
// this.dialog.versus_only_zhu=this.dialog.add(ui.create.switcher('versus_only_zhu',lib.storage.only_zhu)).querySelector('.toggle');
this.dialog.versus_main_zhu=this.dialog.add(ui.create.switcher('versus_main_zhu',lib.storage.main_zhu)).querySelector('.toggle');
if(lib.storage.zhu){
this.dialog.versus_only_zhu.parentNode.classList.remove('disabled');
// this.dialog.versus_only_zhu.parentNode.classList.remove('disabled');
this.dialog.versus_main_zhu.parentNode.classList.remove('disabled');
}
else{
this.dialog.versus_only_zhu.parentNode.classList.add('disabled');
// this.dialog.versus_only_zhu.parentNode.classList.add('disabled');
this.dialog.versus_main_zhu.parentNode.classList.add('disabled');
}
this.dialog.versus_assign_enemy=this.dialog.add(ui.create.switcher('versus_assign_enemy',lib.storage.assign_enemy)).querySelector('.toggle');
this.dialog.versus_cross_seat=this.dialog.add(ui.create.switcher('versus_cross_seat',lib.storage.cross_seat)).querySelector('.toggle');
this.dialog.versus_random_seat=this.dialog.add(ui.create.switcher('versus_random_seat',lib.storage.random_seat)).querySelector('.toggle');
this.dialog.versus_noreplace_end=this.dialog.add(ui.create.switcher('versus_noreplace_end',lib.storage.noreplace_end)).querySelector('.toggle');
this.dialog.versus_single_control=this.dialog.add(ui.create.switcher('versus_single_control',lib.storage.single_control)).querySelector('.toggle');
@ -118,6 +123,25 @@ mode.versus={
this.dialog.versus_number=this.dialog.add(ui.create.switcher('versus_number',[1,2,3],lib.storage.number)).querySelector('.toggle');
this.dialog.replace_number=this.dialog.add(ui.create.switcher('replace_number',[0,1,2,3,5,7,9,17],lib.storage.replace_number)).querySelector('.toggle');
this.dialog.choice=this.dialog.add(ui.create.switcher('choice',[12,16,20,24,40,'∞'],lib.storage.choice)).querySelector('.toggle');
if(lib.storage.cross_seat){
this.dialog.versus_random_seat.parentNode.classList.add('disabled');
}
else{
this.dialog.versus_random_seat.parentNode.classList.remove('disabled');
if(lib.storage.random_seat){
this.dialog.versus_cross_seat.parentNode.classList.add('disabled');
}
else{
this.dialog.versus_cross_seat.parentNode.classList.remove('disabled');
}
}
if(lib.storage.single_control){
this.dialog.versus_control_all.parentNode.classList.remove('disabled');
}
else{
this.dialog.versus_control_all.parentNode.classList.add('disabled');
}
};
event.confirm=function(){
var dialog=event.dialog;
@ -292,19 +316,32 @@ mode.versus={
}
game.save('zhu',dialog.versus_zhu.link);
if(lib.storage.zhu){
dialog.versus_only_zhu.parentNode.classList.remove('disabled');
// dialog.versus_only_zhu.parentNode.classList.remove('disabled');
dialog.versus_main_zhu.parentNode.classList.remove('disabled');
}
else{
dialog.versus_only_zhu.parentNode.classList.add('disabled');
// dialog.versus_only_zhu.parentNode.classList.add('disabled');
dialog.versus_main_zhu.parentNode.classList.add('disabled');
}
game.save('only_zhu',dialog.versus_only_zhu.link);
// game.save('only_zhu',dialog.versus_only_zhu.link);
game.save('main_zhu',dialog.versus_main_zhu.link);
game.save('assign_enemy',dialog.versus_assign_enemy.link);
game.save('random_seat',dialog.versus_random_seat.link);
game.save('cross_seat',dialog.versus_cross_seat.link);
game.save('noreplace_end',dialog.versus_noreplace_end.link);
game.save('single_control',dialog.versus_single_control.link);
if(lib.storage.cross_seat){
dialog.versus_random_seat.parentNode.classList.add('disabled');
}
else{
dialog.versus_random_seat.parentNode.classList.remove('disabled');
if(lib.storage.random_seat){
dialog.versus_cross_seat.parentNode.classList.add('disabled');
}
else{
dialog.versus_cross_seat.parentNode.classList.remove('disabled');
}
}
if(lib.storage.single_control){
dialog.versus_control_all.parentNode.classList.remove('disabled');
}
@ -404,14 +441,26 @@ mode.versus={
}
}
}
for(i=0;i<position;i++){
game.friend.push(game.players[i-position+num*2]);
if(lib.storage.cross_seat){
for(i=0;i<game.players.length;i++){
if(i%2==0){
game.friend.push(game.players[i]);
}
else{
game.enemy.push(game.players[i]);
}
}
}
for(i=position;i<num;i++){
game.friend.push(game.players[i-position]);
}
for(i=0;i<num;i++){
game.enemy.push(game.players[num-position+i]);
else{
for(i=0;i<position;i++){
game.friend.push(game.players[i-position+num*2]);
}
for(i=position;i<num;i++){
game.friend.push(game.players[i-position]);
}
for(i=0;i<num;i++){
game.enemy.push(game.players[num-position+i]);
}
}
}
if(((position==Math.ceil(num/2)-1&&lib.storage.zhu)||(lib.storage.zhu&&lib.storage.single_control))){
@ -449,20 +498,30 @@ mode.versus={
}
}
else{
if(i==Math.ceil(num/2)-1&&lib.storage.zhu){
if(game.me==game.friend[i]&&lib.storage.zhu){
game.friend[i].identity='zhu';
game.friend[i].setIdentity(_status.color+'Zhu');
game.friendZhu=game.friend[i];
}
else{
game.friend[i].identity='zhong';
game.friend[i].setIdentity(_status.color+'Zhong');
}
if(lib.storage.zhu&&get.distance(game.enemy[i],game.me,'pure')==num){
game.enemy[i].identity='zhu';
game.enemy[i].setIdentity(!_status.color+'Zhu');
game.enemyZhu=game.enemy[i];
}
else{
game.friend[i].identity='zhong';
game.friend[i].setIdentity(_status.color+'Zhong');
game.enemy[i].identity='zhong';
game.enemy[i].setIdentity(!_status.color+'Zhong');
}
if(lib.storage.zhu&&!game.enemyZhu){
game.enemy[0].identity='zhu';
game.enemy[0].setIdentity(!_status.color+'Zhu');
game.enemyZhu=game.enemy[0];
}
}
game.friend[i].node.identity.dataset.color=get.translation(_status.color+'Color');
game.enemy[i].node.identity.dataset.color=get.translation(!_status.color+'Color');
@ -955,6 +1014,7 @@ mode.versus={
versus_die_stop_config:'死亡后终止结算',
versus_main_zhu_config:'主将死亡后结束',
versus_assign_enemy_config:'指定对手',
versus_cross_seat_config:'交叉座位',
versus_random_seat_config:'随机座位',
versus_noreplace_end_config:'无替补时结束',
versus_single_control_config:'单人控制',
@ -1025,7 +1085,7 @@ mode.versus={
var list=(this.side==game.me.side)?_status.friend:_status.enemy;
if((list.length==0&&lib.storage.noreplace_end)||
(lib.storage.zhu&&lib.storage.main_zhu&&this.identity=='zhu')){
(lib.storage.zhu&&lib.storage.main_zhu&&this.identity=='zhu'&&game.players.length>2)){
if(game.friend.contains(this)){
game.over(false);
}