This commit is contained in:
libccy 2016-08-14 00:56:12 +08:00
parent d204c135b9
commit 2111a3f506
7 changed files with 924 additions and 907 deletions

File diff suppressed because it is too large Load Diff

View File

@ -426,7 +426,7 @@ mode.boss={
var next=game.createEvent('phaseLoop'); var next=game.createEvent('phaseLoop');
next.player=game.boss; next.player=game.boss;
_status.looped=true; _status.looped=true;
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
if(player.chongzheng){ if(player.chongzheng){
player.chongzheng=false; player.chongzheng=false;
@ -484,7 +484,7 @@ mode.boss={
event.player=event.player.nextSeat; event.player=event.player.nextSeat;
} }
event.goto(0); event.goto(0);
} });
}, },
onSwapControl:function(){ onSwapControl:function(){
if(game.me==game.boss) return; if(game.me==game.boss) return;
@ -520,7 +520,7 @@ mode.boss={
player.init(list[0]); player.init(list[0]);
} }
} }
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
var i; var i;
var list=[]; var list=[];
@ -659,7 +659,7 @@ mode.boss={
}; };
_status.coinCoeff=get.coinCoeff(result.links); _status.coinCoeff=get.coinCoeff(result.links);
} }
} });
return next; return next;
}, },
}, },

View File

