From 90f14bc0673dc38a194173781d7c9effb5612ed8 Mon Sep 17 00:00:00 2001
From: unanmed <1319491857@qq.com>
Date: Wed, 4 Jan 2023 11:32:01 +0800
Subject: [PATCH] =?UTF-8?q?=E9=85=8D=E7=BD=AE=E8=87=AA=E5=8A=A8=E9=83=A8?=
=?UTF-8?q?=E7=BD=B2=EF=BC=8C=E5=88=A0=E9=99=A4=E9=83=A8=E5=88=86=E4=B8=8D?=
=?UTF-8?q?=E9=9C=80=E8=A6=81=E7=9A=84=E5=87=BD=E6=95=B0?=
MIME-Version: 1.0
Content-Type: text/plain; charset=UTF-8
Content-Transfer-Encoding: 8bit
---
.github/workflows/codeql.yml | 74 ++++
.github/workflows/page.yml | 38 ++
public/_server/table/functions.comment.js | 383 +++++++++-----------
public/libs/actions.js | 29 +-
public/libs/control.js | 15 -
public/libs/ui.js | 11 -
public/main.js | 9 -
public/project/functions.js | 421 +---------------------
src/data/desc.json | 8 +-
src/types/function.d.ts | 24 --
src/types/ui.d.ts | 5 -
11 files changed, 301 insertions(+), 716 deletions(-)
create mode 100644 .github/workflows/codeql.yml
create mode 100644 .github/workflows/page.yml
diff --git a/.github/workflows/codeql.yml b/.github/workflows/codeql.yml
new file mode 100644
index 0000000..db494d9
--- /dev/null
+++ b/.github/workflows/codeql.yml
@@ -0,0 +1,74 @@
+# For most projects, this workflow file will not need changing; you simply need
+# to commit it to your repository.
+#
+# You may wish to alter this file to override the set of languages analyzed,
+# or to provide custom queries or build logic.
+#
+# ******** NOTE ********
+# We have attempted to detect the languages in your repository. Please check
+# the `language` matrix defined below to confirm you have the correct set of
+# supported CodeQL languages.
+#
+name: "CodeQL"
+
+on:
+ push:
+ branches: [ "master" ]
+ pull_request:
+ # The branches below must be a subset of the branches above
+ branches: [ "master" ]
+ schedule:
+ - cron: '29 5 * * 5'
+
+jobs:
+ analyze:
+ name: Analyze
+ runs-on: ubuntu-latest
+ permissions:
+ actions: read
+ contents: read
+ security-events: write
+
+ strategy:
+ fail-fast: false
+ matrix:
+ language: [ 'javascript' ]
+ # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ]
+ # Learn more about CodeQL language support at https://aka.ms/codeql-docs/language-support
+
+ steps:
+ - name: Checkout repository
+ uses: actions/checkout@v3
+
+ # Initializes the CodeQL tools for scanning.
+ - name: Initialize CodeQL
+ uses: github/codeql-action/init@v2
+ with:
+ languages: ${{ matrix.language }}
+ # If you wish to specify custom queries, you can do so here or in a config file.
+ # By default, queries listed here will override any specified in a config file.
+ # Prefix the list here with "+" to use these queries and those in the config file.
+
+ # Details on CodeQL's query packs refer to : https://docs.github.com/en/code-security/code-scanning/automatically-scanning-your-code-for-vulnerabilities-and-errors/configuring-code-scanning#using-queries-in-ql-packs
+ # queries: security-extended,security-and-quality
+
+
+ # Autobuild attempts to build any compiled languages (C/C++, C#, Go, or Java).
+ # If this step fails, then you should remove it and run the build manually (see below)
+ - name: Autobuild
+ uses: github/codeql-action/autobuild@v2
+
+ # ℹ️ Command-line programs to run using the OS shell.
+ # 📚 See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#jobsjob_idstepsrun
+
+ # If the Autobuild fails above, remove it and uncomment the following three lines.
+ # modify them (or add more) to build your code if your project, please refer to the EXAMPLE below for guidance.
+
+ # - run: |
+ # echo "Run, Build Application using script"
+ # ./location_of_script_within_repo/buildscript.sh
+
+ - name: Perform CodeQL Analysis
+ uses: github/codeql-action/analyze@v2
+ with:
+ category: "/language:${{matrix.language}}"
diff --git a/.github/workflows/page.yml b/.github/workflows/page.yml
new file mode 100644
index 0000000..9f1e991
--- /dev/null
+++ b/.github/workflows/page.yml
@@ -0,0 +1,38 @@
+# Simple workflow for deploying static content to GitHub Pages
+name: Deploy static content to Pages
+
+on:
+ # Runs on pushes targeting the default branch
+ push:
+ branches:
+ - master
+
+# Allow one concurrent deployment
+concurrency:
+ group: 'pages'
+ cancel-in-progress: true
+
+jobs:
+ # Single deploy job since we're just deploying
+ deploy:
+ runs-on: ubuntu-latest
+ steps:
+ - name: Checkout
+ uses: actions/checkout@v2
+ with:
+ persist-credentials: false
+
+ # 执行依赖安装
+ - name: 安装依赖
+ run: |
+ npm i -g pnpm
+ pnpm i
+ pnpm build
+
+ # 执行部署
+ - name: 部署
+ uses: JamesIves/github-pages-deploy-action@releases/v3 # 这个action会根据配置自动推送代码到指定分支
+ with:
+ ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} # 指定密钥
+ BRANCH: gh-pages ##指定推送到的远程分支
+ FOLDER: dist # 指定构建之后要推送哪个目录的代码
diff --git a/public/_server/table/functions.comment.js b/public/_server/table/functions.comment.js
index f14d295..7521c40 100644
--- a/public/_server/table/functions.comment.js
+++ b/public/_server/table/functions.comment.js
@@ -6,207 +6,182 @@
*/
var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
- "_type": "object",
- "_data": {
- "events": {
- "_type": "object",
- "_data": {
- "resetGame": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "重置游戏"
- },
- "win": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "游戏获胜"
- },
- "lose": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "游戏失败"
- },
- "changingFloor": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "切换楼层中"
- },
- "afterChangeFloor": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "切换楼层后"
- },
- "flyTo": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "楼层飞行"
- },
- "beforeBattle": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "战前判定"
- },
- "afterBattle": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "战后脚本"
- },
- "afterOpenDoor": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "开门后脚本"
- },
- "afterGetItem": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "道具后脚本"
- },
- "afterPushBox": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "推箱子后"
- }
- }
- },
- "enemys": {
- "_type": "object",
- "_data": {
- "getSpecials": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "怪物特殊属性"
- },
- "getEnemyInfo": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "怪物真实属性"
- },
- "getDamageInfo": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "战斗伤害信息"
- }
- }
- },
- "actions": {
- "_type": "object",
- "_data": {
- "onKeyUp": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "按键处理"
- },
- "onStatusBarClick": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_docs": "点击状态栏",
- "_data": "状态栏点击事件,仅在开启自绘状态栏时生效"
- }
- }
- },
- "control": {
- "_type": "object",
- "_data": {
- "saveData": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "存档操作"
- },
- "loadData": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "读档操作"
- },
- "getStatusLabel": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "状态名定义"
- },
- "triggerDebuff": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "毒衰咒处理"
- },
- "updateStatusBar": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "更新状态栏"
- },
- "updateCheckBlock": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "阻激夹域伤害"
- },
- "moveOneStep": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "每步后操作"
- },
- "moveDirectly": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "瞬间移动"
- },
- "parallelDo": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "并行脚本"
- }
- }
- },
- "ui": {
- "_type": "object",
- "_data": {
- "getToolboxItems": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "道具栏显示项"
- },
- "drawStatusBar": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "自绘状态栏"
- },
- "drawStatistics": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "数据统计"
- },
- "drawAbout": {
- "_leaf": true,
- "_type": "textarea",
- "_lint": true,
- "_data": "关于界面"
- }
- }
- }
- }
-}
\ No newline at end of file
+ _type: 'object',
+ _data: {
+ events: {
+ _type: 'object',
+ _data: {
+ resetGame: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '重置游戏'
+ },
+ win: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '游戏获胜'
+ },
+ lose: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '游戏失败'
+ },
+ changingFloor: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '切换楼层中'
+ },
+ afterChangeFloor: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '切换楼层后'
+ },
+ flyTo: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '楼层飞行'
+ },
+ beforeBattle: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '战前判定'
+ },
+ afterBattle: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '战后脚本'
+ },
+ afterOpenDoor: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '开门后脚本'
+ },
+ afterGetItem: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '道具后脚本'
+ },
+ afterPushBox: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '推箱子后'
+ }
+ }
+ },
+ enemys: {
+ _type: 'object',
+ _data: {
+ getSpecials: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '怪物特殊属性'
+ },
+ getEnemyInfo: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '怪物真实属性'
+ },
+ getDamageInfo: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '战斗伤害信息'
+ }
+ }
+ },
+ actions: {
+ _type: 'object',
+ _data: {
+ onKeyUp: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '按键处理'
+ }
+ }
+ },
+ control: {
+ _type: 'object',
+ _data: {
+ saveData: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '存档操作'
+ },
+ loadData: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '读档操作'
+ },
+ getStatusLabel: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '状态名定义'
+ },
+ triggerDebuff: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '毒衰咒处理'
+ },
+ updateStatusBar: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '更新状态栏'
+ },
+ updateCheckBlock: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '阻激夹域伤害'
+ },
+ moveOneStep: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '每步后操作'
+ },
+ moveDirectly: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '瞬间移动'
+ },
+ parallelDo: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '并行脚本'
+ }
+ }
+ },
+ ui: {
+ _type: 'object',
+ _data: {
+ drawStatistics: {
+ _leaf: true,
+ _type: 'textarea',
+ _lint: true,
+ _data: '数据统计'
+ }
+ }
+ }
+ }
+};
diff --git a/public/libs/actions.js b/public/libs/actions.js
index a892818..0598622 100644
--- a/public/libs/actions.js
+++ b/public/libs/actions.js
@@ -125,13 +125,6 @@ actions.prototype._init = function () {
this._sys_longClick_lockControl,
50
);
- // --- onStatusBarClick注册
- this.registerAction(
- 'onStatusBarClick',
- '_sys_onStatusBarClick',
- this._sys_onStatusBarClick,
- 0
- );
};
////// 注册一个用户交互行为 //////
@@ -1050,24 +1043,6 @@ actions.prototype._sys_longClick_lockControl = function (x, y, px, py) {
return false;
};
-actions.prototype.onStatusBarClick = function (e) {
- if (!core.isPlaying()) return false;
- var left = core.dom.gameGroup.offsetLeft + 3;
- var top = core.dom.gameGroup.offsetTop + 3;
- var px = parseInt((e.clientX - left) / core.domStyle.scale),
- py = parseInt((e.clientY - top) / core.domStyle.scale);
- return this.doRegisteredAction(
- 'onStatusBarClick',
- Math.max(px, 0),
- Math.max(py, 0)
- );
-};
-
-actions.prototype._sys_onStatusBarClick = function (px, py, vertical) {
- if (this.actionsdata.onStatusBarClick)
- return this.actionsdata.onStatusBarClick(px, py, vertical);
-};
-
/////////////////// 在某个界面时的按键点击效果 ///////////////////
actions.prototype._getChoicesTopIndex = function (length) {
@@ -2992,10 +2967,8 @@ actions.prototype._clickGameInfo = function (x, y) {
case 3:
return core.ui._drawHelp();
case 4:
- return core.ui._drawAbout();
- case 5:
return this._clickGameInfo_download();
- case 6:
+ case 5:
core.status.event.selection = 5;
core.playSound('取消');
core.ui._drawSettings();
diff --git a/public/libs/control.js b/public/libs/control.js
index 8c4f800..24d55e6 100644
--- a/public/libs/control.js
+++ b/public/libs/control.js
@@ -2471,20 +2471,6 @@ control.prototype._replayAction_key = function (action) {
return true;
};
-control.prototype._replayAction_click = function (action) {
- if (action.indexOf('click:') != 0) return false;
- var p = action.split(':');
- if (p.length != 4) return false;
- core.actions.doRegisteredAction(
- 'onStatusBarClick',
- parseInt(p[2]),
- parseInt(p[3]),
- parseInt(p[1])
- );
- core.replay();
- return true;
-};
-
control.prototype._replayAction_ignoreInput = function (action) {
if (
action.indexOf('input:') == 0 ||
@@ -3202,7 +3188,6 @@ control.prototype.setHeroLoc = function (name, value, noGather) {
if ((name == 'x' || name == 'y') && !noGather) {
this.gatherFollowers();
}
- core.ui.drawStatusBar();
};
////// 获得勇士的位置 //////
diff --git a/public/libs/ui.js b/public/libs/ui.js
index f9b283a..3c071a4 100644
--- a/public/libs/ui.js
+++ b/public/libs/ui.js
@@ -3176,7 +3176,6 @@ ui.prototype._drawGameInfo = function () {
'查看工程',
'游戏主页',
'操作帮助',
- '关于游戏',
'下载离线版本',
'返回主菜单'
]);
@@ -3836,11 +3835,6 @@ ui.prototype._drawKeyBoard = function () {
);
};
-////// 绘制状态栏 /////
-ui.prototype.drawStatusBar = function () {
- this.uidata.drawStatusBar();
-};
-
////// 绘制“数据统计”界面 //////
ui.prototype._drawStatistics = function (floorIds) {
core.playSound('打开界面');
@@ -4079,11 +4073,6 @@ ui.prototype._drawStatistics_generateText = function (obj, type, data) {
return text;
};
-////// 绘制“关于”界面 //////
-ui.prototype._drawAbout = function () {
- return this.uidata.drawAbout();
-};
-
////// 绘制帮助页面 //////
ui.prototype._drawHelp = function () {
core.playSound('打开界面');
diff --git a/public/main.js b/public/main.js
index d5fff40..5bb63e7 100644
--- a/public/main.js
+++ b/public/main.js
@@ -715,15 +715,6 @@ main.prototype.listen = function () {
}
};
- main.dom.statusCanvas.onclick = function (e) {
- try {
- e.preventDefault();
- main.core.onStatusBarClick(e);
- } catch (e) {
- console.error(e);
- }
- };
-
////// 点击状态栏中的怪物手册时 //////
main.statusBar.image.book.onclick = function (e) {
e.stopPropagation();
diff --git a/public/project/functions.js b/public/project/functions.js
index ac269bf..2cb9794 100644
--- a/public/project/functions.js
+++ b/public/project/functions.js
@@ -1149,48 +1149,20 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
case 74: // J:打开技能树
core.useItem('skill1');
break;
- case 56: // 8
- core.useItem('wand');
- break;
case 27: // ESC:打开菜单栏
core.openSettings(true);
break;
case 88: // X:使用怪物手册
- if (!core.getFlag('fixToBook')) core.openBook(true);
- else core.useItem('wand');
+ core.openBook(true);
break;
case 71: // G:使用楼传器
core.useFly(true);
break;
case 65: // A:读取自动存档(回退)
- if (core.status.floorId != 'tower6') {
- core.doSL('autoSave', 'load');
- } else {
- core.myconfirm(
- '确定要读取自动存档吗?读取后无法通过按W回退至现在',
- function () {
- core.doSL('autoSave', 'load');
- },
- function () {
- return;
- }
- );
- }
+ core.doSL('autoSave', 'load');
break;
case 87: // W:撤销回退
- if (core.status.floorId != 'tower6') {
- core.doSL('autoSave', 'reload');
- } else {
- core.myconfirm(
- '确定要撤销回退吗?撤销后后无法通过按A回退至现在',
- function () {
- core.doSL('autoSave', 'reload');
- },
- function () {
- return;
- }
- );
- }
+ core.doSL('autoSave', 'reload');
break;
case 83: // S:存档
core.save(true);
@@ -1278,62 +1250,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
}
}
break;
- case 51: // 快捷键3: 飞
- break;
- case 52: // 快捷键4:破冰/冰冻/地震/上下楼器/... 其他道具依次判断
- {
- var list = [
- 'icePickaxe',
- 'freezeBadge',
- 'earthquake',
- 'upFly',
- 'downFly',
- 'jumpShoes',
- 'lifeWand',
- 'poisonWine',
- 'weakWine',
- 'curseWine',
- 'superWine'
- ];
- for (var i = 0; i < list.length; i++) {
- var itemId = list[i];
- if (core.canUseItem(itemId)) {
- core.status.route.push('key:52');
- core.useItem(itemId, true);
- break;
- }
- }
- }
- break;
case 53: // 5:读取自动存档(回退),方便手机版操作
- if (core.status.floorId != 'tower6') {
- core.doSL('autoSave', 'load');
- } else {
- core.myconfirm(
- '确定要读取自动存档吗?读取后无法通过按6回退至现在',
- function () {
- core.doSL('autoSave', 'load');
- },
- function () {
- return;
- }
- );
- }
+ core.doSL('autoSave', 'load');
break;
case 54: // 6:撤销回退,方便手机版操作
- if (core.status.floorId != 'tower6') {
- core.doSL('autoSave', 'reload');
- } else {
- core.myconfirm(
- '确定要撤销回退吗?撤销后后无法通过按5回退至现在',
- function () {
- core.doSL('autoSave', 'reload');
- },
- function () {
- return;
- }
- );
- }
+ core.doSL('autoSave', 'reload');
break;
case 55: // 快捷键7:绑定为轻按,方便手机版操作
core.getNextItem();
@@ -1341,55 +1262,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
case 118: // F7:开启debug模式
core.debug();
break;
- case 70: // F:开启技能“二倍斩”
- break;
- // 在这里可以任意新增或编辑已有的快捷键内容
- /*
- case 0: // 使用该按键的keyCode
- // 还可以再判定altKey是否被按下,即 if (altKey) { ...
-
- // ... 在这里写你要执行脚本
- // **强烈建议所有新增的自定义快捷键均能给个对应的道具可点击,以方便手机端的行为**
- if (core.hasItem('...')) {
- core.status.route.push("key:0");
- core.useItem('...', true); // 增加true代表该使用道具不计入录像
- }
-
- break;
- */
}
- },
- onStatusBarClick: function (px, py) {
- // 点击状态栏时触发的事件,仅在自绘状态栏开启时生效
- // px和py为点击的像素坐标
- //
- // 横屏模式下状态栏的画布大小是 149*480
- // 竖屏模式下状态栏的画布大小是 480*(32*rows+9) 其中rows为状态栏行数,即全塔属性中statusCanvasRowsOnMobile值
- // 可以使用 core.domStyle.isVertical 来判定当前是否是竖屏模式
-
- // 如果正在执行事件,则忽略
- if (core.status.lockControl) return;
- // 如果当前正在行走,则忽略;也可以使用 core.waitHeroToStop(callback) 来停止行走再回调执行脚本
- if (core.isMoving()) return;
-
- if (!core.domStyle.isVertical) {
- if (px >= 20 && px <= 129 && py >= 320 && py <= 350) {
- core.useItem('skill1');
- }
- if (px >= 20 && px <= 129 && py >= 280 && py <= 310) {
- core.useItem('cross');
- }
- } else {
- if (px >= 400 && px <= 430 && py >= 10 && py <= 95) {
- core.useItem('skill1');
- }
- if (px >= 440 && px <= 470 && py >= 10 && py <= 95) {
- core.useItem('cross');
- }
- }
- // 判定px和py来执行自己的脚本内容.... 注意横竖屏
- // 这里是直接打出点击坐标的例子。
- // console.log("onStatusBarClick:", px, py);
}
},
control: {
@@ -1514,52 +1387,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// action:获得还是解除;'get'表示获得,'remove'表示解除
// type:一个数组表示获得了哪些毒衰咒效果;poison, weak,curse
if (!(type instanceof Array)) type = [type];
-
- if (action == 'get') {
- if (core.inArray(type, 'poison') && !core.hasFlag('poison')) {
- // 获得毒效果
- core.setFlag('poison', true);
- }
- if (core.inArray(type, 'weak') && !core.hasFlag('weak')) {
- // 获得衰效果
- core.setFlag('weak', true);
- if (core.values.weakValue >= 1) {
- // >=1,直接扣数值
- core.addStatus('atk', -core.values.weakValue);
- core.addStatus('def', -core.values.weakValue);
- } else {
- // <1,扣比例
- core.addBuff('atk', -core.values.weakValue);
- core.addBuff('def', -core.values.weakValue);
- }
- }
- if (core.inArray(type, 'curse') && !core.hasFlag('curse')) {
- // 获得咒效果
- core.setFlag('curse', true);
- }
- } else if (action == 'remove') {
- if (core.inArray(type, 'poison') && core.hasFlag('poison')) {
- // 移除毒效果
- core.setFlag('poison', false);
- }
- if (core.inArray(type, 'weak') && core.hasFlag('weak')) {
- // 移除衰效果
- core.setFlag('weak', false);
- if (core.values.weakValue >= 1) {
- // >=1,直接扣数值
- core.addStatus('atk', core.values.weakValue);
- core.addStatus('def', core.values.weakValue);
- } else {
- // <1,扣比例
- core.addBuff('atk', core.values.weakValue);
- core.addBuff('def', core.values.weakValue);
- }
- }
- if (core.inArray(type, 'curse') && core.hasFlag('curse')) {
- // 移除咒效果
- core.setFlag('curse', false);
- }
- }
},
updateStatusBar: function () {
// 更新状态栏
@@ -1567,125 +1394,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 检查等级
core.events.checkLvUp();
- // 检查HP上限
- if (core.flags.statusBarItems.indexOf('enableHPMax') >= 0) {
- core.setStatus(
- 'hp',
- Math.min(core.getStatus('hpmax'), core.getStatus('hp'))
- );
- }
-
- // 设置楼层名
- if (core.status.floorId) {
- core.setStatusBarInnerHTML(
- 'floor',
- core.status.maps[core.status.floorId].name
- );
- }
-
- // 设置勇士名字和图标
- core.setStatusBarInnerHTML('name', core.getStatus('name'));
- // 设置等级名称
- core.setStatusBarInnerHTML('lv', core.getLvName());
-
- // 设置生命上限、生命值、攻防护盾金币和经验值
- var statusList = [
- 'hpmax',
- 'hp',
- 'mana',
- 'atk',
- 'def',
- 'mdef',
- 'money',
- 'exp'
- ];
- statusList.forEach(function (item) {
- // 向下取整
- core.status.hero[item] = Math.floor(core.status.hero[item]);
- // 大数据格式化
- core.setStatusBarInnerHTML(item, core.getRealStatus(item));
- });
-
- // 设置魔力值; status:manamax 只有在非负时才生效。
- if (
- core.status.hero.manamax != null &&
- core.getRealStatus('manamax') >= 0
- ) {
- core.status.hero.mana = Math.min(
- core.status.hero.mana,
- core.getRealStatus('manamax')
- );
- core.setStatusBarInnerHTML(
- 'mana',
- core.status.hero.mana + '/' + core.getRealStatus('manamax')
- );
- } else {
- core.setStatusBarInnerHTML('mana', core.status.hero.mana);
- }
- // 设置技能栏
- // 可以用flag:skill表示当前开启的技能类型,flag:skillName显示技能名;详见文档-个性化-技能塔的支持
- core.setStatusBarInnerHTML(
- 'skill',
- core.getFlag('skillName', '无')
- );
-
- // 可以在这里添加自己额外的状态栏信息,比如想攻击显示 +0.5 可以这么写:
- // if (core.hasFlag('halfAtk')) core.setStatusBarInnerHTML('atk', core.statusBar.atk.innerText + "+0.5");
-
// 如果是自定义添加的状态栏,也需要在这里进行设置显示的数值
- // 进阶
- if (
- core.flags.statusBarItems.indexOf('enableLevelUp') >= 0 &&
- core.status.hero.lv < core.firstData.levelUp.length
- ) {
- var need = core.calValue(
- core.firstData.levelUp[core.status.hero.lv].need
- );
- if (core.flags.statusBarItems.indexOf('levelUpLeftMode') >= 0)
- core.setStatusBarInnerHTML(
- 'up',
- core.formatBigNumber(need - core.getStatus('exp')) || ''
- );
- else
- core.setStatusBarInnerHTML(
- 'up',
- core.formatBigNumber(need) || ''
- );
- } else core.setStatusBarInnerHTML('up', '');
-
- // 钥匙
- var keys = ['yellowKey', 'blueKey', 'redKey', 'greenKey'];
- keys.forEach(function (key) {
- core.setStatusBarInnerHTML(
- key,
- core.setTwoDigits(core.itemCount(key))
- );
- });
- // 毒衰咒
- core.setStatusBarInnerHTML(
- 'poison',
- core.hasFlag('poison') ? '毒' : ''
- );
- core.setStatusBarInnerHTML(
- 'weak',
- core.hasFlag('weak') ? '衰' : ''
- );
- core.setStatusBarInnerHTML(
- 'curse',
- core.hasFlag('curse') ? '咒' : ''
- );
- // 破炸飞
- core.setStatusBarInnerHTML(
- 'pickaxe',
- '破' + core.itemCount('pickaxe')
- );
- core.setStatusBarInnerHTML('bomb', '炸' + core.itemCount('bomb'));
- core.setStatusBarInnerHTML(
- 'fly',
- '飞' + core.itemCount('centerFly')
- );
-
// 难度
if (core.statusBar.hard.innerText != core.status.hard) {
core.statusBar.hard.innerText = core.status.hard;
@@ -1695,8 +1405,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
core.statusBar.hard.style.color = hardColor;
core.statusBar.hard.setAttribute('_style', hardColor);
}
- // 自定义状态栏绘制
- core.drawStatusBar();
// 更新阻激夹域的伤害值
core.updateCheckBlock();
@@ -1902,32 +1610,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
}
}
- // 捕捉
- // 如果要防止捕捉效果,可以直接简单的将 flag:no_ambush 设为true
- if (
- enemy &&
- core.enemys.hasSpecial(enemy.special, 27) &&
- !core.hasFlag('no_ambush')
- ) {
- // 给周围格子加上【捕捉】记号
- for (var dir in core.utils.scan) {
- var nx = x + core.utils.scan[dir].x,
- ny = y + core.utils.scan[dir].y,
- currloc = nx + ',' + ny;
- if (
- nx < 0 ||
- nx >= width ||
- ny < 0 ||
- ny >= height ||
- !core.canMoveHero(x, y, dir, floorId)
- )
- continue;
- ambush[currloc] = (ambush[currloc] || []).concat([
- [x, y, id, dir]
- ]);
- }
- }
-
// 夹击;在这里提前计算所有可能的夹击点,具体计算逻辑在下面
// 如果要防止夹击伤害,可以简单的将 flag:no_betweenAttack 设为true
if (
@@ -2026,13 +1708,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
}
}
- // 取消注释下面这一段可以让护盾抵御阻激夹域伤害
- /*
- for (var loc in damage) {
- damage[loc] = Math.max(0, damage[loc] - core.getRealStatus('mdef'));
- }
- */
-
core.flags.canGoDeadZone = canGoDeadZone;
core.status.checkBlock = {
damage: damage,
@@ -2084,9 +1759,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 执行目标点的阻激夹域事件
core.checkBlock();
- // 执行目标点的script和事件
- if (core.status.floorId == 'tower6')
- core.setMapBlockDisabled('tower6', nowx, nowy, false);
if (!hasTrigger) core.trigger(nowx, nowy, callback);
// 检查该点是否是滑冰
@@ -2234,14 +1906,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y);
if (core.status.checkBlock.haveHunt) return false;
if (ignoreSteps >= 0) {
- // 中毒也允许瞬移
- if (core.hasFlag('poison')) {
- var damage = ignoreSteps * core.values.poisonDamage;
- if (damage >= core.status.hero.hp) return false;
- core.status.hero.statistics.poisonDamage += damage;
- core.status.hero.hp -= damage;
- }
-
core.clearMap('hero');
// 获得勇士最后的朝向
var lastDirection =
@@ -2284,25 +1948,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
}
},
ui: {
- getToolboxItems: function (cls) {
- // 获得道具栏中当前某类型道具的显示项和显示顺序
- // cls为道具类型,只可能是 tools, constants 和 equips
- // 返回一个数组,代表当前某类型道具的显示内容和顺序
- // 默认按id升序排列,您可以取消下面的注释改为按名称排列
- //
- // 用不到这个东西
- },
- drawStatusBar: function () {
- // 自定义绘制状态栏,需要开启状态栏canvas化
- // 作为样板,只绘制楼层、生命、攻击、防御、护盾、金币、钥匙这七个内容
- // 需要其他的请自行进行修改;横竖屏都需要进行适配绘制。
- // (可以使用Chrome浏览器开控制台来模拟手机上的竖屏模式的显示效果,具体方式自行百度)
- // 横屏模式下的画布大小是 149*480
- // 竖屏模式下的画布大小是 480*(32*rows+9) 其中rows为状态栏行数,即全塔属性中statusCanvasRowsOnMobile值
- // 可以使用 core.domStyle.isVertical 来判定当前是否是竖屏模式
- //
- // 这里不需要写任何东西,状态栏全在vue里面
- },
drawStatistics: function () {
// 浏览地图时参与的统计项目
@@ -2352,62 +1997,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
'shield5'
// 在这里可以增加新的ID来进行统计个数,只能增加道具ID
];
- },
- drawAbout: function () {
- // 绘制“关于”界面
- core.ui.closePanel();
- core.lockControl();
- core.status.event.id = 'about';
-
- var left = 52,
- top = 68,
- right = core.__PIXELS__ - 2 * left,
- bottom = core.__PIXELS__ - 2 * top;
-
- core.setAlpha('ui', 0.85);
- core.fillRect('ui', left, top, right, bottom, '#000000');
- core.setAlpha('ui', 1);
- core.strokeRect(
- 'ui',
- left - 1,
- top - 1,
- right + 1,
- bottom + 1,
- '#FFFFFF',
- 2
- );
-
- var text_start = left + 24;
-
- // 名称
- core.setTextAlign('ui', 'left');
- var globalAttribute =
- core.status.globalAttribute || core.initStatus.globalAttribute;
- core.fillText(
- 'ui',
- 'HTML5 魔塔样板',
- text_start,
- top + 35,
- globalAttribute.selectColor,
- 'bold 22px ' + globalAttribute.font
- );
- core.fillText(
- 'ui',
- '版本: ' + main.__VERSION__,
- text_start,
- top + 80,
- '#FFFFFF',
- 'bold 17px ' + globalAttribute.font
- );
- core.fillText('ui', '作者: 艾之葵', text_start, top + 112);
- core.fillText(
- 'ui',
- 'HTML5魔塔交流群:539113091',
- text_start,
- top + 112 + 32
- );
- // TODO: 写自己的“关于”页面,每次增加32像素即可
- core.playSound('打开界面');
}
}
};
diff --git a/src/data/desc.json b/src/data/desc.json
index 784e487..76df3aa 100644
--- a/src/data/desc.json
+++ b/src/data/desc.json
@@ -6,7 +6,8 @@
"这里显示本塔中需要注意的事项。",
"
",
"
",
- "1. 本百科全书字数很多,可以选择性地阅读。",
+ "1. ",
+ "本百科全书字数很多,可以选择性地阅读。",
"
",
"
",
"2. 本塔中几乎所有 ui 都可以纵向滚动,如果发现显示不全,",
@@ -78,7 +79,7 @@
"勇士的金币,可以用于购买物品。本塔中在进入第二章后会有用",
"
",
"6. 护盾:",
- "勇士的护盾,用处是能够在战后减少同等数值的伤害,可以使伤害变为负值。本塔中,在点开无上之盾技能后,",
+ "勇士的护盾,用处是能够在战后减少同等数值的伤害,在本塔中可以使伤害变为负值。本塔中,在点开无上之盾技能后,",
"智慧会充当护盾。更多信息可以查看“勇士属性”条目。"
]
},
@@ -287,8 +288,7 @@
"
",
"
",
"点击一个怪物或者按下回车空格后,将进入怪物详细信息界面。这个界面分为多个栏,分别是特殊属性栏,详细临界栏,更多信息栏。",
- "进入怪物详细信息后默认在特殊属性栏,该栏可以查看怪物的特殊属性。",
- "同时也是唯一一个会在点击屏幕后会返回到怪物手册界面的栏,更多信息请查看本条目的最后一段。",
+ "进入怪物详细信息后默认在特殊属性栏,该栏可以查看怪物的特殊属性。",
"注意特殊属性依然可以纵向滚动。在特殊属性下方,",
"是怪物的临界表,可以粗略地查看怪物的临界信息。在下方,你可以点击详细临界信息进入详细临界栏。",
"
",
diff --git a/src/types/function.d.ts b/src/types/function.d.ts
index 4edc5bb..da25f9b 100644
--- a/src/types/function.d.ts
+++ b/src/types/function.d.ts
@@ -5,14 +5,6 @@ interface ActionData {
* @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 {
@@ -125,26 +117,10 @@ interface EnemyData {
}
interface UiData {
- /**
- * 获取道具栏要显示的道具
- * @param cls 要获取的类型
- */
- getToolboxItems>(cls: T): ItemIdOf[];
-
- /**
- * 绘制状态栏
- */
- drawStatusBar(): void;
-
/**
* 数据统计界面统计的道具数量
*/
drawStatistics(): AllIdsOf<'items'>[];
-
- /**
- * 绘制关于界面
- */
- drawAbout(): void;
}
interface EventData {
diff --git a/src/types/ui.d.ts b/src/types/ui.d.ts
index 5a2bd2c..ed0cc57 100644
--- a/src/types/ui.d.ts
+++ b/src/types/ui.d.ts
@@ -755,11 +755,6 @@ interface Ui {
*/
getToolboxItems>(cls: T): ItemIdOf[];
- /**
- * 绘制状态栏
- */
- drawStatusBar(): void;
-
/**
* 动态创建一个画布
* @param name 画布名称,如果已存在则会直接取用当前存在的