This commit is contained in:
libccy 2016-05-22 16:41:53 +08:00
parent 85a48f5e09
commit ed790a08d3
3 changed files with 156 additions and 43 deletions

View File

@ -2309,6 +2309,12 @@
map.free_choose.hide();
map.double_character_jiange.hide();
}
if(config.versus_mode=='two'){
map.replace_handcard_two.show();
}
else{
map.replace_handcard_two.hide();
}
},
versus_mode:{
name:'游戏模式',
@ -2316,6 +2322,7 @@
item:{
standard:'标准',
jiange:'剑阁',
two:'<span style="display:inline-block;width:100%;text-align:center">2v2</span>',
four:'<span style="display:inline-block;width:100%;text-align:center">4v4</span>'
},
restart:true,
@ -2367,6 +2374,11 @@
init:false,
frequent:true,
},
replace_handcard_two:{
name:'末位可换牌',
init:true,
frequent:true,
},
ban_weak:{
name:'屏蔽弱将',
init:true,
@ -12995,43 +13007,64 @@
}
}
}
next.content=function(){
'step 0'
var send=function(){
game.me.chooseBool('是否置换手牌?');
game.resume();
};
var sendback=function(result,player){
if(_status.connectMode){
next.content=function(){
'step 0'
var send=function(){
game.me.chooseBool('是否置换手牌?');
game.resume();
};
var sendback=function(result,player){
if(result&&result.bool){
var hs=player.get('h')
game.broadcastAll(function(player,hs){
for(var i=0;i<hs.length;i++){
ui.discardPile.appendChild(hs[i]);
}
},player,hs);
player.directgain(get.cards(hs.length));
}
};
for(var i=0;i<event.players.length;i++){
if(event.players[i].isOnline()){
event.withol=true;
event.players[i].send(send);
event.players[i].wait(sendback);
}
else if(event.players[i]==game.me){
event.withme=true;
game.me.chooseBool('是否置换手牌?');
game.me.wait(sendback);
}
}
'step 1'
if(event.withme){
game.me.unwait(result);
}
'step 2'
if(event.withol&&!event.resultOL){
game.pause();
}
}
}
else{
next.content=function(){
'step 0'
if(event.players.contains(game.me)){
game.me.chooseBool('是否置换手牌?');
}
else{
event.finish();
}
'step 1'
if(result&&result.bool){
var hs=player.get('h')
game.broadcastAll(function(player,hs){
for(var i=0;i<hs.length;i++){
ui.discardPile.appendChild(hs[i]);
}
},player,hs);
player.directgain(get.cards(hs.length));
}
};
for(var i=0;i<event.players.length;i++){
if(event.players[i].isOnline()){
event.withol=true;
event.players[i].send(send);
event.players[i].wait(sendback);
}
else if(event.players[i]==game.me){
event.withme=true;
game.me.chooseBool('是否置换手牌?');
game.me.wait(sendback);
var hs=game.me.get('h')
for(var i=0;i<hs.length;i++){
ui.discardPile.appendChild(hs[i]);
}
game.me.directgain(get.cards(hs.length));
}
}
'step 1'
if(event.withme){
game.me.unwait(result);
}
'step 2'
if(event.withol&&!event.resultOL){
game.pause();
}
}
},
removeCard:function(name){
@ -15748,7 +15781,7 @@
lib.card.list.push([suits[Math.floor(Math.random()*suits.length)],Math.ceil(Math.random()*13),name]);
}
}
var packname='mode_extension_'+packagename;
var packname='mode_extension_'+extname;
if(!lib.cardPack[packname]){
lib.cardPack[packname]=[];
lib.translate[packname+'_card_config']=extname;
@ -15758,7 +15791,7 @@
addCardPack:function(pack,packagename){
var extname=_status.extension||'扩展';
packagename=packagename||extname;
var packname='mode_extension_'+extname;
var packname='mode_extension_'+packagename;
lib.cardPack[packname]=[];
lib.translate[packname+'_card_config']=packagename;
for(var i in pack){

View File

@ -1,12 +1,10 @@
window.noname_update={
version:'1.8.10.5',
version:'1.8.11',
changeLog:[
'修bug',
'单机2v2',
],
files:{
global:['game/game.js','game/phantom.js','mode/stone.js','character/hearth.js','character/swd.js','theme/simple/style.css'],
'1.8.10.2':['mode/guozhan.js'],
'1.8.10.3':['character/sp.js','layout/default/layout.css'],
'1.8.10.4':[],
global:['mode/versus.js'],
'1.8.10.5':[],
}
}

View File

@ -38,6 +38,9 @@ mode.versus={
game.prepareArena(8);
// game.pause();
}
else if(_status.mode=='two'){
game.prepareArena(4);
}
else{
if(lib.storage.choice==undefined) game.save('choice',20);
if(lib.storage.zhu==undefined) game.save('zhu',true);
@ -93,6 +96,9 @@ mode.versus={
}
game.chooseCharacterFour();
}
else if(_status.mode=='two'){
game.chooseCharacterTwo();
}
else if(_status.mode=='jiange'){
var list=['shumech','shu','shuboss','shu','wei','weiboss','wei','weimech'];
var pos=Math.floor(Math.random()*8);
@ -177,7 +183,19 @@ mode.versus={
event.finish();
}
else{
if(_status.mode=='four'){
if(_status.mode=='two'){
_status.first_less=true;
var firstChoose=game.players.randomGet();
if(firstChoose.next.side==firstChoose.side){
firstChoose=firstChoose.next;
}
game.gameDraw(firstChoose);
if(get.config('replace_handcard_two')){
game.replaceHandcards(firstChoose.previous);
}
game.phaseLoop(firstChoose);
}
else if(_status.mode=='four'){
game.gameDraw(_status.firstAct,function(player){
if(player==_status.firstAct.previousSeat){
return 5;
@ -511,6 +529,46 @@ mode.versus={
game.addRecentCharacter(game.me.name,game.me.name2);
};
},
chooseCharacterTwo:function(){
var next=game.createEvent('chooseCharacter',false);
next.content=function(){
'step 0'
var bool=Math.random()<0.5;
var bool2=Math.random()<0.5;
var ref=game.players[0];
ref.side=bool;
ref.next.side=bool2;
ref.next.next.side=!bool;
ref.previous.side=!bool2;
for(var i=0;i<game.players.length;i++){
if(game.players[i].side==game.me.side){
game.players[i].node.identity.firstChild.innerHTML='友';
}
else{
game.players[i].node.identity.firstChild.innerHTML='敌';
}
game.players[i].node.identity.dataset.color=game.players[i].side+'zhu';
}
var list=[];
for(i in lib.character){
if(!lib.filter.characterDisabled(i)){
list.push(i);
}
}
var choose=[];
event.list=list;
var dialog=ui.create.dialog('选择角色',[list.randomRemove(7),'character']);
game.me.chooseButton(true,dialog);
'step 1'
game.me.init(result.links[0]);
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=game.me){
game.players[i].init(event.list.randomRemove());
}
}
}
},
chooseCharacterFour:function(){
var next=game.createEvent('chooseCharacter',false);
next.ai=function(player,list,list2){
@ -2455,6 +2513,30 @@ mode.versus={
}
return;
}
else if(_status.mode=='two'){
var friend;
for(var i=0;i<game.players.length;i++){
if(game.players[i].side==this.side){
friend=game.players[i];break;
}
}
if(friend){
var next=game.createEvent('versusDraw');
next.content=function(){
'step 0'
player.chooseBool('是否摸一张牌?');
'step 1'
if(result.bool){
player.draw();
}
};
next.player=friend;
}
else{
game.over(this.side!=game.me.side);
}
return;
}
else if(_status.mode=='jiange'){
if(get.population('wei')==0){
game.over(game.me.identity=='shu');