更新变量的自动补全

This commit is contained in:
ckcz123 2020-06-06 10:29:06 +08:00
parent 923f16e77e
commit 53ae839457
6 changed files with 174 additions and 10 deletions

View File

@ -676,7 +676,7 @@ loc为可选的表示要更改地图块的坐标。如果忽略此项
name是可选的代表目标行走图的文件名。
<br>!> **目标行走图必须在全塔属性的 `images` 中被定义过且宽度至少是128像素高度不限。**<br>如果不加name则恢复默认的角色行走图 `hero.png`<br>
如果要修改勇士的名称,可以使用`setValue`事件来修改`status:name`但请注意value必须加单引号不然会报错。<br>
如果你需要获取当前的行走图文件名,可以使用 `flags.heroIcon` ,但不要直接修改它。
如果你需要获取当前的行走图文件名,可以使用 `core.status.hero.image` ,但不要直接修改它。
### update立刻更新状态栏和地图显伤
如果你需要刷新状态栏和地图显伤,只需要简单地调用 `{"type": "update", "doNotCheckAutoEvents": true}`
### showStatusBar / hideStatusBar显隐状态栏

View File

@ -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__`**: 当前攻防护盾的实际计算比例加成。

View File

@ -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": "色调"
},
}
}
];

View File

@ -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

View File

@ -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;

5
runtime.d.ts vendored
View File

@ -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