@ -629,7 +629,7 @@ mode.chess={
var next=game.createEvent('chooseToMove'); var next=game.createEvent('chooseToMove');
next.num=num||1; next.num=num||1;
next.player=this; next.player=this;
next.content=lib.element.playerproto.chooseToMove; next.content=lib.element.content.chooseToMove;
next.prompt=prompt; next.prompt=prompt;
return next; return next;
}, },
@ -1557,7 +1557,7 @@ mode.chess={
var next=game.createEvent('replaceChessPlayer'); var next=game.createEvent('replaceChessPlayer');
next.playername=name; next.playername=name;
next.enemy=enemy; next.enemy=enemy;
next.content=lib.element.playerproto.replaceChessPlayer; next.content=lib.element.content.replaceChessPlayer;
}, },
removeTreasure:function(player){ removeTreasure:function(player){
game.addVideo('removeTreasure',null,player.dataset.position); game.addVideo('removeTreasure',null,player.dataset.position);
@ -1667,7 +1667,7 @@ mode.chess={
}, },
phaseLoopTafang:function(){ phaseLoopTafang:function(){
var next=game.createEvent('phaseLoop'); var next=game.createEvent('phaseLoop');
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
_status.turnCount++; _status.turnCount++;
ui.turnCount.innerHTML='回合'+get.cnNumber(_status.turnCount,true); ui.turnCount.innerHTML='回合'+get.cnNumber(_status.turnCount,true);
@ -2113,12 +2113,12 @@ mode.chess={
event.goto(0); event.goto(0);
game.delay(); game.delay();
} }
} });
}, },
phaseLoopOrdered:function(player){ phaseLoopOrdered:function(player){
var next=game.createEvent('phaseLoop'); var next=game.createEvent('phaseLoop');
next.player=player; next.player=player;
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
var passed=false; var passed=false;
for(var i=0;i<game.players.length;i++){ for(var i=0;i<game.players.length;i++){
@ -2249,7 +2249,7 @@ mode.chess={
game.removeTreasure(game.treasures[i--]); game.removeTreasure(game.treasures[i--]);
} }
} }
} });
}, },
isChessNeighbour:function(a,b){ isChessNeighbour:function(a,b){
if(a&&a.dataset){ if(a&&a.dataset){
@ -2338,7 +2338,7 @@ mode.chess={
}, },
leaderView:function(){ leaderView:function(){
var next=game.createEvent('leaderView',false); var next=game.createEvent('leaderView',false);
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
var save=get.config('chess_leader_save'); var save=get.config('chess_leader_save');
if(!save){ if(!save){
@ -3726,7 +3726,7 @@ mode.chess={
ui.wuxie.show(); ui.wuxie.show();
ui.auto.show(); ui.auto.show();
game.delay(); game.delay();
} });
}, },
saveData:function(){ saveData:function(){
game.save(get.config('chess_leader_save'),game.data); game.save(get.config('chess_leader_save'),game.data);
@ -3788,7 +3788,7 @@ mode.chess={
player.init(list[0]); player.init(list[0]);
} }
} }
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
ui.wuxie.hide(); ui.wuxie.hide();
var i; var i;
@ -4184,7 +4184,7 @@ mode.chess={
if(_status.mode=='combat'&&get.config('additional_player')){ if(_status.mode=='combat'&&get.config('additional_player')){
_status.additionallist=event.list; _status.additionallist=event.list;
} }
} });
}, },
modeSwapPlayer:function(player){ modeSwapPlayer:function(player){
var content=[game.me.dataset.position,player.dataset.position]; var content=[game.me.dataset.position,player.dataset.position];

View File

@ -395,7 +395,7 @@ mode.guozhan={
} }
} }
} }
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
var addSetting=function(dialog){ var addSetting=function(dialog){
dialog.add('选择座位'); dialog.add('选择座位');
@ -609,11 +609,11 @@ mode.guozhan={
game.players[i].addSkillTrigger(game.players[i].hiddenSkills[j],true); game.players[i].addSkillTrigger(game.players[i].hiddenSkills[j],true);
} }
} }
} });
}, },
chooseCharacterOL:function(){ chooseCharacterOL:function(){
var next=game.createEvent('chooseCharacter',false); var next=game.createEvent('chooseCharacter',false);
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
var list=get.charactersOL(); var list=get.charactersOL();
event.list=list.slice(0); event.list=list.slice(0);
@ -739,7 +739,7 @@ mode.guozhan={
game.players[i]._group=lib.character[game.players[i].name1][1]; game.players[i]._group=lib.character[game.players[i].name1][1];
} }
},result); },result);
} });
} }
}, },
ui:{ ui:{
@ -783,6 +783,31 @@ mode.guozhan={
tongshimingzhi:'同时明置', tongshimingzhi:'同时明置',
}, },
element:{ 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:{ player:{
getModeState:function(){ getModeState:function(){
return { return {
@ -934,29 +959,7 @@ mode.guozhan={
if(this.perfectPair()){ if(this.perfectPair()){
var next=game.createEvent('guozhanDraw'); var next=game.createEvent('guozhanDraw');
next.player=this; next.player=this;
next.content=function(){ next.setContent('zhulian');
"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();
}
}
} }
} }
game.tryResult(); game.tryResult();

View File

@ -529,7 +529,7 @@ mode.identity={
} }
} }
} }
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
var i; var i;
var list; 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) event.ai(game.players[i],event.list.splice(0,get.config('choice_'+game.players[i].identity)),null,event.list)
} }
} }
} });
}, },
chooseCharacterOL:function(){ chooseCharacterOL:function(){
var next=game.createEvent('chooseCharacter',false); var next=game.createEvent('chooseCharacter',false);
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
var i; var i;
var identityList; var identityList;
@ -1103,7 +1103,7 @@ mode.identity={
} }
} }
},result); },result);
} });
}, },
}, },
translate:{ translate:{

View File

@ -546,6 +546,45 @@ mode.stone={
} }
}, },
element:{ 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:{ stonecharacter:{
type:'stonecharacter', type:'stonecharacter',
color:'white', color:'white',
@ -860,43 +899,7 @@ mode.stone={
if(typeof delay=='boolean'){ if(typeof delay=='boolean'){
next.delay=delay; next.delay=delay;
} }
next.content=function(){ next.setContent('addFellowAuto');
"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;
}
}, },
removeFellow:function(fellow){ removeFellow:function(fellow){
if(!this.actcharacterlist) return this; if(!this.actcharacterlist) return this;
@ -1296,7 +1299,7 @@ mode.stone={
stoneLoop:function(player){ stoneLoop:function(player){
var next=game.createEvent('phaseLoop'); var next=game.createEvent('phaseLoop');
next.player=player; next.player=player;
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
player.phase(); player.phase();
event.num=0; event.num=0;
@ -1317,7 +1320,7 @@ mode.stone={
event.player=game.me; event.player=game.me;
} }
event.goto(0); event.goto(0);
} });
}, },
initStone:function(){ initStone:function(){
var list=[],list2=[],list3={},list4={}; var list=[],list2=[],list3={},list4={};
@ -1441,7 +1444,7 @@ mode.stone={
chooseCharacter:function(){ chooseCharacter:function(){
var next=game.createEvent('chooseCharacter',false); var next=game.createEvent('chooseCharacter',false);
next.showConfig=true; next.showConfig=true;
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
var i; var i;
var list=[]; var list=[];
@ -1647,7 +1650,7 @@ mode.stone={
get.deck(game.me,_status.deck.shift()); get.deck(game.me,_status.deck.shift());
get.deck(game.enemy,'random'); get.deck(game.enemy,'random');
} }
} });
}, },
}, },
get:{ get:{

View File

@ -383,7 +383,7 @@ mode.versus={
chooseCharacterJiange:function(){ chooseCharacterJiange:function(){
var next=game.createEvent('chooseCharacter',false); var next=game.createEvent('chooseCharacter',false);
next.showConfig=true; next.showConfig=true;
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
if(lib.config.hiddenCharacterPack.contains('boss')){ if(lib.config.hiddenCharacterPack.contains('boss')){
game.loadPackage('character/boss'); game.loadPackage('character/boss');
@ -550,12 +550,12 @@ mode.versus={
} }
} }
game.addRecentCharacter(game.me.name,game.me.name2); game.addRecentCharacter(game.me.name,game.me.name2);
}; });
}, },
chooseCharacterTwo:function(){ chooseCharacterTwo:function(){
var next=game.createEvent('chooseCharacter',false); var next=game.createEvent('chooseCharacter',false);
next.showConfig=true; next.showConfig=true;
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
for(var i in lib.skill){ for(var i in lib.skill){
if(lib.skill[i].changeSeat){ if(lib.skill[i].changeSeat){
@ -756,7 +756,7 @@ mode.versus={
game.players[i].init(event.list.randomRemove()); game.players[i].init(event.list.randomRemove());
} }
} }
} });
}, },
chooseCharacterFour:function(){ chooseCharacterFour:function(){
var next=game.createEvent('chooseCharacter',false); var next=game.createEvent('chooseCharacter',false);
@ -790,7 +790,7 @@ mode.versus={
this.list.remove(player.name); this.list.remove(player.name);
this.list2.remove(player.name); this.list2.remove(player.name);
} }
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
var i; var i;
var list; var list;
@ -904,12 +904,12 @@ mode.versus={
event.xdialog.close(); event.xdialog.close();
} }
game.addRecentCharacter(game.me.name,game.me.name2); game.addRecentCharacter(game.me.name,game.me.name2);
} });
}, },
chooseCharacter:function(){ chooseCharacter:function(){
var next=game.createEvent('chooseCharacter',false); var next=game.createEvent('chooseCharacter',false);
next.showConfig=true; next.showConfig=true;
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
if(lib.config.continue_name_versus){ if(lib.config.continue_name_versus){
_status.friend=lib.config.continue_name_versus.friend; _status.friend=lib.config.continue_name_versus.friend;
@ -1425,7 +1425,7 @@ mode.versus={
// ui.fakemebg.show(); // ui.fakemebg.show();
game.onSwapControl(); game.onSwapControl();
} }
} });
}, },
chooseCharacterOL:function(){ chooseCharacterOL:function(){
switch(lib.configOL.versus_mode){ switch(lib.configOL.versus_mode){
@ -1437,7 +1437,7 @@ mode.versus={
}, },
chooseCharacterOL4:function(){ chooseCharacterOL4:function(){
var next=game.createEvent('chooseCharacter',false); var next=game.createEvent('chooseCharacter',false);
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
var list=['zhong','ezhong','zhong','ezhong','zhong','ezhong','zhong','ezhong']; var list=['zhong','ezhong','zhong','ezhong','zhong','ezhong','zhong','ezhong'];
list[2*Math.floor(Math.random()*4)]='zhu'; list[2*Math.floor(Math.random()*4)]='zhu';
@ -1590,11 +1590,11 @@ mode.versus={
dialog.close(); dialog.close();
} }
},event.videoId); },event.videoId);
} });
}, },
chooseCharacterOL3:function(){ chooseCharacterOL3:function(){
var next=game.createEvent('chooseCharacterOL',false); var next=game.createEvent('chooseCharacterOL',false);
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
game.additionaldead=[]; game.additionaldead=[];
game.broadcastAll(function(ref,bool){ game.broadcastAll(function(ref,bool){
@ -1703,11 +1703,11 @@ mode.versus={
},_status.friendDied,_status.enemyDied, },_status.friendDied,_status.enemyDied,
_status.friend,_status.enemy,game.me.side, _status.friend,_status.enemy,game.me.side,
game.versusHoverFriend,game.versusHoverEnemy]; game.versusHoverFriend,game.versusHoverEnemy];
} });
}, },
chooseCharacterOL2:function(){ chooseCharacterOL2:function(){
var next=game.createEvent('chooseCharacterOL',false); var next=game.createEvent('chooseCharacterOL',false);
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
game.broadcastAll(function(ref,bool,bool2){ game.broadcastAll(function(ref,bool,bool2){
ref.side=bool; ref.side=bool;
@ -1763,11 +1763,11 @@ mode.versus={
} }
} }
},result); },result);
} });
}, },
chooseCharacterOL1:function(){ chooseCharacterOL1:function(){
var next=game.createEvent('chooseCharacterOL',false); var next=game.createEvent('chooseCharacterOL',false);
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
game.removeCard('shengdong'); game.removeCard('shengdong');
game.additionaldead=[]; game.additionaldead=[];
@ -1965,12 +1965,12 @@ mode.versus={
_status.enemy.remove(result1); _status.enemy.remove(result1);
} }
},result1,result2); },result1,result2);
} });
}, },
versusPhaseLoop:function(player){ versusPhaseLoop:function(player){
var next=game.createEvent('phaseLoop'); var next=game.createEvent('phaseLoop');
next.player=player; next.player=player;
next.content=function(){ next.setContent(function(){
"step 0" "step 0"
if(lib.storage.zhu){ if(lib.storage.zhu){
player.classList.add('acted'); player.classList.add('acted');
@ -2014,12 +2014,12 @@ mode.versus={
"step 2" "step 2"
event.player=result.targets[0]; event.player=result.targets[0];
event.goto(0); event.goto(0);
} });
}, },
phaseLoopJiange:function(){ phaseLoopJiange:function(){
var next=game.createEvent('phaseLoop'); var next=game.createEvent('phaseLoop');
next.num=0; next.num=0;
next.content=function(){ next.setContent(function(){
if(event.num>=8){ if(event.num>=8){
event.num-=8; event.num-=8;
} }
@ -2029,205 +2029,17 @@ mode.versus={
} }
event.num++; event.num++;
event.redo(); event.redo();
} });
}, },
replacePlayerOL:function(player){ replacePlayerOL:function(player){
var next=game.createEvent('replacePlayer'); var next=game.createEvent('replacePlayer');
next.source=player; next.source=player;
next.content=function(){ next.setContent('replacePlayerOL');
'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]);
}
}, },
replacePlayer:function(player){ replacePlayer:function(player){
var next=game.createEvent('replacePlayer'); var next=game.createEvent('replacePlayer');
next.source=player; next.source=player;
next.content=function(){ next.setContent('replacePlayer');
"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');
// }
}
}, },
versusClickToSwap:function(e){ versusClickToSwap:function(e){
if(_status.dragged) return; if(_status.dragged) return;
@ -2609,6 +2421,198 @@ mode.versus={
}, },
}, },
element:{ 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:{ player:{
dieAfter:function(source){ dieAfter:function(source){
if(_status.connectMode){ if(_status.connectMode){
@ -2646,14 +2650,14 @@ mode.versus={
} }
if(friend){ if(friend){
var next=game.createEvent('versusDraw'); var next=game.createEvent('versusDraw');
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
player.chooseBool('是否摸一张牌?'); player.chooseBool('是否摸一张牌?');
'step 1' 'step 1'
if(result.bool){ if(result.bool){
player.draw(); player.draw();
} }
}; });
next.player=friend; next.player=friend;
} }
else{ else{
@ -2721,14 +2725,14 @@ mode.versus={
} }
if(friend){ if(friend){
var next=game.createEvent('versusDraw'); var next=game.createEvent('versusDraw');
next.content=function(){ next.setContent(function(){
'step 0' 'step 0'
player.chooseBool('是否摸一张牌?'); player.chooseBool('是否摸一张牌?');
'step 1' 'step 1'
if(result.bool){ if(result.bool){
player.draw(); player.draw();
} }
}; });
next.player=friend; next.player=friend;
} }
else{ else{