From 53ae839457e09f71230d6a4e4aa4a1476db9be02 Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Sat, 6 Jun 2020 10:29:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=96=B0=E5=8F=98=E9=87=8F=E7=9A=84?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=A1=A5=E5=85=A8?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _docs/event.md | 2 +- _docs/personalization.md | 1 - _server/CodeMirror/defs.js | 171 ++++++++++++++++++++++++++++++++++++- _server/MotaAction.g4 | 4 +- libs/events.js | 1 + runtime.d.ts | 5 +- 6 files changed, 174 insertions(+), 10 deletions(-) diff --git a/_docs/event.md b/_docs/event.md index f14a9265..b01e9ecf 100644 --- a/_docs/event.md +++ b/_docs/event.md @@ -676,7 +676,7 @@ loc为可选的,表示要更改地图块的坐标。如果忽略此项,则 name是可选的,代表目标行走图的文件名。
!> **目标行走图必须在全塔属性的 `images` 中被定义过,且宽度至少是128像素(高度不限)。**
如果不加name,则恢复默认的角色行走图 `hero.png` 。
如果要修改勇士的名称,可以使用`setValue`事件来修改`status:name`,但请注意value必须加单引号,不然会报错。
-如果你需要获取当前的行走图文件名,可以使用 `flags.heroIcon` ,但不要直接修改它。 +如果你需要获取当前的行走图文件名,可以使用 `core.status.hero.image` ,但不要直接修改它。 ### update:立刻更新状态栏和地图显伤 如果你需要刷新状态栏和地图显伤,只需要简单地调用 `{"type": "update", "doNotCheckAutoEvents": true}` 。 ### showStatusBar / hideStatusBar:显隐状态栏 diff --git a/_docs/personalization.md b/_docs/personalization.md index 77e87529..ddc76c03 100644 --- a/_docs/personalization.md +++ b/_docs/personalization.md @@ -651,7 +651,6 @@ if (core.flags.statusBarItems.indexOf('enableSkill')>=0) { - **`flag:input`**: 接受用户输入的事件后,存放用户输入的结果。 - **`flag:type`**, **`flag:keycode`**, **`flag:x`**, **`flag:y`**, **`flag:px`**, **`flag:py`**: 等待用户操作后,用户的操作类型,按键keycode或点击/像素坐标。 - **`flag:skill`**, **`flag:skillName`**: 开启的技能编号和技能名。 -- **`flag:heroIcon`**: 当前的勇士行走图名称。 - **`flag:saveEquips`**: 快速换装时保存的套装。 - **`flag:__visited__`**: 当前访问过的楼层。 - **`flag:__atk_buff__`**, **`flag:__def_buff__`**, **`flag:__mdef_buff__`**: 当前攻防护盾的实际计算比例加成。 diff --git a/_server/CodeMirror/defs.js b/_server/CodeMirror/defs.js index c2286277..5a3854b5 100644 --- a/_server/CodeMirror/defs.js +++ b/_server/CodeMirror/defs.js @@ -1182,6 +1182,102 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ { "!name": "core", "!define": { + "flag": { + "!doc": "当前变量", + "hard": { + "!type": "number", + "!doc": "当前难度编号" + }, + "hatred":{ + "!type": "number", + "!doc": "当前仇恨值" + }, + "poison":{ + "!type": "bool", + "!doc": "是否处于中毒状态" + }, + "weak":{ + "!type": "number", + "!doc": "是否处于衰弱状态" + }, + "curse":{ + "!type": "number", + "!doc": "是否处于诅咒状态" + }, + "no_zone": { + "!type": "bool", + "!doc": "无视领域伤害" + }, + "no_repulse": { + "!type": "bool", + "!doc": "无视阻击伤害" + }, + "no_lasel": { + "!type": "bool", + "!doc": "无视激光伤害" + }, + "no_ambush": { + "!type": "bool", + "!doc": "无视捕捉" + }, + "__bgm__": { + "!type": "string", + "!doc": "背景音乐" + }, + "__weather__": { + "!doc": "天气" + }, + "__color__": { + "!doc": "色调" + }, + "__volume__": { + "!type": "number", + "!doc": "音量" + }, + "skill": { + "!type": "number", + "!doc": "当前开启的技能编号" + }, + "skillName": { + "!type": "string", + "!doc": "当前开启的技能名" + }, + "input": { + "!type": "string|number", + "!doc": "等待用户输入后的存放值" + }, + "type": { + "!type": "number", + "!doc": "等待用户操作后获得的操作类型" + }, + "keycode": { + "!type": "number", + "!doc": "等待用户操作后用户按键的键值" + }, + "x": { + "!type": "number", + "!doc": "等待用户操作后用户点击的网格横坐标" + }, + "y": { + "!type": "number", + "!doc": "等待用户操作后用户点击的网格纵坐标" + }, + "px": { + "!type": "number", + "!doc": "等待用户操作后用户点击的像素横坐标" + }, + "py": { + "!type": "number", + "!doc": "等待用户操作后用户点击的像素纵坐标" + }, + "__visited__": { + "!doc": "当前访问过的楼层" + }, + "cannotMoveDirectly": { + "!type": "bool", + "!doc": "当前是否全局不可瞬移" + }, + }, "hero": { "!doc": "勇士当前属性", "image": { @@ -1246,7 +1342,27 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ "!doc": "永久道具" }, "tools": { - "!doc": "消耗道具" + "!doc": "消耗道具", + "yellowKey": { + "!type": "number", + "!doc": "黄钥匙个数" + }, + "blueKey": { + "!type": "number", + "!doc": "蓝钥匙个数" + }, + "redKey": { + "!type": "number", + "!doc": "红钥匙个数" + }, + "greenKey": { + "!type": "number", + "!doc": "绿钥匙个数" + }, + "steelKey": { + "!type": "number", + "!doc": "铁门钥匙个数" + }, }, "equips": { "!doc": "未装备上的装备" @@ -1268,7 +1384,8 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ }, }, "flags": { - "!doc": "当前变量" + "!type": "flag", + "!doc": "当前游戏中用到的变量" }, "followers": { "!type": "[?]", @@ -1748,7 +1865,6 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ "!doc": "全局动画的帧状态" }, "globalAttribute": { - "!type": "Object", "!doc": "全局css属性" }, "hard": { @@ -1861,5 +1977,54 @@ var terndefs_f6783a0a_522d_417e_8407_94c67b692e50 = [ "_doc": "返回地图上某个点的图块信息" } }, + "hero": { + "!type": "heroStatus", + "!doc": "勇士信息,为 core.status.hero 的简写", + }, + "flags": { + "!doc": "游戏中用到的变量,为 core.status.hero.flags 的简写", + "hatred":{ + "!type": "number", + "!doc": "当前仇恨值" + }, + "poison":{ + "!type": "bool", + "!doc": "是否处于中毒状态" + }, + "weak":{ + "!type": "number", + "!doc": "是否处于衰弱状态" + }, + "curse":{ + "!type": "number", + "!doc": "是否处于诅咒状态" + }, + "no_zone": { + "!type": "bool", + "!doc": "无视领域伤害" + }, + "no_repulse": { + "!type": "bool", + "!doc": "无视阻击伤害" + }, + "no_lasel": { + "!type": "bool", + "!doc": "无视激光伤害" + }, + "no_ambush": { + "!type": "bool", + "!doc": "无视捕捉" + }, + "__bgm__": { + "!type": "string", + "!doc": "背景音乐" + }, + "__weather__": { + "!doc": "天气" + }, + "__color__": { + "!doc": "色调" + }, + } } ]; \ No newline at end of file diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index 77ecf791..dba4e924 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -1250,7 +1250,7 @@ return code; */; showFloorImg_s - : '显示贴图' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline + : '显示贴图' '像素坐标' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline /* showFloorImg_s @@ -1282,7 +1282,7 @@ return code; */; hideFloorImg_s - : '隐藏贴图' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline + : '隐藏贴图' '像素坐标' 'x' EvalString? ',' 'y' EvalString? '楼层' IdString? Newline /* hideFloorImg_s diff --git a/libs/events.js b/libs/events.js index 88c8bff0..b3f558ec 100644 --- a/libs/events.js +++ b/libs/events.js @@ -3023,6 +3023,7 @@ events.prototype.setHeroIcon = function (name, noDraw) { console.error("找不到图片: "+img); return; } + if (core.material.images.hero == img) return; core.status.hero.image = name; core.material.images.hero = img; core.material.icons.hero.width = img.width / 4; diff --git a/runtime.d.ts b/runtime.d.ts index 0cfcd062..78a6016f 100644 --- a/runtime.d.ts +++ b/runtime.d.ts @@ -502,7 +502,6 @@ declare class control { /** * 读取一个flag变量 - * @example core.getFlag('heroIcon', 'hero.png'); // 读取主角当前的行走图文件名,默认为'hero.png' * @param name 变量名,支持中文 * @param defaultValue 当变量不存在时的返回值,可选(事件流中默认填0)。 * @returns flags[name] ?? defaultValue @@ -989,8 +988,8 @@ declare class events { /** * 更改主角行走图 - * @example core.setHeroIcon('npc48.png'); // 把主角从阳光变成样板0层左下角的小姐姐,但不立即刷新 - * @param name 新的行走图文件名,可以是全塔属性中映射前的中文名。映射后会被存入flags.heroIcon + * @example core.setHeroIcon('npc48.png', true); // 把主角从阳光变成样板0层左下角的小姐姐,但不立即刷新 + * @param name 新的行走图文件名,可以是全塔属性中映射前的中文名。映射后会被存入core.status.hero.image * @param noDraw true表示不立即刷新(刷新会导致大地图下视野重置到以主角为中心) */ setHeroIcon(name: string, noDraw?: boolean): void