Bugfix for PR#414

This commit is contained in:
Spmario233 2023-09-28 14:18:32 +08:00
parent 2599f5725c
commit 11639b6b31
4 changed files with 36 additions and 21 deletions

View File

@ -454,12 +454,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 2'
if(result.bool){
target.recover();
event.finish();
}
else{
target.draw([1,2,3,4,5].reduce((p,c)=>p+target.countEmptySlot(c),0));
player.link(false);
player.turnOver(false);
}
'step 3'
player.link(false);
'step 4'
player.turnOver(false);
},
ai:{
expose:0.2,

View File

@ -3016,14 +3016,16 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(result.bool){
var num=1-player.hp;
if(num>0) player.recover(num);
event.finish();
}
else{
target.gainMaxHp();
target.recover();
target.draw();
var num=player.maxHp-player.hp;
if(num>0) player.recover(num);
}
'step 2'
var num=player.maxHp-player.hp;
if(num>0) player.recover(num);
},
},
//王淩

View File

@ -229,11 +229,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
forced:true,
locked:false,
content:function(){
'step 0'
player.draw(2).gaintag=['kangli'];
player.when({source:'damageBegin1'})
.then(()=>{
var cards=player.getCards('h',card=>card.hasGaintag('kangli'));
var cards=player.getCards('h',card=>card.hasGaintag('kangli')&&lib.filter.cardDiscardable(card,player,'kangli'));
if(cards.length) player.discard(cards);
})
},
@ -256,6 +255,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
discard:false,
lose:false,
delay:false,
popname:true,
check:function(card){
var num=6.5;
if(ui.selected.cards.length){
@ -278,6 +278,12 @@ game.import('character',function(lib,game,ui,get,ai,_status){
.assign({
numbers:numbers,
playerx:player,
mod:{
aiOrder:function(player,card,num){
var number=get.number(card);
if(typeof number!='number'||number<=numbers[0]||number>=numbers[1]) return num+10;
},
},
})
.filter((event,player)=>{
return event._tongwei_checked;
@ -286,15 +292,18 @@ game.import('character',function(lib,game,ui,get,ai,_status){
var number=get.number(trigger.card);
var numbers=get.info(event.name).numbers;
event.playerx=get.info(event.name).playerx;
if(number<=numbers[0]||number>=numbers[1]) event.finish();
if(typeof number!='number'||number<=numbers[0]||number>=numbers[1]) event.finish();
})
.then(()=>{
var playerx=event.playerx;
var names=['sha','guohe'].filter(name=>playerx.canUse({name:name,isCard:true},player,false));
if(!names.length) event.finish();
else if(names.length==1) event._result={control:names[0]};
else playerx.chooseControl(names).set('prompt',`统围:视为对${get.translation(player)}使用一张【杀】或【过河拆桥】`).set('ai',()=>{
return _status.event.choice;
else if(names.length==1) event._result={links:[[null,null,names[0]]]};
else playerx.chooseButton([
`请选择要视为对${get.translation(player)}使用的牌`,
[names,'vcard'],
]).set('ai',(button)=>{
return button.link[0][2]==_status.event.choice;
}).set('choice',function(){
var list=names.map(name=>{
return [name,get.effect(player,{name:name,isCard:true},playerx,playerx)];
@ -305,9 +314,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}());
})
.then(()=>{
var name=result.control;
var name=result.links[0][2];
var card={name:name,isCard:true},playerx=event.playerx;
if(playerx.canUse(card,player,false)) playerx.useCard(card,player);
if(playerx.canUse(card,player,false)) playerx.useCard(card,player,'tongwei');
})
},
ai:{
@ -476,10 +485,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
'step 1'
var guessedNum=result.index;
var type=get.type2(trigger.card,trigger.player);
var count=trigger.player.countCards('h',card=>get.type2(card)==type);
player.chat('我猜'+get.cnNumber(guessedNum)+'张');
game.log(player,'猜测',trigger.player,'有',get.cnNumber(guessedNum)+'张'+get.translation(type)+'牌');
event.guessedNum=guessedNum;
game.delay();
'step 2'
var count=trigger.player.countCards('h',card=>get.type2(card)==type);
var guessedNum=event.guessedNum;
if(count==guessedNum){
player.popup('猜测正确','wood');
game.log(player,'猜测','#g正确');

View File

@ -2093,7 +2093,7 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
'step 2'
if(target.countCards('e')>0){
target.chooseControl().set('prompt','追妒:请选择一项').set('choiceList',[
'令'+get.translation(trigger.player)+'此次对你造成的伤害+1',
'令'+get.translation(player)+'此次对你造成的伤害+1',
'弃置装备区里的所有牌',
]).set('ai',function(){
var player=_status.event.player,cards=player.getCards('e');
@ -2137,24 +2137,22 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
event.target=target;
player.awakenSkill('gzshigong');
var list=lib.character[player.name2][3].filter(function(skill){
var info=get.info(skill);
return info&&!get.is.locked(skill)&&!info.juexingji&&!info.hiddenSkill&&!info.zhuSkill&&!info.charlotte&&!info.limited&&!info.dutySkill&&!info.zhenfa&&!info.mainSkill&&!info.viceSkill&&!info.unique;
return get.skillCategoriesOf(skill).length==0;
});
if(!list.length){
event._result={control:'cancel2'};
event.goto(3);
event.goto(2);
}
else event.list=list;
'step 1'
player.removeCharacter(1);
'step 2'
_status.currentPhase.chooseControl(event.list,'cancel2').set('choiceList',event.list.map(i=>{
'step 1'
target.chooseControl(event.list,'cancel2').set('choiceList',event.list.map(i=>{
return '<div class="skill">【'+get.translation(lib.translate[i+'_ab']||get.translation(i).slice(0,2))+'】</div><div>'+get.skillInfoTranslation(i,_status.currentPhase)+'</div>';
})).set('displayIndex',false).set('ai',function(){
if(get.attitude(_status.event.player,_status.event.getParent().player)>0) return 0;
return [0,1].randomGet();
}).set('prompt',get.translation(player)+'对你发动了【示恭】').set('prompt2','获得一个技能并令其将体力回复至体力上限或点击“取消”令其将体力值回复至1点。');
'step 3'
'step 2'
if(result.control=='cancel2'){
player.recover(1-player.hp);
event.finish();