This commit is contained in:
libccy 2016-04-16 00:20:05 +08:00
parent 6b88760a0f
commit 8dedb48715
13 changed files with 1104 additions and 347 deletions

View File

@ -927,7 +927,7 @@ card.standard={
target:function(player,target){ target:function(player,target){
var es=target.get('e'); var es=target.get('e');
var nh=target.num('h'); var nh=target.num('h');
var noe=(es.length==0); var noe=(es.length==0||target.hasSkillTag('noe'));
var noe2=(es.length==1&&es[0].name=='baiyin'&&target.hp<target.maxHp); var noe2=(es.length==1&&es[0].name=='baiyin'&&target.hp<target.maxHp);
var noh=(nh==0||target.hasSkillTag('noh')); var noh=(nh==0||target.hasSkillTag('noh'));
if(noh&&noe) return 0; if(noh&&noe) return 0;
@ -1425,7 +1425,7 @@ card.standard={
else{ else{
str+=get.translation(card); str+=get.translation(card);
} }
if(targets||target){ if((targets||target)&&!isJudge){
str+='对'+get.translation(targets||target); str+='对'+get.translation(targets||target);
} }
str+='将'+(state>0?'生效':'失效')+',是否无懈?'; str+='将'+(state>0?'生效':'失效')+',是否无懈?';

View File

@ -1,5 +1,6 @@
'use strict'; 'use strict';
character.refresh={ character.refresh={
connect:true,
character:{ character:{
re_caocao:['male','wei',4,['hujia','rejianxiong'],['zhu']], re_caocao:['male','wei',4,['hujia','rejianxiong'],['zhu']],
re_simayi:['male','wei',3,['refankui','reguicai']], re_simayi:['male','wei',3,['refankui','reguicai']],
@ -33,11 +34,13 @@ character.refresh={
}, },
content:function(){ content:function(){
'step 0' 'step 0'
trigger.player.chooseTarget(function(card,playerx,target){ trigger.player.chooseTarget(function(card,player,target){
return player.canUse({name:'juedou'},target)&&target!=trigger.player; var evt=_status.event.getParent();
},'是否发动【利驭】?').ai=function(target){ return evt.player.canUse({name:'juedou'},target)&&target!=_status.event.player;
return ai.get.effect(target,{name:'juedou'},player,trigger.player)-2; },'是否发动【利驭】?').set('ai',function(target){
}; var evt=_status.event.getParent();
return ai.get.effect(target,{name:'juedou'},evt.player,_status.event.player)-2;
});
'step 1' 'step 1'
if(result.bool){ if(result.bool){
player.gainPlayerCard(trigger.player,'he',true); player.gainPlayerCard(trigger.player,'he',true);
@ -103,7 +106,7 @@ character.refresh={
}); });
"step 1" "step 1"
if(result.bool){ if(result.bool){
player.logSkill('retuxi'); player.logSkill('retuxi',result.targets);
for(var i=0;i<result.targets.length;i++){ for(var i=0;i<result.targets.length;i++){
player.gain(result.targets[i].get('h').randomGet()); player.gain(result.targets[i].get('h').randomGet());
result.targets[i].$give(1,player); result.targets[i].$give(1,player);
@ -126,10 +129,11 @@ character.refresh={
content:function(){ content:function(){
"step 0" "step 0"
player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+ player.chooseCard(get.translation(trigger.player)+'的'+(trigger.judgestr||'')+'判定为'+
get.translation(trigger.player.judging[0])+',是否发动【鬼才】?','he').ai=function(card){ get.translation(trigger.player.judging[0])+',是否发动【鬼才】?','he').set('ai',function(card){
var trigger=_status.event.parent._trigger; var trigger=_status.event.getParent()._trigger;
var player=_status.event.player; var player=_status.event.player;
var result=trigger.judge(card)-trigger.judge(trigger.player.judging[0]); var judging=_status.event.judging;
var result=trigger.judge(card)-trigger.judge(judging);
var attitude=ai.get.attitude(player,trigger.player); var attitude=ai.get.attitude(player,trigger.player);
if(attitude==0||result==0) return 0; if(attitude==0||result==0) return 0;
if(attitude>0){ if(attitude>0){
@ -138,7 +142,7 @@ character.refresh={
else{ else{
return -result-ai.get.value(card)/2; return -result-ai.get.value(card)/2;
} }
}; }).set('judging',trigger.player.judging[0]);
"step 1" "step 1"
if(result.bool){ if(result.bool){
player.respond(result.cards,'highlight'); player.respond(result.cards,'highlight');
@ -150,7 +154,12 @@ character.refresh={
if(result.bool){ if(result.bool){
player.logSkill('reguicai'); player.logSkill('reguicai');
if(trigger.player.judging[0].clone){ if(trigger.player.judging[0].clone){
trigger.player.judging[0].clone.delete(); trigger.player.judging[0].clone.classList.remove('thrownhighlight');
game.broadcast(function(card){
if(card.clone){
card.clone.classList.remove('thrownhighlight');
}
},trigger.player.judging[0]);
game.addVideo('deletenode',player,get.cardsInfo([trigger.player.judging[0].clone])); game.addVideo('deletenode',player,get.cardsInfo([trigger.player.judging[0].clone]));
} }
ui.discardPile.appendChild(trigger.player.judging[0]); ui.discardPile.appendChild(trigger.player.judging[0]);
@ -188,13 +197,13 @@ character.refresh={
"step 2" "step 2"
if(result.bool){ if(result.bool){
player.logSkill('refankui',trigger.source); player.logSkill('refankui',trigger.source);
player.gain(result.buttons[0].link); player.gain(result.links[0]);
trigger.source.$give(1,player); trigger.source.$give(1,player);
event.goto(1); event.goto(1);
} }
}, },
ai:{ ai:{
result:{ effect:{
target:function(card,player,target){ target:function(card,player,target){
if(player.num('he')>1&&get.tag(card,'damage')){ if(player.num('he')>1&&get.tag(card,'damage')){
if(player.skills.contains('jueqing')) return [1,-1.5]; if(player.skills.contains('jueqing')) return [1,-1.5];
@ -306,7 +315,7 @@ character.refresh={
"step 1" "step 1"
player.chooseCardTarget({ player.chooseCardTarget({
filterCard:function(card){ filterCard:function(card){
return _status.event.parent.cards.contains(card); return _status.event.getParent().cards.contains(card);
}, },
selectCard:[1,event.cards.length], selectCard:[1,event.cards.length],
filterTarget:function(card,player,target){ filterTarget:function(card,player,target){
@ -317,7 +326,7 @@ character.refresh={
return (_status.event.player.num('h')-_status.event.player.hp); return (_status.event.player.num('h')-_status.event.player.hp);
}, },
ai2:function(target){ ai2:function(target){
if(target.num('h')>player.num('h')) return 0; if(target.num('h')>_status.event.player.num('h')) return 0;
return ai.get.attitude(_status.event.player,target)-4; return ai.get.attitude(_status.event.player,target)-4;
}, },
prompt:'请选择要送人的卡牌' prompt:'请选择要送人的卡牌'
@ -389,7 +398,7 @@ character.refresh={
target.gain(cards[0]); target.gain(cards[0]);
"step 1" "step 1"
target.chooseControl('refanjian_card','refanjian_hp').ai=function(event,player){ target.chooseControl('refanjian_card','refanjian_hp').ai=function(event,player){
var cards=target.get('he',{suit:get.suit(player.storage.refanjian)}); var cards=player.get('he',{suit:get.suit(player.storage.refanjian)});
if(cards.length==1) return 0; if(cards.length==1) return 0;
if(cards.length>=2){ if(cards.length>=2){
for(var i=0;i<cards.length;i++){ for(var i=0;i<cards.length;i++){
@ -414,6 +423,7 @@ character.refresh={
} }
"step 3" "step 3"
target.discard(target.get('he',{suit:get.suit(target.storage.refanjian)})) target.discard(target.get('he',{suit:get.suit(target.storage.refanjian)}))
delete target.storage.refanjian;
}, },
ai:{ ai:{
order:9, order:9,
@ -488,6 +498,7 @@ character.refresh={
if(trigger.cards[i].original=='h') num++; if(trigger.cards[i].original=='h') num++;
} }
player.chooseTarget('选择发动连营的目标',[1,num]).ai=function(target){ player.chooseTarget('选择发动连营的目标',[1,num]).ai=function(target){
var player=_status.event.player;
if(player==target) return ai.get.attitude(player,target)+10; if(player==target) return ai.get.attitude(player,target)+10;
return ai.get.attitude(player,target); return ai.get.attitude(player,target);
} }
@ -553,6 +564,9 @@ character.refresh={
silent:true, silent:true,
content:function(){ content:function(){
player.storage.retishen2=player.hp; player.storage.retishen2=player.hp;
game.broadcast(function(player){
player.storage.retishen2=player.hp;
},player);
game.addVideo('storage',player,['retishen2',player.storage.retishen2]); game.addVideo('storage',player,['retishen2',player.storage.retishen2]);
}, },
intro:{ intro:{
@ -572,13 +586,17 @@ character.refresh={
content:function(){ content:function(){
"step 0" "step 0"
event.card=get.cards()[0]; event.card=get.cards()[0];
game.broadcast(function(card){
ui.arena.classList.add('thrownhighlight');
card.copy('thrown','center','thrownhighlight',ui.arena).animate('start');
},event.card);
event.node=event.card.copy('thrown','center','thrownhighlight',ui.arena).animate('start'); event.node=event.card.copy('thrown','center','thrownhighlight',ui.arena).animate('start');
ui.arena.classList.add('thrownhighlight'); ui.arena.classList.add('thrownhighlight');
game.addVideo('thrownhighlight1'); game.addVideo('thrownhighlight1');
game.addVideo('centernode',null,get.cardInfo(event.card)); game.addVideo('centernode',null,get.cardInfo(event.card));
if(get.type(event.card,'trick')==get.type(trigger.card,'trick')){ if(get.type(event.card,'trick')==get.type(trigger.card,'trick')){
player.chooseTarget('选择获得此牌的角色').ai=function(target){ player.chooseTarget('选择获得此牌的角色').ai=function(target){
var att=ai.get.attitude(player,target); var att=ai.get.attitude(_status.event.player,target);
if(att>0){ if(att>0){
return att+Math.max(0,5-target.num('h')); return att+Math.max(0,5-target.num('h'));
} }
@ -601,18 +619,38 @@ character.refresh={
ui.discardPile.appendChild(event.card); ui.discardPile.appendChild(event.card);
} }
game.addVideo('deletenode',player,[get.cardInfo(event.node)]); game.addVideo('deletenode',player,[get.cardInfo(event.node)]);
event.node.delete();
game.broadcast(function(card){
ui.arena.classList.remove('thrownhighlight');
if(card.clone){
card.clone.delete();
}
},event.card);
} }
else if(result.targets){ else if(result.targets){
player.line(result.targets,'green');
result.targets[0].gain(event.card); result.targets[0].gain(event.card);
event.node.moveDelete(result.targets[0]); event.node.moveDelete(result.targets[0]);
game.log(result.targets[0],'获得了',event.card); game.log(result.targets[0],'获得了',event.card);
game.addVideo('gain2',result.targets[0],[get.cardInfo(event.node)]); game.addVideo('gain2',result.targets[0],[get.cardInfo(event.node)]);
game.broadcast(function(card,target){
ui.arena.classList.remove('thrownhighlight');
if(card.clone){
card.clone.moveDelete(target);
}
},event.card,result.targets[0]);
} }
else{ else{
game.log(player,'展示并弃掉了',event.card); game.log(player,'展示并弃掉了',event.card);
ui.discardPile.appendChild(event.card); ui.discardPile.appendChild(event.card);
game.addVideo('deletenode',player,[get.cardInfo(event.node)]); game.addVideo('deletenode',player,[get.cardInfo(event.node)]);
event.node.delete(); event.node.delete();
game.broadcast(function(card){
ui.arena.classList.remove('thrownhighlight');
if(card.clone){
card.clone.delete();
}
},event.card);
} }
game.addVideo('thrownhighlight2'); game.addVideo('thrownhighlight2');
ui.arena.classList.remove('thrownhighlight'); ui.arena.classList.remove('thrownhighlight');
@ -633,6 +671,7 @@ character.refresh={
"step 0" "step 0"
if(get.itemtype(trigger.cards)=='cards'&&get.position(trigger.cards[0])=='d'){ if(get.itemtype(trigger.cards)=='cards'&&get.position(trigger.cards[0])=='d'){
player.chooseControl('rejianxiong_mopai','rejianxiong_napai','cancel').ai=function(){ player.chooseControl('rejianxiong_mopai','rejianxiong_napai','cancel').ai=function(){
var trigger=_status.event.getParent()._trigger;
if(trigger.cards.length==1&&trigger.cards[0].name=='sha') return 0; if(trigger.cards.length==1&&trigger.cards[0].name=='sha') return 0;
return 1; return 1;
}; };
@ -702,6 +741,7 @@ character.refresh={
result.targets[0].storage.reyiji2=result.cards; result.targets[0].storage.reyiji2=result.cards;
} }
player.$give(result.cards.length,result.targets[0]); player.$give(result.cards.length,result.targets[0]);
player.line(result.targets,'green');
game.addVideo('storage',result.targets[0],['reyiji2',get.cardsInfo(result.targets[0].storage.reyiji2),'cards']); game.addVideo('storage',result.targets[0],['reyiji2',get.cardsInfo(result.targets[0].storage.reyiji2),'cards']);
if(num==1){ if(num==1){
event.temp=result.targets[0]; event.temp=result.targets[0];
@ -766,7 +806,7 @@ character.refresh={
}, },
content:function(){ content:function(){
"step 0" "step 0"
player.chooseToCompare(target).small=true; player.chooseToCompare(target).set('small',true);
"step 1" "step 1"
if(result.bool){ if(result.bool){
if(target.skills.contains('yijue2')==false){ if(target.skills.contains('yijue2')==false){
@ -880,12 +920,13 @@ character.refresh={
var target=trigger.target; var target=trigger.target;
var num=target.num('h','shan'); var num=target.num('h','shan');
target.chooseToDiscard('请弃置一张'+get.translation(suit)+'牌,否则不能使用闪抵消此杀','he',function(card){ target.chooseToDiscard('请弃置一张'+get.translation(suit)+'牌,否则不能使用闪抵消此杀','he',function(card){
return get.suit(card)==suit; return get.suit(card)==_status.event.suit;
}).ai=function(card){ }).set('ai',function(card){
var num=_status.event.num;
if(num==0) return 0; if(num==0) return 0;
if(card.name=='shan') return num>1; if(card.name=='shan') return num>1;
return 8-ai.get.value(card); return 8-ai.get.value(card);
}; }).set('num',num).set('suit',suit);
"step 2" "step 2"
if(!result.bool){ if(!result.bool){
trigger.directHit=true; trigger.directHit=true;
@ -994,13 +1035,14 @@ character.refresh={
zhaxiang:{ zhaxiang:{
trigger:{player:'loseHpEnd'}, trigger:{player:'loseHpEnd'},
forced:true, forced:true,
audio:2,
content:function(){ content:function(){
player.draw(3); player.draw(3);
if(_status.currentPhase==player){ if(_status.currentPhase==player){
player.addTempSkill('zhaxiang2',{player:'phaseAfter'}); player.addTempSkill('zhaxiang2',{player:'phaseAfter'});
} }
else{ else{
game.playAudio('skill','zhaxiang'+Math.ceil(Math.random()*2)); game.trySkillAudio('zhaxiang',player);
} }
} }
}, },
@ -1032,7 +1074,7 @@ character.refresh={
}, },
content:function(){ content:function(){
player.chooseToUse({name:'sha'},'诛害:是否对'+get.translation(trigger.player)+'使用一张杀', player.chooseToUse({name:'sha'},'诛害:是否对'+get.translation(trigger.player)+'使用一张杀',
trigger.player).logSkill='zhuhai'; trigger.player).set('logSkill','zhuhai');
} }
}, },
qianxin:{ qianxin:{
@ -1062,12 +1104,13 @@ character.refresh={
}, },
content:function(){ content:function(){
"step 0" "step 0"
player.chooseControl(['red','black','basic','trick','equip']).ai=function(){ player.chooseControl(['red','black','basic','trick','equip']).set('ai',function(){
var player=_status.event.player;
if(player.num('shan')==0) return 'basic'; if(player.num('shan')==0) return 'basic';
if(player.num('e')<=1) return 'equip'; if(player.num('e')<=1) return 'equip';
if(player.num('h')>2) return 'trick'; if(player.num('h')>2) return 'trick';
return 'red'; return 'red';
}; });
"step 1" "step 1"
var num=20; var num=20;
var card; var card;
@ -1163,13 +1206,14 @@ character.refresh={
"step 0" "step 0"
player.chooseTarget('选择令'+get.translation(trigger.card)+'无效的目标', player.chooseTarget('选择令'+get.translation(trigger.card)+'无效的目标',
[1,trigger.targets.length],function(card,player,target){ [1,trigger.targets.length],function(card,player,target){
return trigger.targets.contains(target); return _status.event.getParent()._trigger.targets.contains(target);
}).ai=function(target){ }).set('ai',function(target){
var trigger=_status.event.getParent()._trigger;
if(game.phaseNumber>game.players.length*2&&trigger.targets.length>=game.players.length-1){ if(game.phaseNumber>game.players.length*2&&trigger.targets.length>=game.players.length-1){
return -ai.get.effect(target,trigger.card,trigger.player,player); return -ai.get.effect(target,trigger.card,trigger.player,_status.event.player);
} }
return -1; return -1;
}; });
"step 1" "step 1"
if(result.bool){ if(result.bool){
player.unmarkSkill('fenwei'); player.unmarkSkill('fenwei');
@ -1228,25 +1272,27 @@ character.refresh={
xunxun:{ xunxun:{
audio:2, audio:2,
trigger:{player:'phaseDrawBefore'}, trigger:{player:'phaseDrawBefore'},
frequent:true, direct:true,
content:function(){ content:function(){
"step 0" "step 0"
event.cards=get.cards(4); event.cards=get.cards(4);
player.chooseCardButton(event.cards,2,true,'选择获得两张牌').ai=ai.get.buttonValue; player.chooseCardButton(event.cards,2,'选择获得两张牌').set('ai',ai.get.buttonValue);
trigger.untrigger();
trigger.finish();
"step 1" "step 1"
var choice=[]; if(result.bool){
for(var i=0;i<result.links.length;i++){ player.logSkill('xunxun');
choice.push(result.links[i]); trigger.untrigger();
cards.remove(result.links[i]); trigger.finish();
var choice=[];
for(var i=0;i<result.links.length;i++){
choice.push(result.links[i]);
cards.remove(result.links[i]);
}
for(var i=0;i<cards.length;i++){
ui.cardPile.appendChild(cards[i]);
}
player.gain(choice,'draw');
game.log(player,'获得了两张牌')
} }
for(var i=0;i<cards.length;i++){
ui.cardPile.appendChild(cards[i]);
}
player.gain(choice);
player.$gain(choice.length);
game.delay();
}, },
}, },
wangxi:{ wangxi:{
@ -1330,7 +1376,7 @@ character.refresh={
wangxi:'忘隙', wangxi:'忘隙',
reguose:'新国色', reguose:'新国色',
fenwei:'奋威', fenwei:'奋威',
chulao:'除', chulao:'除',
rejizhi:'集智', rejizhi:'集智',
liyu:'利驭', liyu:'利驭',
liyu_info:'当你使用【杀】对一名其他角色造成伤害后,该角色可令你获得其一张牌,若如此做,则视为你对其选择的另一名角色使用一张【决斗】', liyu_info:'当你使用【杀】对一名其他角色造成伤害后,该角色可令你获得其一张牌,若如此做,则视为你对其选择的另一名角色使用一张【决斗】',

View File

@ -438,7 +438,15 @@ character.shenhua={
if(get.position(button.link)=='j') return -10; if(get.position(button.link)=='j') return -10;
return ai.get.equipValue(button.link); return ai.get.equipValue(button.link);
} }
},targets[0]).set('targets0',targets[0]).set('targets1',targets[1]); },targets[0]).set('targets0',targets[0]).set('targets1',targets[1]).set('filterButton',function(button){
var targets1=_status.event.targets1;
if(get.position(button.link)=='j'){
return !targets1.hasJudge(button.link.viewAs||button.link.name);
}
else{
return !targets1.num('e',{subtype:get.subtype(button.link)});
}
});
} }
else{ else{
event.finish(); event.finish();

View File

@ -821,7 +821,7 @@ character.sp={
if(target.skills.contains('tuntian')) return 0; if(target.skills.contains('tuntian')) return 0;
var es=target.get('e'); var es=target.get('e');
var nh=target.num('h'); var nh=target.num('h');
var noe=(es.length==0); var noe=(es.length==0||target.hasSkillTag('noe'));
var noe2=(es.length==1&&es[0].name=='baiyin'&&target.hp<target.maxHp); var noe2=(es.length==1&&es[0].name=='baiyin'&&target.hp<target.maxHp);
var noh=(nh==0||target.hasSkillTag('noh')); var noh=(nh==0||target.hasSkillTag('noh'));
if(noh&&noe) return 0; if(noh&&noe) return 0;

View File

@ -129,7 +129,7 @@ character.standard={
} }
}, },
ai:{ ai:{
result:{ effect:{
target:function(card,player,target){ target:function(card,player,target){
if(player.num('he')>1&&get.tag(card,'damage')){ if(player.num('he')>1&&get.tag(card,'damage')){
if(player.skills.contains('jueqing')) return [1,-1.5]; if(player.skills.contains('jueqing')) return [1,-1.5];
@ -309,6 +309,9 @@ character.standard={
audio:4, audio:4,
trigger:{player:'judgeEnd'}, trigger:{player:'judgeEnd'},
frequent:true, frequent:true,
filter:function(event,player){
return get.position(event.result.card)=='d'&&event.position==ui.discardPile;
},
content:function(){ content:function(){
player.gain(trigger.result.card); player.gain(trigger.result.card);
player.$gain2(trigger.result.card); player.$gain2(trigger.result.card);
@ -346,6 +349,7 @@ character.standard={
}); });
"step 3" "step 3"
if(result.bool){ if(result.bool){
player.line(result.targets,'green');
result.targets[0].gain(result.cards); result.targets[0].gain(result.cards);
player.$give(result.cards.length,result.targets[0]); player.$give(result.cards.length,result.targets[0]);
for(var i=0;i<result.cards.length;i++){ for(var i=0;i<result.cards.length;i++){
@ -1323,6 +1327,7 @@ character.standard={
player.draw(num); player.draw(num);
}, },
ai:{ ai:{
noe:true,
effect:{ effect:{
target:function(card,player,target,current){ target:function(card,player,target,current){
if(get.type(card)=='equip') return [1,3]; if(get.type(card)=='equip') return [1,3];

View File

@ -4646,7 +4646,8 @@ character.yijiang={
target:function(card,player,target,current){ target:function(card,player,target,current){
if(get.type(card)=='equip') return [1,3]; if(get.type(card)=='equip') return [1,3];
} }
} },
noe:true
} }
}, },
jiangchi:{ jiangchi:{

View File

@ -778,6 +778,11 @@
init:true, init:true,
unfrequent:true, unfrequent:true,
}, },
fold_mode:{
name:'折叠模式菜单',
init:true,
unfrequent:true,
},
auto_popped_config:{ auto_popped_config:{
name:'自动弹出选项', name:'自动弹出选项',
init:true, init:true,
@ -2246,6 +2251,63 @@
}, },
versus:{ versus:{
name:'对决', name:'对决',
connect:{
update:function(config,map){
if(config.connect_versus_mode=='1v1'){
map.connect_choice_num.show();
map.connect_replace_number.show();
}
else{
map.connect_choice_num.hide();
map.connect_replace_number.hide();
}
},
connect_versus_mode:{
name:'游戏模式',
init:'1v1',
item:{
'1v1':'1v1',
'2v2':'2v2',
// '4v4':'4v4',
},
frequent:true
},
connect_choice_num:{
name:'侯选武将数',
init:'20',
frequent:true,
item:{
'12':'12人',
'16':'16人',
'20':'20人',
'24':'24人',
'40':'40人',
}
},
connect_replace_number:{
name:'替补人数',
init:'2',
frequent:true,
item:{
'0':'无',
'1':'1人',
'2':'2人',
'3':'3人',
'4':'4人',
'5':'5人',
}
},
connect_ban_weak:{
name:'屏蔽弱将',
init:true,
restart:true,
},
connect_ban_strong:{
name:'屏蔽强将',
init:false,
restart:true,
},
},
config:{ config:{
update:function(config,map){ update:function(config,map){
if(config.versus_mode=='four'){ if(config.versus_mode=='four'){
@ -4509,7 +4571,7 @@
game.modPhaseDraw(player,event.num); game.modPhaseDraw(player,event.num);
} }
else{ else{
if(get.config('first_less')&&game.phaseNumber==1&&_status.first_less){ if((get.config('first_less')||_status.connectMode)&&game.phaseNumber==1&&_status.first_less){
event.num--; event.num--;
} }
if(event.num>0){ if(event.num>0){
@ -5609,12 +5671,7 @@
game.addVideo('showCards',player,[str,get.cardsInfo(cards)]); game.addVideo('showCards',player,[str,get.cardsInfo(cards)]);
game.delayx(2); game.delayx(2);
"step 1" "step 1"
game.broadcast(function(id){ game.broadcast('closeDialog',event.dialogid);
var dialog=get.idDialog(id);
if(dialog){
dialog.close();
}
},event.dialogid);
event.dialog.close(); event.dialog.close();
}, },
showCards:function(){ showCards:function(){
@ -5636,12 +5693,7 @@
game.delayx(2); game.delayx(2);
game.addVideo('showCards',player,[event.str,get.cardsInfo(cards)]); game.addVideo('showCards',player,[event.str,get.cardsInfo(cards)]);
"step 1" "step 1"
game.broadcast(function(id){ game.broadcast('closeDialog',event.dialogid);
var dialog=get.idDialog(id);
if(dialog){
dialog.close();
}
},event.dialogid);
event.dialog.close(); event.dialog.close();
}, },
viewHandcards:function(){ viewHandcards:function(){
@ -6685,10 +6737,12 @@
cards[i].goto(ui.discardPile); cards[i].goto(ui.discardPile);
} }
if(game.online&&player==game.me&&!_status.over&&!game.controlOver&&!ui.exit){ if(game.online&&player==game.me&&!_status.over&&!game.controlOver&&!ui.exit){
ui.exit=ui.create.control('退出联机',function(){ if(lib.mode[lib.configOL.mode].config.dierestart){
game.saveConfig('reconnect_info'); ui.exit=ui.create.control('退出联机',function(){
game.reload(); game.saveConfig('reconnect_info');
}); game.reload();
});
}
} }
if(lib.config.background_speak){ if(lib.config.background_speak){
@ -7077,7 +7131,15 @@
this.roomempty=false; this.roomempty=false;
var config=info[2]; var config=info[2];
var modetrans; var modetrans;
if(config.mode=='identity'&&config.identity_mode=='zhong'){ if(config.mode=='versus'){
switch(config.versus_mode){
case '1v1':modetrans='单人对决';break;
case '2v2':modetrans='欢乐成双';break;
case '3v3':modetrans='血战到底';break;
case '4v4':modetrans='四人对决';break;
}
}
else if(config.mode=='identity'&&config.identity_mode=='zhong'){
modetrans='忠胆英杰'; modetrans='忠胆英杰';
} }
else{ else{
@ -7261,6 +7323,7 @@
judges:this.get('j'), judges:this.get('j'),
position:parseInt(this.dataset.position), position:parseInt(this.dataset.position),
hujia:this.hujia, hujia:this.hujia,
side:this.side,
identityShown:this.identityShown, identityShown:this.identityShown,
identityNode:[this.node.identity.innerHTML,this.node.identity.dataset.color], identityNode:[this.node.identity.innerHTML,this.node.identity.dataset.color],
identity:this.identity, identity:this.identity,
@ -9433,6 +9496,7 @@
if(self) return true; if(self) return true;
return false; return false;
} }
if(_status.connectMode) return false;
if(lib.config.mode=='versus'){ if(lib.config.mode=='versus'){
if(_status.mode=='four'||_status.mode=='jiange') return false; if(_status.mode=='four'||_status.mode=='jiange') return false;
return ui.autoreplace&&ui.autoreplace.classList.contains('on')&& return ui.autoreplace&&ui.autoreplace.classList.contains('on')&&
@ -10840,42 +10904,8 @@
return this; return this;
}, },
send:function(){ send:function(){
var skills={ this.player.send(function(name,args,set,event,skills){
global:lib.skill.global game.me.applySkills(skills);
};
var skillinfo={};
for(var i in lib.playerOL){
skills[i]={
skills:lib.playerOL[i].skills,
hiddenSkills:lib.playerOL[i].hiddenSkills,
additionalSkills:lib.playerOL[i].additionalSkills,
tempSkills:lib.playerOL[i].tempSkills,
storage:lib.playerOL[i].storage,
}
}
for(var i in lib.skill){
if(lib.skill[i].chooseButton&&lib.skill[i].enable){
skillinfo[i]=lib.skill[i].chooseButton;
}
}
this.player.send(function(name,args,set,event,stat,skills,skillinfo){
for(var i in skills){
if(i=='global'){
lib.skill.global=skills[i];
}
else if(lib.playerOL[i]){
for(var j in skills[i]){
lib.playerOL[i][j]=skills[i][j];
}
}
}
for(var i in skillinfo){
if(!lib.skill[i]){
lib.skill[i]={};
}
lib.skill[i].chooseButton=skillinfo[i];
}
game.me.stat=[stat];
var next=game.me[name].apply(game.me,args); var next=game.me[name].apply(game.me,args);
for(var i=0;i<set.length;i++){ for(var i=0;i<set.length;i++){
next.set(set[i][0],set[i][1]); next.set(set[i][0],set[i][1]);
@ -10883,8 +10913,7 @@
next._modparent=event; next._modparent=event;
game.resume(); game.resume();
},this.name,this._args||[],this._set, },this.name,this._args||[],this._set,
get.stringifiedResult(this.parent,3), get.stringifiedResult(this.parent,3),get.skillState(this.player));
this.player.getStat(),skills,skillinfo);
this.player.wait(); this.player.wait();
game.pause(); game.pause();
}, },
@ -11903,7 +11932,7 @@
game.broadcast(function(player){ game.broadcast(function(player){
player.setNickname(); player.setNickname();
},player); },player);
this.send('reinit',lib.configOL,get.arenaState(),game.getState?game.getState():{},game.ip); this.send('reinit',lib.configOL,get.arenaState(),game.getState?game.getState():{},game.ip,null,_status.onreconnect);
} }
else if(version!=lib.versionOL){ else if(version!=lib.versionOL){
this.send('denied','version'); this.send('denied','version');
@ -12196,10 +12225,9 @@
} }
} }
}, },
reinit:function(config,state,state2,ip,observe){ reinit:function(config,state,state2,ip,observe,onreconnect){
ui.auto.show(); ui.auto.show();
ui.pause.show(); ui.pause.show();
game.clearConnect(); game.clearConnect();
clearTimeout(_status.createNodeTimeout); clearTimeout(_status.createNodeTimeout);
game.online=true; game.online=true;
@ -12252,7 +12280,13 @@
} }
game.clearArena(); game.clearArena();
game.finishCards(); game.finishCards();
if(!observe) ui.create.chat(); if(!observe){
ui.create.chat();
if(ui.exitroom){
ui.exitroom.remove();
delete ui.exitroom;
}
}
else{ else{
if(!ui.exitroom){ if(!ui.exitroom){
ui.create.system('退出旁观',function(){ ui.create.system('退出旁观',function(){
@ -12284,6 +12318,7 @@
player.maxHp=info.maxHp; player.maxHp=info.maxHp;
player.hujia=info.hujia; player.hujia=info.hujia;
player.sex=info.sex; player.sex=info.sex;
player.side=info.side;
player.setNickname(); player.setNickname();
if(info.dead){ if(info.dead){
player.classList.add('dead'); player.classList.add('dead');
@ -12314,13 +12349,13 @@
player.node.judges.appendChild(info.judges[i]); player.node.judges.appendChild(info.judges[i]);
} }
if(!player.setModeState){ if(!player.setModeState){
if(player==game.me||player.identityShown){ if(!game.getIdentityList&&info.identityNode){
player.setIdentity();
}
else if(!game.getIdentityList&&info.identityNode){
player.node.identity.innerHTML=info.identityNode[0]; player.node.identity.innerHTML=info.identityNode[0];
player.node.identity.dataset.color=info.identityNode[1]; player.node.identity.dataset.color=info.identityNode[1];
} }
else if(player==game.me||player.identityShown){
player.setIdentity();
}
else{ else{
player.setIdentity('cai'); player.setIdentity('cai');
} }
@ -12346,6 +12381,11 @@
if(player.isAlive()) game.swapPlayer(player); if(player.isAlive()) game.swapPlayer(player);
} }
} }
else{
if(Array.isArray(onreconnect)){
onreconnect.shift().apply(this,onreconnect);
}
}
game.loop(); game.loop();
game.send('reinited'); game.send('reinited');
_status.gameStarted=true; _status.gameStarted=true;
@ -12465,7 +12505,17 @@
var game={ var game={
online:false, online:false,
onlineID:null, onlineID:null,
randomMapOL:function(){ removeCard:function(name){
for(var i=0;i<lib.card.list.length;i++){
if(lib.card.list[i][2]==name){
lib.card.list.splice(i--,1);
}
}
},
randomMapOL:function(type){
if(type=='hidden'){
ui.arena.classList.add('playerhidden');
}
game.prepareArena(); game.prepareArena();
var list=[]; var list=[];
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
@ -12492,7 +12542,10 @@
map.push([game.players[i].playerid,game.players[i].nickname]); map.push([game.players[i].playerid,game.players[i].nickname]);
lib.playerOL[game.players[i].playerid]=game.players[i]; lib.playerOL[game.players[i].playerid]=game.players[i];
} }
game.broadcast(function(map,config){ game.broadcast(function(map,config,hidden){
if(hidden){
ui.arena.classList.add('playerhidden');
}
lib.configOL=config; lib.configOL=config;
ui.create.players(); ui.create.players();
ui.create.me(); ui.create.me();
@ -12510,8 +12563,9 @@
game.players[i].setNickname(); game.players[i].setNickname();
lib.playerOL[game.players[i].playerid]=game.players[i]; lib.playerOL[game.players[i].playerid]=game.players[i];
} }
_status.mode=lib.configOL.identity_mode; _status.mode=lib.configOL[lib.configOL.mode+'_mode'];
},map,lib.configOL); },map,lib.configOL,type=='hidden');
_status.mode=lib.configOL[lib.configOL.mode+'_mode'];
game.chooseCharacterOL(); game.chooseCharacterOL();
}, },
closeMenu:function(){ closeMenu:function(){
@ -12549,12 +12603,15 @@
func.apply(this,args); func.apply(this,args);
}, },
syncState:function(){ syncState:function(){
if(game.getState&&game.updateState){ var state=null;
game.broadcast(function(state,current){ if(game.getState){
game.updateState(state); state=game.getState();
_status.currentPhase=current;
},game.getState(),_status.currentPhase);
} }
game.broadcast(function(state,current,number){
if(game.updateState&&state) game.updateState(state);
_status.currentPhase=current;
game.phaseNumber=number;
},state,_status.currentPhase,game.phaseNumber);
}, },
updateWaiting:function(){ updateWaiting:function(){
var map=[]; var map=[];
@ -15034,8 +15091,10 @@
ui.tempnowuxie.close(); ui.tempnowuxie.close();
delete ui.tempnowuxie; delete ui.tempnowuxie;
} }
for(var i=0;i<game.players.length;i++){ if(game.getIdentityList){
game.players[i].setIdentity(); for(var i=0;i<game.players.length;i++){
game.players[i].setIdentity();
}
} }
return; return;
} }
@ -17591,7 +17650,7 @@
if(game.onlineroom){ if(game.onlineroom){
game.send('server','config',lib.configOL); game.send('server','config',lib.configOL);
} }
game.connectPlayers[0].say('房间设置已更改'); game.connectPlayers[0].chat('房间设置已更改');
} }
else if(_status.enteringroom){ else if(_status.enteringroom){
lib.configOL.mode=active.mode; lib.configOL.mode=active.mode;
@ -17753,17 +17812,31 @@
var expanded=false; var expanded=false;
var hasexpand=true; var hasexpand=true;
if(hiddenNodes.length){ if(hiddenNodes.length){
ui.create.div('.config.more','更多 <div>&gt;</div>',page,function(){ if(lib.config.fold_mode){
if(expanded){ var clickmore=function(type){
this.classList.remove('on'); if(type==='expand'&&expanded) return;
this.parentNode.classList.remove('expanded'); if(type==='unexpand'&&!expanded) return;
if(expanded){
this.classList.remove('on');
this.parentNode.classList.remove('expanded');
}
else{
this.classList.add('on');
this.parentNode.classList.add('expanded');
}
expanded=!expanded;
};
var morenodes=ui.create.div('.config.more','更多 <div>&gt;</div>',page);
morenodes.listen(clickmore);
morenodes._onclick=clickmore;
page.morenodes=morenodes;
}
else{
page.classList.add('expanded');
if(!connectMenu){
page.classList.add('expanded2');
} }
else{ }
this.classList.add('on');
this.parentNode.classList.add('expanded');
}
expanded=!expanded;
});
for(var k=0;k<hiddenNodes.length;k++){ for(var k=0;k<hiddenNodes.length;k++){
page.appendChild(hiddenNodes[k]); page.appendChild(hiddenNodes[k]);
} }
@ -17829,6 +17902,19 @@
active.classList.add('active'); active.classList.add('active');
} }
rightPane.appendChild(active.link); rightPane.appendChild(active.link);
if(lib.config.fold_mode){
rightPane.addEventListener('mousewheel',function(e){
var morenodes=this.firstChild.morenodes;
if(morenodes){
if(e.wheelDelta<0){
morenodes._onclick.call(morenodes,'expand');
}
else if(this.scrollTop==0){
morenodes._onclick.call(morenodes,'unexpand');
}
}
});
}
}()); }());
(function(){ (function(){
@ -23600,13 +23686,13 @@
if(this.roomfull){ if(this.roomfull){
alert('房间已满'); alert('房间已满');
} }
else if(this.roomgaming){ else if(this.roomgaming&&!game.onlineID){
alert('游戏已开始') alert('游戏已开始')
} }
else if(this.hasOwnProperty('roomindex')){ else if(this.hasOwnProperty('roomindex')){
if(!_status.enteringroom){ if(!_status.enteringroom){
_status.enteringroom=true;
if(this.roomempty){ if(this.roomempty){
_status.enteringroom=true;
_status.roomindex=this.roomindex; _status.roomindex=this.roomindex;
ui.click.connectMenu(); ui.click.connectMenu();
} }
@ -23633,6 +23719,7 @@
} }
} }
else{ else{
if(lib.configOL.mode=='versus') return;
if(lib.configOL.mode=='identity'&&lib.configOL.identity_mode=='zhong') return; if(lib.configOL.mode=='identity'&&lib.configOL.identity_mode=='zhong') return;
if(!this.classList.contains('unselectable2')&&lib.configOL.number<=2) return; if(!this.classList.contains('unselectable2')&&lib.configOL.number<=2) return;
this.classList.toggle('unselectable2') this.classList.toggle('unselectable2')
@ -24438,6 +24525,18 @@
}, },
}; };
var get={ var get={
charactersOL:function(){
var list=[];
for(var i=0;i<lib.configOL.characterPack.length;i++){
var pack=lib.characterPack[lib.configOL.characterPack[i]];
for(var j in pack){
if(j=='zuoci') continue;
if(lib.filter.characterDisabled(j)) continue;
if(lib.character[j]) list.push(j);
}
}
return list;
},
trimip:function(str){ trimip:function(str){
var len=str.length-5; var len=str.length-5;
if(str.lastIndexOf(':8080')==len){ if(str.lastIndexOf(':8080')==len){
@ -24481,6 +24580,7 @@
skills:lib.playerOL[i].skills, skills:lib.playerOL[i].skills,
hiddenSkills:lib.playerOL[i].hiddenSkills, hiddenSkills:lib.playerOL[i].hiddenSkills,
additionalSkills:lib.playerOL[i].additionalSkills, additionalSkills:lib.playerOL[i].additionalSkills,
disabledSkills:lib.playerOL[i].disabledSkills,
tempSkills:lib.playerOL[i].tempSkills, tempSkills:lib.playerOL[i].tempSkills,
storage:lib.playerOL[i].storage, storage:lib.playerOL[i].storage,
} }
@ -24752,8 +24852,13 @@
if(typeof str!='string') return ''; if(typeof str!='string') return '';
str=str.toUpperCase(); str=str.toUpperCase();
var str2=''; var str2='';
var nobreak=false;
for(var i=0;i<str.length;i++){ for(var i=0;i<str.length;i++){
if(str[i]=='`'){
nobreak=!nobreak;continue;
}
str2+=str[i]; str2+=str[i];
if(nobreak) continue;
if(sp&&str[i]=='S'&&str[i+1]=='P') continue; if(sp&&str[i]=='S'&&str[i+1]=='P') continue;
if(i<str.length-1){ if(i<str.length-1){
str2+='<br>'; str2+='<br>';
@ -25132,7 +25237,7 @@
} }
} }
if(get.itemtype(str)=='card'&&str.suit&&str.number){ if(get.itemtype(str)=='card'&&str.suit&&str.number){
if(arg=='viewAs'&&str.viewAs!=str.name){ if(arg=='viewAs'&&str.viewAs!=str.name&&str.viewAs){
str2+=''+get.translation(str)+''; str2+=''+get.translation(str)+'';
} }
else{ else{
@ -26393,8 +26498,16 @@
return -1.5; return -1.5;
} }
if(player.get('e').contains(card)){ if(player.get('e').contains(card)){
return ai.get.equipValue(card)/3; var evalue=ai.get.equipValue(card);
if(player.hasSkillTag('noe')){
if(evalue>=7){
return evalue/6;
}
return evalue/10;
}
return evalue/3;
} }
if(player.hasSkillTag('noh')) return 0.1;
var nh=player.num('h'); var nh=player.num('h');
switch(nh){ switch(nh){
case 1:return 2; case 1:return 2;

View File

@ -1,6 +1,6 @@
window.noname_update={ window.noname_update={
version:'1.8.6.1', version:'1.8.7',
changeLog:[ changeLog:[
'修bug' '界限武将、对决模式联机'
] ]
} }

View File

@ -187,6 +187,10 @@ table{table-layout: fixed;}
font-family:'STHeiti','SimHei','Microsoft JhengHei','Microsoft YaHei','WenQuanYi Micro Hei',Helvetica,Arial,sans-serif font-family:'STHeiti','SimHei','Microsoft JhengHei','Microsoft YaHei','WenQuanYi Micro Hei',Helvetica,Arial,sans-serif
} }
#arena.playerhidden>.player,
#arena.playerhidden>#mebg{
visibility: hidden;
}
#arena.chess>#arenalog{ #arena.chess>#arenalog{
display: none !important; display: none !important;
} }
@ -1286,6 +1290,7 @@ div:hover>.intro{opacity: 1;}
-webkit-animation:identity 0.8s; -webkit-animation:identity 0.8s;
} }
.player .identity[data-color="zhu"], .player .identity[data-color="zhu"],
.player .identity[data-color="truezhu"],
div[data-nature='fire'], div[data-nature='fire'],
span[data-nature='fire']{ span[data-nature='fire']{
text-shadow: black 0 0 1px,rgba(232, 53, 53,1) 0 0 2px,rgba(232, 53, 53,1) 0 0 5px,rgba(232, 53, 53,1) 0 0 10px, text-shadow: black 0 0 1px,rgba(232, 53, 53,1) 0 0 2px,rgba(232, 53, 53,1) 0 0 5px,rgba(232, 53, 53,1) 0 0 10px,
@ -1345,6 +1350,7 @@ span[data-nature='woodmm']{
} }
.player .identity[data-color="cai"], .player .identity[data-color="cai"],
.player .identity[data-color="wei"], .player .identity[data-color="wei"],
.player .identity[data-color="falsezhu"],
div[data-nature='water'], div[data-nature='water'],
span[data-nature='water']{ span[data-nature='water']{
text-shadow: rgba(78, 117, 140,1) 0 0 2px,rgba(78, 117, 140,1) 0 0 5px,rgba(78, 117, 140,1) 0 0 10px, text-shadow: rgba(78, 117, 140,1) 0 0 2px,rgba(78, 117, 140,1) 0 0 5px,rgba(78, 117, 140,1) 0 0 10px,

View File

@ -210,6 +210,9 @@
.menu.main>.menu-content>div>.right.pane>.expanded{ .menu.main>.menu-content>div>.right.pane>.expanded{
padding-bottom:80px; padding-bottom:80px;
} }
.menu.main>.menu-content>div>.right.pane>.expanded.expanded2{
padding-bottom:12px;
}
.menu.main>.menu-content>div>.right.pane>.morenodes{ .menu.main>.menu-content>div>.right.pane>.morenodes{
padding-bottom:10px; padding-bottom:10px;
} }

View File

@ -513,16 +513,7 @@ mode.guozhan={
var next=game.createEvent('chooseCharacter',false); var next=game.createEvent('chooseCharacter',false);
next.content=function(){ next.content=function(){
'step 0' 'step 0'
var list=[]; var list=get.charactersOL();
var libCharacter={};
for(var i=0;i<lib.configOL.characterPack.length;i++){
var pack=lib.characterPack[lib.configOL.characterPack[i]];
for(var j in pack){
if(j=='zuoci') continue;
if(lib.filter.characterDisabled(j)) continue;
if(lib.character[j]) list.push(j);
}
}
event.list=list.slice(0); event.list=list.slice(0);
var list2=[]; var list2=[];
var num; var num;

View File

@ -193,7 +193,14 @@ mode.identity={
game.zhu=game.zhu2; game.zhu=game.zhu2;
delete game.zhu2; delete game.zhu2;
} }
if(_status.mode!='zhong'&&get.config('enhance_zhu')&&get.population('fan')>=3){ var enhance_zhu=false;
if(_status.connectMode){
enhance_zhu=(_status.mode!='zhong'&&lib.configOL.enhance_zhu&&get.population('fan')>=3)
}
else{
enhance_zhu=(_status.mode!='zhong'&&get.config('enhance_zhu')&&get.population('fan')>=3);
}
if(enhance_zhu){
var skill; var skill;
switch(game.zhu.name){ switch(game.zhu.name){
case 'liubei':skill='jizhen';break; case 'liubei':skill='jizhen';break;
@ -208,8 +215,10 @@ mode.identity={
case 'liuxie':skill='moukui';break; case 'liuxie':skill='moukui';break;
default:skill='tianming';break; default:skill='tianming';break;
} }
game.zhu.addSkill(skill); game.broadcastAll(function(player,skill){
game.zhu.storage.enhance_zhu=skill; player.addSkill(skill);
player.storage.enhance_zhu=skill;
},game.zhu,skill);
} }
if(lib.storage.test){ if(lib.storage.test){
if(typeof lib.storage.test=='string'){ if(typeof lib.storage.test=='string'){
@ -400,7 +409,7 @@ mode.identity={
} }
} }
else if(game.me.identity=='nei'){ else if(game.me.identity=='nei'){
if(game.players.length==1){ if(game.players.length==1&&game.me.isAlive()){
game.over(true); game.over(true);
} }
else{ else{
@ -924,6 +933,7 @@ mode.identity={
var list2=[]; var list2=[];
var list3=[]; var list3=[];
event.list=[]; event.list=[];
event.list2=[];
var libCharacter={}; var libCharacter={};
for(var i=0;i<lib.configOL.characterPack.length;i++){ for(var i=0;i<lib.configOL.characterPack.length;i++){
@ -936,6 +946,7 @@ mode.identity={
for(i in libCharacter){ for(i in libCharacter){
if(lib.filter.characterDisabled(i)) continue; if(lib.filter.characterDisabled(i)) continue;
event.list.push(i); event.list.push(i);
event.list2.push(i);
if(libCharacter[i][4]&&libCharacter[i][4].contains('zhu')){ if(libCharacter[i][4]&&libCharacter[i][4].contains('zhu')){
list2.push(i); list2.push(i);
} }
@ -964,6 +975,8 @@ mode.identity={
} }
event.list.remove(game.zhu.name); event.list.remove(game.zhu.name);
event.list.remove(game.zhu.name2); event.list.remove(game.zhu.name2);
event.list2.remove(game.zhu.name);
event.list2.remove(game.zhu.name2);
if(game.players.length>4){ if(game.players.length>4){
game.zhu.maxHp++; game.zhu.maxHp++;
@ -983,30 +996,50 @@ mode.identity={
var list=[]; var list=[];
var selectButton=(lib.configOL.double_character?2:1); var selectButton=(lib.configOL.double_character?2:1);
var num,num2=0;
if(event.zhongmode){
num=3;
}
else{
num=Math.floor(event.list.length/(game.players.length-1));
num2=event.list.length-num*(game.players.length-1);
if(lib.configOL.double_nei){
num2=Math.floor(num2/2);
}
if(num>5){
num=5;
}
if(num2>2){
num2=2;
}
}
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
if(game.players[i]!=game.zhu){ if(game.players[i]!=game.zhu){
var num; var num3;
if(event.zhongmode){ if(game.players[i].identity=='nei'){
num=3; num3=num2;
} }
else{ else{
if(game.players[i].identity=='nei'){ num3=0;
num=7;
}
else{
num=5;
}
} }
list.push([game.players[i],['选择角色',[event.list.randomRemove(num),'character']],selectButton,true]); list.push([game.players[i],['选择角色',[event.list.randomRemove(num+num3),'character']],selectButton,true]);
} }
} }
game.me.chooseButtonOL(list,function(player,result){ game.me.chooseButtonOL(list,function(player,result){
if(game.online||player==game.me) player.init(result.links[0],result.links[1]); if(game.online||player==game.me) player.init(result.links[0],result.links[1]);
}); });
"step 2" "step 2"
for(var i in result){
if(result[i]&&result[i].links){
for(var j=0;j<result[i].links.length;j++){
event.list2.remove(result[i].links[j]);
}
}
}
for(var i in result){ for(var i in result){
if(result[i]=='ai'){ if(result[i]=='ai'){
result[i]=event.list.randomRemove(lib.configOL.double_character?2:1); result[i]=event.list2.randomRemove(lib.configOL.double_character?2:1);
} }
else{ else{
result[i]=result[i].links result[i]=result[i].links
@ -1071,16 +1104,7 @@ mode.identity={
this.node.dieidentity.style.transform=''; this.node.dieidentity.style.transform='';
} }
}, },
dieSpeak:function(){
// switch(this.identity){
// case 'zhu': this.popup('吾降矣',2000);break;
// case 'zhong': this.popup('呃啊',2000);break;
// case 'nei': this.popup('啊,被看穿了',2000);break;
// case 'fan': this.popup('饶命啊',2000);break;
// }
},
dieAfter:function(source){ dieAfter:function(source){
this.dieSpeak();
if(!this.identityShown){ if(!this.identityShown){
game.broadcastAll(function(player){ game.broadcastAll(function(player){
player.setIdentity(player.identity); player.setIdentity(player.identity);

View File

@ -24,7 +24,17 @@ mode.versus={
event.finish(); event.finish();
return; return;
} }
if(_status.mode=='jiange'||_status.mode=='four'){ if(_status.connectMode){
game.waitForPlayer(function(){
switch(lib.configOL.versus_mode){
case '1v1':lib.configOL.number=2;break;
case '2v2':lib.configOL.number=4;break;
case '3v3':lib.configOL.number=6;break;
case '4v4':lib.configOL.number=8;break;
}
});
}
else if(_status.mode=='jiange'||_status.mode=='four'){
game.prepareArena(8); game.prepareArena(8);
// game.pause(); // game.pause();
} }
@ -53,7 +63,15 @@ mode.versus={
} }
game.delay(); game.delay();
"step 2" "step 2"
if(_status.mode=='four'){ if(_status.connectMode){
if(lib.configOL.versus_mode=='1v1'){
game.randomMapOL('hidden');
}
else{
game.randomMapOL();
}
}
else if(_status.mode=='four'){
var list=['zhu','zhong','zhong','zhong','ezhu','ezhong','ezhong','ezhong']; var list=['zhu','zhong','zhong','zhong','ezhu','ezhong','ezhong','ezhong'];
list.randomSort(); list.randomSort();
var side=Math.random()<0.5; var side=Math.random()<0.5;
@ -120,7 +138,7 @@ mode.versus={
}); });
} }
_status.videoInited=true; _status.videoInited=true;
if(_status.mode=='four'||_status.mode=='jiange'){ if(_status.mode=='four'||_status.mode=='jiange'||_status.connectMode){
info.push(false); info.push(false);
} }
else{ else{
@ -128,112 +146,126 @@ mode.versus={
} }
game.addVideo('init',null,info); game.addVideo('init',null,info);
event.trigger('gameStart'); event.trigger('gameStart');
if(_status.mode=='four'){ if(_status.connectMode){
game.gameDraw(_status.firstAct,function(player){ if(_status.mode=='1v1'){
if(player==_status.firstAct.previousSeat){ _status.first_less=true;
return 5; game.gameDraw(_status.firstChoose.next);
} game.phaseLoop(_status.firstChoose.next);
return 4;
});
if(game.me==_status.firstAct.previous||game.me==_status.firstAct.previous.previous){
game.me.chooseBool('是否置换手牌?');
event.replaceCard=true;
} }
} else if(_status.mode='2v2'){
else if(_status.mode=='jiange'){ _status.first_less=true;
var firstAct; var firstChoose=game.players.randomGet();
for(var i=0;i<game.players.length;i++){ game.gameDraw(firstChoose);
if(game.players[i].type=='mech'&&game.players[i].group=='wei'){ game.phaseLoop(firstChoose);
firstAct=game.players[i];break;
}
} }
_status.actlist=[ event.finish();
firstAct,
firstAct.next,
firstAct.previous,
firstAct.next.next,
firstAct.previous.previous,
firstAct.next.next.next,
firstAct.previous.previous.previous,
firstAct.next.next.next.next
];
game.gameDraw(firstAct);
game.phaseLoopJiange();
} }
else{ else{
var firstAct; if(_status.mode=='four'){
if(lib.storage.zhu){ game.gameDraw(_status.firstAct,function(player){
firstAct=(_status.currentSide==game.me.side)?game.friendZhu:game.enemyZhu; if(player==_status.firstAct.previousSeat){
return 5;
}
return 4;
});
if(game.me==_status.firstAct.previous||game.me==_status.firstAct.previous.previous){
game.me.chooseBool('是否置换手牌?');
event.replaceCard=true;
}
} }
else{ else if(_status.mode=='jiange'){
if(!lib.storage.cross_seat&&!lib.storage.random_seat&&lib.storage.number>1){ var firstAct;
for(var i=0;i<game.players.length-1;i++){ for(var i=0;i<game.players.length;i++){
if(game.players[i].side!=game.players[i+1].side){ if(game.players[i].type=='mech'&&game.players[i].group=='wei'){
var actcount; firstAct=game.players[i];break;
if(Math.random()<0.5){
actcount=i;
}
else{
if(i>=lib.storage.number){
actcount=i-lib.storage.number;
}
else{
actcount=i+lib.storage.number;
}
}
if(actcount>0){
actcount--;
}
else{
actcount=game.players.length-1;
}
firstAct=game.players[actcount];
break;
}
} }
} }
else{ _status.actlist=[
firstAct=game.players[Math.floor(Math.random()*game.players.length)]; firstAct,
} firstAct.next,
} firstAct.previous,
game.gameDraw(firstAct,4); firstAct.next.next,
_status.first_less=true; firstAct.previous.previous,
_status.round=0; firstAct.next.next.next,
if(lib.storage.single_control){ firstAct.previous.previous.previous,
lib.skill.global.push('versus_swap'); firstAct.next.next.next.next
ui.autoreplace=ui.create.div('.caption.normal'); ];
ui.autoreplace.innerHTML='<div class="underline">自动换人</div>'; game.gameDraw(firstAct);
ui.autoreplace.style.textAlign='center'; game.phaseLoopJiange();
if(lib.storage.autoreplaceinnerhtml){
ui.autoreplace.classList.add('on')
}
ui.autoreplace.listen(game.switchAutoreplace);
// 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,220);
}
}
_status.enemyCount=ui.create.system('杀敌: '+get.cnNumber(0,true),null,true);
_status.friendCount=ui.create.system('阵亡: '+get.cnNumber(0,true),null,true);
// _status.friendCount=ui.create.system('友方',null,true);
// _status.enemyCount=ui.create.system('敌方',null,true);
lib.setPopped(_status.friendCount,game.versusHoverFriend);
lib.setPopped(_status.enemyCount,game.versusHoverEnemy);
if(lib.storage.zhu){
_status.currentSide=true;
game.versusPhaseLoop(firstAct);
} }
else{ else{
game.versusPhaseLoop(firstAct); var firstAct;
if(lib.storage.zhu){
firstAct=(_status.currentSide==game.me.side)?game.friendZhu:game.enemyZhu;
}
else{
if(!lib.storage.cross_seat&&!lib.storage.random_seat&&lib.storage.number>1){
for(var i=0;i<game.players.length-1;i++){
if(game.players[i].side!=game.players[i+1].side){
var actcount;
if(Math.random()<0.5){
actcount=i;
}
else{
if(i>=lib.storage.number){
actcount=i-lib.storage.number;
}
else{
actcount=i+lib.storage.number;
}
}
if(actcount>0){
actcount--;
}
else{
actcount=game.players.length-1;
}
firstAct=game.players[actcount];
break;
}
}
}
else{
firstAct=game.players[Math.floor(Math.random()*game.players.length)];
}
}
game.gameDraw(firstAct,4);
_status.first_less=true;
_status.round=0;
if(lib.storage.single_control){
lib.skill.global.push('versus_swap');
ui.autoreplace=ui.create.div('.caption.normal');
ui.autoreplace.innerHTML='<div class="underline">自动换人</div>';
ui.autoreplace.style.textAlign='center';
if(lib.storage.autoreplaceinnerhtml){
ui.autoreplace.classList.add('on')
}
ui.autoreplace.listen(game.switchAutoreplace);
// 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,220);
}
}
_status.enemyCount=ui.create.system('杀敌: '+get.cnNumber(0,true),null,true);
_status.friendCount=ui.create.system('阵亡: '+get.cnNumber(0,true),null,true);
lib.setPopped(_status.friendCount,game.versusHoverFriend);
lib.setPopped(_status.enemyCount,game.versusHoverEnemy);
if(lib.storage.zhu){
_status.currentSide=true;
game.versusPhaseLoop(firstAct);
}
else{
game.versusPhaseLoop(firstAct);
}
}
if(_status.mode!='four'){
event.finish();
} }
}
if(_status.mode!='four'){
event.finish();
} }
"step 4" "step 4"
if(event.replaceCard&&result.bool){ if(event.replaceCard&&result.bool){
@ -246,6 +278,18 @@ mode.versus={
game.phaseLoop(_status.firstAct); game.phaseLoop(_status.firstAct);
}, },
game:{ game:{
checkOnlineResult:function(player){
return game.players[0].side==player.side;
},
getRoomInfo:function(uiintro){
if(lib.configOL.versus_mode=='1v1'){
uiintro.add('<div class="text chat">侯选人数:'+lib.configOL.choice_num+'人');
uiintro.add('<div class="text chat">替补人数:'+lib.configOL.replace_number+'人');
}
uiintro.add('<div class="text chat">出牌时限:'+lib.configOL.choose_timeout+'秒');
uiintro.add('<div class="text chat">屏蔽弱将:'+(lib.configOL.ban_weak?'开启':'关闭'));
uiintro.add('<div class="text chat">屏蔽强将:'+(lib.configOL.ban_strong?'开启':'关闭')).style.paddingBottom='8px';
},
getVideoName:function(){ getVideoName:function(){
var str=get.translation(game.me.name); var str=get.translation(game.me.name);
if(game.me.name2){ if(game.me.name2){
@ -1114,6 +1158,356 @@ mode.versus={
} }
} }
}, },
chooseCharacterOL:function(){
switch(lib.configOL.versus_mode){
case '1v1':game.chooseCharacterOL1();break;
case '2v2':game.chooseCharacterOL2();break;
case '3v3':game.chooseCharacterOL3();break;
case '4v4':game.chooseCharacterOL4();break;
}
},
chooseCharacterOL4:function(){
var next=game.createEvent('chooseCharacter',false);
next.content=function(){
"step 0"
var list=
event.filterChoice=function(name){
if(['yuanshu','re_yuanshu','zhangxingcai','hetaiyou','wenpin','yuji',
'xunyu','lusu','guanping','zhangzong','zhoutai','sp_zhangjiao','zhangjiao',
'shixie','zhanglu','chenlin','mayunlu','yangxiu','zhugeke','chengyu',
'zhangbao','zhangliang','sunhao','wutugu','zhugeguo','liuzan','lingcao',
'sunru','lingju','lifeng','hanba','sunluyu','zhuling','daxiaoqiao',
'sp_zhaoyun','sp_diaochan','sp_pangtong','sp_caoren','sp_daqiao',
'sp_ganning','sp_zhangfei','sp_xiahoudun'].contains(name)){
return true;
}
if(lib.characterPack.refresh[name]) return false;
if(lib.characterPack.standard[name]){
if(lib.characterPack.refresh['re_'+name]) return true;
return false;
}
if(lib.characterPack.shenhua[name]) return false;
if(lib.characterPack.sp[name]) return false;
if(lib.characterPack.yijiang[name]) return false;
return true;
}
event.list.randomSort();
event.list2=list2;
event.current=game.players.randomGet();
_status.firstAct=event.current;
event.four_assign=get.config('four_assign');
event.flipassign=true;
"step 1"
if(event.current==game.me||(event.four_assign&&event.current.side==game.me.side)){
var dialog=event.xdialog||ui.create.characterDialog(event.filterChoice);
var names=[];
for(var i=0;i<game.players.length;i++){
if(game.players[i].name){
names.push(game.players[i].name);
}
}
for(var i=0;i<dialog.buttons.length;i++){
if(names.contains(dialog.buttons[i].link)){
dialog.buttons[i].classList.add('unselectable');
dialog.buttons[i].classList.add('noclick');
}
}
if(!event.groupControl){
event.groupControl=ui.create.groupControl(dialog);
}
game.me.chooseButton(dialog,true).closeDialog=false;
event.xdialog=dialog;
dialog.static=true;
event.current.classList.add('selectedx');
}
else{
event.ai(event.current,event.list.randomGets(3),event.list2);
if(!event.four_assign){
event.current=event.current.next;
event.redo();
}
}
"step 2"
event.current.classList.remove('selectedx');
if(event.current.side==game.me.side){
event.current.init(result.buttons[0].link);
event.list.remove(event.current.name);
event.list2.remove(event.current.name);
if(event.current.identity=='zhu'){
event.current.hp++;
event.current.maxHp++;
event.current.update();
}
}
if(event.four_assign){
for(var i=0;i<game.players.length;i++){
if(!game.players[i].name) break;
}
if(i<game.players.length){
var side=event.current.side;
event.current=_status.firstAct;
if(event.flipassign){
for(var iwhile=0;iwhile<8;iwhile++){
event.current=event.current.next;
if(event.current.side!=side&&!event.current.name){
break;
}
}
}
else{
for(var iwhile=0;iwhile<8;iwhile++){
event.current=event.current.previous;
if(event.current.side==side&&!event.current.name){
break;
}
}
}
event.flipassign=!event.flipassign;
event.goto(1);
}
}
else{
for(var i=0;i<game.players.length;i++){
if(!game.players[i].name){
event.ai(game.players[i],event.list.splice(0,3),event.list2);
}
}
}
"step 3"
if(event.groupControl){
event.groupControl.close();
}
if(event.xdialog){
event.xdialog.close();
}
game.addRecentCharacter(game.me.name,game.me.name2);
}
},
chooseCharacterOL2:function(){
var next=game.createEvent('chooseCharacterOL',false);
next.content=function(){
'step 0'
game.broadcastAll(function(ref,bool){
game.me.node.identity.firstChild.innerHTML='友';
game.me.next.next.node.identity.firstChild.innerHTML='友';
game.me.next.node.identity.firstChild.innerHTML='敌';
game.me.previous.node.identity.firstChild.innerHTML='敌';
ref.side=bool;
ref.next.next.side=bool;
ref.next.side=!bool;
ref.previous.side=!bool;
for(var i=0;i<game.players.length;i++){
game.players[i].node.identity.dataset.color=game.players[i].side+'zhu';
}
},game.me,Math.random()<0.5);
_status.onreconnect=[function(){
game.me.node.identity.firstChild.innerHTML='友';
game.me.nextSeat.nextSeat.node.identity.firstChild.innerHTML='友';
game.me.nextSeat.node.identity.firstChild.innerHTML='敌';
game.me.previousSeat.node.identity.firstChild.innerHTML='敌';
}];
var list=get.charactersOL();
var choose=[];
event.list=list;
for(var i=0;i<game.players.length;i++){
choose.push([game.players[i],['选择角色',[list.randomRemove(7),'character']],true]);
}
game.me.chooseButtonOL(choose,function(player,result){
if(game.online||player==game.me) player.init(result.links[0]);
});
'step 1'
for(var i in result){
if(result[i]=='ai'){
result[i]=event.list.randomRemove();
}
else{
result[i]=result[i].links[0];
}
if(!lib.playerOL[i].name){
lib.playerOL[i].init(result[i]);
}
}
game.broadcast(function(result){
for(var i in result){
if(!lib.playerOL[i].name){
lib.playerOL[i].init(result[i]);
}
}
},result);
}
},
chooseCharacterOL1:function(){
var next=game.createEvent('chooseCharacterOL',false);
next.content=function(){
'step 0'
game.removeCard('shengdong');
game.additionaldead=[];
var list=get.charactersOL();
list=list.randomGets(parseInt(lib.configOL.choice_num));
list.remove('huatuo');
list.remove('sunquan');
event.videoId=lib.status.videoId++;
if(Math.random()<0.5){
event.choosing=game.me;
}
else{
event.choosing=game.me.next;
}
var createDialog=function(list,id,list1,list2){
var dialog=ui.create.dialog('选择角色',[list,'character']);
dialog.classList.add('fullwidth');
dialog.classList.add('fullheight');
dialog.classList.add('noslide');
dialog.classList.add('fixed');
dialog.videoId=id;
if(list2&&list2){
ui.arena.classList.add('playerhidden');
for(var i=0;i<dialog.buttons.length;i++){
var button=dialog.buttons[i];
if(list1.contains(button.link)){
button.classList.add('selectedx');
}
else if(list2.contains(button.link)){
button.classList.add('glow');
}
}
}
else{
if(list1!=game.me){
dialog.content.firstChild.innerHTML='等待对手选择';
}
}
};
game.broadcastAll(createDialog,list,event.videoId,event.choosing);
game.me.storage.versuslist=[];
game.me.next.storage.versuslist=[];
event.selected=[];
_status.firstChoose=event.choosing;
event.num=(parseInt(lib.configOL.replace_number)+1)*2;
_status.onreconnect=[createDialog,list,event.videoId,
_status.firstChoose.storage.versuslist,
_status.firstChoose.next.storage.versuslist];
game.broadcastAll(function(player){
player.setIdentity('truezhu');
player.next.setIdentity('falsezhu');
},_status.firstChoose);
'step 1'
var next=event.choosing.chooseButton(event.videoId,1,true);
next.set('filterButton',function(button){
if(_status.event.selected.contains(button.link)) return false;
return true;
});
next.set('selected',event.selected);
next.set('ai',function(){
return Math.random();
});
'step 2'
event.choosing.storage.versuslist.push(result.links[0]);
game.broadcastAll(function(link,choosing,first,id){
var dialog=get.idDialog(id);
if(dialog){
if(choosing==game.me){
choosing='你';
}
else{
choosing='对手';
}
dialog.content.firstChild.innerHTML=choosing+'选择了'+get.translation(link);
for(var i=0;i<dialog.buttons.length;i++){
if(dialog.buttons[i].link==link){
if(first){
dialog.buttons[i].classList.add('selectedx');
}
else{
dialog.buttons[i].classList.add('glow');
}
}
}
}
},result.links[0],event.choosing,event.choosing==_status.firstChoose,event.videoId);
event.selected.push(result.links[0]);
event.choosing=event.choosing.next;
event.num--;
if(event.num){
event.goto(1);
}
'step 3'
game.delay(2)
'step 4'
game.broadcastAll(function(id){
ui.arena.classList.remove('playerhidden');
var dialog=get.idDialog(id);
if(dialog){
dialog.close();
}
},event.videoId);
_status.friendDied=[];
_status.enemyDied=[];
_status.friend=game.me.storage.versuslist;
_status.enemy=game.me.next.storage.versuslist;
delete game.me.storage.versuslist;
delete game.me.next.storage.versuslist;
_status.enemyCount=ui.create.system('杀敌: '+get.cnNumber(0,true),null,true);
_status.friendCount=ui.create.system('阵亡: '+get.cnNumber(0,true),null,true);
lib.setPopped(_status.friendCount,game.versusHoverFriend);
lib.setPopped(_status.enemyCount,game.versusHoverEnemy);
game.me.side=true;
game.me.next.side=false;
var func=function(list1,list2,list3,list4,func1,func2){
game.me.side=false;
game.me.nextSeat.side=true;
_status.friendDied=list1;
_status.enemyDied=list2;
_status.friend=list3;
_status.enemy=list4;
_status.enemyCount=ui.create.system('杀敌: '+get.cnNumber(0,true),null,true);
_status.friendCount=ui.create.system('阵亡: '+get.cnNumber(0,true),null,true);
lib.setPopped(_status.friendCount,func1);
lib.setPopped(_status.enemyCount,func2);
};
_status.onreconnect=[func,_status.enemyDied,_status.friendDied,
_status.enemy,_status.friend,game.versusHoverFriend,game.versusHoverEnemy];
game.me.next.send.apply(game.me.next,_status.onreconnect);
var list=[[game.me,['选择出场角色',[_status.friend,'character']]],[game.me.next,['选择出场角色',[_status.enemy,'character']]]];
game.me.chooseButtonOL(list,function(player,result){
if(game.online||player==game.me) player.init(result.links[0]);
});
'step 5'
var result1=result[game.me.playerid].links[0];
var result2;
var enemy=result[game.me.next.playerid];
if(enemy&&enemy.links&&enemy.links.length){
result2=enemy.links[0];
}
else{
result2=_status.enemy.randomGet();
}
game.me.next.init(result2);
_status.enemy.remove(result2);
_status.friend.remove(result1);
game.me.next.send(function(result1,result2){
if(!game.me.name){
game.me.init(result2);
}
game.me.next.init(result1);
_status.friend.remove(result2);
_status.enemy.remove(result1);
},result1,result2);
}
},
versusPhaseLoop:function(player){ versusPhaseLoop:function(player){
var next=game.createEvent('phaseLoop'); var next=game.createEvent('phaseLoop');
next.player=player; next.player=player;
@ -1178,6 +1572,115 @@ mode.versus={
event.redo(); event.redo();
} }
}, },
replacePlayerOL:function(player){
var next=game.createEvent('replacePlayer');
next.source=player;
next.content=function(){
'step 0'
game.delay();
'step 1'
if(event.source.side==game.me.side){
if(_status.friend.length==1){
event.directresult=_status.friend[0];
}
else if(_status.auto){
event.directresult=_status.friend.randomGet();
}
else{
event.dialog=ui.create.dialog('选择替补角色',[_status.friend,'character']);
event.filterButton=function(){return true};
event.player=game.me;
event.forced=true;
event.custom.replace.confirm=function(){
event.directresult=ui.selected.buttons[0].link;
event.dialog.close();
if(ui.confirm) ui.confirm.close();
delete event.player;
game.resume();
}
event.switchToAuto=function(){
event.directresult=_status.friend.randomGet();
event.dialog.close();
if(ui.confirm) ui.confirm.close();
delete event.player;
};
game.check();
game.pause();
}
}
else{
if(_status.enemy.length==1){
event.directresult=_status.enemy[0];
}
else if(!game.me.nextSeat.isOnline()){
event.directresult=_status.enemy.randomGet();
}
else{
game.me.nextSeat.send(function(player){
if(_status.auto){
_status.event._result=_status.friend.randomGet();
}
else{
var next=game.createEvent('replacePlayer');
next.source=player;
next.content=function(){
event.dialog=ui.create.dialog('选择替补角色',[_status.friend,'character']);
event.filterButton=function(){return true};
event.player=event.source;
event.forced=true;
event.custom.replace.confirm=function(){
event.result=ui.selected.buttons[0].link;
event.dialog.close();
if(ui.confirm) ui.confirm.close();
delete event.player;
game.resume();
}
event.switchToAuto=function(){
event.result=_status.friend.randomGet();
event.dialog.close();
if(ui.confirm) ui.confirm.close();
delete event.player;
};
game.check();
game.pause();
}
}
game.resume();
},game.me.nextSeat);
game.me.nextSeat.wait();
game.pause();
}
}
'step 2'
if(!event.directresult){
if(event.resultOL){
event.directresult=event.resultOL[game.me.nextSeat.playerid];
}
if(!event.directresult||event.directresult=='ai'){
event.directresult=_status.enemy.randomGet();
}
}
var name=event.directresult;
var color=source.node.identity.dataset.color;
game.additionaldead.push({
name:source.name,
stat:source.stat
});
game.broadcastAll(function(source,name,color){
_status.friend.remove(name);
_status.enemy.remove(name);
source.revive();
source.uninit();
source.init(name);
source.node.identity.dataset.color=color;
},source,name,color);
source.draw(4);
_status.event.parent.parent.parent.untrigger(false,source);
game.addVideo('reinit',source,[name,color]);
}
},
replacePlayer:function(player){ replacePlayer:function(player){
var next=game.createEvent('replacePlayer'); var next=game.createEvent('replacePlayer');
next.source=player; next.source=player;
@ -1550,6 +2053,8 @@ mode.versus={
translate:{ translate:{
zhu:'主', zhu:'主',
zhong:'忠', zhong:'忠',
truezhu:"帅",
falsezhu:"将",
trueZhu:"帅", trueZhu:"帅",
falseZhu:"将", falseZhu:"将",
trueZhong:"兵", trueZhong:"兵",
@ -1616,93 +2121,132 @@ mode.versus={
}, },
element:{ element:{
player:{ player:{
dieSpeak:function(){
// switch(this.identity){
// case 'zhu': this.popup('吾降矣',2000);break;
// case 'zhong': this.popup('呃啊',2000);break;
// }
},
dieAfter:function(source){ dieAfter:function(source){
if(_status.mode=='four'){ if(_status.connectMode){
if(this.identity=='zhu'){ if(_status.mode=='1v1'){
game.over(this.side!=game.me.side); game.broadcastAll(function(dead){
if(dead.side==game.me.side){
_status.friendDied.push(dead.name);
_status.friendCount.innerHTML='阵亡: '+get.cnNumber(_status.friendDied.length,true);
}
else{
_status.enemyDied.push(dead.name);
_status.enemyCount.innerHTML='杀敌: '+get.cnNumber(_status.enemyDied.length,true);
}
},this);
if(this==game.me){
if(_status.friend.length==0){
game.over(false);
return;
}
}
else{
if(_status.enemy.length==0){
game.over(true);
return;
}
}
game.replacePlayerOL(this);
} }
else if(source){ else if(_status.mode=='2v2'){
if(source.side==this.side){ if(this.nextSeat.nextSeat.isAlive()){
if(source.identity=='zhu'){ var next=game.createEvent('versusDraw');
source.discard(source.get('he')); next.content=function(){
} 'step 0'
player.chooseBool('是否摸一张牌?');
'step 1'
if(result.bool){
player.draw();
}
};
next.player=this.nextSeat.nextSeat;
} }
else{ else{
var num1=0,num2=1; game.over(this.side!=game.me.side);
for(var i=0;i<game.players.length;i++){
if(game.players[i].side==source.side){
num1++;
}
else{
num2++;
}
}
source.draw(2+Math.max(0,num2-num1));
} }
} }
return;
}
else if(_status.mode=='jiange'){
if(get.population('wei')==0){
game.over(game.me.identity=='shu');
}
else if(get.population('shu')==0){
game.over(game.me.identity=='wei');
}
return;
}
this.dieSpeak();
if(this.side==game.me.side){
_status.friendDied.push(this.name);
_status.friendCount.innerHTML='阵亡: '+get.cnNumber(_status.friendDied.length,true);
} }
else{ else{
_status.enemyDied.push(this.name); if(_status.mode=='four'){
_status.enemyCount.innerHTML='杀敌: '+get.cnNumber(_status.enemyDied.length,true); if(this.identity=='zhu'){
} game.over(this.side!=game.me.side);
}
else if(source){
if(source.side==this.side){
if(source.identity=='zhu'){
source.discard(source.get('he'));
}
}
else{
var num1=0,num2=1;
for(var i=0;i<game.players.length;i++){
if(game.players[i].side==source.side){
num1++;
}
else{
num2++;
}
}
source.draw(2+Math.max(0,num2-num1));
}
}
return;
}
else if(_status.mode=='jiange'){
if(get.population('wei')==0){
game.over(game.me.identity=='shu');
}
else if(get.population('shu')==0){
game.over(game.me.identity=='wei');
}
return;
}
if(this.side==game.me.side){
_status.friendDied.push(this.name);
_status.friendCount.innerHTML='阵亡: '+get.cnNumber(_status.friendDied.length,true);
}
else{
_status.enemyDied.push(this.name);
_status.enemyCount.innerHTML='杀敌: '+get.cnNumber(_status.enemyDied.length,true);
}
var list=(this.side==game.me.side)?_status.friend:_status.enemy; var list=(this.side==game.me.side)?_status.friend:_status.enemy;
if((list.length==0&&lib.storage.noreplace_end)|| if((list.length==0&&lib.storage.noreplace_end)||
(lib.storage.zhu&&lib.storage.main_zhu&&this.identity=='zhu'&&game.players.length>2)){ (lib.storage.zhu&&lib.storage.main_zhu&&this.identity=='zhu'&&game.players.length>2)){
if(game.friend.contains(this)){ if(game.friend.contains(this)){
game.over(false);
}
else{
game.over(true);
}
}
else if(game.friend.length==1&&this==game.friend[0]&&_status.friend.length==0){
game.over(false); game.over(false);
} }
else{ else if(game.enemy.length==1&&this==game.enemy[0]&&_status.enemy.length==0){
game.over(true); game.over(true);
} }
} else{
else if(game.friend.length==1&&this==game.friend[0]&&_status.friend.length==0){ if(source){
game.over(false); if(source.side!=this.side){
} if(lib.storage.versus_reward){
else if(game.enemy.length==1&&this==game.enemy[0]&&_status.enemy.length==0){ source.draw(lib.storage.versus_reward);
game.over(true); }
} }
else{ else{
if(source){ if(lib.storage.versus_punish=='弃牌'){
if(source.side!=this.side){ source.discard(source.get('he'));
if(lib.storage.versus_reward){ }
source.draw(lib.storage.versus_reward); else if(lib.storage.versus_punish=='摸牌'&&lib.storage.versus_reward){
source.draw(lib.storage.versus_reward);
}
} }
} }
else{ else{
if(lib.storage.versus_punish=='弃牌'){ game.delay();
source.discard(source.get('he'));
}
else if(lib.storage.versus_punish=='摸牌'&&lib.storage.versus_reward){
source.draw(lib.storage.versus_reward);
}
} }
game.replacePlayer(this);
} }
else{
game.delay();
}
game.replacePlayer(this);
} }
} }
} }
@ -1711,11 +2255,27 @@ mode.versus={
get:{ get:{
attitude:function(from,to){ attitude:function(from,to){
if(from.side==to.side){ if(from.side==to.side){
if(to.identity=='zhu'&&(lib.storage.main_zhu||_status.mode=='four')) return 10; if(to.identity=='zhu'){
if(_status.connectMode){
if(_status.mode=='4v4') return 10;
}
else{
if(lib.storage.main_zhu||_status.mode=='four') return 10;
}
}
return 6; return 6;
} }
if(to.identity=='zhu'&&(lib.storage.main_zhu||_status.mode=='four')) return -10; else{
return -6; if(to.identity=='zhu'){
if(_status.connectMode){
if(_status.mode=='4v4') return -10;
}
else{
if(lib.storage.main_zhu||_status.mode=='four') return -10;
}
}
return -6;
}
}, },
} }
}, },