Merge branch 'PR-Branch' into PR-Branch

This commit is contained in:
Spmario233 2024-02-06 13:19:15 +08:00 committed by GitHub
commit 7838ceab9c
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
33 changed files with 385 additions and 168 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'],
},
},
/** @type { importCharacterConfig['skill'] } */
skill:{
//族吴乔
clanqiajue:{
@ -42,7 +43,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return player.countCards('he',card=>{
if(_status.connectMode&&get.position(card)=='h') return true;
return get.color(card,player)=='black'&&lib.filter.cardDiscardable(card,player);
});
})>0;
},
direct:true,
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'],
},
},
/** @type { importCharacterConfig['skill'] } */
skill:{
//新InitFilter测试高达一号
//打赢复活赛的牢达[哭]
@ -52,7 +53,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
enable:['chooseToUse','chooseToRespond'],
prompt:'将♦牌当做火【杀】,♥牌当做【桃】,♣牌当做【闪】,♠牌当做【无懈可击】使用或打出',
viewAs(cards,player){
var name=false;
var name;
var nature=null;
switch(get.suit(cards[0],player)){
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=>{
return !player.hasSkill(skill,null,false,false);
});
return skills.length;
return skills.length>0;
},
filter_old(event,player){
var evt=event.getParent();
@ -4677,7 +4677,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2,
trigger:{global:'phaseUseBegin'},
filter(event,player){
return player.countCards('h')&&event.player!=player;
return player.countCards('h')>0&&event.player!=player;
},
direct:true,
content(){
@ -4791,7 +4791,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
audio:2,
trigger:{player:'useCardAfter'},
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(){
'step 0'

View File

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

View File

@ -13,7 +13,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
extra_yin:['shen_liubei','shen_luxun'],
extra_lei:['shen_ganning','shen_zhangliao'],
extra_key:['key_kagari','key_shiki','db_key_hina'],
extra_decade:['shen_jiangwei','shen_machao','shen_zhangfei','shen_zhangjiao','shen_dengai'],
extra_decade:['shen_jiangwei','shen_machao','shen_zhangfei','shen_zhangjiao','shen_dengai','shen_xuzhu'],
extra_ol:['ol_zhangliao','shen_caopi','shen_zhenji','shen_sunquan'],
extra_mobilezhi:['shen_guojia','shen_xunyu'],
extra_mobilexin:['shen_taishici','shen_sunce'],
@ -23,6 +23,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
},
},
character:{
shen_xuzhu:['male','shen',5,['zhengqing','zhuangpo'],['wei']],
shen_lusu:['male','shen',3,['dingzhou','tamo','zhimeng'],['wu']],
shen_huatuo:['male','shen',3,['wuling','youyi'],['qun']],
le_shen_jiaxu:['male','shen',4,['jxlianpo','jxzhaoluan'],['qun']],
@ -90,8 +91,174 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return mode=='identity'&&_status.mode!='purple';
},
},
/** @type { SMap<Skill> } */
/** @type { importCharacterConfig['skill'] } */
skill:{
//神许褚
zhengqing:{
audio:2,
trigger:{global:'roundStart'},
forced:true,
filter(){
return game.hasPlayer(current=>{
return current.countMark('zhengqing');
})||lib.skill.zhengqing.getMostInfoLastRound()[0]>0;
},
getMostInfoLastRound(){
let max=-1,players=[];
const history=game.getAllGlobalHistory();
if(history.length<=2) return [max,players];
for(let i=history.length-2;i>=0;i--){
const evts=history[i]['everything'].filter(evt=>{
if(evt.name!=='damage') return false;
const source=evt.source;
return source&&source.isIn();
});
if(evts.length){
let curMax=-1,curPlayers=[];
const map={};
for(const evt of evts){
const source=evt.source;
const id=source.playerid;
if(typeof map[id]!=='number') map[id]=0;
map[id]+=evt.num;
if(map[id]>curMax){
curMax=map[id];
curPlayers=[source];
}
else if(map[id]==curMax){
curPlayers.add(source);
}
}
if(curMax>max){
max=curMax;
players=curPlayers.slice();
}
else if(curMax===max){
players.addArray(curPlayers);
}
}
if(history[i].isRound) break;
}
return [max,players];
},
async content(event,trigger,player){
game.countPlayer(current=>{
if(current.hasMark('zhengqing')) current.clearMark('zhengqing');
});
const [num,players]=lib.skill.zhengqing.getMostInfoLastRound();
player.line(players,'thunder');
const onlyMe=players.length===1&&players[0]===player;
const isMax=(player.getAllHistory('custom',evt=>evt&&evt.zhengqing_count).map(evt=>evt.zhengqing_count).sort((a,b)=>b-a)[0]||0)<=num;
players.forEach(current=>{
current.addMark('zhengqing',num);
})
if(onlyMe&&isMax){
player.draw(num);
player.getHistory('custom').push({zhengqing_count:num});
}
else{
const drawers=[player].concat(players).sortBySeat(trigger.player);
for(const drawer of drawers){
await drawer.draw();
}
}
},
marktext:'擎',
intro:{
name:'争擎',
name2:'擎',
content:'mark',
},
},
zhuangpo:{
audio:2,
enable:'chooseToUse',
onChooseToUse(event){
if(!game.online&&!event.zhuangpo_cards){
event.set('zhuangpo_cards',event.player.getCards('hes',card=>{
const str=lib.skill.shencai.getStr(card);
return str.includes('【杀】');
}));
}
},
viewAs:{
name:'juedou',
storage:{zhuangpo:true},
},
viewAsFilter(){
return get.event('zhuangpo_cards').length>0;
},
prompt:'将一张牌面信息包含“【杀】”的牌当【决斗】使用',
filterCard(card,player){
return get.event('zhuangpo_cards').includes(card);
},
position:'hes',
precontent(){
player.addTempSkill('zhuangpo_effect');
},
subSkill:{
effect:{
trigger:{
player:'useCardToPlayered',
},
filter(event,player){
const card=event.card;
if(!card||!card.storage||!card.storage.zhuangpo) return false;
return player.hasMark('zhengqing');
},
direct:true,
charlotte:true,
group:'zhuangpo_damage',
async content(event,trigger,player){
const target=trigger.target;
const list=Array.from({length:player.countMark('zhengqing')},(_,i)=>{
return get.cnNumber(i+1,true);
});
const result=await player.chooseControl(list,'cancel2')
.set('prompt','壮魄:是否移去任意枚“擎”?')
.set('prompt2',`若如此做,${get.translation(target)}须弃置等量的牌`)
.set('ai',()=>get.event('choice'))
.set('choice',(()=>{
if(get.attitude(player,target)>=0) return 'cancel2';
const markCount=list.length;
const cards=target.getCards('he',card=>lib.filter.cardDiscardable(card,target));
let allIn=false;
if(player.hp<2||target.hp+target.countCards('h',card=>target.canSaveCard(card,target))<=1+trigger.targets.some(current=>current.hasMark('zhengqing'))) allIn=true;
if(cards.map(card=>get.value(card)).reduce((p,c)=>p+c,0)/cards.length>5) allIn=true;
if(!player.isPhaseUsing()||!player.hasCard(card=>{
if(!lib.skill.shencai.getStr(card).includes('【杀】')) return false;
return player.hasValueTarget(get.autoViewAs({name:'juedou'},[card]));
})) allIn=true;
const maxCount=Math.min(markCount,cards.length);
const toRemoveCount=allIn?maxCount:Math.ceil(Math.random()*maxCount);
return get.cnNumber(toRemoveCount,true);
})())
.forResult();
if(result.control==='cancel2') return;
const toRemoveCount=result.index+1;
player.logSkill('zhuangpo_effect',target);
player.popup(get.cnNumber(toRemoveCount)+'张');
player.removeMark('zhengqing',toRemoveCount);
target.chooseToDiscard('he',toRemoveCount,true);
}
},
damage:{
audio:'zhuangpo',
trigger:{source:'damageBegin1'},
filter(event,player){
const card=event.card;
if(!card||!card.storage||!card.storage.zhuangpo) return false;
const evt=event.getParent(2);
return evt.targets&&evt.targets.some(current=>current.hasMark('zhengqing'));
},
charlotte:true,
forced:true,
async content(event,trigger){
trigger.num++;
},
},
},
},
//神鲁肃
dingzhou:{
audio:2,
@ -8369,6 +8536,13 @@ game.import('character',function(lib,game,ui,get,ai,_status){
tamo_info:'游戏开始时,你可以重新分配除主公外所有角色的座次。',
zhimeng:'智盟',
zhimeng_info:'回合结束后,你可以与一名其他角色将各自所有手牌置于处理区,然后你随机获得这些牌中的一半(向上取整),其获得剩余的牌。',
shen_xuzhu:'神许褚',
shen_xuzhu_prefix:'神',
zhengqing:'争擎',
zhengqing_info:'锁定技。一轮游戏开始时你移去所有角色的“擎”标记令上一轮于一回合内造成伤害值最多的角色各获得X枚“擎”且你与这些角色各摸一张牌X为这些角色该回合内造成的伤害值。若该角色为你且本次获得的“擎”数为本局游戏最多的一次你改为摸X张牌。',
zhuangpo:'壮魄',
zhuangpo_info:'你可以将牌面信息中包含“【杀】”的牌当【决斗】使用然后你获得如下效果1.当此【决斗】指定目标后若你有“擎”你可以移去任意枚“擎”令目标角色弃置等量的牌2.当你造成渠道为此牌的伤害时,若此牌的所有目标角色中存在有“擎”的角色,此伤害+1。',
extra_feng:'神话再临·风',
extra_huo:'神话再临·火',

View File

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

View File

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

View File

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

View File

@ -6,7 +6,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
character:{
dc_liuli:['male','shu',4,['dcfuli','dcdehua']],
yue_daqiao:['female','wu',3,['dcqiqin','dczixi']],
kongrong:['male','qun',3,['dckrmingshi','lirang']],
dc_kongrong:['male','qun',3,['dckrmingshi','lirang']],
dc_sp_menghuo:['male','qun',4,['dcmanwang']],
dc_lingcao:['male','wu','4/5',['dcdufeng']],
yue_xiaoqiao:['female','wu',3,['dcqiqin','dcweiwan']],
@ -116,6 +116,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
sp_zhengyin:['yue_caiwenji','yue_zhoufei','yue_caiyong','yue_xiaoqiao','yue_daqiao'],
}
},
/** @type { importCharacterConfig['skill'] } */
skill:{
//刘理
dcfuli:{
@ -352,7 +353,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
return card.hasGaintag('dcqiqin_tag')&&lib.skill.dczixi.zixiList.some(name=>{
return game.hasPlayer(target=>target.canAddJudge(get.autoViewAs({name:'dczixi_'+name},[card])));
});
});
})>0;
},
zixiList:['lebu','bingliang','shandian'],
direct:true,
@ -487,7 +488,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
if(get.event('goon')) return 0;
return 6-get.value(card);
}).set('goon',get.damageEffect(player,target,target)<=0);
if(!bool) trigger.decrease('num');
if(!bool) trigger.cancel();
},
ai:{
effect:{
@ -12090,7 +12091,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
dcmanwang_info:'出牌阶段你可以弃置任意张牌。然后你依次执行以下选项中的前X项⒈获得〖叛侵〗。⒉摸一张牌。⒊回复1点体力。⒋摸两张牌并失去〖叛侵〗。',
dcpanqin:'叛侵',
dcpanqin_info:'出牌阶段或弃牌阶段结束时你可将你于本阶段内弃置且位于弃牌堆的所有牌当做【南蛮入侵】使用。然后若此牌被使用时对应的实体牌数不大于此牌的目标数则你执行并移除〖蛮王〗中的最后一个选项然后加1点体力上限并回复1点体力。',
kongrong:'孔融',
dc_kongrong:'孔融',
dckrmingshi:'名士',
dckrmingshi_info:'锁定技,当你受到其他角色造成的伤害时,若其手牌数大于你,则其需弃置一张手牌,否则此伤害-1。',
yue_daqiao:'乐大乔',

View File

@ -31,7 +31,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
mb_chengui:['male','qun',3,['guimou','zhouxian']],
mb_huban:['male','wei',4,['mbyilie']],
mb_xianglang:['male','shu',3,['naxue','yijie']],
yanxiang:['male','qun',3,['kujian','twruilian'],['character:tw_yanxiang','die_audio:tw_yanxiang']],
yanxiang:['male','qun',3,['kujian','twruilian'],['die_audio:tw_yanxiang']],
mb_sunluyu:['female','wu',3,['mbmeibu','mbmumu']],
xin_wuban:['male','shu',4,['xinjintao'],['clan:陈留吴氏','character:wuban']],
baoxin:['male','qun',4,['mutao','yimou'],['die_audio:tw_baoxin']],

View File

@ -11,7 +11,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
offline_yijiang:['ol_xinxianying'],
offline_luanwu:["ns_lijue","ns_zhangji","ns_fanchou"],
offline_yongjian:["ns_chendao","yj_caoang","yj_caocao",'yj_liru','yj_caohong','yj_zhangfei','yongjian_ganning','yj_dongzhuo','yj_xuyou','yj_jiaxu','yj_zhenji'],
offline_piracyE:['shen_jiaxu','pe_wangyun','pe_zhonghui','pe_sunchen','pe_mengda','pe_wenqin','ns_caoanmin','chendong','jiangqing','zy_kongrong','jiling','tianfeng','mateng'],
offline_piracyE:['shen_jiaxu','pe_wangyun','pe_zhonghui','pe_sunchen','pe_mengda','pe_wenqin','ns_caoanmin','chendong','jiangqing','kongrong','jiling','tianfeng','mateng'],
offline_piracyS:['ns_jiaxu','longyufei','ps_guanyu','ps1059_guojia','ps2070_guojia','ps2063_zhaoyun','ps2067_zhaoyun','ps1062_zhouyu','ps2080_zhouyu','ps_caozhi','ps_jin_simayi','ps_caopi','ps_simayi','ps2068_simayi','ps_machao','ps_zhugeliang','ps2066_zhugeliang','ps_jiaxu','ps_lvbu','ps_shen_machao','jsp_liubei'],
offline_piracyK:['pk_sp_duyu'],
offline_vtuber:['vtb_xiaosha','vtb_xiaoshan','vtb_xiaotao','vtb_xiaole','vtb_xiaojiu'],
@ -33,7 +33,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
mateng:['male','qun',4,['mashu','xiongyi']],
tianfeng:['male','qun',3,['sijian','gzsuishi']],
jiling:['male','qun',4,['shuangren']],
zy_kongrong:['male','qun',3,['zymingshi','lirang']],
kongrong:['male','qun',3,['zymingshi','lirang']],
chendong:['male','wu',4,['duanxie','fenming']],
jiangqing:['male','wu',4,['zyshangyi']],
pk_sp_duyu:['male','qun',4,['pkwuku','pksanchen']],
@ -6799,8 +6799,8 @@ game.import('character',function(lib,game,ui,get,ai,_status){
tianfeng_prefix:'战役篇',
jiling:'战役篇纪灵',
jiling_prefix:'战役篇',
zy_kongrong:'战役篇孔融',
zy_kongrong_prefix:'战役篇',
kongrong:'战役篇孔融',
kongrong_prefix:'战役篇',
mateng:'战役篇马腾',
mateng_prefix:'战役篇',

View File

@ -1049,6 +1049,7 @@ window.noname_character_rank={
'jsrg_gaoxiang',
'jsrg_sunlubansunluyu',
'jsrg_weiwenzhugezhi',
'shen_xuzhu',
],
b:[
'ol_sb_guanyu',
@ -1563,6 +1564,7 @@ window.noname_character_rank={
'jsrg_xugong',
'old_xiaoqiao',
'old_guanyu',
'dc_kongrong',
],
c:[
'xiahoudun',

Binary file not shown.

After

Width:  |  Height:  |  Size: 110 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 72 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 82 KiB

View File

@ -1093,15 +1093,15 @@ game.import('mode',function(lib,game,ui,get,ai,_status){
event.map[event.bZhu].remove(character);
game.bZhu.init(character);
}
if(!game.rzhu.isInitFilter('noZhuHp')){
game.rzhu.maxHp++;
game.rzhu.hp++;
game.rzhu.update();
if(!game.rZhu.isInitFilter('noZhuHp')){
game.rZhu.maxHp++;
game.rZhu.hp++;
game.rZhu.update();
}
if(!game.bzhu.isInitFilter('noZhuHp')){
game.bzhu.maxHp++;
game.bzhu.hp++;
game.bzhu.update();
if(!game.bZhu.isInitFilter('noZhuHp')){
game.bZhu.maxHp++;
game.bZhu.hp++;
game.bZhu.update();
}
if(!event.isZhu){
var group=game.me.identity.indexOf('r')==0?event.rZhu:event.bZhu;

View File

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

View File

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

View File

@ -1,6 +1,6 @@
{
"name": "noname-typings",
"version": "2024.01.16",
"version": "2024.02.06",
"description": "Noname typings, mainly for showing type hints when creating extensions of the Sanguosha-like game Noname.",
"repository": {
"type": "git",

View File

@ -13,9 +13,7 @@ declare interface Window {
}
/** 游戏配置 */
config: {
forbidai: string[],
}
config: SMap<any>,
/** 游戏源列表(预加载资源列表,待验证) */
noname_source_list?: string[],

View File

@ -16,7 +16,7 @@ import { Library as lib } from '../library/index.js';
import { status as _status } from '../status/index.js';
import { UI as ui } from '../ui/index.js';
import { GNC as gnc } from '../gnc/index.js';
import { userAgent, Uninstantable, GeneratorFunction, AsyncFunction, delay } from "../util/index.js";
import { userAgent, Uninstantable, GeneratorFunction, AsyncFunction, delay, nonameInitialized } from "../util/index.js";
import { DynamicStyle } from "./dynamic-style/index.js";
import { GamePromises } from "./promises.js";
@ -1901,7 +1901,7 @@ export class Game extends Uninstantable {
*/
static createDir(directory, successCallback, errorCallback) {
const paths = directory.split('/').reverse();
if (window.resolveLocalFileSystemURL) return new Promise((resolve, reject) => window.resolveLocalFileSystemURL(lib.assetURL, resolve, reject)).then(directoryEntry => {
if (window.resolveLocalFileSystemURL) return new Promise((resolve, reject) => window.resolveLocalFileSystemURL(nonameInitialized, resolve, reject)).then(directoryEntry => {
const redo = entry => new Promise((resolve, reject) => entry.getDirectory(paths.pop(), {
create: true
}, resolve, reject)).then(resolvedDirectoryEntry => {
@ -2028,7 +2028,7 @@ export class Game extends Uninstantable {
}
game.ensureDirectory(`extension/${extensionName}`).then(writeFile).catch(UHP);
}
else new Promise((resolve, reject) => window.resolveLocalFileSystemURL(lib.assetURL, resolve, reject)).then(directoryEntry => new Promise((resolve, reject) => directoryEntry.getDirectory(`extension/${extensionName}`, {
else new Promise((resolve, reject) => window.resolveLocalFileSystemURL(nonameInitialized, resolve, reject)).then(directoryEntry => new Promise((resolve, reject) => directoryEntry.getDirectory(`extension/${extensionName}`, {
create: true
}, resolve, reject))).then(directoryEntry => {
//扩展文件夹
@ -4677,9 +4677,9 @@ export class Game extends Uninstantable {
deleteFolderRecursive(`${__dirname}/extension/${extensionName}`);
}
catch (error) {
console.log(error);
console.error(error);
}
else new Promise((resolve, reject) => window.resolveLocalFileSystemURL(`${lib.assetURL}extension/${extensionName}`, resolve, reject)).then(directoryEntry => directoryEntry.removeRecursively());
else new Promise((resolve, reject) => window.resolveLocalFileSystemURL(`${nonameInitialized}extension/${extensionName}`, resolve, reject)).then(directoryEntry => directoryEntry.removeRecursively());
}
static addRecentCharacter() {
let list = get.config('recentCharacter') || [];
@ -5429,11 +5429,14 @@ export class Game extends Uninstantable {
* 但是需要事件结果的除外
*/
static executingAsyncEventMap = new Map();
/**
* @type { GameEventPromise[] }
*/
static belongAsyncEventList = [];
/**
* @param { GameEventPromise } [belongAsyncEvent]
*/
static async loop(belongAsyncEvent) {
if (!game.belongAsyncEventList) game.belongAsyncEventList = [];
if (belongAsyncEvent) {
game.belongAsyncEventList.push(belongAsyncEvent);
} else if (game.belongAsyncEventList.length) {
@ -5639,10 +5642,21 @@ export class Game extends Uninstantable {
run(event).then(() => {
// 其实这个if几乎一定执行了
if (game.executingAsyncEventMap.has(event.toEvent())) {
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
event.finish();
resolve();
}));
if (!game.executingAsyncEventMap.get(_status.event.toEvent())) {
console.warn(`game.executingAsyncEventMap中包括了event但不包括_status.event`);
console.log('event :>> ', event.toEvent());
console.log('_status.event :>> ', _status.event.toEvent());
// debugger;
game.executingAsyncEventMap.set(event.toEvent(), game.executingAsyncEventMap.get(event.toEvent()).then(() => {
event.finish();
resolve();
}));
} else {
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
event.finish();
resolve();
}));
}
} else {
event.finish();
resolve();
@ -5681,10 +5695,21 @@ export class Game extends Uninstantable {
event.content(event, trigger, player).then(() => {
// 其实这个if几乎一定执行了
if (game.executingAsyncEventMap.has(event.toEvent())) {
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
event.finish();
resolve();
}));
if (!game.executingAsyncEventMap.get(_status.event.toEvent())) {
console.warn(`game.executingAsyncEventMap中包括了event但不包括_status.event`);
console.log('event :>> ', event.toEvent());
console.log('_status.event :>> ', _status.event.toEvent());
// debugger;
game.executingAsyncEventMap.set(event.toEvent(), game.executingAsyncEventMap.get(event.toEvent()).then(() => {
event.finish();
resolve();
}));
} else {
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
event.finish();
resolve();
}));
}
} else {
event.finish();
resolve();
@ -8122,7 +8147,7 @@ export class Game extends Uninstantable {
/**
* @param { string } key
* @param { * } [value]
* @param { string } [local]
* @param { string | boolean } [local]
* @param { Function } [callback]
*/
static saveConfig(key, value, local, callback) {

View File

@ -13,7 +13,7 @@ export class GamePromises extends Uninstantable {
* (alertOption: 'alert', title: string): Promise<true>;
* }}
*
* @param { string } title 设置prompt标题与input内容
* @param { string } [title] 设置prompt标题与input内容
* @param { boolean } [forced] 为true的话将没有"取消按钮"
* @param { string } alertOption 设置prompt是否模拟alert
* @example

View File

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

View File

@ -23,7 +23,7 @@ export class Button extends HTMLDivElement {
if (typeof type == 'function') button = type(item, type, position, noClick, button);
else if (ui.create.buttonPresets[type]) button = ui.create.buttonPresets[type](item, type, position, noClick, button);
if (button) {
Object.setPrototypeOf(button, Button.prototype);
Object.setPrototypeOf(button, (lib.element.Button || Button).prototype);
if (!noClick) button.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', ui.click.button);
else {
button.classList.add('noclick');

View File

@ -21,7 +21,7 @@ export class Card extends HTMLDivElement {
*/
// @ts-ignore
const card = ui.create.div('.card', position);
Object.setPrototypeOf(card, Card.prototype);
Object.setPrototypeOf(card, (lib.element.Card || Card).prototype);
// @ts-ignore
card._args = [position];
return card;

View File

@ -6,6 +6,9 @@ import { status as _status } from '../../status/index.js';
import { UI as ui } from '../../ui/index.js';
import { GNC as gnc } from '../../gnc/index.js';
/**
* @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>)[]> }
*/
export const Contents = {
phase: [
async (event) => {

View File

@ -22,7 +22,7 @@ export class Control extends HTMLDivElement {
*/
// @ts-ignore
const control = ui.create.div('.control');
Object.setPrototypeOf(control, Control.prototype);
Object.setPrototypeOf(control, (lib.element.Control || Control).prototype);
ui.control.insertBefore(control, _status.createControl || ui.confirm);
controls.forEach(argument => {
if (argument == 'nozoom') return;

View File

@ -38,7 +38,7 @@ export class Dialog extends HTMLDivElement {
/** @type { this } */
// @ts-ignore
const dialog = ui.create.div('.dialog');
Object.setPrototypeOf(dialog, Dialog.prototype);
Object.setPrototypeOf(dialog, (lib.element.Dialog || Dialog).prototype);
dialog.contentContainer = ui.create.div('.content-container', dialog);
dialog.content = ui.create.div('.content', dialog.contentContainer);
dialog.bar1 = ui.create.div('.bar.top', dialog);

View File

@ -65,6 +65,111 @@ export class GameEvent {
static initialGameEvent() {
return new GameEvent().finish().toPromise();
}
/**
* @type { Player }
*/
// @ts-ignore
source;
/**
* @type { Player }
*/
// @ts-ignore
player;
/**
* @type { Player }
*/
// @ts-ignore
target;
/**
* @type { Player[] }
*/
// @ts-ignore
targets;
/**
* @type { Card }
*/
// @ts-ignore
card;
/**
* @type { Card[] }
*/
// @ts-ignore
cards;
/**
* @type { string }
*/
skill;
/**
* @type { boolean }
*/
forced;
/**
* @type { number }
*/
num;
/**
* @type { GameEvent }
*/
// @ts-ignore
_trigger;
/**
* @type { Result }
*/
_result;
/**
* @type { number }
*/
// @ts-ignore
baseDamage;
/**
* @type { Player }
*/
// @ts-ignore
customSource;
/**
* @type { number }
*/
// @ts-ignore
extraDamage;
/**
* @type { string }
*/
// @ts-ignore
nature;
/**
* @type { boolean }
*/
// @ts-ignore
notrigger;
/**
* @type { number }
*/
// @ts-ignore
original_num;
/**
* @type { boolean }
*/
// @ts-ignore
unreal;
/**
* @type { Button[] }
*/
// @ts-ignore
excludeButton;
/**
* @type { Result }
*/
// @ts-ignore
result;
/**
* @type { GameEventPromise | void | null }
*/
// @ts-ignore
parent;
/**
* @type { string }
*/
name;
/**
* @param {keyof this} key
* @param {number} [value]
@ -761,106 +866,4 @@ export class GameEvent {
}
return this.#promise;
}
/**
* @returns {never}
*/
typeAnnotation() {
/**
* @type { Player }
*/
// @ts-ignore
this.source;
/**
* @type { Player }
*/
// @ts-ignore
this.player;
/**
* @type { Player }
*/
// @ts-ignore
this.target;
/**
* @type { Player[] }
*/
// @ts-ignore
this.targets;
/**
* @type { Card }
*/
// @ts-ignore
this.card;
/**
* @type { Card[] }
*/
// @ts-ignore
this.cards;
/**
* @type { string }
*/
this.skill;
/**
* @type { boolean }
*/
this.forced;
/**
* @type { number }
*/
this.num;
/**
* @type { GameEvent }
*/
// @ts-ignore
this._trigger;
/**
* @type { Record<string, any> }
*/
this._result;
/**
* @type { number }
*/
// @ts-ignore
this.baseDamage;
/**
* @type { Player }
*/
// @ts-ignore
this.customSource;
/**
* @type { number }
*/
// @ts-ignore
this.extraDamage;
/**
* @type { string }
*/
// @ts-ignore
this.nature;
/**
* @type { boolean }
*/
// @ts-ignore
this.notrigger;
/**
* @type { number }
*/
// @ts-ignore
this.original_num;
/**
* @type { boolean }
*/
// @ts-ignore
this.unreal;
/**
* @type { Button[] }
*/
// @ts-ignore
this.excludeButton;
/**
* @type { Result }
*/
// @ts-ignore
this.result;
throw new Error('Do not call this method');
}
}

View File

@ -70,6 +70,7 @@ export class GameEventPromise extends Promise {
if (lib.phaseName.includes(event.name)) event.player.getHistory('skipped').add(event.name);
_status.event.next.remove(eventPromise);
event.finish();
// @ts-ignore
resolve();
return eventPromise;
}

View File

@ -23,7 +23,7 @@ export class Player extends HTMLDivElement {
*/
// @ts-ignore
const player = ui.create.div('.player', position);
Object.setPrototypeOf(player, Player.prototype);
Object.setPrototypeOf(player, (lib.element.Player || Player).prototype);
// @ts-ignore
player._args = [position];
return player;

View File

@ -1,4 +1,4 @@
import { Uninstantable } from "../util/index.js";
import { Uninstantable, nonameInitialized } from "../util/index.js";
import { Library as lib } from '../library/index.js';
import { Game as game } from "../game/index.js";
import { Get as get } from "../get/index.js";
@ -2111,7 +2111,7 @@ class Create extends Uninstantable {
if (directoryList.length) {
var dir = directoryList.shift();
var filelist = directories[dir];
window.resolveLocalFileSystemURL(lib.assetURL + dir, function (entry) {
window.resolveLocalFileSystemURL(nonameInitialized + dir, function (entry) {
var writeFile = function () {
if (filelist.length) {
var filename = filelist.shift();
@ -2202,7 +2202,7 @@ class Create extends Uninstantable {
unlink();
}
else {
window.resolveLocalFileSystemURL(lib.assetURL + page.currentpath, function (entry) {
window.resolveLocalFileSystemURL(nonameInitialized + page.currentpath, function (entry) {
var unlink = function () {
if (selected.length) {
entry.getFile(selected.shift().filename, { create: false }, function (fileEntry) {
@ -2257,7 +2257,7 @@ class Create extends Uninstantable {
}
}
else {
window.resolveLocalFileSystemURL(lib.assetURL + this.path, function (entry) {
window.resolveLocalFileSystemURL(nonameInitialized + this.path, function (entry) {
entry.removeRecursively(function () {
enterDirectory(page, page.currentpath);
});
@ -2369,7 +2369,7 @@ class Create extends Uninstantable {
lib.node.fs.mkdir(__dirname + '/' + path + '/' + str, refresh);
}
else {
window.resolveLocalFileSystemURL(lib.assetURL + path, function (entry) {
window.resolveLocalFileSystemURL(nonameInitialized + path, function (entry) {
entry.getDirectory(str, { create: true }, refresh);
});
}
@ -4327,7 +4327,7 @@ class Create extends Uninstantable {
var url = lib.assetURL + 'extension/' + name + '/' + file;
createButton(i, url);
if (lib.device == 'ios' || lib.device == 'android') {
window.resolveLocalFileSystemURL(lib.assetURL + 'extension/' + name, function (entry) {
window.resolveLocalFileSystemURL(nonameInitialized + 'extension/' + name, function (entry) {
entry.getFile(file, {}, function (fileEntry) {
fileEntry.file(function (fileToLoad) {
var fileReader = new FileReader();
@ -4863,7 +4863,7 @@ class Create extends Uninstantable {
var url = lib.assetURL + 'extension/' + name + '/' + file;
createButton(i, url, fullskin);
if (lib.device == 'ios' || lib.device == 'android') {
window.resolveLocalFileSystemURL(lib.assetURL + 'extension/' + name, function (entry) {
window.resolveLocalFileSystemURL(nonameInitialized + 'extension/' + name, function (entry) {
entry.getFile(file, {}, function (fileEntry) {
fileEntry.file(function (fileToLoad) {
var fileReader = new FileReader();

View File

@ -1,3 +1,5 @@
/** @type { string } */
// @ts-ignore
export const nonameInitialized = localStorage.getItem('noname_inited');
export const assetURL = location.protocol.startsWith('http') || typeof nonameInitialized != 'string' || nonameInitialized == 'nodejs' ? '' : nonameInitialized;
export const GeneratorFunction = (function* () {}).constructor;