Merge pull request #921 from nonameShijian/PR-Branch
修改本体中的window.resolveLocalFileSystemURL调用, 修改本体中的lib.element.xxx初始化的原型指向, 为runContent增加一处保底, 类型修复
This commit is contained in:
commit
056228c581
|
@ -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){
|
||||||
|
|
|
@ -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;
|
||||||
|
|
|
@ -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'
|
||||||
|
|
|
@ -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:{
|
||||||
|
|
|
@ -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:{
|
||||||
|
|
|
@ -213,6 +213,7 @@ game.import('character',function(lib,game,ui,get,ai,_status){
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
/** @type { importCharacterConfig['skill'] } */
|
||||||
skill:{
|
skill:{
|
||||||
qingshu:{
|
qingshu:{
|
||||||
ai:{
|
ai:{
|
||||||
|
|
|
@ -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'},
|
||||||
|
|
|
@ -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'},
|
||||||
|
|
|
@ -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,
|
||||||
|
|
|
@ -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[];
|
||||||
|
|
|
@ -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 {
|
||||||
*
|
*
|
||||||
* 取值false(因为undefined != false结果为true,故默认不填和true效果一致)
|
* 取值false(因为undefined != false结果为true,故默认不填和true效果一致)
|
||||||
*/
|
*/
|
||||||
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将会无法判断其身份
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
{
|
{
|
||||||
"name": "noname-typings",
|
"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.",
|
"description": "Noname typings, mainly for showing type hints when creating extensions of the Sanguosha-like game Noname.",
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
|
|
@ -13,9 +13,7 @@ declare interface Window {
|
||||||
}
|
}
|
||||||
|
|
||||||
/** 游戏配置 */
|
/** 游戏配置 */
|
||||||
config: {
|
config: SMap<any>,
|
||||||
forbidai: string[],
|
|
||||||
}
|
|
||||||
|
|
||||||
/** 游戏源列表(预加载资源列表,待验证) */
|
/** 游戏源列表(预加载资源列表,待验证) */
|
||||||
noname_source_list?: string[],
|
noname_source_list?: string[],
|
||||||
|
|
|
@ -16,7 +16,7 @@ import { Library as lib } from '../library/index.js';
|
||||||
import { status as _status } from '../status/index.js';
|
import { status as _status } from '../status/index.js';
|
||||||
import { UI as ui } from '../ui/index.js';
|
import { UI as ui } from '../ui/index.js';
|
||||||
import { GNC as gnc } from '../gnc/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 { DynamicStyle } from "./dynamic-style/index.js";
|
||||||
import { GamePromises } from "./promises.js";
|
import { GamePromises } from "./promises.js";
|
||||||
|
@ -1901,7 +1901,7 @@ export class Game extends Uninstantable {
|
||||||
*/
|
*/
|
||||||
static createDir(directory, successCallback, errorCallback) {
|
static createDir(directory, successCallback, errorCallback) {
|
||||||
const paths = directory.split('/').reverse();
|
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(), {
|
const redo = entry => new Promise((resolve, reject) => entry.getDirectory(paths.pop(), {
|
||||||
create: true
|
create: true
|
||||||
}, resolve, reject)).then(resolvedDirectoryEntry => {
|
}, resolve, reject)).then(resolvedDirectoryEntry => {
|
||||||
|
@ -2028,7 +2028,7 @@ export class Game extends Uninstantable {
|
||||||
}
|
}
|
||||||
game.ensureDirectory(`extension/${extensionName}`).then(writeFile).catch(UHP);
|
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
|
create: true
|
||||||
}, resolve, reject))).then(directoryEntry => {
|
}, resolve, reject))).then(directoryEntry => {
|
||||||
//扩展文件夹
|
//扩展文件夹
|
||||||
|
@ -4677,9 +4677,9 @@ export class Game extends Uninstantable {
|
||||||
deleteFolderRecursive(`${__dirname}/extension/${extensionName}`);
|
deleteFolderRecursive(`${__dirname}/extension/${extensionName}`);
|
||||||
}
|
}
|
||||||
catch (error) {
|
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() {
|
static addRecentCharacter() {
|
||||||
let list = get.config('recentCharacter') || [];
|
let list = get.config('recentCharacter') || [];
|
||||||
|
@ -5429,11 +5429,14 @@ export class Game extends Uninstantable {
|
||||||
* 但是需要事件结果的除外
|
* 但是需要事件结果的除外
|
||||||
*/
|
*/
|
||||||
static executingAsyncEventMap = new Map();
|
static executingAsyncEventMap = new Map();
|
||||||
|
/**
|
||||||
|
* @type { GameEventPromise[] }
|
||||||
|
*/
|
||||||
|
static belongAsyncEventList = [];
|
||||||
/**
|
/**
|
||||||
* @param { GameEventPromise } [belongAsyncEvent]
|
* @param { GameEventPromise } [belongAsyncEvent]
|
||||||
*/
|
*/
|
||||||
static async loop(belongAsyncEvent) {
|
static async loop(belongAsyncEvent) {
|
||||||
if (!game.belongAsyncEventList) game.belongAsyncEventList = [];
|
|
||||||
if (belongAsyncEvent) {
|
if (belongAsyncEvent) {
|
||||||
game.belongAsyncEventList.push(belongAsyncEvent);
|
game.belongAsyncEventList.push(belongAsyncEvent);
|
||||||
} else if (game.belongAsyncEventList.length) {
|
} else if (game.belongAsyncEventList.length) {
|
||||||
|
@ -5639,10 +5642,21 @@ export class Game extends Uninstantable {
|
||||||
run(event).then(() => {
|
run(event).then(() => {
|
||||||
// 其实这个if几乎一定执行了
|
// 其实这个if几乎一定执行了
|
||||||
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
||||||
|
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(() => {
|
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
|
||||||
event.finish();
|
event.finish();
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
event.finish();
|
event.finish();
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -5681,10 +5695,21 @@ export class Game extends Uninstantable {
|
||||||
event.content(event, trigger, player).then(() => {
|
event.content(event, trigger, player).then(() => {
|
||||||
// 其实这个if几乎一定执行了
|
// 其实这个if几乎一定执行了
|
||||||
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
if (game.executingAsyncEventMap.has(event.toEvent())) {
|
||||||
|
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(() => {
|
game.executingAsyncEventMap.set(_status.event.toEvent(), game.executingAsyncEventMap.get(_status.event.toEvent()).then(() => {
|
||||||
event.finish();
|
event.finish();
|
||||||
resolve();
|
resolve();
|
||||||
}));
|
}));
|
||||||
|
}
|
||||||
} else {
|
} else {
|
||||||
event.finish();
|
event.finish();
|
||||||
resolve();
|
resolve();
|
||||||
|
@ -8122,7 +8147,7 @@ export class Game extends Uninstantable {
|
||||||
/**
|
/**
|
||||||
* @param { string } key
|
* @param { string } key
|
||||||
* @param { * } [value]
|
* @param { * } [value]
|
||||||
* @param { string } [local]
|
* @param { string | boolean } [local]
|
||||||
* @param { Function } [callback]
|
* @param { Function } [callback]
|
||||||
*/
|
*/
|
||||||
static saveConfig(key, value, local, callback) {
|
static saveConfig(key, value, local, callback) {
|
||||||
|
|
|
@ -13,7 +13,7 @@ export class GamePromises extends Uninstantable {
|
||||||
* (alertOption: 'alert', title: string): Promise<true>;
|
* (alertOption: 'alert', title: string): Promise<true>;
|
||||||
* }}
|
* }}
|
||||||
*
|
*
|
||||||
* @param { string } title 设置prompt标题与input内容
|
* @param { string } [title] 设置prompt标题与input内容
|
||||||
* @param { boolean } [forced] 为true的话将没有"取消按钮"
|
* @param { boolean } [forced] 为true的话将没有"取消按钮"
|
||||||
* @param { string } alertOption 设置prompt是否模拟alert
|
* @param { string } alertOption 设置prompt是否模拟alert
|
||||||
* @example
|
* @example
|
||||||
|
|
|
@ -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);
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class Button extends HTMLDivElement {
|
||||||
if (typeof type == 'function') button = type(item, type, position, noClick, button);
|
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);
|
else if (ui.create.buttonPresets[type]) button = ui.create.buttonPresets[type](item, type, position, noClick, button);
|
||||||
if (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);
|
if (!noClick) button.addEventListener(lib.config.touchscreen ? 'touchend' : 'click', ui.click.button);
|
||||||
else {
|
else {
|
||||||
button.classList.add('noclick');
|
button.classList.add('noclick');
|
||||||
|
|
|
@ -21,7 +21,7 @@ export class Card extends HTMLDivElement {
|
||||||
*/
|
*/
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const card = ui.create.div('.card', position);
|
const card = ui.create.div('.card', position);
|
||||||
Object.setPrototypeOf(card, Card.prototype);
|
Object.setPrototypeOf(card, (lib.element.Card || Card).prototype);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
card._args = [position];
|
card._args = [position];
|
||||||
return card;
|
return card;
|
||||||
|
|
|
@ -6,6 +6,9 @@ import { status as _status } from '../../status/index.js';
|
||||||
import { UI as ui } from '../../ui/index.js';
|
import { UI as ui } from '../../ui/index.js';
|
||||||
import { GNC as gnc } from '../../gnc/index.js';
|
import { GNC as gnc } from '../../gnc/index.js';
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @type { SMap<((event: GameEventPromise, trigger: GameEventPromise, player: Player) => Promise<any>)[]> }
|
||||||
|
*/
|
||||||
export const Contents = {
|
export const Contents = {
|
||||||
phase: [
|
phase: [
|
||||||
async (event) => {
|
async (event) => {
|
||||||
|
|
|
@ -22,7 +22,7 @@ export class Control extends HTMLDivElement {
|
||||||
*/
|
*/
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const control = ui.create.div('.control');
|
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);
|
ui.control.insertBefore(control, _status.createControl || ui.confirm);
|
||||||
controls.forEach(argument => {
|
controls.forEach(argument => {
|
||||||
if (argument == 'nozoom') return;
|
if (argument == 'nozoom') return;
|
||||||
|
|
|
@ -38,7 +38,7 @@ export class Dialog extends HTMLDivElement {
|
||||||
/** @type { this } */
|
/** @type { this } */
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const dialog = ui.create.div('.dialog');
|
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.contentContainer = ui.create.div('.content-container', dialog);
|
||||||
dialog.content = ui.create.div('.content', dialog.contentContainer);
|
dialog.content = ui.create.div('.content', dialog.contentContainer);
|
||||||
dialog.bar1 = ui.create.div('.bar.top', dialog);
|
dialog.bar1 = ui.create.div('.bar.top', dialog);
|
||||||
|
|
|
@ -65,6 +65,111 @@ export class GameEvent {
|
||||||
static initialGameEvent() {
|
static initialGameEvent() {
|
||||||
return new GameEvent().finish().toPromise();
|
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 {keyof this} key
|
||||||
* @param {number} [value]
|
* @param {number} [value]
|
||||||
|
@ -761,106 +866,4 @@ export class GameEvent {
|
||||||
}
|
}
|
||||||
return this.#promise;
|
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');
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -70,6 +70,7 @@ export class GameEventPromise extends Promise {
|
||||||
if (lib.phaseName.includes(event.name)) event.player.getHistory('skipped').add(event.name);
|
if (lib.phaseName.includes(event.name)) event.player.getHistory('skipped').add(event.name);
|
||||||
_status.event.next.remove(eventPromise);
|
_status.event.next.remove(eventPromise);
|
||||||
event.finish();
|
event.finish();
|
||||||
|
// @ts-ignore
|
||||||
resolve();
|
resolve();
|
||||||
return eventPromise;
|
return eventPromise;
|
||||||
}
|
}
|
||||||
|
|
|
@ -23,7 +23,7 @@ export class Player extends HTMLDivElement {
|
||||||
*/
|
*/
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
const player = ui.create.div('.player', position);
|
const player = ui.create.div('.player', position);
|
||||||
Object.setPrototypeOf(player, Player.prototype);
|
Object.setPrototypeOf(player, (lib.element.Player || Player).prototype);
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
player._args = [position];
|
player._args = [position];
|
||||||
return player;
|
return player;
|
||||||
|
|
|
@ -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 { Library as lib } from '../library/index.js';
|
||||||
import { Game as game } from "../game/index.js";
|
import { Game as game } from "../game/index.js";
|
||||||
import { Get as get } from "../get/index.js";
|
import { Get as get } from "../get/index.js";
|
||||||
|
@ -2111,7 +2111,7 @@ class Create extends Uninstantable {
|
||||||
if (directoryList.length) {
|
if (directoryList.length) {
|
||||||
var dir = directoryList.shift();
|
var dir = directoryList.shift();
|
||||||
var filelist = directories[dir];
|
var filelist = directories[dir];
|
||||||
window.resolveLocalFileSystemURL(lib.assetURL + dir, function (entry) {
|
window.resolveLocalFileSystemURL(nonameInitialized + dir, function (entry) {
|
||||||
var writeFile = function () {
|
var writeFile = function () {
|
||||||
if (filelist.length) {
|
if (filelist.length) {
|
||||||
var filename = filelist.shift();
|
var filename = filelist.shift();
|
||||||
|
@ -2202,7 +2202,7 @@ class Create extends Uninstantable {
|
||||||
unlink();
|
unlink();
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.resolveLocalFileSystemURL(lib.assetURL + page.currentpath, function (entry) {
|
window.resolveLocalFileSystemURL(nonameInitialized + page.currentpath, function (entry) {
|
||||||
var unlink = function () {
|
var unlink = function () {
|
||||||
if (selected.length) {
|
if (selected.length) {
|
||||||
entry.getFile(selected.shift().filename, { create: false }, function (fileEntry) {
|
entry.getFile(selected.shift().filename, { create: false }, function (fileEntry) {
|
||||||
|
@ -2257,7 +2257,7 @@ class Create extends Uninstantable {
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.resolveLocalFileSystemURL(lib.assetURL + this.path, function (entry) {
|
window.resolveLocalFileSystemURL(nonameInitialized + this.path, function (entry) {
|
||||||
entry.removeRecursively(function () {
|
entry.removeRecursively(function () {
|
||||||
enterDirectory(page, page.currentpath);
|
enterDirectory(page, page.currentpath);
|
||||||
});
|
});
|
||||||
|
@ -2369,7 +2369,7 @@ class Create extends Uninstantable {
|
||||||
lib.node.fs.mkdir(__dirname + '/' + path + '/' + str, refresh);
|
lib.node.fs.mkdir(__dirname + '/' + path + '/' + str, refresh);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
window.resolveLocalFileSystemURL(lib.assetURL + path, function (entry) {
|
window.resolveLocalFileSystemURL(nonameInitialized + path, function (entry) {
|
||||||
entry.getDirectory(str, { create: true }, refresh);
|
entry.getDirectory(str, { create: true }, refresh);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
@ -4327,7 +4327,7 @@ class Create extends Uninstantable {
|
||||||
var url = lib.assetURL + 'extension/' + name + '/' + file;
|
var url = lib.assetURL + 'extension/' + name + '/' + file;
|
||||||
createButton(i, url);
|
createButton(i, url);
|
||||||
if (lib.device == 'ios' || lib.device == 'android') {
|
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) {
|
entry.getFile(file, {}, function (fileEntry) {
|
||||||
fileEntry.file(function (fileToLoad) {
|
fileEntry.file(function (fileToLoad) {
|
||||||
var fileReader = new FileReader();
|
var fileReader = new FileReader();
|
||||||
|
@ -4863,7 +4863,7 @@ class Create extends Uninstantable {
|
||||||
var url = lib.assetURL + 'extension/' + name + '/' + file;
|
var url = lib.assetURL + 'extension/' + name + '/' + file;
|
||||||
createButton(i, url, fullskin);
|
createButton(i, url, fullskin);
|
||||||
if (lib.device == 'ios' || lib.device == 'android') {
|
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) {
|
entry.getFile(file, {}, function (fileEntry) {
|
||||||
fileEntry.file(function (fileToLoad) {
|
fileEntry.file(function (fileToLoad) {
|
||||||
var fileReader = new FileReader();
|
var fileReader = new FileReader();
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
/** @type { string } */
|
||||||
|
// @ts-ignore
|
||||||
export const nonameInitialized = localStorage.getItem('noname_inited');
|
export const nonameInitialized = localStorage.getItem('noname_inited');
|
||||||
export const assetURL = location.protocol.startsWith('http') || typeof nonameInitialized != 'string' || nonameInitialized == 'nodejs' ? '' : nonameInitialized;
|
export const assetURL = location.protocol.startsWith('http') || typeof nonameInitialized != 'string' || nonameInitialized == 'nodejs' ? '' : nonameInitialized;
|
||||||
export const GeneratorFunction = (function* () {}).constructor;
|
export const GeneratorFunction = (function* () {}).constructor;
|
||||||
|
|
Loading…
Reference in New Issue