kill bug & new function
This commit is contained in:
parent
4a801cbc85
commit
144ef9755e
@ -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>
|
||||||
|
|||||||
609
libs/control.js
609
libs/control.js
File diff suppressed because it is too large
Load Diff
2
libs/thirdparty/browser-polyfill.min.js
vendored
2
libs/thirdparty/browser-polyfill.min.js
vendored
File diff suppressed because one or more lines are too long
693
libs/ui.js
693
libs/ui.js
File diff suppressed because it is too large
Load Diff
@ -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为要切换到的楼层ID;heroLoc表示勇士切换到的位置
|
// floorId为要切换到的楼层ID;heroLoc表示勇士切换到的位置
|
||||||
@ -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:获得的道具ID;x和y是该道具所在的坐标
|
// itemId:获得的道具ID;x和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
168
runtime.d.ts
vendored
@ -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 新天气(晴天除外)的级别,必须为不大于10的正整数,不填视为5
|
* @param level 新天气(晴天除外)的级别,必须为不大于10的正整数,不填视为5
|
||||||
*/
|
*/
|
||||||
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 闪烁的总次数,不填或填0都视为1
|
* @param times 闪烁的总次数,不填或填0都视为1
|
||||||
* @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>>
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 等比例切分一张图片
|
* 等比例切分一张图片
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user