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>
</div> </div>
<!-- injection --> <!-- injection -->
<script src='libs/thirdparty/browser-polyfill.min.js'></script>
<script src='libs/thirdparty/lz-string.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/priority-queue.min.js'></script>
<script src='libs/thirdparty/localforage.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

View File

@ -51,7 +51,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 隐藏右下角的音乐按钮 // 隐藏右下角的音乐按钮
core.dom.musicBtn.style.display = 'none'; core.dom.musicBtn.style.display = 'none';
core.dom.enlargeBtn.style.display = 'none'; core.dom.enlargeBtn.style.display = 'none';
}, },
"win": function (reason, norank, noexit) { "win": function (reason, norank, noexit) {
// 游戏获胜事件 // 游戏获胜事件
// 请注意成绩统计时是按照hp进行上传并排名 // 请注意成绩统计时是按照hp进行上传并排名
@ -80,7 +80,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.events.gameOver(reason || '', replaying, norank); core.events.gameOver(reason || '', replaying, norank);
}) })
}); });
}, },
"lose": function (reason) { "lose": function (reason) {
// 游戏失败事件 // 游戏失败事件
core.ui.closePanel(); core.ui.closePanel();
@ -93,7 +93,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.events.gameOver(null, replaying); core.events.gameOver(null, replaying);
}); });
}) })
}, },
"changingFloor": function (floorId, heroLoc) { "changingFloor": function (floorId, heroLoc) {
// 正在切换楼层过程中执行的操作;此函数的执行时间是“屏幕完全变黑“的那一刻 // 正在切换楼层过程中执行的操作;此函数的执行时间是“屏幕完全变黑“的那一刻
// floorId为要切换到的楼层IDheroLoc表示勇士切换到的位置 // floorId为要切换到的楼层IDheroLoc表示勇士切换到的位置
@ -161,7 +161,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// ...可以新增一些其他内容,比如创建个画布在右上角显示什么内容等等 // ...可以新增一些其他内容,比如创建个画布在右上角显示什么内容等等
}, },
"afterChangeFloor": function (floorId) { "afterChangeFloor": function (floorId) {
// 转换楼层结束的事件;此函数会在整个楼层切换完全结束后再执行 // 转换楼层结束的事件;此函数会在整个楼层切换完全结束后再执行
// floorId是切换到的楼层 // floorId是切换到的楼层
@ -180,7 +180,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.visitFloor(floorId); core.visitFloor(floorId);
} }
} }
}, },
"flyTo": function (toId, callback) { "flyTo": function (toId, callback) {
// 楼层传送器的使用从当前楼层飞往toId // 楼层传送器的使用从当前楼层飞往toId
// 如果不能飞行请返回false // 如果不能飞行请返回false
@ -223,7 +223,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}); });
return true; return true;
}, },
"beforeBattle": function (enemyId, x, y) { "beforeBattle": function (enemyId, x, y) {
// 战斗前触发的事件,可以加上一些战前特效(详见下面支援的例子) // 战斗前触发的事件,可以加上一些战前特效(详见下面支援的例子)
// 此函数在“检测能否战斗和自动存档”【之后】执行。如果需要更早的战前事件,请在插件中覆重写 core.events.doSystemEvent 函数。 // 此函数在“检测能否战斗和自动存档”【之后】执行。如果需要更早的战前事件,请在插件中覆重写 core.events.doSystemEvent 函数。
@ -245,7 +245,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}); });
core.push(actions, [ core.push(actions, [
{ "type": "waitAsync" }, // 等待所有异步事件执行完毕 { "type": "waitAsync" }, // 等待所有异步事件执行完毕
{ "type": "setBlock", "number": enemyId, "loc": [[x, y]]}, // 重新设置怪物自身 { "type": "setBlock", "number": enemyId, "loc": [[x, y]] }, // 重新设置怪物自身
{ "type": "battle", "loc": [x, y] } // 重要!重新触发本次战斗 { "type": "battle", "loc": [x, y] } // 重要!重新触发本次战斗
]); ]);
core.insertAction(actions); core.insertAction(actions);
@ -254,7 +254,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
return true; return true;
}, },
"afterBattle": function (enemyId, x, y) { "afterBattle": function (enemyId, x, y) {
// 战斗结束后触发的事件 // 战斗结束后触发的事件
@ -405,7 +405,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (todo.length > 0) core.insertAction(todo, x, y); if (todo.length > 0) core.insertAction(todo, x, y);
// 删除该点设置的怪物信息 // 删除该点设置的怪物信息
delete ((flags.enemyOnPoint||{})[core.status.floorId]||{})[x+","+y]; delete ((flags.enemyOnPoint || {})[core.status.floorId] || {})[x + "," + y];
// 因为removeBlock和hideBlock都会刷新状态栏因此将删除部分移动到这里并保证刷新只执行一次以提升效率 // 因为removeBlock和hideBlock都会刷新状态栏因此将删除部分移动到这里并保证刷新只执行一次以提升效率
if (core.getBlock(x, y) != null) { if (core.getBlock(x, y) != null) {
@ -425,7 +425,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
else else
core.clearContinueAutomaticRoute(); core.clearContinueAutomaticRoute();
}, },
"afterOpenDoor": function (doorId, x, y) { "afterOpenDoor": function (doorId, x, y) {
// 开一个门后触发的事件 // 开一个门后触发的事件
@ -446,7 +446,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.continueAutomaticRoute(); core.continueAutomaticRoute();
else else
core.clearContinueAutomaticRoute(); core.clearContinueAutomaticRoute();
}, },
"afterGetItem": function (itemId, x, y, isGentleClick) { "afterGetItem": function (itemId, x, y, isGentleClick) {
// 获得一个道具后触发的事件 // 获得一个道具后触发的事件
// itemId获得的道具IDx和y是该道具所在的坐标 // itemId获得的道具IDx和y是该道具所在的坐标
@ -467,7 +467,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
if (todo.length > 0) core.insertAction(todo, x, y); if (todo.length > 0) core.insertAction(todo, x, y);
}, },
"afterPushBox": function () { "afterPushBox": function () {
// 推箱子后的事件 // 推箱子后的事件
if (core.searchBlock('box').length == 0) { if (core.searchBlock('box').length == 0) {
@ -480,7 +480,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
*/ */
} }
} }
}, },
"enemys": { "enemys": {
"getSpecials": function () { "getSpecials": function () {
@ -518,7 +518,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
[26, "支援", "当周围一圈的怪物受到攻击时将上前支援,并组成小队战斗。", "#77c0b6", 1], [26, "支援", "当周围一圈的怪物受到攻击时将上前支援,并组成小队战斗。", "#77c0b6", 1],
[27, "捕捉", function (enemy) { return "当走到怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时会强制进行战斗。"; }, "#c0ddbb"] [27, "捕捉", function (enemy) { return "当走到怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时会强制进行战斗。"; }, "#c0ddbb"]
]; ];
}, },
"getEnemyInfo": function (enemy, hero, x, y, floorId) { "getEnemyInfo": function (enemy, hero, x, y, floorId) {
// 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用 // 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用
// 例如:坚固、模仿、仿攻等等 // 例如:坚固、模仿、仿攻等等
@ -565,7 +565,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 已经计算过的光环怪ID列表用于判定叠加 // 已经计算过的光环怪ID列表用于判定叠加
var usedEnemyIds = {}; var usedEnemyIds = {};
// 检查光环和支援的缓存 // 检查光环和支援的缓存
var index = x != null && y != null ? (x + "," + y) : "floor"; var index = x != null && y != null ? (x + "," + y) : floorId;
if (!core.status.checkBlock.cache) core.status.checkBlock.cache = {}; if (!core.status.checkBlock.cache) core.status.checkBlock.cache = {};
var cache = core.status.checkBlock.cache[index]; var cache = core.status.checkBlock.cache[index];
if (!cache) { if (!cache) {
@ -641,7 +641,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"special": mon_special, "special": mon_special,
"guards": guards, // 返回支援情况 "guards": guards, // 返回支援情况
}; };
}, },
"getDamageInfo": function (enemy, hero, x, y, floorId) { "getDamageInfo": function (enemy, hero, x, y, floorId) {
// 获得战斗伤害信息(实际伤害计算函数) // 获得战斗伤害信息(实际伤害计算函数)
// //
@ -799,7 +799,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"turn": Math.floor(turn), "turn": Math.floor(turn),
"damage": Math.floor(damage) "damage": Math.floor(damage)
}; };
} }
}, },
"actions": { "actions": {
"onKeyUp": function (keyCode, altKey) { "onKeyUp": function (keyCode, altKey) {
@ -949,7 +949,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
*/ */
} }
}, },
"onStatusBarClick": function (px, py, vertical) { "onStatusBarClick": function (px, py, vertical) {
// 点击状态栏时触发的事件,仅在自绘状态栏开启时生效 // 点击状态栏时触发的事件,仅在自绘状态栏开启时生效
// px和py为点击的像素坐标 // px和py为点击的像素坐标
@ -1019,7 +1019,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
*/ */
} }
}, },
"control": { "control": {
"saveData": function () { "saveData": function () {
@ -1037,7 +1037,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
'floorId': core.status.floorId, 'floorId': core.status.floorId,
'hero': core.clone(core.status.hero), 'hero': core.clone(core.status.hero),
'hard': core.status.hard, 'hard': core.status.hard,
'maps': core.maps.saveMap(), 'maps': core.clone(core.maps.saveMap()),
'route': core.encodeRoute(core.status.route), 'route': core.encodeRoute(core.status.route),
'values': values, 'values': values,
'version': core.firstData.version, 'version': core.firstData.version,
@ -1046,7 +1046,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}; };
return data; return data;
}, },
"loadData": function (data, callback) { "loadData": function (data, callback) {
// 读档操作;从存储中读取了内容后的行为 // 读档操作;从存储中读取了内容后的行为
@ -1085,7 +1085,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.removeFlag('__fromLoad__'); core.removeFlag('__fromLoad__');
if (callback) callback(); if (callback) callback();
}); });
}, },
"getStatusLabel": function (name) { "getStatusLabel": function (name) {
// 返回某个状态英文名的对应中文标签如atk -> 攻击def -> 防御等。 // 返回某个状态英文名的对应中文标签如atk -> 攻击def -> 防御等。
// 请注意此项仅影响 libs/ 下的内容(如绘制怪物手册、数据统计等) // 请注意此项仅影响 libs/ 下的内容(如绘制怪物手册、数据统计等)
@ -1105,8 +1105,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
exp: "经验", exp: "经验",
point: "加点", point: "加点",
steps: "步数", steps: "步数",
} [name] || name; }[name] || name;
}, },
"triggerDebuff": function (action, type) { "triggerDebuff": function (action, type) {
// 毒衰咒效果的获得与解除 // 毒衰咒效果的获得与解除
// action获得还是解除'get'表示获得,'remove'表示解除 // action获得还是解除'get'表示获得,'remove'表示解除
@ -1163,7 +1163,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
} }
if (success) core.playSound('回血'); if (success) core.playSound('回血');
} }
}, },
"updateStatusBar": function () { "updateStatusBar": function () {
// 更新状态栏 // 更新状态栏
@ -1245,7 +1245,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.updateCheckBlock(); core.updateCheckBlock();
// 更新全地图显伤 // 更新全地图显伤
core.updateDamage(); core.updateDamage();
}, },
"updateCheckBlock": function (floorId) { "updateCheckBlock": function (floorId) {
// 领域、夹击、阻击等的伤害值计算 // 领域、夹击、阻击等的伤害值计算
floorId = floorId || core.status.floorId; floorId = floorId || core.status.floorId;
@ -1456,7 +1456,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
needCache: needCache, needCache: needCache,
cache: {} // clear cache cache: {} // clear cache
}; };
}, },
"moveOneStep": function (callback) { "moveOneStep": function (callback) {
// 勇士每走一步后执行的操作。callback为行走完毕后的回调 // 勇士每走一步后执行的操作。callback为行走完毕后的回调
// 这个函数执行在“刚走完”的时候,即还没有检查该点的事件和领域伤害等。 // 这个函数执行在“刚走完”的时候,即还没有检查该点的事件和领域伤害等。
@ -1519,7 +1519,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 如需强行终止行走可以在这里条件判定: // 如需强行终止行走可以在这里条件判定:
// core.stopAutomaticRoute(); // core.stopAutomaticRoute();
}, },
"moveDirectly": function (x, y, ignoreSteps) { "moveDirectly": function (x, y, ignoreSteps) {
// 瞬间移动x,y为要瞬间移动的点ignoreSteps为减少的步数可能之前已经被计算过 // 瞬间移动x,y为要瞬间移动的点ignoreSteps为减少的步数可能之前已经被计算过
// 返回true代表成功瞬移false代表没有成功瞬移 // 返回true代表成功瞬移false代表没有成功瞬移
@ -1557,7 +1557,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
return true; return true;
} }
return false; return false;
}, },
"parallelDo": function (timestamp) { "parallelDo": function (timestamp) {
// 并行事件处理,可以在这里写任何需要并行处理的脚本或事件 // 并行事件处理,可以在这里写任何需要并行处理的脚本或事件
// 该函数将被系统反复执行每次执行间隔视浏览器或设备性能而定一般约为16.6ms一次 // 该函数将被系统反复执行每次执行间隔视浏览器或设备性能而定一般约为16.6ms一次
@ -1574,7 +1574,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
main.log(e); main.log(e);
} }
} }
} }
}, },
"ui": { "ui": {
"getToolboxItems": function (cls) { "getToolboxItems": function (cls) {
@ -1585,8 +1585,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
return Object.keys(core.status.hero.items[cls] || {}) return Object.keys(core.status.hero.items[cls] || {})
.filter(function (id) { return !core.material.items[id].hideInToolbox; }) .filter(function (id) { return !core.material.items[id].hideInToolbox; })
.sort( /*function (id1, id2) { return core.material.items[id1].name <= core.material.items[id2].name ? -1 : 1 }*/ ); .sort( /*function (id1, id2) { return core.material.items[id1].name <= core.material.items[id2].name ? -1 : 1 }*/);
}, },
"drawStatusBar": function () { "drawStatusBar": function () {
// 自定义绘制状态栏需要开启状态栏canvas化 // 自定义绘制状态栏需要开启状态栏canvas化
@ -1689,7 +1689,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
_fillBoldTextWithFontCheck(core.setTwoDigits(core.itemCount('blueKey')), 177, 90, '#AAAADD'); _fillBoldTextWithFontCheck(core.setTwoDigits(core.itemCount('blueKey')), 177, 90, '#AAAADD');
_fillBoldTextWithFontCheck(core.setTwoDigits(core.itemCount('redKey')), 212, 90, '#FF8888'); _fillBoldTextWithFontCheck(core.setTwoDigits(core.itemCount('redKey')), 212, 90, '#FF8888');
} }
}, },
"drawStatistics": function () { "drawStatistics": function () {
// 浏览地图时参与的统计项目 // 浏览地图时参与的统计项目
@ -1705,7 +1705,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
'shield1', 'shield2', 'shield3', 'shield4', 'shield5', 'shield1', 'shield2', 'shield3', 'shield4', 'shield5',
// 在这里可以增加新的ID来进行统计个数只能增加道具ID // 在这里可以增加新的ID来进行统计个数只能增加道具ID
]; ];
}, },
"drawAbout": function () { "drawAbout": function () {
// 绘制“关于”界面 // 绘制“关于”界面
core.ui.closePanel(); core.ui.closePanel();
@ -1733,6 +1733,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.fillText('ui', 'HTML5魔塔交流群539113091', text_start, top + 112 + 32); core.fillText('ui', 'HTML5魔塔交流群539113091', text_start, top + 112 + 32);
// TODO: 写自己的“关于”页面每次增加32像素即可 // TODO: 写自己的“关于”页面每次增加32像素即可
core.playSound('打开界面'); core.playSound('打开界面');
} }
} }
} }

