This commit is contained in:
libccy 2017-02-08 11:25:30 +08:00
parent 7caa54ea8f
commit 10643f521a
5 changed files with 119 additions and 89 deletions

View File

@ -369,6 +369,7 @@ window.characterRank={
'diy_yangyi',
're_yuanshu',
'yuanshu',
're_guojia',
],
b:[
'diy_liufu',
@ -407,7 +408,6 @@ window.characterRank={
'fuwan',
'hs_jinglinglong',
're_xuzhu',
're_guojia',
'ganfuren',
'hs_huzhixiannv',
'sp_sunshangxiang',

View File

@ -5402,6 +5402,9 @@ character.yijiang={
filterCard:function(card){
return card.name=='sha'||get.type(card)=='equip';
},
filter:function(event,player){
return player.num('h','sha')>0||player.num('he',{type:'equip'})>0;
},
check:function(card){return 8-ai.get.value(card)},
selectTarget:2,
multitarget:true,
@ -5658,6 +5661,7 @@ character.yijiang={
if(result.bool){
result.targets[0].gain(result.cards,event.player);
event.player.$give(result.cards.length,result.targets[0]);
player.line(result.targets,'green');
}
},
ai:{

View File

@ -3867,6 +3867,11 @@
else if(lib.character[name]){
nameinfo=lib.character[name];
}
else if(name.indexOf('::')!=-1){
name=name.split('::');
modeimage=name[0];
name=name[1];
}
}
if(!modeimage&&nameinfo&&nameinfo[4]){
for(var i=0;i<nameinfo[4].length;i++){
@ -3891,13 +3896,6 @@
else if(modeimage){
src='image/mode/'+modeimage+'/character/'+name+ext;
}
// else if(type=='character'&&lib.customCharacters.contains(name)){
// src="";
// var node=this;
// game.getDB('image','character:'+name,function(src){
// node.style.backgroundImage="url('"+src+"')";
// });
// }
else if(type=='character'&&lib.config.skin[name]){
src='image/skin/'+name+'/'+lib.config.skin[name]+ext;
}
@ -6742,7 +6740,13 @@
}
}
_status.noclearcountdown=true;
if(event.isMine()){
if(event.player.isUnderControl()){
event.result={
bool:false
}
return;
}
else if(event.isMine()){
if(event.type=='wuxie'){
if(ui.wuxie&&ui.wuxie.classList.contains('glow')){
event.result={
@ -12827,6 +12831,7 @@
}
if(_status.connectMode) return false;
if(lib.config.mode=='versus'){
if(_status.mode=='three') return this.side==me.side;
if(_status.mode=='four'||_status.mode=='jiange') return false;
return ui.autoreplace&&ui.autoreplace.classList.contains('on')&&
this.side==me.side;
@ -18234,7 +18239,6 @@
}
},
deletenode:function(player,cards,method){
console.log(method);
if(cards){
var nodeList=document.querySelectorAll('#arena>.card,#chess>.card');
var nodes=[];
@ -19641,9 +19645,10 @@
ui.control.show();
ui.clear();
game.stopCountChoose();
if(game.layout=='long2'){
if(game.layout=='long2'&&!game.chess){
ui.arena.classList.add('choose-character');
ui.me.hide();
ui.mebg.hide()
ui.autonode.hide();
}
if(game.online){
@ -20073,9 +20078,18 @@
name2:game.me.name2,
time:lib.getUTC(new Date())
};
var modecharacters=lib.characterPack['mode_'+get.mode()];
if(modecharacters){
if(modecharacters[newvid.name1]){
newvid.name1=get.mode()+'::'+newvid.name1;
}
if(modecharacters[newvid.name2]){
newvid.name2=get.mode()+'::'+newvid.name2;
}
}
lib.videos.unshift(newvid);
store.put(newvid);
lib.createVideoNode(newvid,true);
ui.create.videoNode(newvid,true);
}
// _status.auto=false;
if(ui.auto){
@ -20121,7 +20135,7 @@
else if(lib.config.mode=='versus'){
if(_status.mode=='standard'||_status.mode=='three'){
ui.create.control('再战',function(){
game.saveConfig('continue_name_versus',{
game.saveConfig('continue_name_versus'+(_status.mode=='three'?'_three':''),{
friend:_status.friendBackup,
enemy:_status.enemyBackup,
color:_status.color
@ -27312,9 +27326,11 @@
var createNode=function(video,before){
var node=ui.create.div('.videonode.menubutton.large',clickcapt);
node.link=video;
ui.create.div('.menubutton.videoavatar',node).setBackground(video.name1,'character');
var nodename1=ui.create.div('.menubutton.videoavatar',node);
nodename1.setBackground(video.name1,'character');
if(video.name2){
ui.create.div('.menubutton.videoavatar2',node).setBackground(video.name2,'character');
var nodename2=ui.create.div('.menubutton.videoavatar2',node);
nodename2.setBackground(video.name2,'character');
}
var date=new Date(video.time);
var str=date.getFullYear()+'.'+(date.getMonth()+2)+'.'+(date.getDay()+1)+' '+
@ -27344,7 +27360,7 @@
for(var i=0;i<lib.videos.length;i++){
createNode(lib.videos[i]);
}
lib.createVideoNode=createNode;
ui.create.videoNode=createNode;
var importVideoNode=ui.create.div('.config.switcher',
'<span class="underlinenode slim">导入录像...</span>',function(){
this.nextSibling.classList.toggle('hidden');

View File

@ -376,7 +376,7 @@ mode.tafang={
treasures:[],
obstacles:[],
getVideoName:function(){
return [get.translation(game.me.name),'塔防'];
return [get.translation(game.me.name),'塔防模式'];
},
addOverDialog:function(dialog){
dialog.classList.add('center');

View File

@ -75,7 +75,6 @@ mode.versus={
default:lib.storage.cross_seat=false;lib.storage.random_seat=false;
}
game.save('only_zhu',true);
game.save('control_all',true);
ui.wuxie.hide();
ui.create.cards();
game.finishCards();
@ -212,7 +211,7 @@ mode.versus={
info.push(true);
}
else{
info.push(lib.storage.single_control&&lib.storage.control_all&&game.players.length>=4);
info.push(lib.storage.single_control&&game.players.length>=4);
}
game.addVideo('init',null,info);
event.trigger('gameStart');
@ -437,10 +436,14 @@ mode.versus={
if(game.me.name2){
str+='/'+get.translation(game.me.name2);
}
var name=[
str,'对决 - '+lib.storage.number+'v'+lib.storage.number
];
return name;
var str2;
switch(_status.mode){
case 'two':str2='欢乐成双';break;
case 'three':str2='统率三军';break;
case 'four':str2='对决 - 4v4';break;
default:str2='对决 - '+lib.storage.number+'v'+lib.storage.number
}
return [str,str2];
},
addRecord:function(bool){
if(typeof bool=='boolean'){
@ -1071,6 +1074,15 @@ mode.versus={
var next=game.createEvent('chooseCharacter',false);
next.setContent(function(){
'step 0'
if(lib.config.continue_name_versus_three){
event.friendlist=lib.config.continue_name_versus_three.friend;
event.enemylist=lib.config.continue_name_versus_three.enemy;
_status.color=lib.config.continue_name_versus_three.color;
game.additionaldead=[];
event.goto(7);
game.saveConfig('continue_name_versus_three');
return;
}
event.nodes=[];
event.avatars=[];
event.list=[];
@ -1398,20 +1410,27 @@ mode.versus={
}
else{
event.prompt('请选择一名武将');
event.fast=get.time();
}
game.pause();
}
else{
event.prompt('敌方正在选将');
event.aiMove();
game.delay(2);
game.delay(event.fast?1:2);
}
'step 3'
if(typeof event.fast=='number'&&get.time()-event.fast<=1000){
event.fast=true;
}
else{
event.fast=false;
}
delete event.imchoosing;
if(event.checkredo()) return;
if(event.friend.length+event.enemy.length<15){
if(event.side==1){
game.delay(2);
game.delay(event.fast?1:2);
}
event.side++;
if(event.side>3){
@ -1425,7 +1444,7 @@ mode.versus={
event.side=0;
}
if(event.side>=2){
game.delay(2)
game.delay(event.fast?1:2)
}
}
'step 4'
@ -1469,11 +1488,11 @@ mode.versus={
event.friendlist[i]=event.friendlist[i].link;
event.enemylist[i]=event.enemylist[i].link;
}
"step 7"
_status.friendBackup=event.friendlist.slice(0);
_status.enemyBackup=event.enemylist.slice(0);
_status.coinCoeff=get.coinCoeff(event.friendlist);
var num=lib.storage.number;
ui.create.players(6);
for(var i=0;i<game.players.length;i++){
game.players[i].getId();
@ -1582,7 +1601,6 @@ mode.versus={
this.dialog.versus_noreplace_end=this.dialog.add(ui.create.switcher('versus_noreplace_end',lib.storage.noreplace_end)).querySelector('.toggle');
this.dialog.versus_assign_enemy=this.dialog.add(ui.create.switcher('versus_assign_enemy',lib.storage.assign_enemy)).querySelector('.toggle');
this.dialog.versus_single_control=this.dialog.add(ui.create.switcher('versus_single_control',lib.storage.single_control)).querySelector('.toggle');
// this.dialog.versus_control_all=this.dialog.add(ui.create.switcher('versus_control_all',lib.storage.control_all)).querySelector('.toggle');
this.dialog.versus_first_less=this.dialog.add(ui.create.switcher('versus_first_less',get.config('first_less'))).querySelector('.toggle');
this.dialog.versus_reward=this.dialog.add(ui.create.switcher('versus_reward',[0,1,2,3,4],lib.storage.versus_reward)).querySelector('.toggle');
this.dialog.versus_punish=this.dialog.add(ui.create.switcher('versus_punish',['弃牌','无','摸牌'],lib.storage.versus_punish)).querySelector('.toggle');
@ -1603,12 +1621,6 @@ mode.versus={
// this.dialog.versus_cross_seat.parentNode.classList.remove('disabled');
// }
// }
// if(lib.storage.single_control){
// this.dialog.versus_control_all.parentNode.classList.remove('disabled');
// }
// else{
// this.dialog.versus_control_all.parentNode.classList.add('disabled');
// }
};
event.confirm=function(){
var dialog=event.dialog;
@ -1819,30 +1831,11 @@ mode.versus={
// game.save('cross_seat',dialog.versus_cross_seat.link);
game.save('noreplace_end',dialog.versus_noreplace_end.link);
game.save('single_control',dialog.versus_single_control.link);
// if(lib.storage.cross_seat){
// dialog.versus_random_seat.parentNode.classList.add('disabled');
// }
// else{
// dialog.versus_random_seat.parentNode.classList.remove('disabled');
// if(lib.storage.random_seat){
// dialog.versus_cross_seat.parentNode.classList.add('disabled');
// }
// else{
// dialog.versus_cross_seat.parentNode.classList.remove('disabled');
// }
// }
switch(lib.storage.seat_order){
case '交叉':lib.storage.cross_seat=true;lib.storage.random_seat=false;break;
case '随机':lib.storage.cross_seat=false;lib.storage.random_seat=true;break;
default:lib.storage.cross_seat=false;lib.storage.random_seat=false;
}
// if(lib.storage.single_control){
// dialog.versus_control_all.parentNode.classList.remove('disabled');
// }
// else{
// dialog.versus_control_all.parentNode.classList.add('disabled');
// }
// game.save('control_all',dialog.versus_control_all.link);
game.saveConfig('first_less',dialog.versus_first_less.link,true);
game.save('number',dialog.versus_number.link);
game.save('versus_reward',dialog.versus_reward.link);
@ -1906,7 +1899,7 @@ mode.versus={
game.players[i].getId();
game.players[i].node.action.innerHTML='行动';
}
if(lib.storage.single_control&&lib.storage.control_all&&game.players.length>=4){
if(lib.storage.single_control&&game.players.length>=4){
ui.arena.setNumber(parseInt(ui.arena.dataset.number)+1);
for(var i=0;i<game.players.length;i++){
game.players[i].dataset.position=parseInt(game.players[i].dataset.position)+1;
@ -2062,7 +2055,7 @@ mode.versus={
}
_status.friend.splice(0,num);
_status.enemy.splice(0,num);
if(lib.storage.single_control&&lib.storage.control_all&&game.players.length>=4){
if(lib.storage.single_control&&game.players.length>=4){
// ui.fakemebg.show();
game.onSwapControl();
}
@ -2652,46 +2645,69 @@ mode.versus={
}
'step 2'
var target=event.swap(player);
var swap=true,swap2=false;
var swap=[],swap2=[];
for(var i=0;i<game.players.length;i++){
if(swap&&game.players[i].side==target.side&&!game.players[i].classList.contains('acted')){
swap=false;
}
if(!swap2&&!game.players[i].classList.contains('acted')){
swap2=true;
if(!game.players[i].classList.contains('acted')){
if(game.players[i].side==target.side){
swap.push(game.players[i]);
}
else{
swap2.push(game.players[i]);
}
}
}
if(swap){
if(swap2){
if(swap.length==0){
if(swap2.length){
target=event.swap(target);
swap=swap2;
}
else{
for(var i=0;i<game.players.length;i++){
game.players[i].classList.remove('acted');
if(game.players[i].side==target.side){
swap.push(game.players[i]);
}
}
}
}
var rand=Math.random();
target.chooseTarget('选择行动的角色',true,function(card,player,target2){
return target2.side==target.side&&!target2.classList.contains('acted');
}).ai=function(target2){
var num=0;
if(target2.num('j')){
num-=5;
if(swap.length==1){
event.directresult=swap[0];
}
else{
var rand=Math.random();
target.chooseTarget('选择行动的角色',true,function(card,player,target2){
return target2.side==target.side&&!target2.classList.contains('acted');
}).ai=function(target2){
var num=0;
if(target2.num('j')){
num-=5;
}
if(target2.identity!='zhu'){
for(var i=0;i<game.players.length;i++){
if(game.players[i].identity!='zhu'&&game.players[i]!=target&&
game.players[i].side==target.side){
num-=2;
}
}
}
if(rand<1/3){
num+=1/(target2.hp+1);
}
else if(rand<2/3){
num+=target2.num('h')/5;
}
return num;
}
if(rand<1/3){
num+=1/(target2.hp+1);
}
else if(rand<2/3){
num+=target2.num('h')/5;
}
return num;
}
'step 3'
if(result.bool){
event.player=result.targets[0];
event.goto(0);
if(event.directresult){
event.player=event.directresult;
delete event.directresult;
}
else if(result.bool){
event.player=result.targets[0];
}
event.goto(0);
});
},
versusPhaseLoop:function(player){
@ -2965,13 +2981,8 @@ mode.versus={
}
},
modeSwapPlayer:function(player){
if(lib.storage.control_all){
game.swapControl(player);
game.onSwapControl();
}
else{
game.swapPlayer(player);
}
game.swapControl(player);
game.onSwapControl();
},
updateLineMe:function(opacity,player){
if(!player){
@ -3249,7 +3260,6 @@ mode.versus={
versus_noreplace_end_config:'无替补时结束',
versus_single_control_config:'单人控制',
seat_order_config:'座位排列',
versus_control_all_config:'固定控制位置',
versus_first_less_config:'先手少摸牌',
versus_reward_config:'杀敌摸牌',
versus_punish_config:'杀死队友',
@ -4440,7 +4450,7 @@ mode.versus={
break;
}
}
if(lib.storage.single_control&&lib.storage.control_all){
if(lib.storage.single_control){
game.onSwapControl();
}
"step 2"