This commit is contained in:
copcap 2023-11-09 00:40:08 +08:00
parent de1f7b2073
commit 5980622620
No known key found for this signature in database
GPG Key ID: 9AE7B8AF097EC926
5 changed files with 45 additions and 33 deletions

View File

@ -565,6 +565,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
player.chooseTarget(get.prompt2('dcmanzhi'),(card,player,target)=>{ player.chooseTarget(get.prompt2('dcmanzhi'),(card,player,target)=>{
if(player==target) return false; if(player==target) return false;
return !player.hasSkill('dcmanzhi_1')&&target.countCards('he')||!player.hasSkill('dcmanzhi_2')&&target.countCards('hej'); return !player.hasSkill('dcmanzhi_1')&&target.countCards('he')||!player.hasSkill('dcmanzhi_2')&&target.countCards('hej');
}).set('ai',target=>{
return 1-get.attitude(get.player(),target);
}); });
'step 1' 'step 1'
if(result.bool){ if(result.bool){

View File

@ -711,7 +711,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:'twjilun', audio:'twjilun',
inherit:'twjilun', inherit:'twjilun',
filter:function(event,player){ filter:function(event,player){
return player.hasSkill('twjichou'); return player.hasSkill('twjichou',null,false,false);
}, },
content:function(){ content:function(){
'step 0' 'step 0'
@ -815,6 +815,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return{ return{
type:result.control, type:result.control,
audio:'twjiaohua', audio:'twjiaohua',
filterCard:()=>false,
selectCard:-1,
filterTarget:true, filterTarget:true,
content:function(){ content:function(){
'step 0' 'step 0'

View File

@ -2694,7 +2694,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
trigger.directHit.add(target); trigger.directHit.add(target);
player.chooseToDuiben(target).set('title','谋弈').set('namelist',[ player.chooseToDuiben(target).set('title','谋弈').set('namelist',[
'出阵迎战','拱卫中军','直取敌营','扰阵疲敌' '出阵迎战','拱卫中军','直取敌营','扰阵疲敌'
]); ]).set('ai',button=>{
var source=get.event().getParent().player,target=get.event().getParent().target;
if(!target.countCards('he')&&button.link[2]=='db_def2') return 10;
if(!target.countCards('he')&&get.attitude(target,source)<=0&&button.link[2]=='db_atk1') return 10;
return 1+Math.random();
});
'step 1' 'step 1'
if(result.bool){ if(result.bool){
if(result.player=='db_def1') player.gainPlayerCard(target,'he',true); if(result.player=='db_def1') player.gainPlayerCard(target,'he',true);
@ -4696,7 +4701,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
forced:true, forced:true,
locked:false, locked:false,
filter:function(event,player){ filter:function(event,player){
return player.hasSkill('splveying')&&(get.type(event.card)=='trick'&&!get.tag(event.card,'damage'))&&player.countMark('splveying')>1; return player.hasSkill('splveying',null,false,false)&&(get.type(event.card)=='trick'&&!get.tag(event.card,'damage'))&&player.countMark('splveying')>1;
}, },
content:function(){ content:function(){
player.removeMark('splveying',2); player.removeMark('splveying',2);

View File

@ -1472,7 +1472,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(event.card.name!='sha'||!event.cards||event.cards.length!=1) return false; if(event.card.name!='sha'||!event.cards||event.cards.length!=1) return false;
var evt=event.getParent('phaseUse'); var evt=event.getParent('phaseUse');
return evt&&evt.player==player&&player.getHistory('useCard',function(evt2){ return evt&&evt.player==player&&player.getHistory('useCard',function(evt2){
return evt2.card.name=='sha'&&evt.cards&&evt.cards.length==1&&evt2.getParent('phaseUse')==evt; return evt2.card.name=='sha'&&evt2.cards&&evt2.cards.length==1&&evt2.getParent('phaseUse')==evt;
}).indexOf(event)==0; }).indexOf(event)==0;
}, },
content:function(){ content:function(){

View File

@ -8577,36 +8577,39 @@
else src=`image/${type}/${subfolder}/${name}${ext}`; else src=`image/${type}/${subfolder}/${name}${ext}`;
} }
else src=`image/${name}${ext}`; else src=`image/${name}${ext}`;
new Promise((resolve,reject)=>{ this.style.backgroundPositionX='center';
const image=new Image(); this.style.backgroundSize='cover';
image.src=`${lib.assetURL}${src}`; if(type=='character'){
image.onload=resolve; new Promise((resolve,reject)=>{
if(type=='character') image.onerror=reject; const image=new Image();
}).then(()=>{ image.src=`${lib.assetURL}${src}`;
image.onload=resolve;
if(type=='character') image.onerror=reject;
}).then(()=>{
this.setBackgroundImage(src);
}).catch(()=>new Promise((resolve,reject)=>{
const nameinfo=get.character(name);
const sex=nameinfo[0];
src=`image/character/default_silhouette_${sex}${ext}`;
const image=new Image();
image.src=`${lib.assetURL}${src}`;
image.onload=()=>resolve(src);
image.onerror=reject;
}).catch(()=>new Promise((resolve,reject)=>{
const nameinfo=get.character(name);
const sex=nameinfo[0];
src=`image/character/default_silhouette_${sex=='female'?'female':'male'}${ext}`;
const image=new Image();
image.src=`${lib.assetURL}${src}`;
image.onload=()=>resolve(src);
image.onerror=reject;
})).then((src)=>{
this.setBackgroundImage(src);
}));
}
else{
this.setBackgroundImage(src); this.setBackgroundImage(src);
this.style.backgroundPositionX='center'; }
this.style.backgroundSize='cover';
}).catch(()=>new Promise((resolve,reject)=>{
const nameinfo=get.character(name);
const sex=nameinfo[0];
src=`image/character/default_silhouette_${sex}${ext}`;
const image=new Image();
image.src=`${lib.assetURL}${src}`;
image.onload=()=>resolve(src);
image.onerror=reject;
}).catch(()=>new Promise((resolve,reject)=>{
const nameinfo=get.character(name);
const sex=nameinfo[0];
src=`image/character/default_silhouette_${sex=='female'?'female':'male'}${ext}`;
const image=new Image();
image.src=`${lib.assetURL}${src}`;
image.onload=()=>resolve(src);
image.onerror=reject;
})).then((src)=>{
this.setBackgroundImage(src);
this.style.backgroundPositionX='center';
this.style.backgroundSize='cover';
}));
return this; return this;
} }
}); });