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){
var es=target.get('e');
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 noh=(nh==0||target.hasSkillTag('noh'));
if(noh&&noe) return 0;
@ -1425,7 +1425,7 @@ card.standard={
else{
str+=get.translation(card);
}
if(targets||target){
if((targets||target)&&!isJudge){
str+='对'+get.translation(targets||target);
}
str+='将'+(state>0?'生效':'失效')+',是否无懈?';

View File

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

View File

@ -438,7 +438,15 @@ character.shenhua={
if(get.position(button.link)=='j') return -10;
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{
event.finish();

View File

@ -821,7 +821,7 @@ character.sp={
if(target.skills.contains('tuntian')) return 0;
var es=target.get('e');
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 noh=(nh==0||target.hasSkillTag('noh'));
if(noh&&noe) return 0;

View File

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

View File

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

View File

@ -778,6 +778,11 @@
init:true,
unfrequent:true,
},
fold_mode:{
name:'折叠模式菜单',
init:true,
unfrequent:true,
},
auto_popped_config:{
name:'自动弹出选项',
init:true,
@ -2246,6 +2251,63 @@
},
versus:{
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:{
update:function(config,map){
if(config.versus_mode=='four'){
@ -4509,7 +4571,7 @@
game.modPhaseDraw(player,event.num);
}
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--;
}
if(event.num>0){
@ -5609,12 +5671,7 @@
game.addVideo('showCards',player,[str,get.cardsInfo(cards)]);
game.delayx(2);
"step 1"
game.broadcast(function(id){
var dialog=get.idDialog(id);
if(dialog){
dialog.close();
}
},event.dialogid);
game.broadcast('closeDialog',event.dialogid);
event.dialog.close();
},
showCards:function(){
@ -5636,12 +5693,7 @@
game.delayx(2);
game.addVideo('showCards',player,[event.str,get.cardsInfo(cards)]);
"step 1"
game.broadcast(function(id){
var dialog=get.idDialog(id);
if(dialog){
dialog.close();
}
},event.dialogid);
game.broadcast('closeDialog',event.dialogid);
event.dialog.close();
},
viewHandcards:function(){
@ -6685,11 +6737,13 @@
cards[i].goto(ui.discardPile);
}
if(game.online&&player==game.me&&!_status.over&&!game.controlOver&&!ui.exit){
if(lib.mode[lib.configOL.mode].config.dierestart){
ui.exit=ui.create.control('退出联机',function(){
game.saveConfig('reconnect_info');
game.reload();
});
}
}
if(lib.config.background_speak){
if(lib.character[player.name]&&
@ -7077,7 +7131,15 @@
this.roomempty=false;
var config=info[2];
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='忠胆英杰';
}
else{
@ -7261,6 +7323,7 @@
judges:this.get('j'),
position:parseInt(this.dataset.position),
hujia:this.hujia,
side:this.side,
identityShown:this.identityShown,
identityNode:[this.node.identity.innerHTML,this.node.identity.dataset.color],
identity:this.identity,
@ -9433,6 +9496,7 @@
if(self) return true;
return false;
}
if(_status.connectMode) return false;
if(lib.config.mode=='versus'){
if(_status.mode=='four'||_status.mode=='jiange') return false;
return ui.autoreplace&&ui.autoreplace.classList.contains('on')&&
@ -10840,42 +10904,8 @@
return this;
},
send:function(){
var skills={
global:lib.skill.global
};
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];
this.player.send(function(name,args,set,event,skills){
game.me.applySkills(skills);
var next=game.me[name].apply(game.me,args);
for(var i=0;i<set.length;i++){
next.set(set[i][0],set[i][1]);
@ -10883,8 +10913,7 @@
next._modparent=event;
game.resume();
},this.name,this._args||[],this._set,
get.stringifiedResult(this.parent,3),
this.player.getStat(),skills,skillinfo);
get.stringifiedResult(this.parent,3),get.skillState(this.player));
this.player.wait();
game.pause();
},
@ -11903,7 +11932,7 @@
game.broadcast(function(player){
player.setNickname();
},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){
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.pause.show();
game.clearConnect();
clearTimeout(_status.createNodeTimeout);
game.online=true;
@ -12252,7 +12280,13 @@
}
game.clearArena();
game.finishCards();
if(!observe) ui.create.chat();
if(!observe){
ui.create.chat();
if(ui.exitroom){
ui.exitroom.remove();
delete ui.exitroom;
}
}
else{
if(!ui.exitroom){
ui.create.system('退出旁观',function(){
@ -12284,6 +12318,7 @@
player.maxHp=info.maxHp;
player.hujia=info.hujia;
player.sex=info.sex;
player.side=info.side;
player.setNickname();
if(info.dead){
player.classList.add('dead');
@ -12314,13 +12349,13 @@
player.node.judges.appendChild(info.judges[i]);
}
if(!player.setModeState){
if(player==game.me||player.identityShown){
player.setIdentity();
}
else if(!game.getIdentityList&&info.identityNode){
if(!game.getIdentityList&&info.identityNode){
player.node.identity.innerHTML=info.identityNode[0];
player.node.identity.dataset.color=info.identityNode[1];
}
else if(player==game.me||player.identityShown){
player.setIdentity();
}
else{
player.setIdentity('cai');
}
@ -12346,6 +12381,11 @@
if(player.isAlive()) game.swapPlayer(player);
}
}
else{
if(Array.isArray(onreconnect)){
onreconnect.shift().apply(this,onreconnect);
}
}
game.loop();
game.send('reinited');
_status.gameStarted=true;
@ -12465,7 +12505,17 @@
var game={
online:false,
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();
var list=[];
for(var i=0;i<game.players.length;i++){
@ -12492,7 +12542,10 @@
map.push([game.players[i].playerid,game.players[i].nickname]);
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;
ui.create.players();
ui.create.me();
@ -12510,8 +12563,9 @@
game.players[i].setNickname();
lib.playerOL[game.players[i].playerid]=game.players[i];
}
_status.mode=lib.configOL.identity_mode;
},map,lib.configOL);
_status.mode=lib.configOL[lib.configOL.mode+'_mode'];
},map,lib.configOL,type=='hidden');
_status.mode=lib.configOL[lib.configOL.mode+'_mode'];
game.chooseCharacterOL();
},
closeMenu:function(){
@ -12549,12 +12603,15 @@
func.apply(this,args);
},
syncState:function(){
if(game.getState&&game.updateState){
game.broadcast(function(state,current){
game.updateState(state);
_status.currentPhase=current;
},game.getState(),_status.currentPhase);
var state=null;
if(game.getState){
state=game.getState();
}
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(){
var map=[];
@ -15034,9 +15091,11 @@
ui.tempnowuxie.close();
delete ui.tempnowuxie;
}
if(game.getIdentityList){
for(var i=0;i<game.players.length;i++){
game.players[i].setIdentity();
}
}
return;
}
if(lib.config.background_audio){
@ -17591,7 +17650,7 @@
if(game.onlineroom){
game.send('server','config',lib.configOL);
}
game.connectPlayers[0].say('房间设置已更改');
game.connectPlayers[0].chat('房间设置已更改');
}
else if(_status.enteringroom){
lib.configOL.mode=active.mode;
@ -17753,7 +17812,10 @@
var expanded=false;
var hasexpand=true;
if(hiddenNodes.length){
ui.create.div('.config.more','更多 <div>&gt;</div>',page,function(){
if(lib.config.fold_mode){
var clickmore=function(type){
if(type==='expand'&&expanded) return;
if(type==='unexpand'&&!expanded) return;
if(expanded){
this.classList.remove('on');
this.parentNode.classList.remove('expanded');
@ -17763,7 +17825,18 @@
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');
}
}
for(var k=0;k<hiddenNodes.length;k++){
page.appendChild(hiddenNodes[k]);
}
@ -17829,6 +17902,19 @@
active.classList.add('active');
}
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(){
@ -23600,13 +23686,13 @@
if(this.roomfull){
alert('房间已满');
}
else if(this.roomgaming){
else if(this.roomgaming&&!game.onlineID){
alert('游戏已开始')
}
else if(this.hasOwnProperty('roomindex')){
if(!_status.enteringroom){
if(this.roomempty){
_status.enteringroom=true;
if(this.roomempty){
_status.roomindex=this.roomindex;
ui.click.connectMenu();
}
@ -23633,6 +23719,7 @@
}
}
else{
if(lib.configOL.mode=='versus') return;
if(lib.configOL.mode=='identity'&&lib.configOL.identity_mode=='zhong') return;
if(!this.classList.contains('unselectable2')&&lib.configOL.number<=2) return;
this.classList.toggle('unselectable2')
@ -24438,6 +24525,18 @@
},
};
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){
var len=str.length-5;
if(str.lastIndexOf(':8080')==len){
@ -24481,6 +24580,7 @@
skills:lib.playerOL[i].skills,
hiddenSkills:lib.playerOL[i].hiddenSkills,
additionalSkills:lib.playerOL[i].additionalSkills,
disabledSkills:lib.playerOL[i].disabledSkills,
tempSkills:lib.playerOL[i].tempSkills,
storage:lib.playerOL[i].storage,
}
@ -24752,8 +24852,13 @@
if(typeof str!='string') return '';
str=str.toUpperCase();
var str2='';
var nobreak=false;
for(var i=0;i<str.length;i++){
if(str[i]=='`'){
nobreak=!nobreak;continue;
}
str2+=str[i];
if(nobreak) continue;
if(sp&&str[i]=='S'&&str[i+1]=='P') continue;
if(i<str.length-1){
str2+='<br>';
@ -25132,7 +25237,7 @@
}
}
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)+'';
}
else{
@ -26393,8 +26498,16 @@
return -1.5;
}
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');
switch(nh){
case 1:return 2;

View File

@ -1,6 +1,6 @@
window.noname_update={
version:'1.8.6.1',
version:'1.8.7',
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
}
#arena.playerhidden>.player,
#arena.playerhidden>#mebg{
visibility: hidden;
}
#arena.chess>#arenalog{
display: none !important;
}
@ -1286,6 +1290,7 @@ div:hover>.intro{opacity: 1;}
-webkit-animation:identity 0.8s;
}
.player .identity[data-color="zhu"],
.player .identity[data-color="truezhu"],
div[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,
@ -1345,6 +1350,7 @@ span[data-nature='woodmm']{
}
.player .identity[data-color="cai"],
.player .identity[data-color="wei"],
.player .identity[data-color="falsezhu"],
div[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,

View File

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

View File

@ -513,16 +513,7 @@ mode.guozhan={
var next=game.createEvent('chooseCharacter',false);
next.content=function(){
'step 0'
var list=[];
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);
}
}
var list=get.charactersOL();
event.list=list.slice(0);
var list2=[];
var num;

View File

@ -193,7 +193,14 @@ mode.identity={
game.zhu=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;
switch(game.zhu.name){
case 'liubei':skill='jizhen';break;
@ -208,8 +215,10 @@ mode.identity={
case 'liuxie':skill='moukui';break;
default:skill='tianming';break;
}
game.zhu.addSkill(skill);
game.zhu.storage.enhance_zhu=skill;
game.broadcastAll(function(player,skill){
player.addSkill(skill);
player.storage.enhance_zhu=skill;
},game.zhu,skill);
}
if(lib.storage.test){
if(typeof lib.storage.test=='string'){
@ -400,7 +409,7 @@ mode.identity={
}
}
else if(game.me.identity=='nei'){
if(game.players.length==1){
if(game.players.length==1&&game.me.isAlive()){
game.over(true);
}
else{
@ -924,6 +933,7 @@ mode.identity={
var list2=[];
var list3=[];
event.list=[];
event.list2=[];
var libCharacter={};
for(var i=0;i<lib.configOL.characterPack.length;i++){
@ -936,6 +946,7 @@ mode.identity={
for(i in libCharacter){
if(lib.filter.characterDisabled(i)) continue;
event.list.push(i);
event.list2.push(i);
if(libCharacter[i][4]&&libCharacter[i][4].contains('zhu')){
list2.push(i);
}
@ -964,6 +975,8 @@ mode.identity={
}
event.list.remove(game.zhu.name);
event.list.remove(game.zhu.name2);
event.list2.remove(game.zhu.name);
event.list2.remove(game.zhu.name2);
if(game.players.length>4){
game.zhu.maxHp++;
@ -983,30 +996,50 @@ mode.identity={
var list=[];
var selectButton=(lib.configOL.double_character?2:1);
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=game.zhu){
var num;
var num,num2=0;
if(event.zhongmode){
num=3;
}
else{
if(game.players[i].identity=='nei'){
num=7;
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);
}
else{
if(num>5){
num=5;
}
if(num2>2){
num2=2;
}
list.push([game.players[i],['选择角色',[event.list.randomRemove(num),'character']],selectButton,true]);
}
for(var i=0;i<game.players.length;i++){
if(game.players[i]!=game.zhu){
var num3;
if(game.players[i].identity=='nei'){
num3=num2;
}
else{
num3=0;
}
list.push([game.players[i],['选择角色',[event.list.randomRemove(num+num3),'character']],selectButton,true]);
}
}
game.me.chooseButtonOL(list,function(player,result){
if(game.online||player==game.me) player.init(result.links[0],result.links[1]);
});
"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){
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{
result[i]=result[i].links
@ -1071,16 +1104,7 @@ mode.identity={
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){
this.dieSpeak();
if(!this.identityShown){
game.broadcastAll(function(player){
player.setIdentity(player.identity);

View File

@ -24,7 +24,17 @@ mode.versus={
event.finish();
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.pause();
}
@ -53,7 +63,15 @@ mode.versus={
}
game.delay();
"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'];
list.randomSort();
var side=Math.random()<0.5;
@ -120,7 +138,7 @@ mode.versus={
});
}
_status.videoInited=true;
if(_status.mode=='four'||_status.mode=='jiange'){
if(_status.mode=='four'||_status.mode=='jiange'||_status.connectMode){
info.push(false);
}
else{
@ -128,6 +146,21 @@ mode.versus={
}
game.addVideo('init',null,info);
event.trigger('gameStart');
if(_status.connectMode){
if(_status.mode=='1v1'){
_status.first_less=true;
game.gameDraw(_status.firstChoose.next);
game.phaseLoop(_status.firstChoose.next);
}
else if(_status.mode='2v2'){
_status.first_less=true;
var firstChoose=game.players.randomGet();
game.gameDraw(firstChoose);
game.phaseLoop(firstChoose);
}
event.finish();
}
else{
if(_status.mode=='four'){
game.gameDraw(_status.firstAct,function(player){
if(player==_status.firstAct.previousSeat){
@ -218,8 +251,6 @@ mode.versus={
}
_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);
@ -235,6 +266,7 @@ mode.versus={
if(_status.mode!='four'){
event.finish();
}
}
"step 4"
if(event.replaceCard&&result.bool){
var hs=game.me.get('h');
@ -246,6 +278,18 @@ mode.versus={
game.phaseLoop(_status.firstAct);
},
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(){
var str=get.translation(game.me.name);
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){
var next=game.createEvent('phaseLoop');
next.player=player;
@ -1178,6 +1572,115 @@ mode.versus={
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){
var next=game.createEvent('replacePlayer');
next.source=player;
@ -1550,6 +2053,8 @@ mode.versus={
translate:{
zhu:'主',
zhong:'忠',
truezhu:"帅",
falsezhu:"将",
trueZhu:"帅",
falseZhu:"将",
trueZhong:"兵",
@ -1616,13 +2121,52 @@ mode.versus={
},
element:{
player:{
dieSpeak:function(){
// switch(this.identity){
// case 'zhu': this.popup('吾降矣',2000);break;
// case 'zhong': this.popup('呃啊',2000);break;
// }
},
dieAfter:function(source){
if(_status.connectMode){
if(_status.mode=='1v1'){
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(_status.mode=='2v2'){
if(this.nextSeat.nextSeat.isAlive()){
var next=game.createEvent('versusDraw');
next.content=function(){
'step 0'
player.chooseBool('是否摸一张牌?');
'step 1'
if(result.bool){
player.draw();
}
};
next.player=this.nextSeat.nextSeat;
}
else{
game.over(this.side!=game.me.side);
}
}
}
else{
if(_status.mode=='four'){
if(this.identity=='zhu'){
game.over(this.side!=game.me.side);
@ -1657,7 +2201,6 @@ mode.versus={
}
return;
}
this.dieSpeak();
if(this.side==game.me.side){
_status.friendDied.push(this.name);
_status.friendCount.innerHTML='阵亡: '+get.cnNumber(_status.friendDied.length,true);
@ -1706,16 +2249,33 @@ mode.versus={
}
}
}
}
},
ai:{
get:{
attitude:function(from,to){
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;
}
if(to.identity=='zhu'&&(lib.storage.main_zhu||_status.mode=='four')) return -10;
else{
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;
}
},
}
},