Merge branch 'libccy:PR-Branch' into PR-Branch

This commit is contained in:
nonameShijian 2024-01-27 20:58:13 +08:00 committed by GitHub
commit 2e82eeeb50
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 119 additions and 9 deletions

View File

@ -3016,8 +3016,11 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
},
erika_yousheng:{
init:(player)=>{
player.addSkill('erika_yousheng_mamori');
},
dutySkill:true,
group:['erika_yousheng_achieve','erika_yousheng_fail','erika_yousheng_mamori'],
group:['erika_yousheng_achieve','erika_yousheng_fail'],
trigger:{global:'useCardToTarget'},
direct:true,
filter(event,player){

View File

@ -581,7 +581,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
target.damage('nosource');
break;
case '鹰':
player.gain(target.getGainableCards(player,'he'),target,'giveAuto');
player.gain(target.getGainableCards(player,'he').randomGet(),target,'giveAuto');
break;
case '熊':
target.discard(target.getGainableCards(player,'e').randomGet()).discarder=player;

View File

@ -1579,14 +1579,15 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
async content(event,trigger,player){
const target=event.target;
const {result:{control}}=await target.chooseControl('heart2','diamond2','club2','spade2').set('ai',event=>{
const control=await target.chooseControl('heart2','diamond2','club2','spade2').set('ai',event=>{
switch(Math.floor(Math.random()*6)){
case 0:return 'heart2';
case 1:case 4:case 5:return 'diamond2';
case 2:return 'club2';
case 3:return 'spade2';
}
});
})
.forResultControl();
game.log(target,'选择了'+get.translation(control));
event.choice=control;
target.chat('我选'+get.translation(event.choice));
@ -1641,7 +1642,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
});
},
async content(event,trigger,player){
const {result:{bool,targets,cards}}=await player.chooseCardTarget({
const [bool,targets,cards]=await player.chooseCardTarget({
position:'he',
filterCard:lib.filter.cardDiscardable,
filterTarget:(card,player,target)=>{
@ -1671,7 +1672,9 @@ game.import('character',function(lib,game,ui,get,ai,_status){
prompt2:'弃置一张牌,将此【杀】转移给攻击范围内的一名其他角色',
source:trigger.player,
card:trigger.card,
}).setHiddenSkill(event.name);
})
.setHiddenSkill(event.name)
.forResult('bool','targets','cards');
if(bool){
const target=targets[0];
player.logSkill(event.name,target);
@ -2210,7 +2213,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
async content(event,trigger,player){
const list=['弃牌','摸牌','取消'];
if(!player.countCards('he')) list.remove('弃牌');
const {result:{control}}=await player.chooseControl(list,()=>{
const control=await player.chooseControl(list,()=>{
const player=_status.event.player;
if(list.includes('弃牌')){
if(player.countCards('h')>3&&player.countCards('h','sha')>1){
@ -2224,7 +2227,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return '摸牌';
}
return 'cancel2';
}).set('prompt',get.prompt2('new_jiangchi'));
})
.set('prompt',get.prompt2('new_jiangchi'))
.forResultControl();
if(control=='弃牌'){
player.chooseToDiscard(true,'he');
player.addTempSkill('jiangchi2','phaseUseEnd');

View File

@ -11905,6 +11905,10 @@ game.import('character',function(lib,game,ui,get,ai,_status){
}
},
ai:{
filterDamage:true,
skillTagFilter:(player,tag,arg)=>{
return arg&&arg.jiu==true;
},
effect:{
target:(card,player,target)=>{
if(target.hp<=0&&target.hasSkill('zhenlie_lose')&&get.tag(card,'recover')) return [1,1.2];

View File

@ -162,4 +162,95 @@ export class GameEventPromise extends Promise {
game.promises.prompt('debugger调试').then(inputCallback);
});
}
/**
*
* 直接获得result中的信息
*
*
* @example
*
* let chooseCardResult = await player.chooseCard().forResult();
* 选择的卡牌chooseCardResult.cards
*
* let cards = await player.chooseCard().forResult('cards');
* 选择的卡牌cards
*
* let [success,cards,targets] = await player.chooseCardTarget().forResult('bool','cards','targets');
* success:是否做出选择
* cards:选择的牌
* targets:选择的目标
*/
forResult(){
if(arguments.length == 0){
return this.then(event=>{
return Promise.resolve(event.result);
});
}else if(arguments.length == 1){
return this.then(event=>{
return Promise.resolve(event.result[arguments[0]]);
});
}else{
return this.then(event=>{
return Promise.resolve(Array.from(arguments).map(key=>event.result[key]));
});
}
}
/**
* 返回result中的bool项
*
* @returns {boolean} 返回的bool项
*/
forResultBool(){
return this.forResult('bool');
}
/**
* 返回result中的targets项
*
* @returns {lib.element.Player[]} 返回的targets项
*
*/
forResultTargets(){
return this.forResult('targets');
}
/**
* 返回result中的cards项
*
* @returns {lib.element.Card[]} 返回的cards项
*
*/
forResultCards(){
return this.forResult('cards');
}
/**
* 返回result中的card项
*
* @returns {lib.element.VCard|lib.element.Card} 返回的card项
*
*/
forResultCard(){
return this.forResult('card');
}
/**
* 返回result中的control项
*
* @returns {string} 返回的control项
*/
forResultControl(){
return this.forResult('control');
}
/**
* 返回result中的links项
*
* @returns {Array<?>} 返回的links项
*/
forResultLinks(){
return this.forResult('links');
}
}

View File

@ -3703,7 +3703,13 @@ class Create extends Uninstantable {
// if(!get.config('menu_loadondemand')) node._initLink();
return node;
};
for (var i in lib.extensionMenu) {
let extensionsInMenu = Object.keys(lib.extensionMenu);
if(lib.config.extensionSort && Array.isArray(lib.config.extensionSort)){
extensionsInMenu.sort((a,b)=>{
return lib.config.extensionSort.indexOf(a) - lib.config.extensionSort.indexOf(b);
});
}
for (let i of extensionsInMenu) {
if (lib.config.all.stockextension.includes(i) && !lib.config.all.plays.includes(i)) continue;
if (lib.config.hiddenPlayPack.includes(i)) continue;
createModeConfig(i, start.firstChild);