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

View File

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

View File

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

View File

@ -202,6 +202,10 @@ mode.identity={
game.players[i].ai.shown=0;
}
}
if(game.zhu==game.me&&game.zhu.identity!='zhu'&&_status.brawl&&_status.brawl.identityShown){
delete game.zhu;
}
else{
game.zhu.ai.shown=1;
if(game.zhu2){
game.zhong=game.zhu;
@ -235,6 +239,7 @@ mode.identity={
player.storage.enhance_zhu=skill;
},game.zhu,skill);
}
}
if(lib.storage.test){
if(typeof lib.storage.test=='string'){
if(Math.random()<0.5) game.me.next.init(lib.storage.test);
@ -257,8 +262,8 @@ mode.identity={
_status.videoInited=true,
game.addVideo('init',null,info);
game.gameDraw(game.zhong||game.zhu);
game.phaseLoop(game.zhong||game.zhu);
game.gameDraw(game.zhong||game.zhu||_status.firstAct||game.me);
game.phaseLoop(game.zhong||game.zhu||_status.firstAct||game.me);
},
game:{
getState:function(){
@ -678,7 +683,6 @@ mode.identity={
}
dialog.content.appendChild(table);
dialog.add('选择座位');
var seats=document.createElement('table');
seats.style.margin='0 auto';
@ -744,6 +748,11 @@ mode.identity={
delete event.identity;
}
for(i=0;i<game.players.length;i++){
if(_status.brawl&&_status.brawl.identityShown){
if(game.players[i].identity=='zhu') game.zhu=game.players[i];
game.players[i].identityShown=true;
}
else{
game.players[i].identity=identityList[i];
game.players[i].setIdentity('cai');
if(event.zhongmode){
@ -761,10 +770,14 @@ mode.identity={
}
game.players[i].identityShown=false;
}
}
if(!game.zhu) game.zhu=game.me;
else{
game.zhu.setIdentity();
game.zhu.identityShown=true;
game.zhu.isZhu=(game.zhu.identity=='zhu');
game.me.setIdentity();
}
for(i in lib.character){
if(chosen.contains(i)) continue;
if(lib.filter.characterDisabled(i)) continue;
@ -818,10 +831,12 @@ mode.identity={
}
else{
dialog=ui.create.dialog('选择角色','hidden',[list,'character']);
if(!_status.brawl||!_status.brawl.noAddSetting){
if(get.config('change_identity')){
addSetting(dialog);
}
}
}
if(!event.chosen.length){
game.me.chooseButton(dialog,true).selectButton=function(){
@ -1415,6 +1430,11 @@ mode.identity={
}
},
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 identity=from.identity;
var identity2=to.identity;

View File

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