HumanBreak/src/types/function.d.ts

252 lines
5.7 KiB
TypeScript
Raw Normal View History

interface ActionData {
/**
*
* @param keyCode keyCode
* @param altKey alt键
*/
onKeyUp(keyCode: number, altKey: boolean): boolean;
}
interface ControlData {
/**
*
*/
saveData(): Save;
/**
*
* @param data
* @param callback
*/
loadData(data: Save, callback?: () => void): void;
/**
*
* @param name
*/
getStatusLabel(name: string): string;
/**
*
*/
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 {
/**
*
*/
drawStatistics(): AllIdsOf<'items'>[];
}
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
*/
2023-01-01 22:02:58 +08:00
flyTo(toId: FloorIds, callback?: () => void): boolean;
/**
*
* @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;
}