tianjitu fix

This commit is contained in:
Spmario233 2023-09-09 13:05:30 +08:00
parent 78f6a550c4
commit a5d2293a8a
3 changed files with 91 additions and 27 deletions

View File

@ -239,7 +239,11 @@ game.import('card',function(lib,game,ui,get,ai,_status){
type:'equip', type:'equip',
subtype:'equip5', subtype:'equip5',
loseDelay:false, loseDelay:false,
global:'tianjitu_skill', skills:['tianjitu_skill'],
onLose:function(){
player.addTempSkill('tianjitu_skill_lose')
},
loseDelay:false,
ai:{ ai:{
value:function(card,player){ value:function(card,player){
if(player.countCards('h')>3||get.position(card)!='e') return 0.5; if(player.countCards('h')>3||get.position(card)!='e') return 0.5;
@ -374,14 +378,33 @@ game.import('card',function(lib,game,ui,get,ai,_status){
}, },
tianjitu_skill:{ tianjitu_skill:{
audio:true, audio:true,
trigger:{player:['equipBegin','loseBegin']}, trigger:{player:'equipAfter'},
forced:true, forced:true,
equipSkill:true, equipSkill:true,
filter:(event,player,name)=>name=='equipBegin'?event.card.name=='tianjitu'&&player.hasCard(card=>card!=event.card):event.cards.some(value=>get.position(value)=='e'&&value.name=='tianjitu')&&player.countCards('h')<5, filter:(event,player)=>event.card.name=='tianjitu'&&player.hasCard(card=>card!=event.card),
content:()=>{ content:()=>{
if(event.triggername=='loseBegin') player.drawTo(5); player.chooseToDiscard(true,card=>card!=_status.event.getTrigger().card,'he');
else player.chooseToDiscard(true,card=>card!=_status.event.getTrigger().card,'he'); },
} subSkill:{
lose:{
audio:'tianjitu_skill',
forced:true,
charlotte:true,
equipSkill:true,
trigger:{
player:'loseAfter',
global:['equipAfter','addJudgeAfter','gainAfter','loseAsyncAfter','addToExpansionAfter'],
},
filter:(event,player)=>{
if(player.countCards('h')>=5) return false;
var evt=event.getl(player);
return evt&&evt.es.some(card=>card.name=='tianjitu')
},
content:function(){
player.drawTo(5);
},
},
},
}, },
taigongyinfu_skill:{ taigongyinfu_skill:{
equipSkill:true, equipSkill:true,

View File

@ -36081,7 +36081,7 @@
else{ else{
imgsrc='ext:'+extname+'/'+j+'.jpg'; imgsrc='ext:'+extname+'/'+j+'.jpg';
} }
const audiosrc='die:ext:'+extname+'/'+name+'.mp3'; const audiosrc='die:ext:'+extname+'/'+j+'.mp3';
pack[i][j][4].add(imgsrc); pack[i][j][4].add(imgsrc);
pack[i][j][4].add(audiosrc); pack[i][j][4].add(audiosrc);
if(pack[i][j][4].contains('boss')|| if(pack[i][j][4].contains('boss')||

View File

@ -2034,38 +2034,79 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
} }
}, },
shanrangzhaoshu:{ shanrangzhaoshu:{
trigger:{global:'gainEnd'}, trigger:{
global:['gainEnd','loseAsyncAfter'],
},
direct:true, direct:true,
filter:function(event,player){ filter:function(event,player){
return event.player!=player&&event.player!=_status.currentPhase&&event.player.getHistory('gain')[0]==event&&player.countCards('he')+event.player.countCards('he')>0; let min=0;
if(!player.hasSkill('shanrangzhaoshu',null,false)) min+=get.sgn(player.getEquips('shanrangzhaoshu').length)
const bool=player.countCards('he')>min;
return game.hasPlayer(current=>{
if(current==player||current==_status.currentPhase) return false;
if(!bool&&current.countCards('h')==0) return false;
const history=current.getHistory('gain')[0];
if(!history) return false;
if(event.name=='gain'){
return history==event&&event.getlx!==false;
}
return history.getParent()==event;
})
}, },
content:function(){ content:function(){
'step 0' 'step 0'
event.target=trigger.player; event.targets=game.filterPlayer(function(current){
var list=[]; if(current==player||current==_status.currentPhase) return false;
if(player.countCards('he')>1) list.push('交给其一张牌'); const history=current.getHistory('gain')[0];
if(trigger.player.countCards('he')>0) list.push('令其交给你一张牌'); if(!history) return false;
event.list=list; if(trigger.name=='gain'){
player.chooseControl('cancel2').set('choiceList',list).set('prompt',get.prompt('shanrangzhaoshu',trigger.player)).set('ai',function(){ return history==trigger&&trigger.getlx!==false;
if(get.attitude(_status.event.player,_status.event.getTrigger().player)<0) return _status.event.getParent().list.length-1; }
return 'cancel2'; return history.getParent()==trigger;
}); }).sortBySeat(_status.currentPhase);
'step 1' 'step 1'
var target=event.targets.shift();
event.target=target;
if(target.isIn()){
var list=[];
var min=0;
if(!player.hasSkill('shanrangzhaoshu',null,false)) min+=get.sgn(player.getEquips('shanrangzhaoshu').length);
if(player.countCards('he')>min) list.push(`交给${get.translation(target)}一张牌`);
if(target.countCards('he')>0) list.push(`${get.translation(target)}交给你一张牌`);
event.list=list;
if(list.length==0) event.goto(4);
else if(list.length==1) event._result={index:0};
else player.chooseControl('cancel2').set('choiceList',list).set('prompt',get.prompt('shanrangzhaoshu',target)).set('ai',function(){
if(get.attitude(_status.event.player,_status.event.getParent().target)<0) return 1;
return 'cancel2';
});
}
else event.goto(4);
'step 2'
if(result.control=='cancel2'){ if(result.control=='cancel2'){
event.finish();return; event.goto(4);
return;
} }
player.logSkill('shanrangzhaoshu',target); player.logSkill('shanrangzhaoshu',target);
if(event.list[result.index][0]=='令'){ if(event.list[result.index][0]=='令'){
event.player=target; event.gainner=player;
event.target=player; event.giver=target;
target.chooseCard('he',true,`交给${get.translation(player)}一张牌`);
}
else{
event.giver=player;
event.gainner=target;
player.chooseCard('he',true,`交给${get.translation(target)}一张牌`).set('filterCard',function(card,player){
if(_status.event.ignoreCard) return true;
var cards=player.getEquips('shanrangzhaoshu');
if(!cards.contains(card)) return true;
return cards.some(cardx=>(cardx!=card&&!ui.selected.cards.contains(cardx)));
}).set('ignoreCard',player.hasSkill('shanrangzhaoshu',null,false));
} }
'step 2'
player.chooseCard('he',true).set('filterCard',function(card,player){
if(player!=_status.event.getTrigger().player) return card!=player.getEquip('shanrangzhaoshu');
return true;
});
'step 3' 'step 3'
if(result.cards&&result.cards.length) target.gain(result.cards,player,'giveAuto'); if(result.cards&&result.cards.length) event.giver.give(result.cards,event.gainner);
'step 4'
if(targets.length>0) event.goto(1);
}, },
}, },
lingsheji:{ lingsheji:{