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(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog);
else _status.event.getParent().removeSetting(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(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog);
else _status.event.getParent().removeSetting(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(!dialog.querySelector('table')&&get.config('change_identity')) _status.event.getParent().addSetting(dialog);
else _status.event.getParent().removeSetting(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);
}
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){
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(){
addCharacter.disabled=false;
if(line7.childElementCount>=8){
addCharacter.disabled=true;
}
else{
addCharacter.disabled=false;
}
// editCode.disabled=false;
saveButton.disabled=false;
exportButton.disabled=false;

View File

@ -485,8 +485,10 @@ mode.guozhan={
}
else{
var dialog=ui.create.dialog('选择角色','hidden',[list,'character']);
if(get.config('change_identity')){
addSetting(dialog);
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){

View File

@ -202,38 +202,43 @@ mode.identity={
game.players[i].ai.shown=0;
}
}
game.zhu.ai.shown=1;
if(game.zhu2){
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)
if(game.zhu==game.me&&game.zhu.identity!='zhu'&&_status.brawl&&_status.brawl.identityShown){
delete game.zhu;
}
else{
enhance_zhu=(_status.mode!='zhong'&&get.config('enhance_zhu')&&get.population('fan')>=3);
}
if(enhance_zhu){
var skill;
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.zhu.ai.shown=1;
if(game.zhu2){
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{
enhance_zhu=(_status.mode!='zhong'&&get.config('enhance_zhu')&&get.population('fan')>=3);
}
if(enhance_zhu){
var skill;
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(typeof lib.storage.test=='string'){
@ -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,27 +748,36 @@ mode.identity={
delete event.identity;
}
for(i=0;i<game.players.length;i++){
game.players[i].identity=identityList[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];
}
if(_status.brawl&&_status.brawl.identityShown){
if(game.players[i].identity=='zhu') game.zhu=game.players[i];
game.players[i].identityShown=true;
}
else{
if(identityList[i]=='zhu'){
game.zhu=game.players[i];
game.players[i].identity=identityList[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();
game.zhu.identityShown=true;
game.zhu.isZhu=(game.zhu.identity=='zhu');
game.me.setIdentity();
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,8 +831,10 @@ mode.identity={
}
else{
dialog=ui.create.dialog('选择角色','hidden',[list,'character']);
if(get.config('change_identity')){
addSetting(dialog);
if(!_status.brawl||!_status.brawl.noAddSetting){
if(get.config('change_identity')){
addSetting(dialog);
}
}
}
@ -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,8 +692,10 @@ mode.versus={
}
var dialog=ui.create.dialog('选择角色',[characterChoice,'character']);
game.me.chooseButton(true,dialog);
if(get.config('change_identity')){
addSetting(dialog);
if(!_status.brawl||!_status.brawl.noAddSetting){
if(get.config('change_identity')){
addSetting(dialog);
}
}
ui.create.cheat=function(){