This commit is contained in:
libccy 2016-08-20 17:47:05 +08:00
parent d37bdf2a4a
commit 652e1d02cc
5 changed files with 149 additions and 76 deletions

View File

@ -1917,8 +1917,10 @@
var dialog; var dialog;
if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup; if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup;
else dialog=_status.event.dialog; else dialog=_status.event.dialog;
if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog); if(!_status.brawl||!_status.brawl.noAddSetting){
else _status.event.getParent().removeSetting(dialog); if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog);
else _status.event.getParent().removeSetting(dialog);
}
ui.update(); ui.update();
} }
}, },
@ -2196,8 +2198,10 @@
var dialog; var dialog;
if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup; if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup;
else dialog=_status.event.dialog; else dialog=_status.event.dialog;
if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog); if(!_status.brawl||!_status.brawl.noAddSetting){
else _status.event.getParent().removeSetting(dialog); if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog);
else _status.event.getParent().removeSetting(dialog);
}
ui.update(); ui.update();
} }
}, },
@ -2468,8 +2472,10 @@
var dialog; var dialog;
if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup; if(ui.cheat2&&ui.cheat2.backup) dialog=ui.cheat2.backup;
else dialog=_status.event.dialog; else dialog=_status.event.dialog;
if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog); if(!_status.brawl||!_status.brawl.noAddSetting){
else _status.event.getParent().removeSetting(dialog); if(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog);
else _status.event.getParent().removeSetting(dialog);
}
ui.update(); ui.update();
} }
}, },

View File

