This commit is contained in:
parent
d204c135b9
commit
2111a3f506
1221
game/game.js
1221
game/game.js
File diff suppressed because it is too large
Load Diff
|
@ -426,7 +426,7 @@ mode.boss={
|
|||
var next=game.createEvent('phaseLoop');
|
||||
next.player=game.boss;
|
||||
_status.looped=true;
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
if(player.chongzheng){
|
||||
player.chongzheng=false;
|
||||
|
@ -484,7 +484,7 @@ mode.boss={
|
|||
event.player=event.player.nextSeat;
|
||||
}
|
||||
event.goto(0);
|
||||
}
|
||||
});
|
||||
},
|
||||
onSwapControl:function(){
|
||||
if(game.me==game.boss) return;
|
||||
|
@ -520,7 +520,7 @@ mode.boss={
|
|||
player.init(list[0]);
|
||||
}
|
||||
}
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
var i;
|
||||
var list=[];
|
||||
|
@ -659,7 +659,7 @@ mode.boss={
|
|||
};
|
||||
_status.coinCoeff=get.coinCoeff(result.links);
|
||||
}
|
||||
}
|
||||
});
|
||||
return next;
|
||||
},
|
||||
},
|
||||
|
|
|
@ -629,7 +629,7 @@ mode.chess={
|
|||
var next=game.createEvent('chooseToMove');
|
||||
next.num=num||1;
|
||||
next.player=this;
|
||||
next.content=lib.element.playerproto.chooseToMove;
|
||||
next.content=lib.element.content.chooseToMove;
|
||||
next.prompt=prompt;
|
||||
return next;
|
||||
},
|
||||
|
@ -1557,7 +1557,7 @@ mode.chess={
|
|||
var next=game.createEvent('replaceChessPlayer');
|
||||
next.playername=name;
|
||||
next.enemy=enemy;
|
||||
next.content=lib.element.playerproto.replaceChessPlayer;
|
||||
next.content=lib.element.content.replaceChessPlayer;
|
||||
},
|
||||
removeTreasure:function(player){
|
||||
game.addVideo('removeTreasure',null,player.dataset.position);
|
||||
|
@ -1667,7 +1667,7 @@ mode.chess={
|
|||
},
|
||||
phaseLoopTafang:function(){
|
||||
var next=game.createEvent('phaseLoop');
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
_status.turnCount++;
|
||||
ui.turnCount.innerHTML='回合'+get.cnNumber(_status.turnCount,true);
|
||||
|
@ -2113,12 +2113,12 @@ mode.chess={
|
|||
event.goto(0);
|
||||
game.delay();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
phaseLoopOrdered:function(player){
|
||||
var next=game.createEvent('phaseLoop');
|
||||
next.player=player;
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
var passed=false;
|
||||
for(var i=0;i<game.players.length;i++){
|
||||
|
@ -2249,7 +2249,7 @@ mode.chess={
|
|||
game.removeTreasure(game.treasures[i--]);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
isChessNeighbour:function(a,b){
|
||||
if(a&&a.dataset){
|
||||
|
@ -2338,7 +2338,7 @@ mode.chess={
|
|||
},
|
||||
leaderView:function(){
|
||||
var next=game.createEvent('leaderView',false);
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
var save=get.config('chess_leader_save');
|
||||
if(!save){
|
||||
|
@ -3726,7 +3726,7 @@ mode.chess={
|
|||
ui.wuxie.show();
|
||||
ui.auto.show();
|
||||
game.delay();
|
||||
}
|
||||
});
|
||||
},
|
||||
saveData:function(){
|
||||
game.save(get.config('chess_leader_save'),game.data);
|
||||
|
@ -3788,7 +3788,7 @@ mode.chess={
|
|||
player.init(list[0]);
|
||||
}
|
||||
}
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
ui.wuxie.hide();
|
||||
var i;
|
||||
|
@ -4184,7 +4184,7 @@ mode.chess={
|
|||
if(_status.mode=='combat'&&get.config('additional_player')){
|
||||
_status.additionallist=event.list;
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
modeSwapPlayer:function(player){
|
||||
var content=[game.me.dataset.position,player.dataset.position];
|
||||
|
|
|
@ -395,7 +395,7 @@ mode.guozhan={
|
|||
}
|
||||
}
|
||||
}
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
var addSetting=function(dialog){
|
||||
dialog.add('选择座位');
|
||||
|
@ -609,11 +609,11 @@ mode.guozhan={
|
|||
game.players[i].addSkillTrigger(game.players[i].hiddenSkills[j],true);
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseCharacterOL:function(){
|
||||
var next=game.createEvent('chooseCharacter',false);
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
var list=get.charactersOL();
|
||||
event.list=list.slice(0);
|
||||
|
@ -739,7 +739,7 @@ mode.guozhan={
|
|||
game.players[i]._group=lib.character[game.players[i].name1][1];
|
||||
}
|
||||
},result);
|
||||
}
|
||||
});
|
||||
}
|
||||
},
|
||||
ui:{
|
||||
|
@ -783,6 +783,31 @@ mode.guozhan={
|
|||
tongshimingzhi:'同时明置',
|
||||
},
|
||||
element:{
|
||||
content:{
|
||||
zhulian:function(){
|
||||
"step 0"
|
||||
player.popup('珠联璧合');
|
||||
game.log(player,'发动了【珠联璧合】');
|
||||
if(player.hp==player.maxHp){
|
||||
player.draw(2);
|
||||
event.finish();
|
||||
}
|
||||
else{
|
||||
player.chooseControl('draw_card','recover_hp',function(){
|
||||
if(player.hp>=2||player.hp>=player.maxHp-1) return 'draw_card';
|
||||
if(player.hp==2&&player.num('h')==0) return 'draw_card';
|
||||
return 'recover_hp';
|
||||
},ui.create.dialog('hidden','珠联璧合:选择一项奖励'));
|
||||
}
|
||||
"step 1"
|
||||
if(result.control=='draw_card'){
|
||||
player.draw(2);
|
||||
}
|
||||
else{
|
||||
player.recover();
|
||||
}
|
||||
}
|
||||
},
|
||||
player:{
|
||||
getModeState:function(){
|
||||
return {
|
||||
|
@ -934,29 +959,7 @@ mode.guozhan={
|
|||
if(this.perfectPair()){
|
||||
var next=game.createEvent('guozhanDraw');
|
||||
next.player=this;
|
||||
next.content=function(){
|
||||
"step 0"
|
||||
player.popup('珠联璧合');
|
||||
game.log(player,'发动了【珠联璧合】');
|
||||
if(player.hp==player.maxHp){
|
||||
player.draw(2);
|
||||
event.finish();
|
||||
}
|
||||
else{
|
||||
player.chooseControl('draw_card','recover_hp',function(){
|
||||
if(player.hp>=2||player.hp>=player.maxHp-1) return 'draw_card';
|
||||
if(player.hp==2&&player.num('h')==0) return 'draw_card';
|
||||
return 'recover_hp';
|
||||
},ui.create.dialog('hidden','珠联璧合:选择一项奖励'));
|
||||
}
|
||||
"step 1"
|
||||
if(result.control=='draw_card'){
|
||||
player.draw(2);
|
||||
}
|
||||
else{
|
||||
player.recover();
|
||||
}
|
||||
}
|
||||
next.setContent('zhulian');
|
||||
}
|
||||
}
|
||||
game.tryResult();
|
||||
|
|
|
@ -529,7 +529,7 @@ mode.identity={
|
|||
}
|
||||
}
|
||||
}
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
var i;
|
||||
var list;
|
||||
|
@ -898,11 +898,11 @@ mode.identity={
|
|||
event.ai(game.players[i],event.list.splice(0,get.config('choice_'+game.players[i].identity)),null,event.list)
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseCharacterOL:function(){
|
||||
var next=game.createEvent('chooseCharacter',false);
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
var i;
|
||||
var identityList;
|
||||
|
@ -1103,7 +1103,7 @@ mode.identity={
|
|||
}
|
||||
}
|
||||
},result);
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
translate:{
|
||||
|
|
|
@ -546,6 +546,45 @@ mode.stone={
|
|||
}
|
||||
},
|
||||
element:{
|
||||
content:{
|
||||
addFellowAuto:function(){
|
||||
"step 0"
|
||||
if(!player.canAddFellow()){
|
||||
event.finish();
|
||||
return;
|
||||
}
|
||||
var name=event.fellowName;
|
||||
var added=false;
|
||||
var i;
|
||||
for(i=0;i<player.actcharacterlist.length;i++){
|
||||
if(player.actcharacterlist[i]===null){
|
||||
added=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var pos=i+4;
|
||||
if(player!=game.me){
|
||||
pos+=4;
|
||||
}
|
||||
var fellow=game.addFellow(pos,name,'zoominanim');
|
||||
fellow.side=player.side;
|
||||
fellow.classList.add('turnedover');
|
||||
player.actcharacterlist[i]=fellow;
|
||||
event.source=fellow;
|
||||
var num=lib.character[name][5][1];
|
||||
if(num){
|
||||
fellow.draw(num,false);
|
||||
}
|
||||
player.updateActCount();
|
||||
if(fellow.hasSkillTag('noPhaseDelay')||event.delay===false){
|
||||
fellow.noPhaseDelay=true;
|
||||
}
|
||||
// player.line(fellow,'green');
|
||||
"step 1"
|
||||
event.trigger('fellow');
|
||||
event.result=event.source;
|
||||
}
|
||||
},
|
||||
stonecharacter:{
|
||||
type:'stonecharacter',
|
||||
color:'white',
|
||||
|
@ -860,43 +899,7 @@ mode.stone={
|
|||
if(typeof delay=='boolean'){
|
||||
next.delay=delay;
|
||||
}
|
||||
next.content=function(){
|
||||
"step 0"
|
||||
if(!player.canAddFellow()){
|
||||
event.finish();
|
||||
return;
|
||||
}
|
||||
var name=event.fellowName;
|
||||
var added=false;
|
||||
var i;
|
||||
for(i=0;i<player.actcharacterlist.length;i++){
|
||||
if(player.actcharacterlist[i]===null){
|
||||
added=true;
|
||||
break;
|
||||
}
|
||||
}
|
||||
var pos=i+4;
|
||||
if(player!=game.me){
|
||||
pos+=4;
|
||||
}
|
||||
var fellow=game.addFellow(pos,name,'zoominanim');
|
||||
fellow.side=player.side;
|
||||
fellow.classList.add('turnedover');
|
||||
player.actcharacterlist[i]=fellow;
|
||||
event.source=fellow;
|
||||
var num=lib.character[name][5][1];
|
||||
if(num){
|
||||
fellow.draw(num,false);
|
||||
}
|
||||
player.updateActCount();
|
||||
if(fellow.hasSkillTag('noPhaseDelay')||event.delay===false){
|
||||
fellow.noPhaseDelay=true;
|
||||
}
|
||||
// player.line(fellow,'green');
|
||||
"step 1"
|
||||
event.trigger('fellow');
|
||||
event.result=event.source;
|
||||
}
|
||||
next.setContent('addFellowAuto');
|
||||
},
|
||||
removeFellow:function(fellow){
|
||||
if(!this.actcharacterlist) return this;
|
||||
|
@ -1296,7 +1299,7 @@ mode.stone={
|
|||
stoneLoop:function(player){
|
||||
var next=game.createEvent('phaseLoop');
|
||||
next.player=player;
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
player.phase();
|
||||
event.num=0;
|
||||
|
@ -1317,7 +1320,7 @@ mode.stone={
|
|||
event.player=game.me;
|
||||
}
|
||||
event.goto(0);
|
||||
}
|
||||
});
|
||||
},
|
||||
initStone:function(){
|
||||
var list=[],list2=[],list3={},list4={};
|
||||
|
@ -1441,7 +1444,7 @@ mode.stone={
|
|||
chooseCharacter:function(){
|
||||
var next=game.createEvent('chooseCharacter',false);
|
||||
next.showConfig=true;
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
var i;
|
||||
var list=[];
|
||||
|
@ -1647,7 +1650,7 @@ mode.stone={
|
|||
get.deck(game.me,_status.deck.shift());
|
||||
get.deck(game.enemy,'random');
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
},
|
||||
get:{
|
||||
|
|
432
mode/versus.js
432
mode/versus.js
|
@ -383,7 +383,7 @@ mode.versus={
|
|||
chooseCharacterJiange:function(){
|
||||
var next=game.createEvent('chooseCharacter',false);
|
||||
next.showConfig=true;
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
if(lib.config.hiddenCharacterPack.contains('boss')){
|
||||
game.loadPackage('character/boss');
|
||||
|
@ -550,12 +550,12 @@ mode.versus={
|
|||
}
|
||||
}
|
||||
game.addRecentCharacter(game.me.name,game.me.name2);
|
||||
};
|
||||
});
|
||||
},
|
||||
chooseCharacterTwo:function(){
|
||||
var next=game.createEvent('chooseCharacter',false);
|
||||
next.showConfig=true;
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
for(var i in lib.skill){
|
||||
if(lib.skill[i].changeSeat){
|
||||
|
@ -756,7 +756,7 @@ mode.versus={
|
|||
game.players[i].init(event.list.randomRemove());
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseCharacterFour:function(){
|
||||
var next=game.createEvent('chooseCharacter',false);
|
||||
|
@ -790,7 +790,7 @@ mode.versus={
|
|||
this.list.remove(player.name);
|
||||
this.list2.remove(player.name);
|
||||
}
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
var i;
|
||||
var list;
|
||||
|
@ -904,12 +904,12 @@ mode.versus={
|
|||
event.xdialog.close();
|
||||
}
|
||||
game.addRecentCharacter(game.me.name,game.me.name2);
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseCharacter:function(){
|
||||
var next=game.createEvent('chooseCharacter',false);
|
||||
next.showConfig=true;
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
if(lib.config.continue_name_versus){
|
||||
_status.friend=lib.config.continue_name_versus.friend;
|
||||
|
@ -1425,7 +1425,7 @@ mode.versus={
|
|||
// ui.fakemebg.show();
|
||||
game.onSwapControl();
|
||||
}
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseCharacterOL:function(){
|
||||
switch(lib.configOL.versus_mode){
|
||||
|
@ -1437,7 +1437,7 @@ mode.versus={
|
|||
},
|
||||
chooseCharacterOL4:function(){
|
||||
var next=game.createEvent('chooseCharacter',false);
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
var list=['zhong','ezhong','zhong','ezhong','zhong','ezhong','zhong','ezhong'];
|
||||
list[2*Math.floor(Math.random()*4)]='zhu';
|
||||
|
@ -1590,11 +1590,11 @@ mode.versus={
|
|||
dialog.close();
|
||||
}
|
||||
},event.videoId);
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseCharacterOL3:function(){
|
||||
var next=game.createEvent('chooseCharacterOL',false);
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
game.additionaldead=[];
|
||||
game.broadcastAll(function(ref,bool){
|
||||
|
@ -1703,11 +1703,11 @@ mode.versus={
|
|||
},_status.friendDied,_status.enemyDied,
|
||||
_status.friend,_status.enemy,game.me.side,
|
||||
game.versusHoverFriend,game.versusHoverEnemy];
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseCharacterOL2:function(){
|
||||
var next=game.createEvent('chooseCharacterOL',false);
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
game.broadcastAll(function(ref,bool,bool2){
|
||||
ref.side=bool;
|
||||
|
@ -1763,11 +1763,11 @@ mode.versus={
|
|||
}
|
||||
}
|
||||
},result);
|
||||
}
|
||||
});
|
||||
},
|
||||
chooseCharacterOL1:function(){
|
||||
var next=game.createEvent('chooseCharacterOL',false);
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
game.removeCard('shengdong');
|
||||
game.additionaldead=[];
|
||||
|
@ -1965,12 +1965,12 @@ mode.versus={
|
|||
_status.enemy.remove(result1);
|
||||
}
|
||||
},result1,result2);
|
||||
}
|
||||
});
|
||||
},
|
||||
versusPhaseLoop:function(player){
|
||||
var next=game.createEvent('phaseLoop');
|
||||
next.player=player;
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
"step 0"
|
||||
if(lib.storage.zhu){
|
||||
player.classList.add('acted');
|
||||
|
@ -2014,12 +2014,12 @@ mode.versus={
|
|||
"step 2"
|
||||
event.player=result.targets[0];
|
||||
event.goto(0);
|
||||
}
|
||||
});
|
||||
},
|
||||
phaseLoopJiange:function(){
|
||||
var next=game.createEvent('phaseLoop');
|
||||
next.num=0;
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
if(event.num>=8){
|
||||
event.num-=8;
|
||||
}
|
||||
|
@ -2029,205 +2029,17 @@ mode.versus={
|
|||
}
|
||||
event.num++;
|
||||
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(event.source==game.me){
|
||||
if(_status.auto){
|
||||
event.directresult=_status.friend.randomGet();
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!event.source.isOnline()){
|
||||
event.directresult=_status.friend.randomGet();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(_status.enemy.length==1){
|
||||
event.directresult=_status.enemy[0];
|
||||
}
|
||||
else{
|
||||
if(!event.source.isOnline()){
|
||||
event.directresult=_status.enemy.randomGet();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!event.directresult){
|
||||
if(event.source==game.me){
|
||||
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{
|
||||
event.source.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();
|
||||
},event.source);
|
||||
event.source.wait();
|
||||
game.pause();
|
||||
}
|
||||
}
|
||||
'step 2'
|
||||
if(!event.directresult){
|
||||
if(event.resultOL){
|
||||
event.directresult=event.resultOL[source.playerid];
|
||||
}
|
||||
if(!event.directresult||event.directresult=='ai'){
|
||||
if(source.side==game.me.side){
|
||||
event.directresult=_status.friend.randomGet();
|
||||
}
|
||||
else{
|
||||
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;
|
||||
if(source==game.me){
|
||||
ui.arena.classList.remove('selecting');
|
||||
}
|
||||
},source,name,color);
|
||||
|
||||
source.draw(4);
|
||||
_status.event.parent.parent.parent.untrigger(false,source);
|
||||
game.addVideo('reinit',source,[name,color]);
|
||||
}
|
||||
next.setContent('replacePlayerOL');
|
||||
},
|
||||
replacePlayer:function(player){
|
||||
var next=game.createEvent('replacePlayer');
|
||||
next.source=player;
|
||||
next.content=function(){
|
||||
"step 0"
|
||||
var list=(source.side==game.me.side)?_status.friend:_status.enemy;
|
||||
if(list.length==0){
|
||||
// if(game.friend.contains(source)){
|
||||
// game.over(false);
|
||||
// }
|
||||
// else{
|
||||
// game.over(true);
|
||||
// }
|
||||
game.friend.remove(source);
|
||||
game.enemy.remove(source);
|
||||
if(game.friend.length==0) game.over(false);
|
||||
else if(game.enemy.length==0) game.over(true);
|
||||
if(game.friendZhu&&game.friendZhu.classList.contains('dead')&&game.friend.length){
|
||||
game.friendZhu=game.friend[0];
|
||||
game.friendZhu.setIdentity(_status.color+'Zhu');
|
||||
}
|
||||
if(game.enemyZhu&&game.enemyZhu.classList.contains('dead')&&game.enemy.length){
|
||||
game.enemyZhu=game.enemy[0];
|
||||
game.enemyZhu.setIdentity(!_status.color+'Zhu');
|
||||
}
|
||||
event.finish();
|
||||
return;
|
||||
}
|
||||
if(source.side==game.me.side&&list.length>1&&(game.me==game.friendZhu||(lib.storage.zhu&&lib.storage.single_control))&&
|
||||
!_status.auto){
|
||||
event.dialog=ui.create.dialog('选择替补角色',[list,'character']);
|
||||
event.filterButton=function(){return true;};
|
||||
event.player=game.me;
|
||||
event.forced=true;
|
||||
event.custom.replace.confirm=function(){
|
||||
event.character=ui.selected.buttons[0].link;
|
||||
event.dialog.close();
|
||||
if(ui.confirm) ui.confirm.close();
|
||||
delete event.player;
|
||||
game.resume();
|
||||
}
|
||||
game.check();
|
||||
game.pause();
|
||||
}
|
||||
else{
|
||||
event.character=list[Math.floor(Math.random()*list.length)];
|
||||
}
|
||||
"step 1"
|
||||
_status.friend.remove(event.character);
|
||||
_status.enemy.remove(event.character);
|
||||
source.revive();
|
||||
game.additionaldead.push({
|
||||
name:source.name,
|
||||
stat:source.stat
|
||||
});
|
||||
game.addVideo('reinit',source,[event.character,get.translation(source.side+'Color')]);
|
||||
source.uninit();
|
||||
source.init(event.character);
|
||||
source.node.identity.dataset.color=get.translation(source.side+'Color');
|
||||
source.draw(4);
|
||||
_status.event.parent.parent.parent.untrigger(false,source);
|
||||
if(lib.storage.single_control&&lib.storage.control_all){
|
||||
game.onSwapControl();
|
||||
}
|
||||
"step 2"
|
||||
// if(_status.currentPhase==source){
|
||||
// source.skip('phase');
|
||||
// }
|
||||
}
|
||||
next.setContent('replacePlayer');
|
||||
},
|
||||
versusClickToSwap:function(e){
|
||||
if(_status.dragged) return;
|
||||
|
@ -2609,6 +2421,198 @@ mode.versus={
|
|||
},
|
||||
},
|
||||
element:{
|
||||
content:{
|
||||
replacePlayer:function(){
|
||||
"step 0"
|
||||
var list=(source.side==game.me.side)?_status.friend:_status.enemy;
|
||||
if(list.length==0){
|
||||
// if(game.friend.contains(source)){
|
||||
// game.over(false);
|
||||
// }
|
||||
// else{
|
||||
// game.over(true);
|
||||
// }
|
||||
game.friend.remove(source);
|
||||
game.enemy.remove(source);
|
||||
if(game.friend.length==0) game.over(false);
|
||||
else if(game.enemy.length==0) game.over(true);
|
||||
if(game.friendZhu&&game.friendZhu.classList.contains('dead')&&game.friend.length){
|
||||
game.friendZhu=game.friend[0];
|
||||
game.friendZhu.setIdentity(_status.color+'Zhu');
|
||||
}
|
||||
if(game.enemyZhu&&game.enemyZhu.classList.contains('dead')&&game.enemy.length){
|
||||
game.enemyZhu=game.enemy[0];
|
||||
game.enemyZhu.setIdentity(!_status.color+'Zhu');
|
||||
}
|
||||
event.finish();
|
||||
return;
|
||||
}
|
||||
if(source.side==game.me.side&&list.length>1&&(game.me==game.friendZhu||(lib.storage.zhu&&lib.storage.single_control))&&
|
||||
!_status.auto){
|
||||
event.dialog=ui.create.dialog('选择替补角色',[list,'character']);
|
||||
event.filterButton=function(){return true;};
|
||||
event.player=game.me;
|
||||
event.forced=true;
|
||||
event.custom.replace.confirm=function(){
|
||||
event.character=ui.selected.buttons[0].link;
|
||||
event.dialog.close();
|
||||
if(ui.confirm) ui.confirm.close();
|
||||
delete event.player;
|
||||
game.resume();
|
||||
}
|
||||
game.check();
|
||||
game.pause();
|
||||
}
|
||||
else{
|
||||
event.character=list[Math.floor(Math.random()*list.length)];
|
||||
}
|
||||
"step 1"
|
||||
_status.friend.remove(event.character);
|
||||
_status.enemy.remove(event.character);
|
||||
source.revive();
|
||||
game.additionaldead.push({
|
||||
name:source.name,
|
||||
stat:source.stat
|
||||
});
|
||||
game.addVideo('reinit',source,[event.character,get.translation(source.side+'Color')]);
|
||||
source.uninit();
|
||||
source.init(event.character);
|
||||
source.node.identity.dataset.color=get.translation(source.side+'Color');
|
||||
source.draw(4);
|
||||
_status.event.parent.parent.parent.untrigger(false,source);
|
||||
if(lib.storage.single_control&&lib.storage.control_all){
|
||||
game.onSwapControl();
|
||||
}
|
||||
"step 2"
|
||||
// if(_status.currentPhase==source){
|
||||
// source.skip('phase');
|
||||
// }
|
||||
},
|
||||
replacePlayerOL: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(event.source==game.me){
|
||||
if(_status.auto){
|
||||
event.directresult=_status.friend.randomGet();
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(!event.source.isOnline()){
|
||||
event.directresult=_status.friend.randomGet();
|
||||
}
|
||||
}
|
||||
}
|
||||
else{
|
||||
if(_status.enemy.length==1){
|
||||
event.directresult=_status.enemy[0];
|
||||
}
|
||||
else{
|
||||
if(!event.source.isOnline()){
|
||||
event.directresult=_status.enemy.randomGet();
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!event.directresult){
|
||||
if(event.source==game.me){
|
||||
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{
|
||||
event.source.send(function(player){
|
||||
if(_status.auto){
|
||||
_status.event._result=_status.friend.randomGet();
|
||||
}
|
||||
else{
|
||||
var next=game.createEvent('replacePlayer');
|
||||
next.source=player;
|
||||
next.setContent(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();
|
||||
},event.source);
|
||||
event.source.wait();
|
||||
game.pause();
|
||||
}
|
||||
}
|
||||
'step 2'
|
||||
if(!event.directresult){
|
||||
if(event.resultOL){
|
||||
event.directresult=event.resultOL[source.playerid];
|
||||
}
|
||||
if(!event.directresult||event.directresult=='ai'){
|
||||
if(source.side==game.me.side){
|
||||
event.directresult=_status.friend.randomGet();
|
||||
}
|
||||
else{
|
||||
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;
|
||||
if(source==game.me){
|
||||
ui.arena.classList.remove('selecting');
|
||||
}
|
||||
},source,name,color);
|
||||
|
||||
source.draw(4);
|
||||
_status.event.parent.parent.parent.untrigger(false,source);
|
||||
game.addVideo('reinit',source,[name,color]);
|
||||
},
|
||||
},
|
||||
player:{
|
||||
dieAfter:function(source){
|
||||
if(_status.connectMode){
|
||||
|
@ -2646,14 +2650,14 @@ mode.versus={
|
|||
}
|
||||
if(friend){
|
||||
var next=game.createEvent('versusDraw');
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
player.chooseBool('是否摸一张牌?');
|
||||
'step 1'
|
||||
if(result.bool){
|
||||
player.draw();
|
||||
}
|
||||
};
|
||||
});
|
||||
next.player=friend;
|
||||
}
|
||||
else{
|
||||
|
@ -2721,14 +2725,14 @@ mode.versus={
|
|||
}
|
||||
if(friend){
|
||||
var next=game.createEvent('versusDraw');
|
||||
next.content=function(){
|
||||
next.setContent(function(){
|
||||
'step 0'
|
||||
player.chooseBool('是否摸一张牌?');
|
||||
'step 1'
|
||||
if(result.bool){
|
||||
player.draw();
|
||||
}
|
||||
};
|
||||
});
|
||||
next.player=friend;
|
||||
}
|
||||
else{
|
||||
|
|
Loading…
Reference in New Issue