mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-09 06:14:30 +08:00
完善装备栏、怪物手册,更新样板
This commit is contained in:
1 parent
bde0a4d1c0
commit
2f88272df8
37 files changed
+10569
-2558
No files matched your search
Vendored
+126
-63
@@ -1,74 +1,137 @@
|
||||
/** @file actions.js 定义了玩家的操作控制 */
|
||||
declare class actions {
|
||||
/**
|
||||
* 鼠标与触屏操作的函数
|
||||
*/
|
||||
type MotaMouseFunc = (x: number, y: number, px: number, py: number) => boolean;
|
||||
|
||||
/**
|
||||
* 按键操作的函数
|
||||
*/
|
||||
type MotaKeyboardFunc = (e: KeyboardEvent) => boolean;
|
||||
|
||||
/**
|
||||
* 没有最乱,只有更乱
|
||||
*/
|
||||
interface RegisteredActionMap {
|
||||
keyDown: (keyCode: number) => boolean;
|
||||
keyDownCtrl: () => boolean;
|
||||
keyUp: (keyCode: number, altKey: boolean, fromReplay: boolean) => boolean;
|
||||
longClick: MotaMouseFunc;
|
||||
onStatusBarClick: (px: number, py: number, vertical: boolean) => boolean;
|
||||
ondown: MotaMouseFunc;
|
||||
onkeyDown: MotaKeyboardFunc;
|
||||
onkeyUp: MotaKeyboardFunc;
|
||||
onmousewheel: (direct: 1 | -1) => boolean;
|
||||
onmove: MotaMouseFunc;
|
||||
onup: MotaMouseFunc;
|
||||
pressKey: (keyCode: number) => boolean;
|
||||
}
|
||||
|
||||
type ActionKey = keyof RegisteredActionMap;
|
||||
|
||||
/**
|
||||
* 将注册的函数的返回值变成void就变成了actions上的函数...
|
||||
*/
|
||||
type VoidedActionFuncs = {
|
||||
[P in ActionKey]: (...params: Parameters<RegisteredActionMap[P]>) => void;
|
||||
};
|
||||
|
||||
/**
|
||||
* 点击位置
|
||||
*/
|
||||
interface ClickLoc extends Loc {
|
||||
/**
|
||||
* 格子的大小(这不是32还能是其它的吗??
|
||||
*/
|
||||
size: 32;
|
||||
}
|
||||
|
||||
interface RegisteredActionOf<K extends ActionKey> {
|
||||
/**
|
||||
* 交互的类型
|
||||
*/
|
||||
action: K;
|
||||
|
||||
/**
|
||||
* 交互的唯一标识符
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* 优先级,越高越优先执行
|
||||
*/
|
||||
priority: number;
|
||||
|
||||
/**
|
||||
* 交互函数
|
||||
*/
|
||||
func: RegisteredActionMap[K];
|
||||
}
|
||||
|
||||
/**
|
||||
* 交互模块
|
||||
*/
|
||||
interface Actions extends VoidedActionFuncs {
|
||||
/**
|
||||
* 横向的最后一个格子的横坐标
|
||||
*/
|
||||
readonly LAST: number;
|
||||
|
||||
/**
|
||||
* 格子长度的一半
|
||||
*/
|
||||
readonly _HX_: number;
|
||||
|
||||
/**
|
||||
* 格子高度的一半
|
||||
*/
|
||||
readonly _HY_: number;
|
||||
|
||||
/**
|
||||
* 脚本编辑中的交互函数
|
||||
*/
|
||||
readonly actionsdata: ActionData;
|
||||
|
||||
/**
|
||||
* 所有已注册的交互操作
|
||||
*/
|
||||
readonly actions: {
|
||||
[P in ActionKey]: RegisteredActionOf<P>[];
|
||||
};
|
||||
|
||||
/**
|
||||
* 此函数将注册一个用户交互行为。
|
||||
* @param action 要注册的交互类型,如 ondown, onclick, keyDown 等等。
|
||||
* @param name 你的自定义名称,可被注销使用;同名重复注册将后者覆盖前者。
|
||||
* @param func 执行函数。
|
||||
* 如果func返回true,则不会再继续执行其他的交互函数;否则会继续执行其他的交互函数。
|
||||
* @param priority 优先级;优先级高的将会被执行。此项可不填,默认为0
|
||||
* @param action 要注册的交互类型
|
||||
* @param name 自定义名称,可被注销使用
|
||||
* @param func 执行函数,如果func返回true,则不会再继续执行其他的交互函数
|
||||
* @param priority 优先级,优先级高的将会被执行。此项可不填,默认为0
|
||||
*/
|
||||
registerAction(
|
||||
action: string,
|
||||
registerAction<K extends ActionKey>(
|
||||
action: K,
|
||||
name: string,
|
||||
func: string | ((...params: any) => void),
|
||||
func: RegisteredActionMap[K],
|
||||
priority?: number
|
||||
): void;
|
||||
|
||||
/** 注销一个用户交互行为 */
|
||||
unregisterAction(action: string, name: string): void;
|
||||
/**
|
||||
* 注销一个用户交互行为
|
||||
* @param action 要注销的交互类型
|
||||
* @param name 要注销的自定义名称
|
||||
*/
|
||||
unregisterAction(action: ActionKey, name: string): void;
|
||||
|
||||
/** 执行一个用户交互行为 */
|
||||
doRegisteredAction(action: string, ...params: any): void;
|
||||
|
||||
/** 按下某个键时 */
|
||||
onkeyDown(e: KeyboardEvent): void;
|
||||
|
||||
/** 放开某个键时 */
|
||||
onkeyUp(e: KeyboardEvent): void;
|
||||
|
||||
/** 按住某个键时 */
|
||||
pressKey(keyCode: number): void;
|
||||
|
||||
/** 根据按下键的code来执行一系列操作 */
|
||||
keyDown(keyCode: number): void;
|
||||
|
||||
/** 根据放开键的code来执行一系列操作 */
|
||||
keyUp(keyCode: number, altKey?: boolean, fromReplay?: boolean): void;
|
||||
|
||||
/** 点击(触摸)事件按下时 */
|
||||
ondown(loc: number[]): void;
|
||||
|
||||
/** 当在触摸屏上滑动时 */
|
||||
onmove(loc: number[]): void;
|
||||
|
||||
/** 当点击(触摸)事件放开时 */
|
||||
onup(loc: number[]): void;
|
||||
|
||||
/** 具体点击屏幕上(x,y)点时,执行的操作 */
|
||||
onclick(
|
||||
x: number,
|
||||
y: number,
|
||||
px: number,
|
||||
py: number,
|
||||
stepPostfix?: any
|
||||
/**
|
||||
* 执行一个用户交互行为
|
||||
*/
|
||||
doRegisteredAction<K extends ActionKey>(
|
||||
action: K,
|
||||
...params: Parameters<RegisteredActionMap[K]>
|
||||
): void;
|
||||
|
||||
/** 滑动鼠标滚轮时的操作 */
|
||||
onmousewheel(direct: 1 | -1): void;
|
||||
|
||||
/** 长按Ctrl键时 */
|
||||
keyDownCtrl(): void;
|
||||
|
||||
/** 长按 */
|
||||
longClick(
|
||||
x: number,
|
||||
y: number,
|
||||
px: number,
|
||||
py: number,
|
||||
fromEvent?: boolean
|
||||
): void;
|
||||
|
||||
/** 点击自绘状态栏时 */
|
||||
onStatusBarClick(e?: MouseEvent): void;
|
||||
/**
|
||||
* 判断一个横坐标是否在(_HX_ - 2, _HX_ + 2)范围外
|
||||
* @param x 要判断的横坐标
|
||||
*/
|
||||
_out(x: number): boolean;
|
||||
}
|
||||
|
||||
declare const actions: new () => Actions;
|
||||
Vendored
+826
-353
File diff suppressed because it is too large.
Load diff
Vendored
+1412
-303
File diff suppressed because it is too large.
Load diff
Vendored
+140
@@ -0,0 +1,140 @@
|
||||
interface MainData {
|
||||
/**
|
||||
* 所有的楼层id
|
||||
*/
|
||||
readonly floorIds: FloorIds[];
|
||||
|
||||
/**
|
||||
* 分区指定
|
||||
*/
|
||||
readonly floorPatitions: [FloorIds, FloorIds?][];
|
||||
|
||||
/**
|
||||
* 所有的额外素材
|
||||
*/
|
||||
readonly tilesets: string[];
|
||||
|
||||
/**
|
||||
* 所有的动画
|
||||
*/
|
||||
readonly animates: AnimationIds[];
|
||||
|
||||
/**
|
||||
* 所有的bgm
|
||||
*/
|
||||
readonly bgms: BgmIds[];
|
||||
|
||||
/**
|
||||
* 所有的音效
|
||||
*/
|
||||
readonly sounds: SoundIds[];
|
||||
|
||||
/**
|
||||
* 所有的字体
|
||||
*/
|
||||
readonly fonts: FontIds[];
|
||||
|
||||
/**
|
||||
* 文件别名
|
||||
*/
|
||||
readonly nameMap: NameMap;
|
||||
|
||||
/**
|
||||
* 难度选择
|
||||
*/
|
||||
readonly levelChoose: LevelChooseEvent[];
|
||||
|
||||
/**
|
||||
* 装备孔的名称
|
||||
*/
|
||||
readonly equipName: string[];
|
||||
|
||||
/**
|
||||
* 初始界面的bgm
|
||||
*/
|
||||
readonly startBgm: BgmIds;
|
||||
|
||||
/**
|
||||
* 主样式
|
||||
*/
|
||||
readonly styles: MainStyle;
|
||||
|
||||
/**
|
||||
* 图片切分信息
|
||||
*/
|
||||
readonly splitImages: SplitImageData;
|
||||
}
|
||||
|
||||
interface FirstData {
|
||||
/**
|
||||
* 游戏标题
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* 游戏英文名,应当与mota.config.ts中的一致
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* 游戏版本
|
||||
*/
|
||||
version: string;
|
||||
|
||||
/**
|
||||
* 初始地图
|
||||
*/
|
||||
floorId: FloorIds;
|
||||
|
||||
/**
|
||||
* 勇士的初始信息
|
||||
*/
|
||||
hero: HeroStatus;
|
||||
|
||||
/**
|
||||
* 标题界面事件化
|
||||
*/
|
||||
startCanvas: MotaEvent;
|
||||
|
||||
/**
|
||||
* 初始剧情
|
||||
*/
|
||||
startText: MotaEvent;
|
||||
|
||||
/**
|
||||
* 全局商店信息
|
||||
*/
|
||||
shops: ShopEventOf<keyof ShopEventMap>[];
|
||||
|
||||
/**
|
||||
* 升级事件
|
||||
*/
|
||||
levelUp: LevelUpEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 全塔属性信息
|
||||
*/
|
||||
interface DataCore {
|
||||
/**
|
||||
* 全塔属性的main信息
|
||||
*/
|
||||
readonly main: MainData;
|
||||
|
||||
/**
|
||||
* 初始化信息
|
||||
*/
|
||||
readonly firstData: FirstData;
|
||||
|
||||
/**
|
||||
* 全局数值
|
||||
*/
|
||||
readonly values: CoreValues;
|
||||
|
||||
/**
|
||||
* 全局变量
|
||||
*/
|
||||
readonly flags: CoreFlags;
|
||||
}
|
||||
|
||||
declare const data: new () => Omit<DataCore, 'main'>;
|
||||
Vendored
+313
-125
@@ -1,16 +1,242 @@
|
||||
/** @file enemys.js 定义了一系列和敌人相关的API函数。 */
|
||||
declare class enemys {
|
||||
type PartialNumbericEnemyProperty =
|
||||
| 'value'
|
||||
| 'zone'
|
||||
| 'repulse'
|
||||
| 'laser'
|
||||
| 'breakArmor'
|
||||
| 'counterAttack'
|
||||
| 'vampire'
|
||||
| 'hpBuff'
|
||||
| 'atkBuff'
|
||||
| 'defBuff'
|
||||
| 'range'
|
||||
| 'haloRange'
|
||||
| 'n'
|
||||
| 'purify'
|
||||
| 'atkValue'
|
||||
| 'defValue'
|
||||
| 'damage';
|
||||
|
||||
type BooleanEnemyProperty =
|
||||
| 'zoneSquare'
|
||||
| 'haloSquare'
|
||||
| 'notBomb'
|
||||
| 'add'
|
||||
| 'haloAdd';
|
||||
|
||||
type DetailedEnemy<I extends EnemyIds = EnemyIds> = {
|
||||
specialText: string[];
|
||||
toShowSpecial: string[];
|
||||
toShowColor: Color[];
|
||||
specialColor: Color[];
|
||||
damageColor: Color;
|
||||
} & Enemy<I>;
|
||||
|
||||
type Enemy<I extends EnemyIds = EnemyIds> = {
|
||||
/**
|
||||
* 判定某种特殊属性的有无
|
||||
* @example core.hasSpecial('greenSlime', 1) // 判定绿头怪有无先攻属性
|
||||
* @param special 敌人id或敌人对象或正整数数组或自然数
|
||||
* @param test 待检查的属性编号
|
||||
* @returns 若special为数组或数且含有test或相等、或special为敌人id或对象且具有此属性,则返回true
|
||||
* 怪物id
|
||||
*/
|
||||
hasSpecial(
|
||||
special: number | number[] | string | Enemy,
|
||||
test: number
|
||||
): boolean;
|
||||
id: I;
|
||||
|
||||
/**
|
||||
* 怪物名称
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* 在怪物手册中映射到的怪物ID。如果此项不为null,则在怪物手册中,将用目标ID来替换该怪物原本的ID。
|
||||
* 常被运用在同一个怪物的多朝向上
|
||||
*/
|
||||
displayIdInBook: EnemyIds;
|
||||
|
||||
/**
|
||||
* 战前事件
|
||||
*/
|
||||
beforeBattle: MotaEvent;
|
||||
|
||||
/**
|
||||
* 战后事件
|
||||
*/
|
||||
afterBattle: MotaEvent;
|
||||
} & {
|
||||
[P in PartialNumbericEnemyProperty]?: number;
|
||||
} & {
|
||||
[P in BooleanEnemyProperty]: boolean;
|
||||
} & EnemyInfoBase;
|
||||
|
||||
/**
|
||||
* 怪物的特殊属性定义
|
||||
*/
|
||||
type EnemySpecialDeclaration = [
|
||||
id: number,
|
||||
name: string | ((enemy: Enemy) => string),
|
||||
desc: string | ((enemy: Enemy) => string),
|
||||
color: Color,
|
||||
extra?: number
|
||||
];
|
||||
|
||||
interface DamageString {
|
||||
/**
|
||||
* 伤害字符串
|
||||
*/
|
||||
damage: string;
|
||||
|
||||
/**
|
||||
* 伤害颜色
|
||||
*/
|
||||
color: Color;
|
||||
}
|
||||
|
||||
interface EnemyInfoBase {
|
||||
/**
|
||||
* 生命值
|
||||
*/
|
||||
hp: number;
|
||||
|
||||
/**
|
||||
* 攻击力
|
||||
*/
|
||||
atk: number;
|
||||
|
||||
/**
|
||||
* 防御力
|
||||
*/
|
||||
def: number;
|
||||
|
||||
/**
|
||||
* 金币
|
||||
*/
|
||||
money: number;
|
||||
|
||||
/**
|
||||
* 经验
|
||||
*/
|
||||
exp: number;
|
||||
|
||||
/**
|
||||
* 加点量
|
||||
*/
|
||||
point: number;
|
||||
|
||||
/**
|
||||
* 特殊属性列表
|
||||
*/
|
||||
special: number[];
|
||||
}
|
||||
|
||||
interface EnemyInfo extends EnemyInfoBase {
|
||||
/**
|
||||
* 支援信息
|
||||
*/
|
||||
guards: [x: number, y: number, id: EnemyIds];
|
||||
}
|
||||
|
||||
interface DamageInfo {
|
||||
/**
|
||||
* 怪物生命值
|
||||
*/
|
||||
mon_hp: number;
|
||||
|
||||
/**
|
||||
* 怪物攻击力
|
||||
*/
|
||||
mon_atk: number;
|
||||
|
||||
/**
|
||||
* 怪物防御力
|
||||
*/
|
||||
mon_def: number;
|
||||
|
||||
/**
|
||||
* 先攻伤害
|
||||
*/
|
||||
init_damage: number;
|
||||
|
||||
/**
|
||||
* 怪物的每回合伤害
|
||||
*/
|
||||
per_damage: number;
|
||||
|
||||
/**
|
||||
* 勇士的每回合伤害
|
||||
*/
|
||||
hero_per_damage: number;
|
||||
|
||||
/**
|
||||
* 战斗的回合数
|
||||
*/
|
||||
turn: number;
|
||||
|
||||
/**
|
||||
* 勇士损失的生命值
|
||||
*/
|
||||
damage: number;
|
||||
}
|
||||
|
||||
interface BookEnemyInfo extends Enemy, EnemyInfo {
|
||||
/**
|
||||
* 怪物的坐标列表
|
||||
*/
|
||||
locs?: [x: number, y: number][];
|
||||
|
||||
/**
|
||||
* 怪物的中文名
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* 特殊属性名称列表
|
||||
*/
|
||||
specialText: string[];
|
||||
|
||||
/**
|
||||
* 特殊属性的颜色列表
|
||||
*/
|
||||
specialColor: Color[];
|
||||
|
||||
/**
|
||||
* 怪物的伤害
|
||||
*/
|
||||
damage: number;
|
||||
|
||||
/**
|
||||
* 第一个临界的加攻的值
|
||||
*/
|
||||
critical: number;
|
||||
|
||||
/**
|
||||
* 临界的减伤值
|
||||
*/
|
||||
criticalDamage: number;
|
||||
|
||||
/**
|
||||
* ratio防减伤
|
||||
*/
|
||||
defDamage: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 怪物模块
|
||||
*/
|
||||
interface Enemys extends EnemyData {
|
||||
/**
|
||||
* 所有的怪物信息
|
||||
*/
|
||||
readonly enemys: {
|
||||
[P in EnemyIds]: Enemy<P>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 脚本编辑的怪物相关
|
||||
*/
|
||||
readonly enemydata: EnemyData;
|
||||
|
||||
/**
|
||||
* 获得所有怪物原始数据的一个副本
|
||||
*/
|
||||
getEnemys(): {
|
||||
[P in EnemyIds]: Enemy<P>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 获得某种敌人的全部特殊属性名称
|
||||
@@ -18,120 +244,135 @@ declare class enemys {
|
||||
* @param enemy 敌人id或敌人对象,如core.material.enemys.greenSlime
|
||||
* @returns 字符串数组
|
||||
*/
|
||||
getSpecialText(enemy: string | Enemy): string[];
|
||||
getSpecialText(enemy: EnemyIds | Enemy): string[];
|
||||
|
||||
/**
|
||||
* 获得所有特殊属性的颜色
|
||||
* @param enemy 敌人id或敌人对象,如core.material.enemys.greenSlime
|
||||
*/
|
||||
getSpecialColor(enemy: EnemyIds | Enemy): Color[];
|
||||
|
||||
/**
|
||||
* 获得所有特殊属性的额外标记
|
||||
* @param enemy 敌人id或敌人对象,如core.material.enemys.greenSlime
|
||||
*/
|
||||
getSpecialFlag(enemy: EnemyIds | Enemy): number[];
|
||||
|
||||
/**
|
||||
* 获得某种敌人的某种特殊属性的介绍
|
||||
* @example core.getSpecialHint('bat', 1) // '先攻:怪物首先攻击'
|
||||
* @param enemy 敌人id或敌人对象,用于确定属性的具体数值,否则可选
|
||||
* @param enemy 敌人id或敌人对象,用于确定属性的具体数值
|
||||
* @param special 属性编号,可以是该敌人没有的属性
|
||||
* @returns 属性的介绍,以属性名加中文冒号开头
|
||||
*/
|
||||
getSpecialHint(enemy: string | Enemy, special: number): string;
|
||||
getSpecialHint(enemy: EnemyIds | Enemy, special: number): string;
|
||||
|
||||
/** 获得某个敌人的某项属性值 */
|
||||
getEnemyValue(
|
||||
enemy: string | Enemy,
|
||||
name: string,
|
||||
/**
|
||||
* 获得某个敌人的某项属性值
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param name 获取的敌人属性
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在楼层
|
||||
*/
|
||||
getEnemyValue<K extends keyof Enemy>(
|
||||
enemy: EnemyIds | Enemy,
|
||||
name: K,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: string
|
||||
): any;
|
||||
floorId?: FloorIds
|
||||
): Enemy[K];
|
||||
|
||||
/**
|
||||
* 判定主角当前能否打败某只敌人
|
||||
* @example core.canBattle('greenSlime',0,0,'MT0') // 能否打败主塔0层左上角的绿头怪(假设有)
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param x 敌人的横坐标,可选
|
||||
* @param y 敌人的纵坐标,可选
|
||||
* @param floorId 敌人所在的地图,可选
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
* @returns true表示可以打败,false表示无法打败
|
||||
*/
|
||||
canBattle(
|
||||
enemy: string | Enemy,
|
||||
enemy: EnemyIds | Enemy,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: string
|
||||
floorId?: FloorIds
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* 获得某只敌人对主角的总伤害
|
||||
* @example core.getDamage('greenSlime',0,0,'MT0') // 绿头怪的总伤害
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param x 敌人的横坐标,可选
|
||||
* @param y 敌人的纵坐标,可选
|
||||
* @param floorId 敌人所在的地图,可选
|
||||
* @returns 总伤害,如果因为没有破防或无敌怪等其他原因无法战斗,则返回null
|
||||
*/
|
||||
getDamage(
|
||||
enemy: string | Enemy,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: string
|
||||
): number;
|
||||
|
||||
/**
|
||||
* 获得某只敌人的地图显伤,包括颜色
|
||||
* @example core.getDamageString('greenSlime', 0, 0, 'MT0') // 绿头怪的地图显伤
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param x 敌人的横坐标,可选
|
||||
* @param y 敌人的纵坐标,可选
|
||||
* @param floorId 敌人所在的地图,可选
|
||||
* @returns damage: 表示伤害值或为'???',color: 形如'#RrGgBb'
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
*/
|
||||
getDamageString(
|
||||
enemy: string | Enemy,
|
||||
enemy: EnemyIds | Enemy,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: string
|
||||
): {
|
||||
damage: string;
|
||||
color: string;
|
||||
};
|
||||
floorId?: FloorIds
|
||||
): DamageString;
|
||||
|
||||
/**
|
||||
* 获得某只敌人接下来的若干个临界及其减伤,算法基于useLoop开关选择回合法或二分法
|
||||
* @example core.nextCriticals('greenSlime', 9, 0, 0, 'MT0') // 绿头怪接下来的9个临界
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param number 要计算的临界数量,可选,默认为1
|
||||
* @param x 敌人的横坐标,可选
|
||||
* @param y 敌人的纵坐标,可选
|
||||
* @param floorId 敌人所在的地图,可选
|
||||
* @param number 要计算的临界数量,默认为1
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
* @returns 两列的二维数组,每行表示一个临界及其减伤
|
||||
*/
|
||||
nextCriticals(
|
||||
enemy: string | Enemy,
|
||||
enemy: EnemyIds | Enemy,
|
||||
number?: number,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: string
|
||||
): [atk: number, dam: number][];
|
||||
floorId?: FloorIds
|
||||
): [critical: number, damage: number][];
|
||||
|
||||
/**
|
||||
* 计算再加若干点防御能使某只敌人对主角的总伤害降低多少
|
||||
* @example core.nextCriticals('greenSlime', 10, 0, 0, 'MT0') // 再加10点防御能使绿头怪的伤害降低多少
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param k 假设主角增加的防御力,可选,默认为1
|
||||
* @param x 敌人的横坐标,可选
|
||||
* @param y 敌人的纵坐标,可选
|
||||
* @param floorId 敌人所在的地图,可选
|
||||
* @param k 假设主角增加的防御力,默认为1
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
* @returns 总伤害的减少量
|
||||
*/
|
||||
getDefDamage(
|
||||
enemy: string | Enemy,
|
||||
enemy: EnemyIds | Enemy,
|
||||
k?: number,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: string
|
||||
floorId?: FloorIds
|
||||
): number;
|
||||
|
||||
/**
|
||||
* 获得某只敌人对主角的总伤害
|
||||
* @example core.getDamage('greenSlime',0,0,'MT0') // 绿头怪的总伤害
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
* @returns 总伤害,如果因为没有破防或无敌怪等其他原因无法战斗,则返回null
|
||||
*/
|
||||
getDamage(
|
||||
enemy: EnemyIds | Enemy,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: FloorIds
|
||||
): number;
|
||||
|
||||
/**
|
||||
* 获得某张地图的敌人集合,用于手册绘制
|
||||
* @example core.getCurrentEnemys('MT0') // 主塔0层的敌人集合
|
||||
* @param floorId 地图id,可选
|
||||
* @param floorId 地图id
|
||||
* @returns 敌人集合,按伤害升序排列,支持多朝向怪合并
|
||||
*/
|
||||
getCurrentEnemys(floorId?: string): (Enemy & DetailedEnemy)[];
|
||||
getCurrentEnemys(floorId?: FloorIds): DetailedEnemy[];
|
||||
|
||||
/**
|
||||
* 检查某些楼层是否还有漏打的(某种)敌人
|
||||
@@ -140,63 +381,10 @@ declare class enemys {
|
||||
* @param floorId 地图id或其数组,可选,默认为当前地图
|
||||
* @returns true表示有敌人被漏打,false表示敌人已死光
|
||||
*/
|
||||
hasEnemyLeft(enemyId?: string, floorId?: string | string[]): boolean;
|
||||
|
||||
/** 获得所有怪物原始数据的一个副本 */
|
||||
getEnemys(): any;
|
||||
|
||||
/** 获得所有特殊属性定义 */
|
||||
getSpecials(): [
|
||||
number,
|
||||
string | ((enemy: Enemy) => string),
|
||||
string | ((enemy: Enemy) => string),
|
||||
string | [number, number, number, number?],
|
||||
number?
|
||||
][];
|
||||
|
||||
/** 获得所有特殊属性的颜色 */
|
||||
getSpecialColor(
|
||||
enemy: string | Enemy
|
||||
): Array<string | [number, number, number, number?]>;
|
||||
|
||||
/** 获得所有特殊属性的额外标记 */
|
||||
getSpecialFlag(enemy: string | Enemy): Array<number>;
|
||||
|
||||
/** 获得怪物真实属性 */
|
||||
getEnemyInfo(
|
||||
enemy: string | Enemy,
|
||||
hero?: any,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: string
|
||||
): {
|
||||
hp: number;
|
||||
def: number;
|
||||
atk: number;
|
||||
money: number;
|
||||
exp: number;
|
||||
point: number;
|
||||
special: number | number[];
|
||||
guards: Array<[number, number, string]>;
|
||||
[x: string]: any;
|
||||
};
|
||||
|
||||
/** 获得战斗伤害信息(实际伤害计算函数) */
|
||||
getDamageInfo(
|
||||
enemy: string | Enemy,
|
||||
hero?: any,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: string
|
||||
): {
|
||||
mon_hp: number;
|
||||
mon_atk: number;
|
||||
mon_def: number;
|
||||
init_damage: number;
|
||||
per_damage: number;
|
||||
hero_per_damage: number;
|
||||
turn: number;
|
||||
damage: number;
|
||||
[x: string]: any;
|
||||
} | null;
|
||||
hasEnemyLeft(
|
||||
enemyId?: EnemyIds | EnemyIds[],
|
||||
floorId?: FloorIds | FloorIds[]
|
||||
): boolean;
|
||||
}
|
||||
|
||||
declare const enemys: new () => Enemys;
|
||||
Vendored
+494
-309
File diff suppressed because it is too large.
Load diff
Vendored
+313
@@ -0,0 +1,313 @@
|
||||
type MotaAction = any;
|
||||
type MotaEvent = any[];
|
||||
|
||||
/**
|
||||
* 某种类型的商店
|
||||
*/
|
||||
type ShopEventOf<T extends keyof ShopEventMap> = ShopEventMap[T];
|
||||
|
||||
interface ShopEventMap {
|
||||
/**
|
||||
* 普通商店
|
||||
*/
|
||||
common: CommonShopEvent;
|
||||
|
||||
/**
|
||||
* 道具商店
|
||||
*/
|
||||
item: ItemShopEvent;
|
||||
|
||||
/**
|
||||
* 公共事件商店
|
||||
*/
|
||||
event: CommonEventShopEvent;
|
||||
}
|
||||
|
||||
interface ShopEventBase {
|
||||
/**
|
||||
* 商店的id
|
||||
*/
|
||||
id: string;
|
||||
|
||||
/**
|
||||
* 商店快捷名称
|
||||
*/
|
||||
textInList: string;
|
||||
|
||||
/**
|
||||
* 是否在未开启状态下快捷商店不显示该商店
|
||||
*/
|
||||
mustEnable: boolean;
|
||||
|
||||
/**
|
||||
* 是否不可预览
|
||||
*/
|
||||
disablePreview: boolean;
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通商店的一个商店选项
|
||||
*/
|
||||
interface CommonShopChoice {
|
||||
/**
|
||||
* 选项文字
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* 选项需求,需要是一个表达式
|
||||
*/
|
||||
need: string;
|
||||
|
||||
/**
|
||||
* 图标
|
||||
*/
|
||||
icon: AllIds;
|
||||
|
||||
/**
|
||||
* 文字的颜色
|
||||
*/
|
||||
color: Color;
|
||||
|
||||
/**
|
||||
* 该选项被选中时执行的事件
|
||||
*/
|
||||
action: MotaEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 普通商店
|
||||
*/
|
||||
interface CommonShopEvent extends ShopEventBase {
|
||||
/**
|
||||
* 商店中显示的文字
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* 普通商店的选项
|
||||
*/
|
||||
choices: CommonShopChoice[];
|
||||
}
|
||||
|
||||
/**
|
||||
* 道具商店的一个选项
|
||||
*/
|
||||
interface ItemShopChoice {
|
||||
/**
|
||||
* 该选项的道具id
|
||||
*/
|
||||
id: AllIdsOf<'items'>;
|
||||
|
||||
/**
|
||||
* 道具存量
|
||||
*/
|
||||
number: number;
|
||||
|
||||
/**
|
||||
* 购买时消耗的资源数量,是字符串大概是因为这玩意可以用${}
|
||||
*/
|
||||
money: string;
|
||||
|
||||
/**
|
||||
* 卖出时获得的资源数量
|
||||
*/
|
||||
sell: string;
|
||||
|
||||
/**
|
||||
* 出现条件
|
||||
*/
|
||||
condition: string;
|
||||
}
|
||||
|
||||
/**
|
||||
* 道具商店
|
||||
*/
|
||||
interface ItemShopEvent extends ShopEventBase {
|
||||
/**
|
||||
* 道具商店标识
|
||||
*/
|
||||
item: true;
|
||||
|
||||
/**
|
||||
* 购买消耗什么东西,金币还是经验
|
||||
*/
|
||||
use: 'money' | 'exp';
|
||||
|
||||
/**
|
||||
* 每个选项
|
||||
*/
|
||||
choices: ItemShopChoice[];
|
||||
}
|
||||
|
||||
interface CommonEventShopEvent {
|
||||
/**
|
||||
* 使用的公共事件
|
||||
*/
|
||||
commonEvent: EventDeclaration;
|
||||
}
|
||||
|
||||
interface AutoEventBase {
|
||||
/**
|
||||
* 自动事件的触发条件
|
||||
*/
|
||||
condition: string;
|
||||
|
||||
/**
|
||||
* 是否只在当前层检测
|
||||
*/
|
||||
currentFloor: boolean;
|
||||
|
||||
/**
|
||||
* 优先级,优先级越高越优先执行
|
||||
*/
|
||||
priority: number;
|
||||
|
||||
/**
|
||||
* 是否在事件流中延迟执行
|
||||
*/
|
||||
delayExecute: boolean;
|
||||
|
||||
/**
|
||||
* 是否允许多次执行
|
||||
*/
|
||||
multiExecute: boolean;
|
||||
|
||||
/**
|
||||
* 当条件满足时执行的事件
|
||||
*/
|
||||
data: MotaEvent;
|
||||
}
|
||||
|
||||
interface AutoEvent extends AutoEventBase {
|
||||
/**
|
||||
* 当前的楼层id
|
||||
*/
|
||||
floorId: FloorIds;
|
||||
|
||||
/**
|
||||
* 自动事件的索引
|
||||
*/
|
||||
index: string;
|
||||
|
||||
/**
|
||||
* 事件所在的横坐标
|
||||
*/
|
||||
x: number;
|
||||
|
||||
/**
|
||||
* 事件所在的纵坐标
|
||||
*/
|
||||
y: number;
|
||||
|
||||
/**
|
||||
* 事件的唯一标识符
|
||||
*/
|
||||
symbol: string;
|
||||
}
|
||||
|
||||
interface LevelChooseEvent {
|
||||
/**
|
||||
* 难度名称
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* 难度简称
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* 难度的hard值
|
||||
*/
|
||||
hard: number;
|
||||
|
||||
/**
|
||||
* 难度的颜色
|
||||
*/
|
||||
color: RGBArray;
|
||||
|
||||
/**
|
||||
* 选择该难度时执行的事件
|
||||
*/
|
||||
action: MotaEvent;
|
||||
}
|
||||
|
||||
interface LevelUpEvent {
|
||||
/**
|
||||
* 升级所需经验
|
||||
*/
|
||||
need: number;
|
||||
|
||||
/**
|
||||
* 这个等级的等级名
|
||||
*/
|
||||
title: string;
|
||||
|
||||
/**
|
||||
* 升级时执行的事件
|
||||
*/
|
||||
action: MotaEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 门信息
|
||||
*/
|
||||
interface DoorInfo {
|
||||
/**
|
||||
* 开门时间
|
||||
*/
|
||||
time: number;
|
||||
|
||||
/**
|
||||
* 开门音效
|
||||
*/
|
||||
openSound: SoundIds;
|
||||
|
||||
/**
|
||||
* 关门音效
|
||||
*/
|
||||
closeSound: SoundIds;
|
||||
|
||||
/**
|
||||
* 需要的钥匙
|
||||
*/
|
||||
keys: Partial<Record<ItemIdOf<'tools'> | `${ItemIdOf<'tools'>}:o`, number>>;
|
||||
|
||||
/**
|
||||
* 开门后事件
|
||||
*/
|
||||
afterOpenDoor?: MotaEvent;
|
||||
}
|
||||
|
||||
interface ChangeFloorEvent {
|
||||
/**
|
||||
* 到达的楼层
|
||||
*/
|
||||
floorId: ':before' | ':after' | ':now' | FloorIds;
|
||||
|
||||
/**
|
||||
* 到达的坐标,填了的话stair就无效了
|
||||
*/
|
||||
loc?: LocArr;
|
||||
|
||||
/**
|
||||
* 到达的坐标
|
||||
*/
|
||||
stair?: FloorChangeStair;
|
||||
|
||||
/**
|
||||
* 勇士朝向
|
||||
*/
|
||||
direction?: HeroTurnDir;
|
||||
|
||||
/**
|
||||
* 楼层转换时间
|
||||
*/
|
||||
time?: number;
|
||||
|
||||
/**
|
||||
* 是否不可穿透
|
||||
*/
|
||||
ignoreChangeFloor?: boolean;
|
||||
}
|
||||
Vendored
+456
@@ -0,0 +1,456 @@
|
||||
interface EventStatusDataMap {
|
||||
/**
|
||||
* 执行事件中
|
||||
*/
|
||||
action: ActionStatusData;
|
||||
|
||||
/**
|
||||
* 怪物手册的信息,是当前选择了哪个怪物
|
||||
*/
|
||||
book: number;
|
||||
|
||||
/**
|
||||
* 楼层传送器中当前楼层索引
|
||||
*/
|
||||
fly: number;
|
||||
|
||||
/**
|
||||
* 浏览地图时的信息
|
||||
*/
|
||||
viewMaps: ViewMapStatusData;
|
||||
|
||||
/**
|
||||
* 装备栏的信息
|
||||
*/
|
||||
equipbox: EquipboxStatusData;
|
||||
|
||||
/**
|
||||
* 道具栏的信息
|
||||
*/
|
||||
toolbox: ToolboxStatusData;
|
||||
|
||||
/**
|
||||
* 存档界面的信息
|
||||
*/
|
||||
save: SaveStatusData;
|
||||
load: SaveStatusData;
|
||||
replayLoad: SaveStatusData;
|
||||
replayRemain: SaveStatusData;
|
||||
replaySince: SaveStatusData;
|
||||
|
||||
/**
|
||||
* 文本框界面的信息
|
||||
*/
|
||||
text: TextStatusData;
|
||||
|
||||
/**
|
||||
* 确认框界面的信息
|
||||
*/
|
||||
confirmBox: ConfirmStatusData;
|
||||
|
||||
/**
|
||||
* 关于界面,帮助界面,怪物手册详细信息界面,虚拟键盘界面,系统设置界面,系统选项栏界面,
|
||||
* 快捷商店界面,存档笔记界面,同步存档界面,光标界面,录像回放界面,游戏信息界面,没有东西
|
||||
*/
|
||||
about: null;
|
||||
help: null;
|
||||
'book-detail': null;
|
||||
keyBoard: null;
|
||||
switchs: null;
|
||||
'switchs-sounds': null;
|
||||
'switchs-display': null;
|
||||
'switchs-action': null;
|
||||
settings: null;
|
||||
selectShop: null;
|
||||
notes: null;
|
||||
syncSave: null;
|
||||
syncSelect: null;
|
||||
localSaveSelect: null;
|
||||
storageRemove: null;
|
||||
cursor: null;
|
||||
replay: null;
|
||||
gameInfo: null;
|
||||
}
|
||||
|
||||
interface _EventStatusSelectionMap {
|
||||
/**
|
||||
* 执行事件中,一般是选择框的当前选中项
|
||||
*/
|
||||
action: number;
|
||||
|
||||
/**
|
||||
* 装备栏中当前选中了哪个装备
|
||||
*/
|
||||
equipbox: number;
|
||||
|
||||
/**
|
||||
* 道具栏中当前选中了哪个道具
|
||||
*/
|
||||
toolbox: number;
|
||||
|
||||
/**
|
||||
* 当前是否是删除模式
|
||||
*/
|
||||
save: boolean;
|
||||
load: boolean;
|
||||
|
||||
/**
|
||||
* 当前选择了确认(0)还是取消(1)
|
||||
*/
|
||||
confirmBox: 0 | 1;
|
||||
|
||||
/**
|
||||
* 系统设置界面,存档笔记界面,同步存档界面,录像回放界面,游戏信息界面,当前的选择项
|
||||
*/
|
||||
switchs: number;
|
||||
'switchs-sounds': number;
|
||||
'switchs-display': number;
|
||||
'switchs-action': number;
|
||||
settings: number;
|
||||
notes: number;
|
||||
syncSave: number;
|
||||
syncSelect: number;
|
||||
localSaveSelect: number;
|
||||
storageRemove: number;
|
||||
replay: number;
|
||||
gameInfo: number;
|
||||
}
|
||||
|
||||
interface _EventStatusUiMap {
|
||||
/**
|
||||
* 执行事件中,一般是与选择框有关的
|
||||
*/
|
||||
action: ActionStatusUi;
|
||||
|
||||
/**
|
||||
* 如果是从浏览地图界面呼出的怪物手册,该项是当前正在浏览的地图的索引(注意不是id)
|
||||
*/
|
||||
book: number;
|
||||
|
||||
/**
|
||||
* 确认框中显示的文字
|
||||
*/
|
||||
confirmBox: string;
|
||||
|
||||
/**
|
||||
* 显示设置的选择信息
|
||||
*/
|
||||
'switchs-display': SwitchsStatusData;
|
||||
|
||||
/**
|
||||
* 系统选项栏的选择信息
|
||||
*/
|
||||
settings: SwitchsStatusData;
|
||||
|
||||
/**
|
||||
* 快捷商店界面,存档笔记界面,同步存档界面,录像回放界面,游戏信息界面的绘制信息
|
||||
*/
|
||||
selectShop: SelectShopStatusUi;
|
||||
notes: SelectShopStatusUi;
|
||||
syncSave: SelectShopStatusUi;
|
||||
syncSelect: SelectShopStatusUi;
|
||||
localSaveSelect: SelectShopStatusUi;
|
||||
storageRemove: SelectShopStatusUi;
|
||||
gameInfo: SelectShopStatusUi;
|
||||
}
|
||||
|
||||
interface _EventStatusIntervalMap {
|
||||
/**
|
||||
* 执行事件中,一般用于呼出某个界面时暂存当前事件信息(?
|
||||
*/
|
||||
action: ActionStatusData;
|
||||
|
||||
/**
|
||||
* 如果是从事件中呼出的,用于存储当前事件信息,当退出怪物手册时恢复事件
|
||||
*/
|
||||
book: ActionStatusData;
|
||||
|
||||
/**
|
||||
* 如果是从事件中呼出的,用于存储当前事件信息,当退出存档节目时恢复事件
|
||||
*/
|
||||
save: ActionStatusData;
|
||||
load: ActionStatusData;
|
||||
}
|
||||
|
||||
interface _EventStatusTimeoutMap {
|
||||
/**
|
||||
* 执行事件中,一般是等待用户操作事件等事件中的超时时间的判定
|
||||
*/
|
||||
action: number;
|
||||
}
|
||||
|
||||
interface _EventStatusAnimateUiMap {
|
||||
/**
|
||||
* 执行事件中,一般是对话框事件的动画定时器
|
||||
*/
|
||||
action: number;
|
||||
}
|
||||
|
||||
type EventStatus = keyof EventStatusDataMap;
|
||||
|
||||
type _FillEventStatus<T> = {
|
||||
[P in EventStatus]: P extends keyof T ? T[P] : null;
|
||||
};
|
||||
|
||||
type EventStatusSelectionMap = _FillEventStatus<_EventStatusSelectionMap>;
|
||||
type EventStatusUiMap = _FillEventStatus<_EventStatusUiMap>;
|
||||
type EventStatusIntervalMap = _FillEventStatus<_EventStatusIntervalMap>;
|
||||
type EventStatusTimeoutMap = _FillEventStatus<_EventStatusTimeoutMap>;
|
||||
type EventStatusAnimateUiMap = _FillEventStatus<_EventStatusAnimateUiMap>;
|
||||
|
||||
/**
|
||||
* 某个事件状态下的信息
|
||||
*/
|
||||
interface EventStatusOf<T extends EventStatus = EventStatus> {
|
||||
/**
|
||||
* 当前事件状态的类型
|
||||
*/
|
||||
id: T;
|
||||
|
||||
/**
|
||||
* 当前事件状态的信息
|
||||
*/
|
||||
data: EventStatusDataMap[T];
|
||||
|
||||
/**
|
||||
* 当前事件状态的选择信息
|
||||
*/
|
||||
selection: EventStatusSelectionMap[T];
|
||||
|
||||
/**
|
||||
* 当前事件状态的ui信息
|
||||
*/
|
||||
ui: EventStatusUiMap[T];
|
||||
|
||||
/**
|
||||
* 当前事件状态的定时器信息
|
||||
*/
|
||||
interval: EventStatusIntervalMap[T];
|
||||
|
||||
/**
|
||||
* 当前事件状态的计时器信息
|
||||
*/
|
||||
timeout: EventStatusTimeoutMap[T];
|
||||
|
||||
/**
|
||||
* 当前事件状态的动画信息
|
||||
*/
|
||||
animateUi: EventStatusAnimateUiMap[T];
|
||||
}
|
||||
|
||||
interface ActionStatusEventList {
|
||||
/**
|
||||
* 要执行的事件列表
|
||||
*/
|
||||
todo: MotaEvent;
|
||||
|
||||
/**
|
||||
* 全部的事件列表
|
||||
*/
|
||||
total: MotaEvent;
|
||||
|
||||
/**
|
||||
* 执行条件
|
||||
*/
|
||||
contidion: string;
|
||||
}
|
||||
|
||||
interface ActionLocStackInfo {
|
||||
/**
|
||||
* 横坐标
|
||||
*/
|
||||
x: number;
|
||||
|
||||
/**
|
||||
* 纵坐标
|
||||
*/
|
||||
y: number;
|
||||
|
||||
/**
|
||||
* 楼层id
|
||||
*/
|
||||
floorId: FloorIds;
|
||||
}
|
||||
|
||||
/**
|
||||
* 执行事件中
|
||||
*/
|
||||
interface ActionStatusData {
|
||||
/**
|
||||
* 当前的事件列表
|
||||
*/
|
||||
list: DeepReadonly<ActionStatusEventList>;
|
||||
|
||||
/**
|
||||
* 事件执行的横坐标,或者对话框的横坐标
|
||||
*/
|
||||
x?: number;
|
||||
|
||||
/**
|
||||
* 事件执行的纵坐标,或者对话框的纵坐标
|
||||
*/
|
||||
y?: number;
|
||||
|
||||
/**
|
||||
* 事件执行完毕的回调函数
|
||||
*/
|
||||
callback?: () => void;
|
||||
|
||||
/**
|
||||
* 不太清楚用处,可能是与自动事件有关的
|
||||
*/
|
||||
appendingEvents: MotaEvent[];
|
||||
|
||||
/**
|
||||
* 事件的坐标栈
|
||||
*/
|
||||
locStack: any[];
|
||||
|
||||
/**
|
||||
* 当前的事件类型
|
||||
*/
|
||||
type: EventType;
|
||||
|
||||
/**
|
||||
* 当前事件
|
||||
*/
|
||||
current: MotaAction;
|
||||
}
|
||||
|
||||
interface ActionStatusUi {
|
||||
/**
|
||||
* 显示文字事件的文字,包括确认框等
|
||||
*/
|
||||
text: string;
|
||||
|
||||
/**
|
||||
* 确认框中确定时执行的事件
|
||||
*/
|
||||
yes?: MotaEvent;
|
||||
|
||||
/**
|
||||
* 确认框中取消时执行的事件
|
||||
*/
|
||||
no?: MotaEvent;
|
||||
|
||||
/**
|
||||
* 当前是选择事件时所有的选项
|
||||
*/
|
||||
choices?: string[];
|
||||
|
||||
/**
|
||||
* 当前是选择事件时选项框的宽度
|
||||
*/
|
||||
width?: number;
|
||||
}
|
||||
|
||||
interface ViewMapStatusData {
|
||||
/**
|
||||
* 当前浏览的楼层索引
|
||||
*/
|
||||
index: number;
|
||||
|
||||
/**
|
||||
* 是否显示伤害
|
||||
*/
|
||||
damage: boolean;
|
||||
|
||||
/**
|
||||
* 大地图是否显示全部地图
|
||||
*/
|
||||
all: boolean;
|
||||
|
||||
/**
|
||||
* 大地图不显示全部地图时当前的横坐标,单位格子
|
||||
*/
|
||||
x: number;
|
||||
|
||||
/**
|
||||
* 大地图不显示全部地图时当前的纵坐标,单位格子
|
||||
*/
|
||||
y: number;
|
||||
}
|
||||
|
||||
interface EquipboxStatusData {
|
||||
/**
|
||||
* 拥有装备的当前页数
|
||||
*/
|
||||
page: number;
|
||||
|
||||
/**
|
||||
* 当前选中的装备
|
||||
*/
|
||||
selectId: ItemIdOf<'equips'>;
|
||||
}
|
||||
|
||||
interface ToolboxStatusData {
|
||||
/**
|
||||
* 消耗道具的当前页码数
|
||||
*/
|
||||
toolsPage: number;
|
||||
|
||||
/**
|
||||
* 永久道具的当前页码数
|
||||
*/
|
||||
constantsPage: number;
|
||||
|
||||
/**
|
||||
* 当前选中的道具id
|
||||
*/
|
||||
selectId: ItemIdOf<'constants' | 'tools'>;
|
||||
}
|
||||
|
||||
interface SaveStatusData {
|
||||
/**
|
||||
* 当前存读档界面的页码数
|
||||
*/
|
||||
page: number;
|
||||
|
||||
/**
|
||||
* 选择的框的偏移量,在不同状态下意义不同
|
||||
*/
|
||||
offset: number;
|
||||
|
||||
/**
|
||||
* 当前存读档界面的模式,fav表示收藏,all表示所有存档
|
||||
*/
|
||||
mode: 'fav' | 'all';
|
||||
}
|
||||
|
||||
interface TextStatusData {
|
||||
/**
|
||||
* 文本框要显示的文字列表
|
||||
*/
|
||||
list: string[];
|
||||
|
||||
/**
|
||||
* 文字显示完毕后的回调函数
|
||||
*/
|
||||
callback: () => void;
|
||||
}
|
||||
|
||||
interface ConfirmStatusData {
|
||||
/**
|
||||
* 点击确认时
|
||||
*/
|
||||
yes: () => void;
|
||||
|
||||
/**
|
||||
* 点击取消时
|
||||
*/
|
||||
no: () => void;
|
||||
}
|
||||
|
||||
interface SwitchsStatusData {
|
||||
/**
|
||||
* 选择项
|
||||
*/
|
||||
choices: string[];
|
||||
}
|
||||
|
||||
interface SelectShopStatusUi {
|
||||
/**
|
||||
* 选择框的偏移量
|
||||
*/
|
||||
offset: number;
|
||||
}
|
||||
Vendored
+282
@@ -0,0 +1,282 @@
|
||||
interface ActionData {
|
||||
/**
|
||||
* 当按键弹起时
|
||||
* @param keyCode 按键的keyCode
|
||||
* @param altKey 当前是否按下了alt键
|
||||
*/
|
||||
onKeyUp(keyCode: number, altKey: boolean): boolean;
|
||||
|
||||
/**
|
||||
* 当点击状态栏时
|
||||
* @param px 点击的横坐标
|
||||
* @param py 点击的纵坐标
|
||||
* @param vertical 当前是否是竖屏
|
||||
*/
|
||||
onClickStatusBar(px: number, py: number, vertical: boolean): boolean;
|
||||
}
|
||||
|
||||
interface ControlData {
|
||||
/**
|
||||
* 获取保存信息
|
||||
*/
|
||||
saveData(): Save;
|
||||
|
||||
/**
|
||||
* 读取一个存档
|
||||
* @param data 存档信息
|
||||
* @param callback 读取完毕后的回调函数
|
||||
*/
|
||||
loadData(data: Save, callback?: () => void): void;
|
||||
|
||||
/**
|
||||
* 获取一个属性对应的中文名
|
||||
* @param name 要获取的状态名称
|
||||
*/
|
||||
getStatusLabel(name: string): string;
|
||||
|
||||
/**
|
||||
* 变更勇士的debuff
|
||||
* @param action 触发的类型,get表示获得debuff,remove表示移除debuff
|
||||
* @param type 获取的debuff列表
|
||||
*/
|
||||
triggerDebuff(action: 'get' | 'remove', type: string | string[]): void;
|
||||
|
||||
/**
|
||||
* 立即仅更新状态栏
|
||||
*/
|
||||
updateStatusBar(): void;
|
||||
|
||||
/**
|
||||
* 更新一个地图的地图伤害
|
||||
* @param floorId 要更新的楼层id
|
||||
*/
|
||||
updateCheckBlock(floorId: FloorIds): void;
|
||||
|
||||
/**
|
||||
* 每步移动后执行的函数
|
||||
* @param callback 回调函数(好像没什么必要吧
|
||||
*/
|
||||
moveOneStep(callback?: () => void): void;
|
||||
|
||||
/**
|
||||
* 瞬移到某一点
|
||||
* @param x 瞬移至的横坐标
|
||||
* @param y 瞬移至的纵坐标
|
||||
* @param ignoreSteps 忽略的步数,不填则会自动计算
|
||||
*/
|
||||
moveDirectly(x: number, y: number, ignoreSteps?: number): boolean;
|
||||
|
||||
/**
|
||||
* 并行脚本
|
||||
* @param time 距离游戏加载完毕经过的时间
|
||||
*/
|
||||
parallelDo(time: number): void;
|
||||
}
|
||||
|
||||
interface EnemyData {
|
||||
/**
|
||||
* 获得所有特殊属性定义
|
||||
*/
|
||||
getSpecials(): EnemySpecialDeclaration[];
|
||||
|
||||
/**
|
||||
* 获得怪物真实属性
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param hero 勇士信息,不填则从core.status.hero获取
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
*/
|
||||
getEnemyInfo(
|
||||
enemy: EnemyIds | Enemy,
|
||||
hero?: HeroStatus,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: FloorIds
|
||||
): EnemyInfo;
|
||||
|
||||
/**
|
||||
* 获得战斗伤害信息(实际伤害计算函数)
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param hero 勇士信息,不填则从core.status.hero获取
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
*/
|
||||
getDamageInfo(
|
||||
enemy: EnemyIds | Enemy,
|
||||
hero?: Partial<HeroStatus>,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: FloorIds
|
||||
): DamageInfo;
|
||||
|
||||
/**
|
||||
* 判定某种特殊属性的有无
|
||||
* @example core.hasSpecial('greenSlime', 1) // 判定绿头怪有无先攻属性
|
||||
* @param special 敌人id或敌人对象或正整数数组或自然数
|
||||
* @param test 待检查的属性编号
|
||||
* @returns 若special为数组或数且含有test或相等、或special为敌人id或对象且具有此属性,则返回true
|
||||
*/
|
||||
hasSpecial(
|
||||
special: number | number[] | EnemyIds | Enemy,
|
||||
test: number
|
||||
): boolean;
|
||||
}
|
||||
|
||||
interface UiData {
|
||||
/**
|
||||
* 获取道具栏要显示的道具
|
||||
* @param cls 要获取的类型
|
||||
*/
|
||||
getToolboxItems<T extends Exclude<ItemCls, 'items'>>(cls: T): ItemIdOf<T>[];
|
||||
|
||||
/**
|
||||
* 绘制状态栏
|
||||
*/
|
||||
drawStatusBar(): void;
|
||||
|
||||
/**
|
||||
* 数据统计界面统计的道具数量
|
||||
*/
|
||||
drawStatistics(): AllIdsOf<'items'>[];
|
||||
|
||||
/**
|
||||
* 绘制关于界面
|
||||
*/
|
||||
drawAbout(): void;
|
||||
}
|
||||
|
||||
interface EventData {
|
||||
/**
|
||||
* 重置游戏
|
||||
* @param hero 勇士信息
|
||||
* @param hard 难度信息
|
||||
* @param floorId 勇士所在楼层
|
||||
* @param maps 所有的地图信息
|
||||
* @param values 全局数值信息
|
||||
*/
|
||||
resetGame(
|
||||
hero: HeroStatus,
|
||||
hard: string,
|
||||
floorId: FloorIds,
|
||||
maps: GameStatus['maps'],
|
||||
values: Partial<CoreValues>
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 游戏获胜
|
||||
* @param reason 胜利原因
|
||||
* @param norank 是否不计榜
|
||||
* @param noexit 是否不退出
|
||||
*/
|
||||
win(reason: string, norank?: boolean, noexit?: boolean): void;
|
||||
|
||||
/**
|
||||
* 游戏失败
|
||||
* @param reason 失败原因
|
||||
*/
|
||||
lose(reason: string): void;
|
||||
|
||||
/**
|
||||
* 切换楼层中,即屏幕完全变黑的那一刻
|
||||
* @param floorId 目标楼层
|
||||
* @param heroLoc 勇士到达的位置
|
||||
*/
|
||||
changingFloor(floorId: FloorIds, heroLoc: Loc): void;
|
||||
|
||||
/**
|
||||
* 切换楼层后
|
||||
* @param floorId 目标楼层
|
||||
*/
|
||||
afterChangeFloor(floorId: FloorIds): void;
|
||||
|
||||
/**
|
||||
* 飞往某个楼层
|
||||
* @param toId 目标楼层
|
||||
* @param callback 飞到后的回调函数
|
||||
*/
|
||||
flyTo(toId: FloorIds, callback: () => void): void;
|
||||
|
||||
/**
|
||||
* 与怪物战斗前
|
||||
* @param enemyId 打败的怪物
|
||||
* @param x 怪物横坐标
|
||||
* @param y 怪物纵坐标
|
||||
*/
|
||||
beforeBattle(
|
||||
enemyId: AllIdsOf<'enemys' | 'enemy48'>,
|
||||
x?: number,
|
||||
y?: number
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 与怪物战斗后
|
||||
* @param enemyId 打败的怪物
|
||||
* @param x 怪物横坐标
|
||||
* @param y 怪物纵坐标
|
||||
*/
|
||||
afterBattle(
|
||||
enemyId: AllIdsOf<'enemys' | 'enemy48'>,
|
||||
x?: number,
|
||||
y?: number
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 开门后
|
||||
* @param doorId 门的id
|
||||
* @param x 门的横坐标
|
||||
* @param y 门的纵坐标
|
||||
*/
|
||||
afterOpenDoor(
|
||||
doorId: AllIdsOf<Exclude<Cls, 'enemys' | 'enemy48'>>,
|
||||
x: number,
|
||||
y: number
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 获得道具后
|
||||
* @param itemId 道具id
|
||||
* @param x 道具横坐标
|
||||
* @param y 道具纵坐标
|
||||
* @param isGentleClick 是否是轻按
|
||||
*/
|
||||
afterGetItem(
|
||||
itemId: AllIdsOf<'items'>,
|
||||
x: number,
|
||||
y: number,
|
||||
isGentleClick?: boolean
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 推箱子后
|
||||
*/
|
||||
afterPushBox(): void;
|
||||
}
|
||||
|
||||
interface FunctionsData {
|
||||
/**
|
||||
* 交互信息
|
||||
*/
|
||||
actions: ActionData;
|
||||
|
||||
/**
|
||||
* 游戏的逻辑信息
|
||||
*/
|
||||
control: ControlData;
|
||||
|
||||
/**
|
||||
* 怪物信息
|
||||
*/
|
||||
enemys: EnemyData;
|
||||
|
||||
/**
|
||||
* ui信息
|
||||
*/
|
||||
ui: UiData;
|
||||
|
||||
/**
|
||||
* 事件信息
|
||||
*/
|
||||
events: EventData;
|
||||
}
|
||||
Vendored
+66
-15
@@ -1,20 +1,71 @@
|
||||
/** 和图标相关的函数 */
|
||||
declare class icons {
|
||||
/** 获得所有图标类型 */
|
||||
getIcons(): void;
|
||||
type IconIds =
|
||||
| keyof MaterialIcon['animates']
|
||||
| keyof MaterialIcon['autotile']
|
||||
| keyof MaterialIcon['enemy48']
|
||||
| keyof MaterialIcon['enemys']
|
||||
| keyof MaterialIcon['hero']
|
||||
| keyof MaterialIcon['items']
|
||||
| keyof MaterialIcon['items']
|
||||
| keyof MaterialIcon['npc48']
|
||||
| keyof MaterialIcon['npcs']
|
||||
| keyof MaterialIcon['terrains'];
|
||||
|
||||
/** 根据ID获得其类型 */
|
||||
getClsFromId(id?: string): BlockCls;
|
||||
|
||||
/** 获得所有图标的ID */
|
||||
getAllIconIds(): void;
|
||||
|
||||
/** 根据图块数字或ID获得所在的tileset和坐标信息 */
|
||||
getTilesetOffset(id?: string): void;
|
||||
interface IconOffsetInfo {
|
||||
/**
|
||||
* 图块所在额外素材的id
|
||||
*/
|
||||
image: string;
|
||||
|
||||
/**
|
||||
* 获取图块的帧数
|
||||
* @param cls 图块类型
|
||||
* 图块所在图片位于额外素材的横坐标
|
||||
*/
|
||||
getAnimateFrames(cls: BlockCls): 1 | 2 | 4;
|
||||
x: number;
|
||||
|
||||
/**
|
||||
* 图块所在图片位于额外素材的纵坐标
|
||||
*/
|
||||
y: number;
|
||||
}
|
||||
|
||||
/**
|
||||
* 和图标相关的内容
|
||||
*/
|
||||
interface Icons {
|
||||
/**
|
||||
* 图标信息
|
||||
*/
|
||||
readonly icons: MaterialIcon;
|
||||
|
||||
/**
|
||||
* 额外素材偏移起点
|
||||
*/
|
||||
readonly tilesetStartOffset: 10000;
|
||||
|
||||
/**
|
||||
* 图标的id
|
||||
*/
|
||||
readonly allIconIds: IconIds;
|
||||
|
||||
/**
|
||||
* 获得所有图标类型
|
||||
*/
|
||||
getIcons(): MaterialIcon;
|
||||
|
||||
/**
|
||||
* 根据ID获得图块类型
|
||||
*/
|
||||
getClsFromId<T extends AllIds>(id: T): ClsOf<T>;
|
||||
|
||||
/**
|
||||
* 获得所有图标的ID
|
||||
*/
|
||||
getAllIconIds(): IconIds;
|
||||
|
||||
/**
|
||||
* 根据图块数字或ID获得所在的tileset和坐标信息
|
||||
* @param id 图块数字或id
|
||||
*/
|
||||
getTilesetOffset(id: string | number): IconOffsetInfo | null;
|
||||
}
|
||||
|
||||
declare const icons: new () => Icons;
|
||||
Vendored
+168
-38
@@ -1,12 +1,117 @@
|
||||
/** @file items.js 主要负责一切和道具相关的内容。 */
|
||||
declare class items {
|
||||
interface Item<I extends AllIdsOf<'items'>> {
|
||||
/**
|
||||
* 即捡即用类的道具获得时的效果
|
||||
* 道具id
|
||||
*/
|
||||
id: I;
|
||||
|
||||
/**
|
||||
* 道具的类型
|
||||
*/
|
||||
cls: ItemClsOf<I>;
|
||||
|
||||
/**
|
||||
* 道具的名称
|
||||
*/
|
||||
name: string;
|
||||
|
||||
/**
|
||||
* 道具的描述
|
||||
*/
|
||||
text?: string;
|
||||
|
||||
/**
|
||||
* 是否在道具栏隐藏
|
||||
*/
|
||||
hideInToolBox: boolean;
|
||||
|
||||
/**
|
||||
* 装备信息
|
||||
*/
|
||||
equip: ItemClsOf<I> extends 'equips' ? Equip : never;
|
||||
|
||||
/**
|
||||
* 回放使用时是否不先打开道具栏再使用
|
||||
*/
|
||||
hideInReplay: boolean;
|
||||
|
||||
/**
|
||||
* 即捡即用效果
|
||||
*/
|
||||
itemEffect?: string;
|
||||
|
||||
/**
|
||||
* 即捡即用道具捡过之后的提示
|
||||
*/
|
||||
itemEffectTip?: string;
|
||||
|
||||
/**
|
||||
* 使用道具时执行的事件
|
||||
*/
|
||||
useItemEvent?: MotaEvent;
|
||||
|
||||
/**
|
||||
* 使用道具时执行的代码
|
||||
*/
|
||||
useItemEffect?: string;
|
||||
|
||||
/**
|
||||
* 能否使用道具
|
||||
*/
|
||||
canUseItemEffect?: string | boolean;
|
||||
}
|
||||
|
||||
interface EquipBase {
|
||||
/**
|
||||
* 装备增加的数值
|
||||
*/
|
||||
value: Record<keyof SelectType<HeroStatus, number>, number>;
|
||||
|
||||
/**
|
||||
* 装备增加的百分比
|
||||
*/
|
||||
percentage: Record<keyof SelectType<HeroStatus, number>, number>;
|
||||
}
|
||||
|
||||
interface Equip extends EquipBase {
|
||||
/**
|
||||
* 可以装备到的装备孔
|
||||
*/
|
||||
type: number | string;
|
||||
|
||||
/**
|
||||
* 动画信息
|
||||
*/
|
||||
animate: AnimationIds;
|
||||
|
||||
/**
|
||||
* 穿上装备时执行的事件
|
||||
*/
|
||||
equipEvent?: MotaEvent;
|
||||
|
||||
/**
|
||||
* 脱下装备时执行的事件
|
||||
*/
|
||||
unequipEvent?: MotaEvent;
|
||||
}
|
||||
|
||||
/**
|
||||
* 道具相关的内容
|
||||
*/
|
||||
interface Items {
|
||||
/**
|
||||
* 获得所有道具
|
||||
*/
|
||||
getItems(): {
|
||||
[P in AllIdsOf<'items'>]: Item<P>;
|
||||
};
|
||||
|
||||
/**
|
||||
* 执行即捡即用类的道具获得时的效果
|
||||
* @example core.getItemEffect('redPotion', 10) // 执行获得10瓶红血的效果
|
||||
* @param itemId 道具id
|
||||
* @param itemNum 道具数量,可选,默认为1
|
||||
* @param itemNum 道具数量,默认为1
|
||||
*/
|
||||
getItemEffect(itemId: string, itemNum?: number): void;
|
||||
getItemEffect(itemId: AllIdsOf<'items'>, itemNum?: number): void;
|
||||
|
||||
/**
|
||||
* 即捡即用类的道具获得时的额外提示
|
||||
@@ -14,16 +119,20 @@ declare class items {
|
||||
* @param itemId 道具id
|
||||
* @returns 图块属性itemEffectTip的内容
|
||||
*/
|
||||
getItemEffectTip(itemId: string): string;
|
||||
getItemEffectTip(itemId: AllIdsOf<'items'>): string;
|
||||
|
||||
/**
|
||||
* 使用一个道具
|
||||
* @example core.useItem('pickaxe', true) // 使用破墙镐,不计入录像,无回调
|
||||
* @param itemId 道具id
|
||||
* @param noRoute 是否不计入录像,快捷键使用的请填true,否则可省略
|
||||
* @param callback 道具使用完毕或使用失败后的回调函数
|
||||
* @param callback 道具使用完毕或使用失败后的回调函数,好像没什么意义吧(
|
||||
*/
|
||||
useItem(itemId: string, noRoute?: boolean, callback?: () => void): void;
|
||||
useItem(
|
||||
itemId: ItemIdOf<'tools' | 'constants'>,
|
||||
noRoute?: boolean,
|
||||
callback?: () => void
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 检查能否使用某种道具
|
||||
@@ -31,7 +140,7 @@ declare class items {
|
||||
* @param itemId 道具id
|
||||
* @returns true表示可以使用
|
||||
*/
|
||||
canUseItem(itemId: string): boolean;
|
||||
canUseItem(itemId: AllIdsOf<'items'>): boolean;
|
||||
|
||||
/**
|
||||
* 统计某种道具的持有量
|
||||
@@ -39,7 +148,7 @@ declare class items {
|
||||
* @param itemId 道具id
|
||||
* @returns 该种道具的持有量,不包括已穿戴的装备
|
||||
*/
|
||||
itemCount(itemId: string): number;
|
||||
itemCount(itemId: AllIdsOf<'items'>): number;
|
||||
|
||||
/**
|
||||
* 检查主角是否持有某种道具(不包括已穿戴的装备)
|
||||
@@ -47,7 +156,7 @@ declare class items {
|
||||
* @param itemId 道具id
|
||||
* @returns true表示持有
|
||||
*/
|
||||
hasItem(itemId: string): boolean;
|
||||
hasItem(itemId: AllIdsOf<'items'>): boolean;
|
||||
|
||||
/**
|
||||
* 检查主角是否穿戴着某件装备
|
||||
@@ -55,7 +164,7 @@ declare class items {
|
||||
* @param itemId 装备id
|
||||
* @returns true表示已装备
|
||||
*/
|
||||
hasEquip(itemId: string): boolean;
|
||||
hasEquip(itemId: ItemIdOf<'equips'>): boolean;
|
||||
|
||||
/**
|
||||
* 检查主角某种类型的装备目前是什么
|
||||
@@ -63,7 +172,7 @@ declare class items {
|
||||
* @param equipType 装备类型,自然数
|
||||
* @returns 装备id,null表示未穿戴
|
||||
*/
|
||||
getEquip(equipType: number): string;
|
||||
getEquip(equipType: number): ItemIdOf<'equips'> | null;
|
||||
|
||||
/**
|
||||
* 设置某种道具的持有量
|
||||
@@ -71,15 +180,29 @@ declare class items {
|
||||
* @param itemId 道具id
|
||||
* @param itemNum 新的持有量,可选,自然数,默认为0
|
||||
*/
|
||||
setItem(itemId: string, itemNum?: number): void;
|
||||
setItem(itemId: AllIdsOf<'items'>, itemNum?: number): void;
|
||||
|
||||
/**
|
||||
* 静默增减某种道具的持有量 不会更新游戏画面或是显示提示
|
||||
* @example core.addItem('yellowKey', -2) // 没收两把黄钥匙
|
||||
* @param itemId 道具id
|
||||
* @param itemNum 增加量,负数表示没收
|
||||
* @param itemNum 增加量,负数表示减少
|
||||
*/
|
||||
addItem(itemId: string, itemNum?: number): void;
|
||||
addItem(itemId: AllIdsOf<'items'>, itemNum?: number): void;
|
||||
|
||||
/**
|
||||
* @deprecated 使用addItem代替。
|
||||
* 删除某个物品一定的数量,相当于addItem(itemId, -n);
|
||||
* @param itemId 道具id
|
||||
* @param itemNum 减少量,负数表示增加
|
||||
*/
|
||||
removeItem(itemId?: AllIdsOf<'items'>, itemNum?: number): void;
|
||||
|
||||
/**
|
||||
* 根据类型获得一个可用的装备孔
|
||||
* @param equipId 道具名称
|
||||
*/
|
||||
getEquipTypeByName(name?: ItemIdOf<'equips'>): number;
|
||||
|
||||
/**
|
||||
* 判定某件装备的类型
|
||||
@@ -87,7 +210,7 @@ declare class items {
|
||||
* @param equipId 装备id
|
||||
* @returns 类型编号,自然数
|
||||
*/
|
||||
getEquipTypeById(equipId: string): number | string;
|
||||
getEquipTypeById(equipId: ItemIdOf<'equips'>): number;
|
||||
|
||||
/**
|
||||
* 检查能否穿上某件装备
|
||||
@@ -96,7 +219,7 @@ declare class items {
|
||||
* @param hint 无法穿上时是否提示(比如是因为未持有还是别的什么原因)
|
||||
* @returns true表示可以穿上,false表示无法穿上
|
||||
*/
|
||||
canEquip(equipId: string, hint: boolean): boolean;
|
||||
canEquip(equipId: ItemIdOf<'equips'>, hint?: boolean): boolean;
|
||||
|
||||
/**
|
||||
* 尝试穿上某件背包里的装备并提示
|
||||
@@ -104,7 +227,7 @@ declare class items {
|
||||
* @param equipId 装备id
|
||||
* @param callback 穿戴成功或失败后的回调函数
|
||||
*/
|
||||
loadEquip(equipId: string, callback?: () => void): void;
|
||||
loadEquip(equipId: ItemIdOf<'equips'>, callback?: () => void): void;
|
||||
|
||||
/**
|
||||
* 脱下某个类型的装备
|
||||
@@ -121,10 +244,10 @@ declare class items {
|
||||
* @param beComparedEquipId 装备乙的id
|
||||
* @returns 两装备的各属性差,甲减乙,0省略
|
||||
*/
|
||||
compareEquipment(
|
||||
compareEquipId: string,
|
||||
beComparedEquipId: string
|
||||
): { [key: string]: number };
|
||||
compareEquipment<F extends ItemIdOf<'equips'>>(
|
||||
compareEquipId: F,
|
||||
beComparedEquipId: Exclude<ItemIdOf<'equips'>, F>
|
||||
): EquipBase;
|
||||
|
||||
/**
|
||||
* 保存当前套装
|
||||
@@ -140,15 +263,6 @@ declare class items {
|
||||
*/
|
||||
quickLoadEquip(index: number): void;
|
||||
|
||||
/** 获得所有道具 */
|
||||
getItems(): void;
|
||||
|
||||
/** 删除某个物品 */
|
||||
removeItem(itemId?: string, itemNum?: number): void;
|
||||
|
||||
/** 根据类型获得一个可用的装备孔 */
|
||||
getEquipTypeByName(name?: string): void;
|
||||
|
||||
/**
|
||||
* 设置某个装备的属性并计入存档
|
||||
* @example core.setEquip('sword1', 'value', 'atk', 300, '+='); // 设置铁剑的攻击力数值再加300
|
||||
@@ -156,15 +270,31 @@ declare class items {
|
||||
* @param valueType 增幅类型,只能是value(数值)或percentage(百分比)
|
||||
* @param name 要修改的属性名称,如atk
|
||||
* @param value 要修改到的属性数值
|
||||
* @param operator 操作符,可选,如+=表示在原始值上增加
|
||||
* @param operator 操作符,如+=表示在原始值上增加
|
||||
* @param prefix 独立开关前缀,一般不需要
|
||||
*/
|
||||
setEquip(
|
||||
equipId: string,
|
||||
valueType: string,
|
||||
name: string,
|
||||
value: any,
|
||||
operator?: string,
|
||||
equipId: ItemIdOf<'equips'>,
|
||||
valueType: 'value' | 'percentage',
|
||||
name: keyof SelectType<HeroStatus, number>,
|
||||
value: number,
|
||||
operator?: MotaOperator,
|
||||
prefix?: string
|
||||
): void;
|
||||
|
||||
/**
|
||||
* 真正的穿脱装备
|
||||
* @param type 装备孔
|
||||
* @param loadId 装上的装备
|
||||
* @param unloadId 脱下的装备
|
||||
* @param callback 回调函数
|
||||
*/
|
||||
_realLoadEquip(
|
||||
type: number,
|
||||
loadId?: ItemIdOf<'equips'>,
|
||||
unloadId?: ItemIdOf<'equips'>,
|
||||
callback?: () => void
|
||||
): void;
|
||||
}
|
||||
|
||||
declare const items: new () => Items;
|
||||
Vendored
+57
-21
@@ -1,29 +1,65 @@
|
||||
/** @file loader.js 主要负责资源的加载 */
|
||||
declare class loader {
|
||||
/** 加载一系列图片 */
|
||||
loadImages(dir: any, names: any, toSave: any, callback?: () => any): any;
|
||||
/**
|
||||
* 负责资源的加载
|
||||
*/
|
||||
interface Loader {
|
||||
/**
|
||||
* 加载一系列图片
|
||||
* @param dir 图片所在目录
|
||||
* @param names 图片名称列表
|
||||
* @param toSave 要保存到的对象
|
||||
* @param callback 加载完毕后的回调函数
|
||||
*/
|
||||
loadImages(
|
||||
dir: string,
|
||||
names: string[],
|
||||
toSave: Record<string, HTMLImageElement>,
|
||||
callback?: () => void
|
||||
): void;
|
||||
|
||||
/** 加载某一张图片 */
|
||||
loadImage(dir: any, imgName?: any, callback?: () => any): any;
|
||||
/**
|
||||
* 加载某一张图片
|
||||
* @param dir 图片所在目录
|
||||
* @param imgName 图片名称
|
||||
* @param callback 加载完毕的回调函数
|
||||
*/
|
||||
loadImage(dir: string, imgName: string, callback?: () => void): void;
|
||||
|
||||
/** 从zip中加载一系列图片 */
|
||||
/**
|
||||
* 从zip中加载一系列图片
|
||||
* @param url 图片所在目录
|
||||
* @param names 图片名称列表
|
||||
*/
|
||||
loadImagesFromZip(
|
||||
url?: any,
|
||||
names?: any,
|
||||
toSave?: any,
|
||||
onprogress?: any,
|
||||
onfinished?: any
|
||||
): any;
|
||||
url: string,
|
||||
names: string,
|
||||
toSave: Record<string, HTMLImageElement>,
|
||||
onprogress?: (loaded: number, total: number) => void,
|
||||
onfinished?: () => void
|
||||
): void;
|
||||
|
||||
/** 加载一个音乐 */
|
||||
loadOneMusic(name?: string): any;
|
||||
/**
|
||||
* 加载一个音乐
|
||||
* @param name 要加载的音乐的名称
|
||||
*/
|
||||
loadOneMusic(name: BgmIds): void;
|
||||
|
||||
/** 加载一个音效 */
|
||||
loadOneSound(name?: string): any;
|
||||
/**
|
||||
* 加载一个音效
|
||||
* @param name 要加载的音效的名称
|
||||
*/
|
||||
loadOneSound(name: SoundIds): void;
|
||||
|
||||
/** 加载一个bgm */
|
||||
loadBgm(name?: string): any;
|
||||
/**
|
||||
* 加载一个bgm
|
||||
* @param name 加载的bgm的id或名称
|
||||
*/
|
||||
loadBgm(name: BgmIds | NameMapIn<BgmIds>): void;
|
||||
|
||||
/** 释放一个bgm的缓存 */
|
||||
freeBgm(name?: string): any;
|
||||
/**
|
||||
* 释放一个bgm的缓存
|
||||
* @param name 要释放的bgm的id或名称
|
||||
*/
|
||||
freeBgm(name: BgmIds | NameMapIn<BgmIds>): void;
|
||||
}
|
||||
|
||||
declare const loader: new () => Loader;
|
||||
Vendored
+1051
-307
File diff suppressed because it is too large.
Load diff
Vendored
+98
@@ -0,0 +1,98 @@
|
||||
/**
|
||||
* 图块类型
|
||||
*/
|
||||
type Cls =
|
||||
| 'autotile'
|
||||
| 'animates'
|
||||
| 'enemys'
|
||||
| 'items'
|
||||
| 'npcs'
|
||||
| 'terrains'
|
||||
| 'enemy48'
|
||||
| 'npc48'
|
||||
| 'tilesets';
|
||||
|
||||
/**
|
||||
* 所有的可动画图块类型
|
||||
*/
|
||||
type AnimatableCls = Exclude<Cls, 'items' | 'terrains' | 'tilesets'>;
|
||||
|
||||
/**
|
||||
* 道具类型
|
||||
*/
|
||||
type ItemCls = 'tools' | 'items' | 'equips' | 'constants';
|
||||
|
||||
/**
|
||||
* 所有的道具id
|
||||
*/
|
||||
type AllIds = keyof IdToNumber;
|
||||
|
||||
/**
|
||||
* 所有的道具数字
|
||||
*/
|
||||
type AllNumbers = keyof NumberToId | 0;
|
||||
|
||||
/**
|
||||
* 某种类型的图块的id
|
||||
*/
|
||||
type AllIdsOf<T extends Cls> = keyof {
|
||||
[P in keyof IdToCls as IdToCls[P] extends T ? P : never]: P;
|
||||
};
|
||||
|
||||
/**
|
||||
* 某种类型的道具的id
|
||||
*/
|
||||
type ItemIdOf<T extends ItemCls> = keyof {
|
||||
[P in keyof ItemDeclaration as ItemDeclaration[P] extends T ? P : never]: P;
|
||||
};
|
||||
|
||||
/**
|
||||
* 某个道具的类型
|
||||
*/
|
||||
type ItemClsOf<T extends AllIdsOf<'items'>> = ItemDeclaration[T];
|
||||
|
||||
/**
|
||||
* 获取某个图块的类型
|
||||
*/
|
||||
type ClsOf<T extends AllIds> = IdToCls[T];
|
||||
|
||||
/**
|
||||
* 某种类型的图块数字
|
||||
*/
|
||||
type AllNumbersOf<T extends Cls> = IdToNumber[AllIdsOf<T>];
|
||||
|
||||
/**
|
||||
* 选取在一段字符串中的映射名称
|
||||
*/
|
||||
type NameMapIn<T extends string> = keyof {
|
||||
[P in keyof NameMap as NameMap[P] extends T ? P : never]: NameMap[P];
|
||||
};
|
||||
|
||||
/**
|
||||
* 所有的怪物id
|
||||
*/
|
||||
type EnemyIds = AllIdsOf<'enemys' | 'enemy48'>;
|
||||
|
||||
/**
|
||||
* 各种图块的动画数量
|
||||
*/
|
||||
interface FrameNumbers {
|
||||
autotile: 4;
|
||||
animates: 4;
|
||||
enemys: 2;
|
||||
items: 1;
|
||||
npcs: 2;
|
||||
terrains: 1;
|
||||
enemy48: 4;
|
||||
npc48: 4;
|
||||
}
|
||||
|
||||
/**
|
||||
* 动画帧数
|
||||
*/
|
||||
type FrameOf<T extends Cls> = FrameNumbers[T];
|
||||
|
||||
/**
|
||||
* 所有的文件名
|
||||
*/
|
||||
type SourceIds = ImageIds | AnimationIds | SoundIds | BgmIds | FontIds;
|
||||
Vendored
+943
-161
File diff suppressed because it is too large.
Load diff
Vendored
+723
-385
File diff suppressed because it is too large.
Load diff
Vendored
+607
-317
File diff suppressed because it is too large.
Load diff
Reference in new issue
Block a user