Merge branch 'PR-Branch' of https://github.com/libccy/noname into PR-Branch

This commit is contained in:
Spmario233 2023-10-01 21:38:42 +08:00
commit da953811d4
3 changed files with 70 additions and 51 deletions

View File

@ -784,12 +784,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return ui.selected.targets.length==ui.selected.cards.length+1;
},
check:function(card){
let player=get.owner(card),targets=_status.event.getTempCache('sblijian','targets');
if(!Array.isArray(targets)){
lib.skill.sblijian.selectTargetAi(_status.event,player);
targets=_status.event.getTempCache('sblijian','targets');
}
targets=Math.min(player.countCards('he')+1,targets.length);
let player=get.owner(card),targets=lib.skill.sblijian.selectTargetAi(_status.event,player);
if(ui.selected.cards.length<targets-1){
if(player.hasSkill('sbbiyue')) return 4*targets-get.value(card);
return 6+targets-get.value(card);
@ -797,44 +792,59 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return 0;
},
selectTargetAi:function(event,player){
let id=[null,0],players=game.filterPlayer(current=>current!==player),res;
let cache=_status.event.getTempCache('sblijian','targets');
if(Array.isArray(cache)) return cache.length;
let id=[null,0],players=game.filterPlayer(current=>current!==player),temp;
for(let i of players){
res=get.attitude(event.player,i);
if(res<id[1]) id=[i,res];
temp=get.attitude(event.player,i);
if(temp<id[1]) id=[i,temp];
}
if(id[0]) id=id[0].identity;
else{
event.putTempCache('sblijian','targets',[]);
return;
return 0;
}
let vp=ui.create.player().init('sunce'),target=[null,0];
vp.skills=[];
if(id.endsWith('zhu')||id.endsWith('Zhu')) id=id.slice(0,-1)+'ong';
vp.identity=id;
vp.showIdentity();
game.players.push(vp);
for(let i of players){
res=get.effect(i,{name:'juedou',isCard:true},vp,event.player)+get.effect(vp,{name:'juedou',isCard:true},i,event.player);
if(res>target[1]) target=[i,res];
}
game.players.remove(vp);
if(target[1]<=0){
event.putTempCache('sblijian','targets',[]);
return;
}
let targets=[],idx=-1;
do{
idx++;
targets.push(target.concat([get.sgn(get.attitude(player,target[0]))]));
players.remove(target[0]);
target[1]=0;
for(let i of players){
res=get.effect(i,{name:'juedou',isCard:true},targets[idx][0],event.player);
if(res>target[1]) target=[i,res];
let target=[null,0],targets=[],vp=player.getEnemies();
if(vp.length>1){
let list=[game.createCard('sha'),game.createCard('shan')];
vp=ui.create.player().init('sunce');
vp.hp=2;
vp.skills=[];
game.players.push(vp);
if(typeof id==='string'){
if(id.endsWith('zhu')||id.endsWith('Zhu')) id=id.slice(0,-1)+'ong';
vp.identity=id;
vp.showIdentity();
}
}while(target[1]>0);
if(!player.hasSkill('sbbiyue')) targets=targets.filter(i=>i[2]!==0);
else vp.side=id[0].side;
vp.directgain(list,false);
for(let i of players){
temp=get.effect(i,{name:'juedou',isCard:true},vp,event.player)+get.effect(vp,{name:'juedou',isCard:true},i,event.player);
if(temp>=0) targets.push([i,temp]);
}
game.cardsGotoSpecial(list);
game.players.remove(vp);
}
else{
vp=vp[0];
for(let i of players){
temp=get.effect(i,{name:'juedou',isCard:true},vp,event.player)+get.effect(vp,{name:'juedou',isCard:true},i,event.player);
if(temp>=0) targets.push([i,temp]);
}
}
for(let i=0;i<targets.length;i++){
temp=get.attitude(player,targets[i][0]);
if(temp>0&&targets[i][1]<2.5*temp&&targets.length>2) targets.splice(i--,1);
else targets[i].push(temp);
}
targets.sort((a,b)=>{
let att1=get.sgn(get.attitude(event.player,a[0])),att2=get.sgn(get.attitude(event.player,b[0]));
if(att1!==att2) return att1-att2;
return b[1]-a[1];
});
targets=targets.slice(0,player.countCards('he')+1);
event.putTempCache('sblijian','targets',targets);
return targets.length;
},
multiline:true,
content:function(){
@ -847,24 +857,36 @@ game.import('character',function(lib,game,ui,get,ai,_status){
order:7,
result:{
player:function(player,target){
if(!player.hasSkill('sbbiyue')) return 0;
let targets=_status.event.getTempCache('sblijian','targets');
if(Array.isArray(targets)) for(let i=0;i<targets.length;i++){
if(!Array.isArray(targets)) return 0;
if(targets.length>2&&!player.hasSkill('sbbiyue')) return 0;
for(let i=0;i<targets.length;i++){
if(target===targets[i][0]&&targets[i][2]===0) return 1;
}
return 0;
},
target:function(player,target){
let targets=_status.event.getTempCache('sblijian','targets');
if(Array.isArray(targets)) for(let i=0;i<targets.length;i++){
if(target===targets[i][0]){
if(targets[i][2]>0) return targets[i][1]/5;
return -targets[i][1];
if(Array.isArray(targets)){
for(let i=0;i<targets.length;i++){
if(target===targets[i][0]){
if(targets[i][2]>0) return targets[i][1]/5;
return -targets[i][1];
}
}
return 0;
}
if(ui.selected.targets.length){
let tars=ui.selected.targets.concat([target]);
return get.effect(target,{name:'juedou',isCard:true},tars[tars.length-2],target)+get.effect(tars[0],{name:'juedou',isCard:true},target,target);
let tars=ui.selected.targets.concat([target]).sortBySeat();
for(let i=0;i<tars.length;i++){
if(target!==tars[i]) continue;
let eff;
if(i===0) eff=get.effect(target,{name:'juedou',isCard:true},tars[tars.length-1],target);
else eff=get.effect(target,{name:'juedou',isCard:true},tars[i-1],target);
if(i===tars.length-1) eff+=get.effect(tars[i-1],{name:'juedou',isCard:true},target,target);
else eff+=get.effect(tars[0],{name:'juedou',isCard:true},target,target);
return eff;
}
}
return 0;
}

View File

@ -54437,8 +54437,7 @@
var intro=ui.create.div('.characterintro',get.characterIntro(name),uiintro);
if(lib.config.show_characternamepinyin=='showPinyin2'||lib.config.show_characternamepinyin=='showCodeIdentifier2'){
var charactername=get.rawName(name);
var characterpinyin=get.pinyin(charactername);
if(lib.config.show_characternamepinyin=='showCodeIdentifier2') characterpinyin=name;
var characterpinyin=lib.config.show_characternamepinyin=='showCodeIdentifier2'?name:get.pinyin(charactername);
var nameinfo=get.character(name);
var charactersex=get.translation(nameinfo[0]);
const charactergroups=get.is.double(name,true);
@ -54475,8 +54474,7 @@
var skillname=get.translation(this.link);
var skilltranslationinfo=get.skillInfoTranslation(this.link);
if((lib.config.show_skillnamepinyin=='showPinyin2'||lib.config.show_skillnamepinyin=='showCodeIdentifier2')&&skillname!='阵亡'){
var skillpinyin=get.pinyin(skillname);
if(lib.config.show_skillnamepinyin=='showCodeIdentifier2') skillpinyin=this.link;
var skillpinyin=lib.config.show_skillnamepinyin=='showCodeIdentifier2'?this.link:get.pinyin(skillname);
intro2.innerHTML='<span style="font-weight:bold;margin-right:5px">'+skillname+'</span>'+'<span style="font-size:14px;font-family:SimHei,STHeiti,sans-serif">'+'['+skillpinyin+']'+'</span>'+' '+skilltranslationinfo;
}else{
intro2.innerHTML='<span style="font-weight:bold;margin-right:5px">'+skillname+'</span>'+skilltranslationinfo;
@ -54494,8 +54492,7 @@
var derivationname=get.translation(derivation[i]);
var derivationtranslationinfo=get.skillInfoTranslation(derivation[i]);
if((lib.config.show_skillnamepinyin=='showPinyin2'||lib.config.show_skillnamepinyin=='showCodeIdentifier2')&&derivationname.length<=5&&derivation[i].indexOf('_faq')==-1){
var derivationpinyin=get.pinyin(derivationname);
if(lib.config.show_skillnamepinyin=='showCodeIdentifier2') derivationpinyin=derivation[i];
var derivationpinyin=lib.config.show_skillnamepinyin=='showCodeIdentifier2'?derivation[i]:get.pinyin(derivationname);
intro2.innerHTML+='<br><br><span style="font-weight:bold;margin-right:5px">'+derivationname+'</span>'+'<span style="font-size:14px;font-family:SimHei,STHeiti,sans-serif">'+'['+derivationpinyin+']'+'</span>'+' '+derivationtranslationinfo;
}else{
intro2.innerHTML+='<br><br><span style="font-weight:bold;margin-right:5px">'+derivationname+'</span>'+derivationtranslationinfo;

View File

@ -1019,7 +1019,7 @@ input.fileinput::-webkit-file-upload-button {
}
.config {
height: 25px;
/* height: 25px; */
line-height: 25px;
position: relative;
}