类型修复

This commit is contained in:
nonameShijian 2024-02-06 00:26:11 +08:00
parent cb34cd1e46
commit d47bd0e0ea
12 changed files with 26 additions and 16 deletions

View File

@ -33,6 +33,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
clan_zhong:['clan_zhongyan','clan_zhonghui','clan_zhongyu'], clan_zhong:['clan_zhongyan','clan_zhonghui','clan_zhongyu'],
}, },
}, },
/** @type { importCharacterConfig['skill'] } */
skill:{ skill:{
//族吴乔 //族吴乔
clanqiajue:{ clanqiajue:{
@ -42,7 +43,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return player.countCards('he',card=>{ return player.countCards('he',card=>{
if(_status.connectMode&&get.position(card)=='h') return true; if(_status.connectMode&&get.position(card)=='h') return true;
return get.color(card,player)=='black'&&lib.filter.cardDiscardable(card,player); return get.color(card,player)=='black'&&lib.filter.cardDiscardable(card,player);
}); })>0;
}, },
direct:true, direct:true,
async content(event,trigger,player){ async content(event,trigger,player){

View File

@ -44,6 +44,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
collab_remake:['dc_caocao','dc_liubei','dc_sunquan','nezha','dc_sunce','dc_zhaoyun'], collab_remake:['dc_caocao','dc_liubei','dc_sunquan','nezha','dc_sunce','dc_zhaoyun'],
}, },
}, },
/** @type { importCharacterConfig['skill'] } */
skill:{ skill:{
//新InitFilter测试高达一号 //新InitFilter测试高达一号
//打赢复活赛的牢达[哭] //打赢复活赛的牢达[哭]
@ -52,7 +53,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
enable:['chooseToUse','chooseToRespond'], enable:['chooseToUse','chooseToRespond'],
prompt:'将♦牌当做火【杀】,♥牌当做【桃】,♣牌当做【闪】,♠牌当做【无懈可击】使用或打出', prompt:'将♦牌当做火【杀】,♥牌当做【桃】,♣牌当做【闪】,♠牌当做【无懈可击】使用或打出',
viewAs(cards,player){ viewAs(cards,player){
var name=false; var name;
var nature=null; var nature=null;
switch(get.suit(cards[0],player)){ switch(get.suit(cards[0],player)){
case 'club':name='shan';break; case 'club':name='shan';break;

View File

@ -4572,7 +4572,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
const skills=player.getStockSkills(true,true).filter(skill=>{ const skills=player.getStockSkills(true,true).filter(skill=>{
return !player.hasSkill(skill,null,false,false); return !player.hasSkill(skill,null,false,false);
}); });
return skills.length; return skills.length>0;
}, },
filter_old(event,player){ filter_old(event,player){
var evt=event.getParent(); var evt=event.getParent();
@ -4677,7 +4677,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2, audio:2,
trigger:{global:'phaseUseBegin'}, trigger:{global:'phaseUseBegin'},
filter(event,player){ filter(event,player){
return player.countCards('h')&&event.player!=player; return player.countCards('h')>0&&event.player!=player;
}, },
direct:true, direct:true,
content(){ content(){
@ -4791,7 +4791,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2, audio:2,
trigger:{player:'useCardAfter'}, trigger:{player:'useCardAfter'},
filter(event,player){ filter(event,player){
return event.cards.filterInD('od').length&&get.color(event.card)=='red'; return event.cards.filterInD('od').length>0&&get.color(event.card)=='red';
}, },
content(){ content(){
'step 0' 'step 0'

View File

@ -547,6 +547,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
key_chihaya:['key_sakuya'], key_chihaya:['key_sakuya'],
key_lucia:['key_shizuru'], key_lucia:['key_shizuru'],
}, },
/** @type { importCharacterConfig['skill'] } */
skill:{ skill:{
//伊吹风子 //伊吹风子
fuuko_xingdiao:{ fuuko_xingdiao:{

View File

@ -90,7 +90,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return mode=='identity'&&_status.mode!='purple'; return mode=='identity'&&_status.mode!='purple';
}, },
}, },
/** @type { SMap<Skill> } */ /** @type { importCharacterConfig['skill'] } */
skill:{ skill:{
//神鲁肃 //神鲁肃
dingzhou:{ dingzhou:{

View File

@ -213,6 +213,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
} }
} }
}, },
/** @type { importCharacterConfig['skill'] } */
skill:{ skill:{
qingshu:{ qingshu:{
ai:{ ai:{

View File

@ -81,6 +81,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
gw_luoqi:'是个爱国者…还是个货真价实的王八蛋。', gw_luoqi:'是个爱国者…还是个货真价实的王八蛋。',
gw_yioufeisi:'国王还是乞丐,两者有何区别,人类少一个算一个', gw_yioufeisi:'国王还是乞丐,两者有何区别,人类少一个算一个',
}, },
/** @type { importCharacterConfig['skill'] } */
skill:{ skill:{
sqlongyin:{ sqlongyin:{
trigger:{player:'phaseBeginStart'}, trigger:{player:'phaseBeginStart'},

View File

@ -218,6 +218,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
hs_jaina:['hs_antonidas'], hs_jaina:['hs_antonidas'],
hs_malfurion:['hs_malorne'], hs_malfurion:['hs_malorne'],
}, },
/** @type { importCharacterConfig['skill'] } */
skill:{ skill:{
hshuanyu:{ hshuanyu:{
trigger:{player:'damageEnd'}, trigger:{player:'damageEnd'},

View File

@ -115,6 +115,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
sp_zhengyin:['yue_caiwenji','yue_zhoufei','yue_caiyong','yue_xiaoqiao','yue_daqiao'], sp_zhengyin:['yue_caiwenji','yue_zhoufei','yue_caiyong','yue_xiaoqiao','yue_daqiao'],
} }
}, },
/** @type { importCharacterConfig['skill'] } */
skill:{ skill:{
dcshengxi:{ dcshengxi:{
inherit:'reshengxi', inherit:'reshengxi',
@ -201,7 +202,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return card.hasGaintag('dcqiqin_tag')&&lib.skill.dczixi.zixiList.some(name=>{ return card.hasGaintag('dcqiqin_tag')&&lib.skill.dczixi.zixiList.some(name=>{
return game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card]))); return game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card])));
}); });
}); })>0;
}, },
zixiList:['lebu','bingliang','shandian'], zixiList:['lebu','bingliang','shandian'],
direct:true, direct:true,

View File

@ -2,7 +2,7 @@ declare type CardBaseUIData = {
name?: string; name?: string;
suit?: string; suit?: string;
number?: number; number?: number;
nature?: string; nature?: string | null;
//用于某些方法,用于过滤卡牌的额外结构 //用于某些方法,用于过滤卡牌的额外结构
type?: string | string[]; type?: string | string[];

View File

@ -863,7 +863,7 @@ declare interface Skill {
* *
* v1.9.102使viewAs使backup,ok; * v1.9.102使viewAs使backup,ok;
*/ */
viewAs?: string | CardBaseUIData | ((cards: Card[], player: Player) => string | VCard | CardBaseUIData); viewAs?: string | CardBaseUIData | ((cards: Card[], player: Player) => string | VCard | CardBaseUIData | null);
/** /**
* *
* @param player * @param player
@ -923,7 +923,7 @@ declare interface Skill {
* *
* falseundefined != false结果为truetrue效果一致 * falseundefined != false结果为truetrue效果一致
*/ */
discard?: boolean; discard?: boolean | ContentFuncByAll | OldContentFuncByAll;
/** /**
* player.lose * player.lose
* *
@ -1590,7 +1590,7 @@ declare interface SkillAI {
* ai发动技能的优先度 * ai发动技能的优先度
* 使 * 使
*/ */
order?: number | TwoParmFun<SkillOrCard, Player, number | void>; order?: number | ((item: SkillOrCard, player: Player) => number | void);
/** /**
* 0~1 * 0~1
* 0~1,AI判断身份,AI中未写expose其他AI将会无法判断其身份 * 0~1,AI判断身份,AI中未写expose其他AI将会无法判断其身份

View File

@ -2041,15 +2041,15 @@ export class Get extends Uninstantable {
return card; return card;
} }
/** /**
* @template T * @overload
* @returns {GameEvent}
*/
/**
* @template { keyof GameEvent } T
* @overload * @overload
* @param {T} key * @param {T} key
* @returns {GameEvent[T]} * @returns {GameEvent[T]}
*/ */
/**
* @overload
* @returns {GameEvent}
*/
static event(key) { return key ? _status.event[key] : _status.event; } static event(key) { return key ? _status.event[key] : _status.event; }
static player() { return _status.event.player; } static player() { return _status.event.player; }
static players(sort, dead, out) { static players(sort, dead, out) {
@ -4205,6 +4205,9 @@ export class Get extends Uninstantable {
let cache = CacheContext.requireCacheContext(); let cache = CacheContext.requireCacheContext();
return cache.get.order(item); return cache.get.order(item);
} }
/**
* @returns { number }
*/
static order(item) { static order(item) {
let cache = CacheContext.requireCacheContext(); let cache = CacheContext.requireCacheContext();
var info = get.info(item); var info = get.info(item);