168
runtime.d.ts vendored
View File

@ -8,6 +8,8 @@ type move = 'forward' | direction
type loc = { direction: direction, x: number, y: number } type loc = { direction: direction, x: number, y: number }
type rgbarray = [number, number, number, number] type rgbarray = [number, number, number, number]
type Events = MotaAction[] | string
type Block = { type Block = {
x: number, x: number,
y: number, y: number,
@ -45,7 +47,53 @@ type Floor = {
} }
type ResolvedMap = { 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 = { type Enemy = {
@ -150,8 +198,42 @@ type gameStatus = {
fgmaps: { [key: string]: number[][] } fgmaps: { [key: string]: number[][] }
mapBlockObjs: { [key: string]: any } mapBlockObjs: { [key: string]: any }
/** 显伤伤害 */ /** 显伤伤害 */
checkBlock: {} checkBlock: {
damage: {} 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 lockControl: boolean
@ -182,13 +264,13 @@ type gameStatus = {
ctrlDown: boolean ctrlDown: boolean
// 路线&回放 // 路线&回放
route: [], route: string[],
replay: { replay: {
replaying: boolean replaying: boolean
pausing: boolean pausing: boolean
/** 正在某段动画中 */animate: boolean /** 正在某段动画中 */animate: boolean
toReplay: [] toReplay: string[]
totalList: [] totalList: string[]
speed: number speed: number
steps: number steps: number
save: [] save: []
@ -197,13 +279,13 @@ type gameStatus = {
// event事件 // event事件
shops: {} shops: {}
event: { event: {
id: null id: string
data: null data: any
selection: null selection: any
ui: null ui: any
interval: null interval: number
} }
autoEvents: [] autoEvents: Events
textAttribute: { textAttribute: {
position: string position: string
offset: number offset: number
@ -253,28 +335,6 @@ declare class control {
*/ */
updateStatusBar(doNotCheckAutoEvents?: boolean): void 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/变量 */ /** 删除某个flag/变量 */
removeFlag(name: string): void removeFlag(name: string): void
@ -406,7 +466,7 @@ declare class control {
nearHero(x: number, y: number, n?: number): boolean nearHero(x: number, y: number, n?: number): boolean
/** /**
* * 使使core.updateStatusBar()
* @example core.updateDamage(); // 更新当前地图的显伤,绘制在显伤层(废话) * @example core.updateDamage(); // 更新当前地图的显伤,绘制在显伤层(废话)
* @param floorId id * @param floorId id
* @param ctx * @param ctx
@ -445,10 +505,10 @@ declare class control {
* @example core.getRealStatus('atk'); // 计算主角的攻击力,包括百分比修正。战斗使用的就是这个值 * @example core.getRealStatus('atk'); // 计算主角的攻击力,包括百分比修正。战斗使用的就是这个值
* @param name NaN * @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 * 1
@ -457,7 +517,7 @@ declare class control {
* @param name NaN * @param name NaN
* @param value 1 * @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) * core.setBuff(name, core.getBuff(name) + value)
@ -465,21 +525,21 @@ declare class control {
* @param name NaN * @param name NaN
* @param value * @param value
*/ */
addBuff(name: string, value: number): void addBuff<K extends keyof HeroStatus>(name: K, value: HeroStatus[K]): void
/** /**
* 1 * 1
* @example core.getBuff('atk'); // 主角当前能发挥出多大比例的攻击力 * @example core.getBuff('atk'); // 主角当前能发挥出多大比例的攻击力
* @param name * @param name
*/ */
getBuff(name: string): number getBuff<K extends keyof HeroStatus>(name: HeroStatus[K]): number
/** /**
* *
* @param action 'get''remove' * @param action 'get''remove'
* @param type * @param type
*/ */
triggerDebuff(action: string, type: string|string[]): void triggerDebuff(action: string, type: string | string[]): void
/** /**
* *
@ -516,7 +576,7 @@ declare class control {
* *
* null * null
*/ */
getNextLvUpNeed() : number getNextLvUpNeed(): number
/** /**
* flag变量 * flag变量
@ -556,13 +616,13 @@ declare class control {
* @param type * @param type
* @param level 105 * @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 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() * 使core.events._action_setCurtain()
@ -581,7 +641,7 @@ declare class control {
* @param times 01 * @param times 01
* @param callback * @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__ * flags.__bgm__
@ -910,7 +970,7 @@ declare class events {
* @param callback * @param callback
* @param addToLast true表示插入到末尾 * @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 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 win(reason?: string, norank?: boolean, noexit?: boolean): void
@ -1641,7 +1701,7 @@ declare class maps {
* @param showDisable true表示计入 * @param showDisable true表示计入
* @returns * @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表示计入 * @param showDisable true表示计入
* @returns * @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 stopAnimate(id?: number, doCallback?: boolean): void
/** 获得当前正在播放的所有指定动画的id列表 */ /** 获得当前正在播放的所有指定动画的id列表 */
getPlayingAnimates(name?: string) : Array<number> getPlayingAnimates(name?: string): Array<number>
/** 加载某个楼层(从剧本或存档中) */ /** 加载某个楼层(从剧本或存档中) */
loadFloor(floorId?: string, map?: any): any loadFloor(floorId?: string, map?: any): any
@ -1910,7 +1970,7 @@ declare class maps {
/** @file loader.js 主要负责资源的加载 */ /** @file loader.js 主要负责资源的加载 */
declare class loader { 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 loadImage(dir: any, imgName?: any, callback?: () => any): any
@ -2055,7 +2115,7 @@ declare class items {
* @param beComparedEquipId id * @param beComparedEquipId id
* @returns 0 * @returns 0
*/ */
compareEquipment(compareEquipId: string, beComparedEquipId: string): { [key: string]: number} compareEquipment(compareEquipId: string, beComparedEquipId: string): { [key: string]: number }
/** /**
* *
@ -2246,7 +2306,7 @@ declare class ui {
drawUIEventSelector(code: number, background: string, x: number, y: number, w: number, h: number, z?: number): void 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 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 clone<T>(data?: T, filter?: (name: string, value: any) => boolean, recursion?: boolean): T
/** 深拷贝一个1D或2D的数组 */ /** 深拷贝一个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>>
/** /**
* *