This commit is contained in:
libccy 2017-11-24 01:48:56 +08:00
parent e7e3a26228
commit c2cadda2a0
4 changed files with 222 additions and 89 deletions

View File

@ -1572,17 +1572,24 @@ game.import('character',function(lib,game,ui,get,ai,_status){
for(var i in slist){
list.push(i);
}
if(event.isMine()){
event.dialog=ui.create.dialog('选择获得一项技能',[list,'character']);
if(trigger.name=='game'){
event.control=ui.create.control();
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{
event.control=ui.create.control(['cancel2']);
currentname=event.dialog.querySelector('.selected.button').link;
}
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();
@ -1613,6 +1620,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
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;
@ -1622,6 +1630,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
break;
}
}
}
if(event.triggername=='phaseBegin'){
(function(){
@ -1655,13 +1664,26 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}());
}
}
ui.auto.show();
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.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');
}
}
},

View File

@ -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'],

View File

@ -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=[];
@ -45111,6 +45174,24 @@
if(!banned.contains(character)){
cfg.classList.add('on');
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(){

View File

@ -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"]',
],