@ -875,35 +875,67 @@ mode.brawl={
}, },
content:{ content:{
submode:'normal', submode:'normal',
chooseCharacterFixed:true, noAddSetting:true,
identityShown:true,
chooseCharacterBefore:function(){ chooseCharacterBefore:function(){
var scene=_status.brawl.scene; var scene=_status.brawl.scene;
var playercontrol=[]; var playercontrol=[];
var withseat=[],withoutseat=[]; var maxpos=0;
for(var i=0;i<scene.players.length;i++){ for(var i=0;i<scene.players.length;i++){
if(scene.players[i].playercontrol){ if(scene.players[i].playercontrol){
playercontrol.push(scene.players[i]); playercontrol.push(scene.players[i]);
} }
if(scene.players[i].position=='0'){ maxpos=Math.max(maxpos,scene.players[i].position);
withoutseat.push(game.players[i]); }
if(maxpos<scene.players.length){
maxpos=scene.players.length;
}
var posmap=[];
for(var i=0;i<maxpos;i++){
posmap[i]=i;
}
for(var i=0;i<scene.players.length;i++){
if(scene.players[i].pos){
posmap.remove(scene.players[i].pos);
} }
else{ }
withseat.push(game.players[i]); for(var i=0;i<scene.players.length;i++){
if(!scene.players[i].pos){
scene.players[i].pos=posmap.randomRemove();
} }
} }
if(playercontrol.length){ if(playercontrol.length){
game.me.brawlinfo=playercontrol.randomGet(); game.me.brawlinfo=playercontrol.randomGet();
}
if(game.me.brawlinfo&&game.me.brawlinfo.position!='0'){
} }
else{ else{
game.me.brawlinfo=scene.players.randomGet();
}
var getpos=function(info){
var dp=info.position-game.me.brawlinfo.position;
if(dp<0){
dp+=maxpos;
}
return dp;
};
scene.players.sort(function(a,b){
return getpos(a)-getpos(b);
});
var target=game.me;
for(var i=0;i<scene.players.length;i++){
target.brawlinfo=scene.players[i];
target.identity=scene.players[i].identity;
target.setIdentity(scene.players[i].identity);
target=target.next;
} }
}, },
chooseCharacterAi:function(player){ chooseCharacterAi:function(player){
var scene=_status.brawl.scene; if(player.brawlinfo&&player.brawlinfo.name!='random'){
player.init(player.brawlinfo.name)
}
else{
return false;
}
} }
} }
}, },
@ -1362,7 +1394,7 @@ mode.brawl={
player.node.judges.appendChild(fakecard.apply(this,info.judges[i])); player.node.judges.appendChild(fakecard.apply(this,info.judges[i]));
} }
player.setIdentity(info.identity); player.setIdentity(info.identity);
var pos=parseInt(info.position); var pos=info.position;
if(pos==0){ if(pos==0){
pos='随机位置'; pos='随机位置';
} }
@ -1391,7 +1423,7 @@ mode.brawl={
name:name1.value, name:name1.value,
name2:name2.value, name2:name2.value,
identity:identity.value, identity:identity.value,
position:position.value, position:parseInt(position.value),
hp:parseInt(hp.value), hp:parseInt(hp.value),
maxHp:parseInt(maxHp.value), maxHp:parseInt(maxHp.value),
linked:linked.checked, linked:linked.checked,
@ -1406,7 +1438,7 @@ mode.brawl={
alert('不能有两个主公'); alert('不能有两个主公');
return; return;
} }
if(info.position!='0'&&info.position==line7.childNodes[i].info.position){ if(info.position!=0&&info.position==line7.childNodes[i].info.position){
alert('座位与现在角色相同'); alert('座位与现在角色相同');
return; return;
} }
@ -1425,8 +1457,14 @@ mode.brawl={
player.listen(function(){ player.listen(function(){
if(confirm('是否删除此角色?')){ if(confirm('是否删除此角色?')){
this.remove(); this.remove();
if(line7.childElementCount<8){
addCharacter.disabled=false;
}
} }
}); });
if(line7.childElementCount>=8){
addCharacter.disabled=true;
}
resetCharacter(); resetCharacter();
}); });
ui.create.div('.menubutton.large','取消',line4,style3,resetCharacter); ui.create.div('.menubutton.large','取消',line4,style3,resetCharacter);
@ -1456,7 +1494,12 @@ mode.brawl={
line9.style.display='none'; line9.style.display='none';
line9.style.marginTop='20px'; line9.style.marginTop='20px';
var resetStatus=function(){ var resetStatus=function(){
addCharacter.disabled=false; if(line7.childElementCount>=8){
addCharacter.disabled=true;
}
else{
addCharacter.disabled=false;
}
// editCode.disabled=false; // editCode.disabled=false;
saveButton.disabled=false; saveButton.disabled=false;
exportButton.disabled=false; exportButton.disabled=false;

View File

@ -485,8 +485,10 @@ mode.guozhan={
} }
else{ else{
var dialog=ui.create.dialog('选择角色','hidden',[list,'character']); var dialog=ui.create.dialog('选择角色','hidden',[list,'character']);
if(get.config('change_identity')){ if(!_status.brawl||!_status.brawl.noAddSetting){
addSetting(dialog); if(get.config('change_identity')){
addSetting(dialog);
}
} }
var next=game.me.chooseButton(dialog,true,2); var next=game.me.chooseButton(dialog,true,2);
next.filterButton=function(button){ next.filterButton=function(button){

View File

@ -202,38 +202,43 @@ mode.identity={
game.players[i].ai.shown=0; game.players[i].ai.shown=0;
} }
} }
game.zhu.ai.shown=1; if(game.zhu==game.me&&game.zhu.identity!='zhu'&&_status.brawl&&_status.brawl.identityShown){
if(game.zhu2){ delete game.zhu;
game.zhong=game.zhu;
game.zhu=game.zhu2;
delete game.zhu2;
}
var enhance_zhu=false;
if(_status.connectMode){
enhance_zhu=(_status.mode!='zhong'&&lib.configOL.enhance_zhu&&get.population('fan')>=3)
} }
else{ else{
enhance_zhu=(_status.mode!='zhong'&&get.config('enhance_zhu')&&get.population('fan')>=3); game.zhu.ai.shown=1;
} if(game.zhu2){
if(enhance_zhu){ game.zhong=game.zhu;
var skill; game.zhu=game.zhu2;
switch(game.zhu.name){ delete game.zhu2;
case 'liubei':skill='jizhen';break; }
case 'dongzhuo':skill='hengzheng';break; var enhance_zhu=false;
case 'sunquan':skill='batu';break; if(_status.connectMode){
case 'sp_zhangjiao':skill='tiangong';break; enhance_zhu=(_status.mode!='zhong'&&lib.configOL.enhance_zhu&&get.population('fan')>=3)
case 'liushan':skill='shengxi';break; }
case 'sunce':skill='ciqiu';break; else{
case 'yuanshao':skill='geju';break; enhance_zhu=(_status.mode!='zhong'&&get.config('enhance_zhu')&&get.population('fan')>=3);
case 're_caocao':skill='dangping';break; }
case 'caopi':skill='junxing';break; if(enhance_zhu){
case 'liuxie':skill='moukui';break; var skill;
default:skill='tianming';break; switch(game.zhu.name){
case 'liubei':skill='jizhen';break;
case 'dongzhuo':skill='hengzheng';break;
case 'sunquan':skill='batu';break;
case 'sp_zhangjiao':skill='tiangong';break;
case 'liushan':skill='shengxi';break;
case 'sunce':skill='ciqiu';break;
case 'yuanshao':skill='geju';break;
case 're_caocao':skill='dangping';break;
case 'caopi':skill='junxing';break;
case 'liuxie':skill='moukui';break;
default:skill='tianming';break;
}
game.broadcastAll(function(player,skill){
player.addSkill(skill);
player.storage.enhance_zhu=skill;
},game.zhu,skill);
} }
game.broadcastAll(function(player,skill){
player.addSkill(skill);
player.storage.enhance_zhu=skill;
},game.zhu,skill);
} }
if(lib.storage.test){ if(lib.storage.test){
if(typeof lib.storage.test=='string'){ if(typeof lib.storage.test=='string'){
@ -257,8 +262,8 @@ mode.identity={
_status.videoInited=true, _status.videoInited=true,
game.addVideo('init',null,info); game.addVideo('init',null,info);
game.gameDraw(game.zhong||game.zhu); game.gameDraw(game.zhong||game.zhu||_status.firstAct||game.me);
game.phaseLoop(game.zhong||game.zhu); game.phaseLoop(game.zhong||game.zhu||_status.firstAct||game.me);
}, },
game:{ game:{
getState:function(){ getState:function(){
@ -678,7 +683,6 @@ mode.identity={
} }
dialog.content.appendChild(table); dialog.content.appendChild(table);
dialog.add('选择座位'); dialog.add('选择座位');
var seats=document.createElement('table'); var seats=document.createElement('table');
seats.style.margin='0 auto'; seats.style.margin='0 auto';
@ -744,27 +748,36 @@ mode.identity={
delete event.identity; delete event.identity;
} }
for(i=0;i<game.players.length;i++){ for(i=0;i<game.players.length;i++){
game.players[i].identity=identityList[i]; if(_status.brawl&&_status.brawl.identityShown){
game.players[i].setIdentity('cai'); if(game.players[i].identity=='zhu') game.zhu=game.players[i];
if(event.zhongmode){ game.players[i].identityShown=true;
if(identityList[i]=='mingzhong'){
game.zhu=game.players[i];
}
else if(identityList[i]=='zhu'){
game.zhu2=game.players[i];
}
} }
else{ else{
if(identityList[i]=='zhu'){ game.players[i].identity=identityList[i];
game.zhu=game.players[i]; game.players[i].setIdentity('cai');
if(event.zhongmode){
if(identityList[i]=='mingzhong'){
game.zhu=game.players[i];
}
else if(identityList[i]=='zhu'){
game.zhu2=game.players[i];
}
} }
else{
if(identityList[i]=='zhu'){
game.zhu=game.players[i];
}
}
game.players[i].identityShown=false;
} }
game.players[i].identityShown=false;
} }
game.zhu.setIdentity(); if(!game.zhu) game.zhu=game.me;
game.zhu.identityShown=true; else{
game.zhu.isZhu=(game.zhu.identity=='zhu'); game.zhu.setIdentity();
game.me.setIdentity(); game.zhu.identityShown=true;
game.zhu.isZhu=(game.zhu.identity=='zhu');
game.me.setIdentity();
}
for(i in lib.character){ for(i in lib.character){
if(chosen.contains(i)) continue; if(chosen.contains(i)) continue;
if(lib.filter.characterDisabled(i)) continue; if(lib.filter.characterDisabled(i)) continue;
@ -818,8 +831,10 @@ mode.identity={
} }
else{ else{
dialog=ui.create.dialog('选择角色','hidden',[list,'character']); dialog=ui.create.dialog('选择角色','hidden',[list,'character']);
if(get.config('change_identity')){ if(!_status.brawl||!_status.brawl.noAddSetting){
addSetting(dialog); if(get.config('change_identity')){
addSetting(dialog);
}
} }
} }
@ -1415,6 +1430,11 @@ mode.identity={
} }
}, },
realAttitude:function(from,to){ realAttitude:function(from,to){
if(!game.zhu){
if(from.identity=='nei'||to.identity=='nei') return -1;
if(from.identity==to.identity) return 6;
return -6;
}
var situation=ai.get.situation(); var situation=ai.get.situation();
var identity=from.identity; var identity=from.identity;
var identity2=to.identity; var identity2=to.identity;

View File

@ -692,8 +692,10 @@ mode.versus={
} }
var dialog=ui.create.dialog('选择角色',[characterChoice,'character']); var dialog=ui.create.dialog('选择角色',[characterChoice,'character']);
game.me.chooseButton(true,dialog); game.me.chooseButton(true,dialog);
if(get.config('change_identity')){ if(!_status.brawl||!_status.brawl.noAddSetting){
addSetting(dialog); if(get.config('change_identity')){
addSetting(dialog);
}
} }
ui.create.cheat=function(){ ui.create.cheat=function(){