kill bug & new function

This commit is contained in:
unamed 2022-02-01 23:35:24 +08:00
parent 4a801cbc85
commit 144ef9755e
6 changed files with 2657 additions and 2574 deletions

View File

@ -189,7 +189,6 @@
</div>
</div>
<!-- injection -->
<script src='libs/thirdparty/browser-polyfill.min.js'></script>
<script src='libs/thirdparty/lz-string.min.js'></script>
<script src='libs/thirdparty/priority-queue.min.js'></script>
<script src='libs/thirdparty/localforage.min.js'></script>

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

170
runtime.d.ts vendored
View File

@ -8,6 +8,8 @@ type move = 'forward' | direction
type loc = { direction: direction, x: number, y: number }
type rgbarray = [number, number, number, number]
type Events = MotaAction[] | string
type Block = {
x: number,
y: number,
@ -45,7 +47,53 @@ type Floor = {
}
type ResolvedMap = {
floorId: string
afterBattle: { [x: string]: Events }
afterOpenDoor: { [x: string]: Events }
afterGetItem: { [x: string]: Events }
autoEvent: Event
beforeBattle: { [x: string]: Events }
canFlyFrom: boolean
canFltTo: boolean
canUseQuickShop: boolean
cannotMove: Object
cannotMoveIn: Object
cannotViewMap: boolean
changeFloor: {
[x: string]: {
floorId: ':before' | ':after' | ':now' | string
loc?: [number, number]
stair?: 'upFloor' | 'downFloor' | ':symmetry' | ':symmetry_x' | ':symmetry_y' | 'flyPoint'
direction?: 'left' | 'right' | 'up' | 'down' | ':left' | ':right' | ':back' | ':hero' | ':backhero'
time?: number
ignoreChangeFloor?: boolean
}
}
defaultGround: string
bgm: string | Array<string>
bgmap: number[][]
/** 事件层 */
map: number[][]
fgmap: number[][]
width: number
height: number
images: Array<{
canvas: 'bg' | 'auto' | 'fg'
name: string
x: number
y: number
reverse?: ':x' | ':y' | ':o'
disable?: boolean
sx?: number
sy?: number
w?: number
h?: number
frame?: numer
}>
name: string
ratio: number
title: string
weather: [string, number]
}
type Enemy = {
@ -150,8 +198,42 @@ type gameStatus = {
fgmaps: { [key: string]: number[][] }
mapBlockObjs: { [key: string]: any }
/** 显伤伤害 */
checkBlock: {}
damage: {}
checkBlock: {
ambush: { [x: string]: [number, number, string, direction] }
repulse: { [x: string]: [number, number, string, direction] }
damage: { [x: string]: number }
needCache: boolean
type: { [x: string]: { [x: string]: boolean } }
cache: {
[s: string]: {
hp_buff: number
atk_buff: number
def_buff: number
guards: [number, number, string]
}
}
}
damage: {
posX: number
posY: number
data: Array<{
[x: string]: {
text: string
px: number
py: number
color: string | Array<number>
}
}>
extraData: Array<{
[x: string]: {
text: string
px: number
py: number
color: string | Array<number>
alpha: number
}
}>
}
lockControl: boolean
@ -182,13 +264,13 @@ type gameStatus = {
ctrlDown: boolean
// 路线&回放
route: [],
route: string[],
replay: {
replaying: boolean
pausing: boolean
/** 正在某段动画中 */animate: boolean
toReplay: []
totalList: []
toReplay: string[]
totalList: string[]
speed: number
steps: number
save: []
@ -197,13 +279,13 @@ type gameStatus = {
// event事件
shops: {}
event: {
id: null
data: null
selection: null
ui: null
interval: null
id: string
data: any
selection: any
ui: any
interval: number
}
autoEvents: []
autoEvents: Events
textAttribute: {
position: string
offset: number
@ -253,28 +335,6 @@ declare class control {
*/
updateStatusBar(doNotCheckAutoEvents?: boolean): void
/**
* flag
* @example core.setFlag('xyz', 2) // 设置变量xyz为2
* @param name
* @param value
*/
setFlag(name: string, value: any): void
/**
* flag
* @example core.getFlag('point', 2) // 获得变量point的值如果该变量从未定义过则返回2
* @param name
* @param defaultValue
* @returns
*/
getFlag(name: string, defaultValue: any): any
/**
* 0 core.getFlag('xyz', 0)!=0
*/
hasFlag(name: string): boolean
/** 删除某个flag/变量 */
removeFlag(name: string): void
@ -406,7 +466,7 @@ declare class control {
nearHero(x: number, y: number, n?: number): boolean
/**
*
* 使使core.updateStatusBar()
* @example core.updateDamage(); // 更新当前地图的显伤,绘制在显伤层(废话)
* @param floorId id
* @param ctx
@ -445,10 +505,10 @@ declare class control {
* @example core.getRealStatus('atk'); // 计算主角的攻击力,包括百分比修正。战斗使用的就是这个值
* @param name NaN
*/
getRealStatus(name: string): any
getRealStatus<K extends keyof HeroStatus>(name: K): HeroStatus[K]
/** 获得某个状态的名字 */
getStatusLabel(name: string): string
getStatusLabel<K extends keyof HeroStatus>(name: K): string
/**
* 1
@ -457,7 +517,7 @@ declare class control {
* @param name NaN
* @param value 1
*/
setBuff(name: string, value?: number): void
setBuff<K extends keyof HeroStatus>(name: K, value?: HeroStatus[K]): void
/**
* core.setBuff(name, core.getBuff(name) + value)
@ -465,21 +525,21 @@ declare class control {
* @param name NaN
* @param value
*/
addBuff(name: string, value: number): void
addBuff<K extends keyof HeroStatus>(name: K, value: HeroStatus[K]): void
/**
* 1
* @example core.getBuff('atk'); // 主角当前能发挥出多大比例的攻击力
* @param name
*/
getBuff(name: string): number
getBuff<K extends keyof HeroStatus>(name: HeroStatus[K]): number
/**
*
* @param action 'get''remove'
* @param type
*/
triggerDebuff(action: string, type: string|string[]): void
triggerDebuff(action: string, type: string | string[]): void
/**
*
@ -516,7 +576,7 @@ declare class control {
*
* null
*/
getNextLvUpNeed() : number
getNextLvUpNeed(): number
/**
* flag变量
@ -556,13 +616,13 @@ declare class control {
* @param type
* @param level 105
*/
setWeather(type?: 'rain' | 'snow' | 'sun' | 'fog' | 'cloud', level?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10): void
setWeather(type?: 'rain' | 'snow' | 'sun' | 'fog' | 'cloud' | string, level?: 1 | 2 | 3 | 4 | 5 | 6 | 7 | 8 | 9 | 10): void
/** 注册一个天气 */
registerWeather(name: string, initFunc: (level: number) => void, frameFunc?: (timestamp: number, level: number) => void): void
/** 注销一个天气 */
unregisterWeather(name: string) : void;
unregisterWeather(name: string): void;
/**
* 使core.events._action_setCurtain()
@ -581,7 +641,7 @@ declare class control {
* @param times 01
* @param callback
*/
screenFlash(color: [number, number, number, number], time: number, times?: number, moveMode?: string, callback?: () => void): void
screenFlash(color: [number, number, number, number?], time: number, times?: number, moveMode?: string, callback?: () => void): void
/**
* flags.__bgm__
@ -910,7 +970,7 @@ declare class events {
* @param callback
* @param addToLast true表示插入到末尾
*/
insertAction(action: string | MotaAction | MotaAction[], x?: number, y?: number, callback?: () => void, addToLast?: boolean): void
insertAction(action: Events, x?: number, y?: number, callback?: () => void, addToLast?: boolean): void
/**
*
@ -1072,7 +1132,7 @@ declare class events {
tryUseItem(itemId: string): void
/** 初始化游戏 */
resetGame(hero?: any, hard?: any, floorId?: string, maps?: any, values?: any): void
resetGame(hero?: HeroStatus, hard?: any, floorId?: string, maps?: any, values?: any): void
/** 游戏获胜事件 */
win(reason?: string, norank?: boolean, noexit?: boolean): void
@ -1641,7 +1701,7 @@ declare class maps {
* @param showDisable true表示计入
* @returns
*/
searchBlock(id: string, floorId?: string|Array<string>, showDisable?: boolean): Array<{ floorId: string, index: number, x: number, y: number, block: Block }>
searchBlock(id: string, floorId?: string | Array<string>, showDisable?: boolean): Array<{ floorId: string, index: number, x: number, y: number, block: Block }>
/**
*
@ -1651,7 +1711,7 @@ declare class maps {
* @param showDisable true表示计入
* @returns
*/
searchBlockWithFilter(blockFilter: (Block) => boolean, floorId?: string|Array<string>, showDisable?: boolean): Array<{ floorId: string, index: number, x: number, y: number, block: Block }>
searchBlockWithFilter(blockFilter: (Block) => boolean, floorId?: string | Array<string>, showDisable?: boolean): Array<{ floorId: string, index: number, x: number, y: number, block: Block }>
/**
* /
@ -1784,7 +1844,7 @@ declare class maps {
stopAnimate(id?: number, doCallback?: boolean): void
/** 获得当前正在播放的所有指定动画的id列表 */
getPlayingAnimates(name?: string) : Array<number>
getPlayingAnimates(name?: string): Array<number>
/** 加载某个楼层(从剧本或存档中) */
loadFloor(floorId?: string, map?: any): any
@ -1910,7 +1970,7 @@ declare class maps {
/** @file loader.js 主要负责资源的加载 */
declare class loader {
/** 加载一系列图片 */
loadImages(dir: any, names: any, toSave: any, callback?: () => any) : any
loadImages(dir: any, names: any, toSave: any, callback?: () => any): any
/** 加载某一张图片 */
loadImage(dir: any, imgName?: any, callback?: () => any): any
@ -2055,7 +2115,7 @@ declare class items {
* @param beComparedEquipId id
* @returns 0
*/
compareEquipment(compareEquipId: string, beComparedEquipId: string): { [key: string]: number}
compareEquipment(compareEquipId: string, beComparedEquipId: string): { [key: string]: number }
/**
*
@ -2090,7 +2150,7 @@ declare class items {
* @param operator +=
* @param prefix
*/
setEquip(equipId: string, valueType: string, name: string, value: any, operator?: string, prefix?: string): void
setEquip(equipId: string, valueType: string, name: string, value: any, operator?: string, prefix?: string): void
}
/** @file ui.js 主要用来进行UI窗口的绘制如对话框、怪物手册、楼传器、存读档界面等等。*/
@ -2246,7 +2306,7 @@ declare class ui {
drawUIEventSelector(code: number, background: string, x: number, y: number, w: number, h: number, z?: number): void
/** 清除一个或多个选择光标 */
clearUIEventSelector(code: number|number[]): void
clearUIEventSelector(code: number | number[]): void
/** 绘制一个确认框 */
drawConfirmBox(text: string, yesCallback?: () => void, noCallback?: () => void): void
@ -2412,7 +2472,7 @@ declare class utils {
clone<T>(data?: T, filter?: (name: string, value: any) => boolean, recursion?: boolean): T
/** 深拷贝一个1D或2D的数组 */
cloneArray(data?: Array<number>|Array<Array<number>>): Array<number>|Array<Array<number>>
cloneArray(data?: Array<number> | Array<Array<number>>): Array<number> | Array<Array<number>>
/**
*