v1.9.45
This commit is contained in:
parent
e7e3a26228
commit
c2cadda2a0
|
@ -1572,96 +1572,118 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
for(var i in slist){
|
||||
list.push(i);
|
||||
}
|
||||
event.switchToAuto=function(){
|
||||
var currentbutton=event.dialog.querySelector('.selected.button');
|
||||
if(!currentbutton){
|
||||
currentbutton=event.dialog.buttons[0];
|
||||
currentbutton.classList.add('selected');
|
||||
}
|
||||
event.clickControl(player.storage.huashen.owned[currentbutton.link].randomGet());
|
||||
}
|
||||
|
||||
event.clickControl=function(link,type){
|
||||
if(link!='cancel2'){
|
||||
var currentname;
|
||||
if(type=='ai'){
|
||||
currentname=event.currentname;
|
||||
}
|
||||
else{
|
||||
currentname=event.dialog.querySelector('.selected.button').link;
|
||||
}
|
||||
var mark=player.marks.huashen;
|
||||
if(trigger.name=='game'){
|
||||
mark.hide();
|
||||
// mark.style.transform='scale(0.8)';
|
||||
mark.style.transition='all 0.3s';
|
||||
setTimeout(function(){
|
||||
mark.style.transition='all 0s';
|
||||
ui.refresh(mark);
|
||||
mark.setBackground(currentname,'character');
|
||||
if(mark.firstChild){
|
||||
mark.firstChild.remove();
|
||||
}
|
||||
setTimeout(function(){
|
||||
mark.style.transition='';
|
||||
mark.show();
|
||||
// mark.style.transform='';
|
||||
},50);
|
||||
},500);
|
||||
}
|
||||
else{
|
||||
if(mark.firstChild){
|
||||
mark.firstChild.remove();
|
||||
}
|
||||
mark.setBackground(currentname,'character');
|
||||
}
|
||||
player.addAdditionalSkill('huashen',link);
|
||||
player.logSkill('huashen2');
|
||||
game.log(player,'获得技能','【'+get.translation(link)+'】');
|
||||
player.popup(link);
|
||||
|
||||
if(event.dialog&&event.dialog.buttons){
|
||||
for(var i=0;i<event.dialog.buttons.length;i++){
|
||||
if(event.dialog.buttons[i].classList.contains('selected')){
|
||||
var name=event.dialog.buttons[i].link;
|
||||
player.sex=lib.character[name][0];
|
||||
player.group=lib.character[name][1];
|
||||
// player.node.identity.style.backgroundColor=get.translation(player.group+'Color');
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if(event.triggername=='phaseBegin'){
|
||||
(function(){
|
||||
var skills=[link];
|
||||
var list=[];
|
||||
game.expandSkills(skills);
|
||||
var triggerevent=event._trigger;
|
||||
var name='phaseBegin';
|
||||
for(i=0;i<skills.length;i++){
|
||||
var trigger=get.info(skills[i]).trigger;
|
||||
if(trigger){
|
||||
var add=false;
|
||||
if(player==triggerevent.player&&trigger.player){
|
||||
if(typeof trigger.player=='string'){
|
||||
if(trigger.player==name) add=true;
|
||||
}
|
||||
else if(trigger.player.contains(name)) add=true;
|
||||
}
|
||||
if(trigger.global){
|
||||
if(typeof trigger.global=='string'){
|
||||
if(trigger.global==name) add=true;
|
||||
}
|
||||
else if(trigger.global.contains(name)) add=true;
|
||||
}
|
||||
if(add&&player.isOut()==false) list.push(skills[i]);
|
||||
}
|
||||
}
|
||||
for(var i=0;i<list.length;i++){
|
||||
game.createTrigger('phaseBegin',list[i],player,triggerevent);
|
||||
}
|
||||
}());
|
||||
}
|
||||
}
|
||||
if(type!='ai'){
|
||||
// ui.auto.show();
|
||||
event.dialog.close();
|
||||
event.control.close();
|
||||
game.resume();
|
||||
}
|
||||
};
|
||||
if(event.isMine()){
|
||||
event.dialog=ui.create.dialog('选择获得一项技能',[list,'character']);
|
||||
for(var i=0;i<event.dialog.buttons.length;i++){
|
||||
event.dialog.buttons[i].classList.add('pointerdiv');
|
||||
}
|
||||
if(trigger.name=='game'){
|
||||
event.control=ui.create.control();
|
||||
}
|
||||
else{
|
||||
event.control=ui.create.control(['cancel2']);
|
||||
}
|
||||
event.clickControl=function(link){
|
||||
if(link!='cancel2'){
|
||||
var currentname=event.dialog.querySelector('.selected.button').link;
|
||||
var mark=player.marks.huashen;
|
||||
if(trigger.name=='game'){
|
||||
mark.hide();
|
||||
// mark.style.transform='scale(0.8)';
|
||||
mark.style.transition='all 0.3s';
|
||||
setTimeout(function(){
|
||||
mark.style.transition='all 0s';
|
||||
ui.refresh(mark);
|
||||
mark.setBackground(currentname,'character');
|
||||
if(mark.firstChild){
|
||||
mark.firstChild.remove();
|
||||
}
|
||||
setTimeout(function(){
|
||||
mark.style.transition='';
|
||||
mark.show();
|
||||
// mark.style.transform='';
|
||||
},50);
|
||||
},500);
|
||||
}
|
||||
else{
|
||||
if(mark.firstChild){
|
||||
mark.firstChild.remove();
|
||||
}
|
||||
mark.setBackground(currentname,'character');
|
||||
}
|
||||
player.addAdditionalSkill('huashen',link);
|
||||
player.logSkill('huashen2');
|
||||
game.log(player,'获得技能','【'+get.translation(link)+'】');
|
||||
player.popup(link);
|
||||
|
||||
for(var i=0;i<event.dialog.buttons.length;i++){
|
||||
if(event.dialog.buttons[i].classList.contains('selected')){
|
||||
var name=event.dialog.buttons[i].link;
|
||||
player.sex=lib.character[name][0];
|
||||
player.group=lib.character[name][1];
|
||||
// player.node.identity.style.backgroundColor=get.translation(player.group+'Color');
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(event.triggername=='phaseBegin'){
|
||||
(function(){
|
||||
var skills=[link];
|
||||
var list=[];
|
||||
game.expandSkills(skills);
|
||||
var triggerevent=event._trigger;
|
||||
var name='phaseBegin';
|
||||
for(i=0;i<skills.length;i++){
|
||||
var trigger=get.info(skills[i]).trigger;
|
||||
if(trigger){
|
||||
var add=false;
|
||||
if(player==triggerevent.player&&trigger.player){
|
||||
if(typeof trigger.player=='string'){
|
||||
if(trigger.player==name) add=true;
|
||||
}
|
||||
else if(trigger.player.contains(name)) add=true;
|
||||
}
|
||||
if(trigger.global){
|
||||
if(typeof trigger.global=='string'){
|
||||
if(trigger.global==name) add=true;
|
||||
}
|
||||
else if(trigger.global.contains(name)) add=true;
|
||||
}
|
||||
if(add&&player.isOut()==false) list.push(skills[i]);
|
||||
}
|
||||
}
|
||||
for(var i=0;i<list.length;i++){
|
||||
game.createTrigger('phaseBegin',list[i],player,triggerevent);
|
||||
}
|
||||
}());
|
||||
}
|
||||
}
|
||||
ui.auto.show();
|
||||
event.dialog.close();
|
||||
event.control.close();
|
||||
game.resume();
|
||||
};
|
||||
event.control.custom=event.clickControl;
|
||||
ui.auto.hide();
|
||||
// ui.auto.hide();
|
||||
game.pause();
|
||||
for(var i=0;i<event.dialog.buttons.length;i++){
|
||||
event.dialog.buttons[i].classList.add('selectable');
|
||||
|
@ -1712,7 +1734,35 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
|||
}
|
||||
}
|
||||
else{
|
||||
event.finish();
|
||||
var skills=[];
|
||||
var map={};
|
||||
for(var i=0;i<list.length;i++){
|
||||
var sub=player.storage.huashen.owned[list[i]];
|
||||
skills.addArray(sub);
|
||||
for(var j=0;j<sub.length;j++){
|
||||
map[sub]=list[i];
|
||||
}
|
||||
}
|
||||
var add=player.additionalSkills.huashen;
|
||||
if(typeof add=='string'){
|
||||
add=[add];
|
||||
}
|
||||
if(Array.isArray(add)){
|
||||
for(var i=0;i<add.length;i++){
|
||||
skills.remove(add[i]);
|
||||
}
|
||||
}
|
||||
var cond='out';
|
||||
if(event.triggername=='phaseBegin'){
|
||||
cond='in';
|
||||
}
|
||||
skills.randomSort();
|
||||
skills.sort(function(a,b){
|
||||
return get.skillRank(b,cond)-get.skillRank(a,cond);
|
||||
});
|
||||
var choice=skills[0];
|
||||
event.currentname=map[choice];
|
||||
event.clickControl(choice,'ai');
|
||||
}
|
||||
}
|
||||
},
|
||||
|
|
|
@ -1,5 +1,6 @@
|
|||
window.config={
|
||||
forbidai:['zuoci','miheng'],
|
||||
forbidai:[],
|
||||
forbidai_user:['miheng'],
|
||||
forbidall:['xiahouyuan','huangzhong','weiyan','dianwei','zhangjiao',
|
||||
'caocao','simayi','guanyu','zhangfei','zhaoyun','ganning','lvmeng','lvbu'],
|
||||
forbidversus:['swd_kangnalishi'],
|
||||
|
|
91
game/game.js
91
game/game.js
|
@ -6789,7 +6789,7 @@
|
|||
|
||||
var extensionlist=[];
|
||||
if(!localStorage.getItem(lib.configprefix+'disable_extension')){
|
||||
if(lib.config.extensions.length){
|
||||
if(lib.config.extensions&&lib.config.extensions.length){
|
||||
window.resetExtension=function(){
|
||||
for(var i=0;i<lib.config.extensions.length;i++){
|
||||
game.saveConfig('extension_'+lib.config.extensions[i]+'_enable',false);
|
||||
|
@ -7455,6 +7455,9 @@
|
|||
character[i][j][k][4].contains('hiddenboss')){
|
||||
lib.config.forbidai.add(k);
|
||||
}
|
||||
if(lib.config.forbidai_user&&lib.config.forbidai_user.contains(k)){
|
||||
lib.config.forbidai.add(k);
|
||||
}
|
||||
for(var l=0;l<character[i][j][k][3].length;l++){
|
||||
lib.skilllist.add(character[i][j][k][3][l]);
|
||||
}
|
||||
|
@ -9312,6 +9315,9 @@
|
|||
character[i][j][k][4].contains('hiddenboss')){
|
||||
lib.config.forbidai.add(k);
|
||||
}
|
||||
if(lib.config.forbidai_user&&lib.config.forbidai_user.contains(k)){
|
||||
lib.config.forbidai.add(k);
|
||||
}
|
||||
for(var l=0;l<character[i][j][k][3].length;l++){
|
||||
lib.skilllist.add(character[i][j][k][3][l]);
|
||||
}
|
||||
|
@ -25749,6 +25755,9 @@
|
|||
pack[i][j][4].contains('hiddenboss')){
|
||||
lib.config.forbidai.add(j);
|
||||
}
|
||||
if(lib.config.forbidai_user&&lib.config.forbidai_user.contains(j)){
|
||||
lib.config.forbidai.add(j);
|
||||
}
|
||||
for(var l=0;l<pack[i][j][3].length;l++){
|
||||
lib.skilllist.add(pack[i][j][3][l]);
|
||||
}
|
||||
|
@ -43296,18 +43305,72 @@
|
|||
}
|
||||
return num?Math.round(9*(num-1)/8+1):'x';
|
||||
},
|
||||
skillRank:function(skill){
|
||||
skillRank:function(skill,type,grouped){
|
||||
var info=lib.skill[skill];
|
||||
var player=_status.event.skillRankPlayer||_status.event.player;
|
||||
if(!info) return 0;
|
||||
if(info.ai){
|
||||
if(info.ai.halfneg) return 0;
|
||||
if(typeof info.ai.combo=='string'&&_status.event.player&&
|
||||
!_status.event.player.hasSkill(info.ai.combo)){
|
||||
if(typeof info.ai.combo=='string'&&player&&!player.hasSkill(info.ai.combo)){
|
||||
return 0;
|
||||
}
|
||||
if(info.ai.neg) return -1;
|
||||
}
|
||||
return 1;
|
||||
var num=1;
|
||||
var threaten=1;
|
||||
if(info.ai&&info.ai.threaten){
|
||||
if(typeof info.ai.threaten=='number'){
|
||||
threaten=info.ai.threaten;
|
||||
}
|
||||
else if(typeof info.ai.threaten=='function'&&player){
|
||||
threaten=info.ai.threaten(player,player);
|
||||
}
|
||||
}
|
||||
if(type=='in'){
|
||||
if(info.enable=='phaseUse') num+=0.5;
|
||||
if(info.trigger&&['phaseBegin','phaseDrawBegin','phaseUseBegin','phaseEnd'].contains(info.trigger.player)){
|
||||
num+=0.5;
|
||||
}
|
||||
if(info.trigger&&((typeof info.trigger.player=='string'&&info.trigger.player.indexOf('use')==0)||info.trigger.source)){
|
||||
num+=0.3;
|
||||
}
|
||||
if(num>1&&threaten>1){
|
||||
num+=Math.sqrt(threaten)-1;
|
||||
}
|
||||
}
|
||||
else if(type=='out'){
|
||||
if(threaten<1){
|
||||
num=1/Math.sqrt(threaten);
|
||||
}
|
||||
if(info.trigger&&(info.trigger.global||info.trigger.target||(typeof info.trigger.player=='string'&&
|
||||
(info.trigger.player.indexOf('damage')==0||info.trigger.player.indexOf('lose')==0)))) num+=0.1;
|
||||
if(info.ai){
|
||||
if(info.ai.maixie||info.ai.maixie_hp||info.ai.maixie_defend){
|
||||
num+=0.5;
|
||||
}
|
||||
if(info.ai.nolose||info.ai.noh||info.ai.noe||info.ai.nodiscard){
|
||||
num+=0.3;
|
||||
}
|
||||
}
|
||||
}
|
||||
if(!grouped){
|
||||
var groups=game.expandSkills([skill]);
|
||||
groups.remove(skill);
|
||||
var ggt=[];
|
||||
for(var i=0;i<groups.length;i++){
|
||||
var gi=get.skillRank(groups[i],type,true);
|
||||
if(gi<0){
|
||||
num-=0.5;
|
||||
}
|
||||
else if(gi>1){
|
||||
ggt.push(gi);
|
||||
}
|
||||
}
|
||||
if(ggt.length){
|
||||
num+=Math.max.apply(this,ggt)-1+ggt.length/20;
|
||||
}
|
||||
}
|
||||
return num;
|
||||
},
|
||||
targetsInfo:function(targets){
|
||||
var info=[];
|
||||
|
@ -45113,6 +45176,24 @@
|
|||
banall=true;
|
||||
}
|
||||
}
|
||||
if(node._banning=='offline'){
|
||||
var cfg=ui.create.div('.config','AI可选',page);
|
||||
cfg.classList.add('toggle');
|
||||
cfg.listen(function(){
|
||||
this.classList.toggle('on');
|
||||
if(this.classList.contains('on')){
|
||||
lib.config.forbidai_user.remove(character);
|
||||
}
|
||||
else{
|
||||
lib.config.forbidai_user.add(character);
|
||||
}
|
||||
game.saveConfig('forbidai_user',lib.config.forbidai_user);
|
||||
});
|
||||
ui.create.div(ui.create.div(cfg));
|
||||
if(!lib.config.forbidai_user.contains(character)){
|
||||
cfg.classList.add('on');
|
||||
}
|
||||
}
|
||||
ui.create.div('.menubutton.pointerdiv',banall?'全部禁用':'全部启用',uiintro.content,function(){
|
||||
if(this.innerHTML=='全部禁用'){
|
||||
for(var i=0;i<page.childElementCount;i++){
|
||||
|
|
|
@ -1,8 +1,9 @@
|
|||
window.noname_update={
|
||||
version:'1.9.45',
|
||||
update:'1.9.44.1',
|
||||
// update:'1.9.44.1',
|
||||
changeLog:[
|
||||
'bug修复',
|
||||
'自定义AI禁选(武将资料->禁用)',
|
||||
'部分DIY比赛武将',
|
||||
'players:["ns_caocao","ns_caocaosp","ns_zhugeliang","ns_wangyue","ns_yuji","ns_xinxianying","ns_guanlu","ns_simazhao","ns_sunjian","hs_aiqinvyao"]',
|
||||
],
|
||||
|
|
Loading…
Reference in New Issue