Merge pull request #1 from ckcz123/v2.x

V2.x
This commit is contained in:
AutumnOrange51 2020-05-14 16:02:47 +08:00 committed by GitHub
commit fedafb2917
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
70 changed files with 5974 additions and 6211 deletions

View File

@ -99,9 +99,9 @@ core.status.hero 勇士信息此项和全塔属性中的hero大体是
core.status.hero.mana 当前魔力值
core.status.hero.atk 当前攻击力
core.status.hero.def 当前防御力
core.status.hero.mdef 当前魔防
core.status.hero.mdef 当前护盾
core.status.hero.money 当前金币值
core.status.hero.experience 当前经验值
core.status.hero.exp 当前经验值
core.status.hero.loc 当前的位置信息
core.status.hero.equipment 当前装上的装备
core.status.hero.items 当前拥有的道具信息
@ -749,7 +749,7 @@ core.getDamage(enemy, x, y, floorId)
core.getExtraDamage(enemy, x, y, floorId)
获得某个怪物的额外伤害值(不可被魔防减伤)。
获得某个怪物的额外伤害值(不可被护盾减伤)。
目前暂时只包含了仇恨和固伤两者,如有需要可复写该函数。
@ -815,12 +815,7 @@ core.startGame(hard, seed, route, callback)
开始新游戏。
hard为难度字符串会被设置为core.status.hard。
seed为开始时要设置的的种子route为要开始播放的录像callback为回调函数。
该函数将重置整个游戏调用setInitData执行startText事件上传游戏人数统计信息等。
core.setInitData()
根据难度分歧来初始化难度包括设置flag:hard设置初始属性等。
该函数实际被转发到了脚本编辑中,执行脚本编辑中的内容。
该函数将重置整个游戏执行startText事件上传游戏人数统计信息等。
core.win(reason, norank)
@ -1042,7 +1037,7 @@ core.follow(name) / core.unfollow(name)
跟随和取消跟随都会调用core.gatherFollowers()来聚集所有的跟随者。
core.setValue(name, value, prefix) / core.addValue(name, value, prefix)
core.setValue(name, operator, value, prefix) / core.addValue(name, value, prefix)
设置/增减某个数值。name可以是status:xxxitem:xxx或flag:xxx。
value可以是一个表达式将调用core.calValue()计算。prefix为前缀独立开关使用脚本中一般忽略。
@ -1142,10 +1137,6 @@ core.tryUseItem(itemId)
对于怪物手册和楼传器将分别调用core.openBook()和core.useFly()函数。
对于中心对称飞行器则会调用core.drawCenterFly()函数。
对于其他的道具,将检查是否拥有,能否使用,并且进行使用。
core.afterUseBomb()
使用炸弹或圣锤后的事件。实际被转发到了脚本编辑中。
```
## icons.js
@ -1242,7 +1233,7 @@ core.unloadEquip(equipType, callback)
core.compareEquipment(compareEquipId, beComparedEquipId)
比较两个套装的差异。
此函数将对所有的勇士属性包括生命魔力攻防魔防金币等进行比较。
此函数将对所有的勇士属性包括生命魔力攻防护盾金币等进行比较。
如果存在差异的,将作为一个对象返回其差异内容。
@ -1532,13 +1523,13 @@ core.removeBlock(x, y, floorId)
如果存在自定义事件,则简单的禁用它,以供以后可能的启用事件。
core.removeBlockById(index, floorId)
core.removeBlockByIndex(index, floorId)
每个楼层的图块存成一个数组index即为该数组中的索引每个索引对应该地图中的一个图块
根据索引从地图的block数组中尽可能删除一个图块。floorId可不填或null表示当前楼层。
core.removeBlockByIds(floorId, ids)
ids为由索引组成的数组如[0,1]等
core.removeBlockByIndexes(indexes, floorId)
indexes为由索引组成的数组如[0,1]等
根据索引数组从地图的block数组中尽可能删除一系列图块。floorId可不填或null表示当前楼层。
@ -1625,7 +1616,7 @@ core.drawBoxAnimate()
绘制UI层的box动画如怪物手册和对话框中的帧动画等。
core.drawAnimate(name, x, y, callback)
core.drawAnimate(name, x, y, alignWindow, callback)
绘制一个动画。name为动画名x和y为绘制的基准坐标callback为绘制完毕的回调函数。
此函数将播放动画音效,并异步开始绘制该动画。
此函数会返回一个动画id可以通过core.stopAnimate()立刻停止该动画的播放。
@ -1889,8 +1880,8 @@ core.drawStatistics()
绘制数据统计。将从脚本编辑中获得要统计的数据列表,再遍历所有地图进行统计。
core.drawAbout() / core.drawPaint() / core.drawHelp()
绘制关于界面,绘图模式,帮助界面。
core.drawAbout() / core.drawHelp()
绘制关于界面,帮助界面。
// ------ 动态创建画布相关的API ------ //
@ -2100,10 +2091,6 @@ core.encodeBase64(str) / core.decodeBase64(str)
可用于解压缩录像数据
core.convertBase(str, fromBase, toBase)
任意进制转换。此函数可能执行的非常慢,慎用。
core.rand(num)
使用伪种子生成伪随机数。该随机函数能被录像支持。
num如果设置大于0则生成一个[0, num-1]之间的数否则生成一个0到1之间的浮点数。
@ -2159,11 +2146,6 @@ core.showWithAnimate(obj, speed, callback) / core.hideWithAnimate(obj, speed, ca
动画淡入或淡出一个对象。
core.consoleOpened()
检测当前的控制台是否处于开启状态。仅在全塔属性中的检查控制台开关开启时有效。
此函数有可能会存在误伤行为,即没开过控制台仍认为开启过。
core.hashCode(obj)
计算一个对象的哈希值。

View File

@ -52,7 +52,7 @@ core.updateStatusBar()
core.setStatus('atk', 1000)
将攻击力设置为1000这里把atk可以改成hp, def, mdef, money, experience等等。
将攻击力设置为1000这里把atk可以改成hp, def, mdef, money, exp等等。
本句等价于 core.status.hero.atk = 1000
@ -287,7 +287,7 @@ core.closePanel()
结束一切事件和绘制关闭UI窗口返回游戏进程。
core.replaceText(text)
core.replaceText(text, prefix, need, times)
将一段文字中的${}进行计算并替换。
@ -385,10 +385,6 @@ core.enemys.getDamage(enemyId, x, y, floorId)
后面三个参数是怪物坐标和楼层。
core.enemys.getExtraDamage(enemyId)
返回某个怪物会对勇士造成的额外伤害(不可被魔防抵消),例如仇恨、固伤等等。
core.enemys.nextCriticals(enemyId, number, x, y, floorId)
返回一个列表为接下来number可忽略默认为1个该怪物的临界值和临界减伤。
列表每一项类似 [x,y] 表示临界值为x且临界减伤为y。
@ -481,15 +477,15 @@ core.maps.canMoveDirectly(destX, destY)
该函数如果返回0则不可瞬间移动大于0则可以瞬间移动且返回值是跨度即少走的步数
core.maps.removeBlockById(index, floorId)
core.maps.removeBlockByIndexes(index, floorId)
根据索引删除或禁用某块。
core.maps.removeBlockByIds(floorId, ids)
core.maps.removeBlockByIndexes(indexes, floorId)
根据索引删除或禁用若干块。
core.maps.drawAnimate(name, x, y, callback)
core.maps.drawAnimate(name, x, y, alignWindow, callback)
播放一段动画name为动画名需在全塔属性注册x和y为坐标0-12之间callback可选为播放完毕的回调函数。
播放过程是异步的如需等待播放完毕请使用insertAction插入一条type:waitAsync事件。
此函数将随机返回一个数字id为此异步动画的唯一标识符。

View File

@ -99,9 +99,9 @@ core.status.hero 勇士信息此项和全塔属性中的hero大体是
core.status.hero.mana 当前魔力值
core.status.hero.atk 当前攻击力
core.status.hero.def 当前防御力
core.status.hero.mdef 当前魔防
core.status.hero.mdef 当前护盾
core.status.hero.money 当前金币值
core.status.hero.experience 当前经验值
core.status.hero.exp 当前经验值
core.status.hero.loc 当前的位置信息
core.status.hero.equipment 当前装上的装备
core.status.hero.items 当前拥有的道具信息
@ -747,11 +747,6 @@ core.getDamage(enemy, x, y, floorId)
如果没有破防或无法战斗则返回null否则返回具体的伤害值。
core.getExtraDamage(enemy, x, y, floorId)
获得某个怪物的额外伤害值(不可被魔防减伤)。
目前暂时只包含了仇恨和固伤两者,如有需要可复写该函数。
core.getDamageString(enemy, x, y, floorId)
获得某个怪物伤害字符串和颜色信息,以便于在地图上绘制显伤。
@ -814,12 +809,7 @@ core.startGame(hard, seed, route, callback)
开始新游戏。
hard为难度字符串会被设置为core.status.hard。
seed为开始时要设置的的种子route为要开始播放的录像callback为回调函数。
该函数将重置整个游戏调用setInitData执行startText事件上传游戏人数统计信息等。
core.setInitData()
根据难度分歧来初始化难度包括设置flag:hard设置初始属性等。
该函数实际被转发到了脚本编辑中,执行脚本编辑中的内容。
该函数将重置整个游戏执行startText事件上传游戏人数统计信息等。
core.win(reason, norank)
@ -1041,7 +1031,7 @@ core.follow(name) / core.unfollow(name)
跟随和取消跟随都会调用core.gatherFollowers()来聚集所有的跟随者。
core.setValue(name, value, prefix) / core.addValue(name, value, prefix)
core.setValue(name, operator, value, prefix) / core.addValue(name, value, prefix)
设置/增减某个数值。name可以是status:xxxitem:xxx或flag:xxx。
value可以是一个表达式将调用core.calValue()计算。prefix为前缀独立开关使用脚本中一般忽略。
@ -1141,10 +1131,6 @@ core.tryUseItem(itemId)
对于怪物手册和楼传器将分别调用core.openBook()和core.useFly()函数。
对于中心对称飞行器则会调用core.drawCenterFly()函数。
对于其他的道具,将检查是否拥有,能否使用,并且进行使用。
core.afterUseBomb()
使用炸弹或圣锤后的事件。实际被转发到了脚本编辑中。
```
## icons.js
@ -1241,7 +1227,7 @@ core.unloadEquip(equipType, callback)
core.compareEquipment(compareEquipId, beComparedEquipId)
比较两个套装的差异。
此函数将对所有的勇士属性包括生命魔力攻防魔防金币等进行比较。
此函数将对所有的勇士属性包括生命魔力攻防护盾金币等进行比较。
如果存在差异的,将作为一个对象返回其差异内容。
@ -1531,13 +1517,13 @@ core.removeBlock(x, y, floorId)
如果存在自定义事件,则简单的禁用它,以供以后可能的启用事件。
core.removeBlockById(index, floorId)
core.removeBlockByIndex(index, floorId)
每个楼层的图块存成一个数组index即为该数组中的索引每个索引对应该地图中的一个图块
根据索引从地图的block数组中尽可能删除一个图块。floorId可不填或null表示当前楼层。
core.removeBlockByIds(floorId, ids)
ids为由索引组成的数组如[0,1]等
core.removeBlockByIndexes(indexes, floorId)
indexes为由索引组成的数组如[0,1]等
根据索引数组从地图的block数组中尽可能删除一系列图块。floorId可不填或null表示当前楼层。
@ -1624,7 +1610,7 @@ core.drawBoxAnimate()
绘制UI层的box动画如怪物手册和对话框中的帧动画等。
core.drawAnimate(name, x, y, callback)
core.drawAnimate(name, x, y, alignWindow, callback)
绘制一个动画。name为动画名x和y为绘制的基准坐标callback为绘制完毕的回调函数。
此函数将播放动画音效,并异步开始绘制该动画。
此函数会返回一个动画id可以通过core.stopAnimate()立刻停止该动画的播放。
@ -1894,8 +1880,8 @@ core.drawStatistics()
绘制数据统计。将从脚本编辑中获得要统计的数据列表,再遍历所有地图进行统计。
core.drawAbout() / core.drawPaint() / core.drawHelp()
绘制关于界面,绘图模式,帮助界面。
core.drawAbout() / core.drawHelp()
绘制关于界面,帮助界面。
// ------ 动态创建画布相关的API ------ //
@ -2105,10 +2091,6 @@ core.encodeBase64(str) / core.decodeBase64(str)
可用于解压缩录像数据
core.convertBase(str, fromBase, toBase)
任意进制转换。此函数可能执行的非常慢,慎用。
core.rand(num)
使用伪种子生成伪随机数。该随机函数能被录像支持。
num如果设置大于0则生成一个[0, num-1]之间的数否则生成一个0到1之间的浮点数。
@ -2164,11 +2146,6 @@ core.showWithAnimate(obj, speed, callback) / core.hideWithAnimate(obj, speed, ca
动画淡入或淡出一个对象。
core.consoleOpened()
检测当前的控制台是否处于开启状态。仅在全塔属性中的检查控制台开关开启时有效。
此函数有可能会存在误伤行为,即没开过控制台仍认为开启过。
core.hashCode(obj)
计算一个对象的哈希值。

View File

@ -54,9 +54,9 @@
type为该装备的类型必填和上面装备栏一一对应。例如0就是武器2就是首饰等等。
atk/def/mdef为该装备分别增加的攻防魔防数值(支持负数);如果不加也可省略不写。
atk/def/mdef为该装备分别增加的攻防护盾数值(支持负数);如果不加也可省略不写。
从V2.6开始可以拓展到任何勇士的属性如hpmax, atk, def, mdef, experience等等自行添加的属性包括攻速speed也能使用。
从V2.6开始可以拓展到任何勇士的属性如hpmax, atk, def, mdef, exp等等自行添加的属性包括攻速speed也能使用。
animate为该装备的攻击动画仅对type为0时有效。具体可参见[动画和天气系统](#动画和天气系统)。
@ -68,9 +68,9 @@ percentage为该装备是否按比例增加属性。
{"type": 0, "atk": 10} // 装备类型是武器,效果是攻击+10使用默认的攻击动画
{"type": 0, "atk": 40, "animate": "sword"} // 装备类型为武器,效果是攻击+10攻击动画是sword
{"type": 1, "def": 40, "percentage": true} // 装备类型是防具效果是防御提升40%
{"type": 1, "def": 100, "mdef": 100} // 装备类型是防具,效果是防御和魔防各+100
{"type": 3, "atk": -20, "def": 50, "mdef": 50} // 装备类型是魔杖,效果是攻击-20防御和魔防各+50
{"type": 2, "atk": -20, "def": 50, "mdef": 50, "percentage": true} // 装备类型是魔杖效果是攻击下降20%,防御和魔防各提升50%
{"type": 1, "def": 100, "mdef": 100} // 装备类型是防具,效果是防御和护盾各+100
{"type": 3, "atk": -20, "def": 50, "mdef": 50} // 装备类型是魔杖,效果是攻击-20防御和护盾各+50
{"type": 2, "atk": -20, "def": 50, "mdef": 50, "percentage": true} // 装备类型是魔杖效果是攻击下降20%,防御和护盾各提升50%
```
所有取值全部向下取整。
@ -153,13 +153,13 @@ yellowWall, blueWall, whiteWall
怪物的特殊属性所对应的数字special在脚本编辑中的`getSpecials`中定义,请勿对已有的属性进行修改。
多属性可采用数组的写法,比如`'special': [1,3]`视为同时拥有先攻和坚固属性;`'special': [5,10,14,18]`视为拥有3连击、魔防、诅咒、阻击四个属性。
多属性可采用数组的写法,比如`'special': [1,3]`视为同时拥有先攻和坚固属性;`'special': [5,10,14,18]`视为拥有3连击、模仿、诅咒、阻击四个属性。
怪物可以负伤,在全塔属性的全局变量`enableNegativeDamage`中指定。
打败怪物后可以进行加点操作。有关加点塔的制作可参见[加点事件](event#加点事件)。
如果全塔属性中的enableExperience为false即不启用经验的话怪物手册里将不显示怪物的经验值打败怪物也不获得任何经验。
如果全塔属性中的enableexp为false即不启用经验的话怪物手册里将不显示怪物的经验值打败怪物也不获得任何经验。
拿到幸运金币后,打怪获得的金币将翻倍。
@ -199,8 +199,6 @@ N连击怪物的special是6且我们可以为它定义n代表实际连击数
退化怪需要设置'atkValue'和'defValue'表示退化的数值也可以不设置默认为0。
夹击可以通过全塔属性中的`betweenAttackCeil`设为true可以将伤害向上取整。
**将`flag:no_betweenAttack`设置为true可以免疫夹击效果。**
固伤怪则需要设置`damage`选项,代表战前扣血数值。
@ -282,13 +280,14 @@ floorId指定的是目标楼层的唯一标识符ID
- 使用`${}`来计算一个表达式的值,如`${status:atk+status:def}`。
- 使用`\f[...]`来同时插入一张立绘图,如`\f[1.png,100,200]`。
- 使用`\\i[...]`来在对话框中绘制一个图标,如`\\i[fly]`。
- 使用`\\c[...]`来修改字体大小,如`\\b[16]`。
- 使用`\\c[...]`来修改字体大小,如`\\c[16]`。
- 使用`\\d`来加粗或者取消粗体。
- 使用`\\e`来加斜体或取消斜体。
- 使用`\\z[...]`来添加打字中的暂停效果。
从V2.5.2开始,也允许绘制一张头像图在对话框中,只要通过`\t[1.png]`或`\t[标题,1.png]`的写法。
**使用`\\i,\\c,\\d,\\e`时请注意:在事件块中,允许只写一个反斜杠`\`,系统会自动转义成`\\`;但是在脚本中必须两个反斜杠都写上!**
**使用`\\i,\\c,\\d,\\e,\\z`时请注意:在事件块中,允许只写一个反斜杠`\`,系统会自动转义成`\\`;但是在脚本中必须两个反斜杠都写上!**
详细信息请参见[剧情文本控制](event#text显示一段文字剧情)中的说明。
@ -416,20 +415,6 @@ HTML5魔塔一大亮点就是存在录像系统可以很方便进行录像回
如果录像出现问题请加群539113091找小艾反馈Bug。
## 绘图模式
从V2.5开始,样板提供了绘图模式,可以让玩家在画布上任意进行绘制,标记等。
使用M键或在菜单栏中可以进入绘图模式。
**绘图的内容会自动保存,且以页面为生命周期,和存读档无关,返回标题并重新开始游戏后绘制的内容仍有效,但刷新页面就会消失。**
你可以将绘制内容保存到文件,也可以从文件读取保存的绘制内容。
绘图模式下,状态栏的图标也会相应改变,铅笔为绘制模式,橡皮为擦除模式,存读档为保存和读取绘图文件,退出为返回默认值。
在浏览地图页面中也可以按楼传按钮或M键来开启/关闭该层的绘图显示。
## 操作说明
![](img/keyboard.png)
@ -463,7 +448,6 @@ HTML5魔塔一大亮点就是存在录像系统可以很方便进行录像回
- **[R]** 回放录像
- **[E]** 显示光标
- **[SPACE]** 轻按(仅在轻按开关打开时有效)
- **[M]** 绘图模式
- **[PgUp/PgDn]** 浏览地图
- **[1]** 快捷使用破墙镐
- **[2]** 快捷使用炸弹/圣锤

View File

@ -332,7 +332,7 @@
![](img/events/7.png)
- `status:xxx` 获取勇士属性时只能使用如下几个hp生命值atk攻击力def防御力mdef魔防值money金币experience经验x勇士的横坐标y勇士的纵坐标direction勇士的方向
- `status:xxx` 获取勇士属性时只能使用如下几个hp生命值atk攻击力def防御力mdef护盾值money金币exp经验x勇士的横坐标y勇士的纵坐标direction勇士的方向
- `item:xxx` 中的xxx为道具ID。所有道具的ID定义在items.js中请自行查看。例如`item:centerFly` 代表中心对称飞行器的个数。
- `flag:xxx` 中的xxx为一个自定义的变量/Flag支持中文如果没有对其进行赋值则默认值为0。
- `global:xxx` 中的xxx为一个全局存储的名称支持中文如果没有对其进行赋值则默认值为0。
@ -491,27 +491,6 @@ value是一个表达式将通过这个表达式计算出的结果赋值给nam
在刷新的情况下如果hp被设置成了0或以下将触发lose事件直接死亡。
### addValue增减勇士的某个属性、道具个数或某个变量/Flag的值
和`{"type": "setValue"}`的写法完全相同,不过此项是可以直接将值加减到原始数值上。
即下面的写法是等价的:
``` js
[
{"type": "setValue", "name": "status:atk", "value": "status:atk+10" } // 攻击提高10点
{"type": "addVakue", "name": "status:atk", "value": "10" } // 和上面写法等价
{"type": "setValue", "name": "item:yellowKey", "value": "item:yellowKey-3" } // 黄钥匙个数-3
{"type": "addValue", "name": "item:yellowKey", "value": "-3" } // 和上面写法等价
{"type": "setValue", "name": "flag:door2", "value": "flag:door2+1" } // 将变量door值+1
{"type": "addValue", "name": "flag:door2", "value": "01" } // 和上面写法等价
]
```
![](img/events/14.jpg)
从V2.6.5开始,当设置了`"norefresh": true`后可以不刷新状态栏、地图显伤和自动事件,从而加速事件执行。
### setEnemy设置怪物属性
使用`{"type":"setEnemy"}`可以设置某个怪物的某个属性
@ -528,7 +507,7 @@ value是一个表达式将通过这个表达式计算出的结果赋值给nam
id为必填项代表要修改的怪物ID。
name为必填项代表要修改的项例如`hp`, `atk`, `def`, `money`, `experience`, `point`, `special`, `name`
name为必填项代表要修改的项例如`hp`, `atk`, `def`, `money`, `exp`, `point`, `special`, `name`
value为必填项代表要修改到的内容。对于修改名称的必须加单引号。
@ -596,7 +575,7 @@ value为必填项代表要修改到的结果。该项必须是个数值。
``` js
[
{"type": "setGlobalFlag", "name": "enableMDef", "value": false}, // 不在状态栏显示魔防
{"type": "setGlobalFlag", "name": "enableMDef", "value": false}, // 不在状态栏显示护盾
]
```
@ -1672,7 +1651,7 @@ text为提示文字可以在这里给输入提示文字。这里同样可以
],
"false": [ // 条件不成立则执行false里的事件
"你当前攻击力为${status:atk}, 不足500\n给你增加100点攻击力",
{"type": "addValue", "name": "status:atk", "value": "100"}, // 攻击力加100 接着会执行revisit事件
{"type": "setValue", "name": "status:atk", "operator": "+=", "value": "100"}, // 攻击力加100 接着会执行revisit事件
]
},
{"type", "revisit"}, // 立刻重启本事件, 直到攻击力大于500后结束
@ -1874,7 +1853,7 @@ yes和no均为必填项即用户点击确认或取消后执行的事件。
[
{"type":"while", "condition": "flag:i<=10", // 循环处理注意flag未设置则默认为0
"data":[
{"type": "addValue", "name": "flag:i", "value": "1"}, // 递增i
{"type": "setValue", "name": "flag:i", "operator": "+=", "value": "1"}, // 递增i
"${flag:i}", // 输出i
{"type": "sleep","time":1000}, // 等待1秒
]
@ -1908,7 +1887,7 @@ yes和no均为必填项即用户点击确认或取消后执行的事件。
[
{"type":"while", "condition": "true", // 循环处理;永远为真
"data":[
{"type": "addValue", "name": "flag:i", "value": "1"}, // 递增i
{"type": "setValue", "name": "flag:i", "operator": "+=", "value": "1"}, // 递增i
"${flag:i}", // 输出i
{"type": "sleep","time":1000}, // 等待1秒
{"type": "if", "condition": "flag:i<10", // 测试i是否小于10
@ -2544,7 +2523,7 @@ if (core.flags.enableAddPoint && point > 0) {
"name": "贪婪之神", // 商店名称(标题)
"icon": "blueShop", // 商店图标blueShop为蓝色商店pinkShop为粉色商店
"textInList": "1F金币商店", // 在快捷商店栏中显示的名称
"use": "money", // 商店所要使用的。只能是"money"或"experience"。
"use": "money", // 商店所要使用的。只能是"money"或"exp"。
"commonTimes": true, // 是否使用全局次数
"mustEnable": false, // 如果未开启则不显示在状态栏中
"need": "20+10*times*(times+1)", // 商店需要的金币/经验数值可以是一个表达式以times访问次数作为参数计算。
@ -2553,7 +2532,7 @@ if (core.flags.enableAddPoint && point > 0) {
// effect可以对statusitem和flag进行操作必须是X+=Y的形式其中Y可以是一个表达式
{"text": "生命+800", "effect": "status:hp+=800"}, // 生命+800
{"text": "攻击+4", "need": 30, "effect": "status:atk+=4"}, // 规定具体的数值
{"text": "防御+2魔防+4", "effect": "status:def+=2;status:mdef+=4"}, // 多个效果用分号分开
{"text": "防御+2护盾+4", "effect": "status:def+=2;status:mdef+=4"}, // 多个效果用分号分开
]
}
],
@ -2565,7 +2544,7 @@ if (core.flags.enableAddPoint && point > 0) {
- name 为商店的名称(打开商店后的标题)
- icon 为商店的图标在icons.js的npcs中定义。如woman可代表一个商人。
- textInList 为其在快捷商店栏中显示的名称,如"3楼金币商店"等
- use 为消耗的类型是金币money还是经验experience)。
- use 为消耗的类型是金币money还是经验exp
- commonTimes 是否使用全局次数如果为true则可以多个快捷商店共享相同的次数
- mustEnable 是否必须是只在开启状态才在列表显示如果此项为true则未开启的快捷商店不予显示
- need 是一个表达式,计算商店所需要用到的数值。
@ -2665,26 +2644,6 @@ if (core.flags.enableAddPoint && point > 0) {
除此以外,每层楼还提供了`firstArrive`和`eachArrive`事件,分别为首次到达该楼层和每次到达该楼层时执行的事件。
## 使用炸弹后的事件
上面的afterBattle事件只对和怪物进行战斗后才有会被处理。
如果我们想在使用炸弹后也能触发一些事件(如开门),则可以在脚本编辑里面的`afterUseBomb`函数进行处理:
``` js
////// 使用炸弹/圣锤后的事件 //////
"afterUseBomb": function () {
// 这是一个使用炸弹也能开门的例子
if (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在
&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在
{
core.insertAction([ // 插入事件
{"type": "openDoor", "loc": [x0,y0]} // 开门
])
}
}
```
## 滑冰事件
从V2.6开始,滑冰事件被重写。现在的滑冰由公共事件执行。
@ -2751,7 +2710,7 @@ if (core.flags.enableAddPoint && point > 0) {
本塔也支持经验升级,即用户杀怪获得经验后,可以到达某些数值自动进阶,全面提升属性。
要经验升级,你需要先在`data.js`中的全局变量中启用。你需要将`enableExperience`启用经验,且`enableLevelUp`启用进阶。同时你也可以将`enableLv`置为true以在状态栏中显示当前等级境界
要经验升级,你需要先在`data.js`中的全局变量中启用。你需要将`enableExp`启用经验,且`enableLevelUp`启用进阶。同时你也可以将`enableLv`置为true以在状态栏中显示当前等级境界
同时,你还需要在`data.js`中的`levelUp`来定义每一个进阶所需要的经验值,以及进阶时的效果。

View File

@ -23,18 +23,16 @@
// basepath: '../docs/',
// Search Support
// search: {
// maxAge: 43200000, // 过期时间,单位毫秒,默认一天
// paths: 'auto',
// placeholder: {
// '/en/': 'Search',
// '/': '搜索',
// },
// noData: {
// '/en/': 'No Results',
// '/': '找不到结果',
// },
// },
search: {
maxAge: 43200000, // 过期时间,单位毫秒,默认一天
paths: 'auto',
placeholder: {
'/': '搜索文档...',
},
noData: {
'/': '找不到结果',
},
},
// load sidebar from _sidebar.md
loadSidebar: '_sidebar',
@ -46,5 +44,6 @@
}
</script>
<script src="https://cdn.bootcss.com/docsify/4.5.5/docsify.min.js"></script>
<script src="https://cdn.bootcss.com/docsify/4.5.5/plugins/search.min.js"></script>
</body>
</html>

View File

@ -19,7 +19,6 @@ HTML5魔塔是使用画布canvas来绘制存在若干个图层它们
- animate动画层主要用来绘制动画。 (z-index: 70)
- weather**[D]**:天气层;主要用来绘制天气(雨/雪/雾) (z-index: 80)
- route**[D]**:路线层;主要用来绘制勇士的行走路线图。 (z-index: 95)
- paint**[D]**绘图层主要用来进行绘图模式。z-index: 95)
- curtain色调层用来控制当前楼层的画面色调 (z-index: 125)
- image1\~50**[D]**图片层用来绘制图片等操作。z-index: 100+code, 101~150
- uievent**[D]**自定义UI绘制层用来进行自定义UI绘制等操作。z-index135可以通过事件设置该值
@ -495,11 +494,8 @@ this.myfunc = function(x) {
3. 在脚本编辑-updateStatusBar中可以直接替换技能栏的显示内容
```
// 设置技能栏
if (core.flags.enableSkill) {
// 替换成你想显示的内容比如你定义的一个flag:abc。
core.setStatusBarInnerHTML('skill', core.getFlag("abc", 0));
}
// 替换成你想显示的内容比如你定义的一个flag:abc。
core.setStatusBarInnerHTML('skill', core.getFlag("abc", 0));
```
### 额外新增新项目
@ -569,22 +565,17 @@ core.statusBar.speed.innerHTML = core.getFlag('speed', 0);
在脚本编辑-updateStatusBar中可以对状态栏显示内容进行修改。
``` js
// 设置魔力值
if (core.flags.enableMana) {
// status:manamax 只有在非负时才生效。
if (core.status.hero.manamax != null && core.status.hero.manamax >= 0) {
core.status.hero.mana = Math.min(core.status.hero.mana, core.status.hero.manamax);
core.setStatusBarInnerHTML('mana', core.status.hero.mana + "/" + core.status.hero.manamax);
}
else {
core.setStatusBarInnerHTML("mana", core.status.hero.mana);
}
// 设置魔力值; status:manamax 只有在非负时才生效。
if (core.status.hero.manamax != null && core.status.hero.manamax >= 0) {
core.status.hero.mana = Math.min(core.status.hero.mana, core.status.hero.manamax);
core.setStatusBarInnerHTML('mana', core.status.hero.mana + "/" + core.status.hero.manamax);
}
else {
core.setStatusBarInnerHTML("mana", core.status.hero.mana);
}
// 设置技能栏
if (core.flags.enableSkill) {
// 可以用flag:skill表示当前开启的技能类型flag:skillName显示技能名
core.statusBar.skill.innerHTML = core.getFlag('skillName', '无');
}
// 可以用flag:skill表示当前开启的技能类型flag:skillName显示技能名
core.statusBar.skill.innerHTML = core.getFlag('skillName', '无');
```
### 技能的触发
@ -629,8 +620,8 @@ else { // 关闭技能
``` js
case 87: // W开启技能“二倍斩”
// 检测技能栏是否开启,是否拥有“二倍斩”这个技能道具
if (core.flags.enableSkill && core.hasItem('skill1')) {
// 是否拥有“二倍斩”这个技能道具
if (core.hasItem('skill1')) {
core.status.route.push("key:87");
core.useItem('skill1', true);
}
@ -669,7 +660,7 @@ if (core.getFlag('skill', 0)==1) { // 开启了技能1
``` js
// 战后的技能处理,比如扣除魔力值
if (core.flags.enableSkill) {
if (core.flags.statusBarItems.indexOf('enableSkill')>=0) {
// 检测当前开启的技能类型
var skill = core.getFlag('skill', 0);
if (skill==1) { // 技能1二倍斩
@ -704,13 +695,13 @@ if (core.flags.enableSkill) {
- **`flag:heroIcon`**: 当前的勇士行走图名称。
- **`flag:saveEquips`**: 快速换装时保存的套装。
- **`flag:__visited__`**: 当前访问过的楼层。
- **`flag:__atk_buff__`**, **`flag:__def_buff__`**, **`flag:__mdef_buff__`**: 当前攻防魔防的实际计算比例加成。
- **`flag:__atk_buff__`**, **`flag:__def_buff__`**, **`flag:__mdef_buff__`**: 当前攻防护盾的实际计算比例加成。
- **`flag:__color__`**, **`flag:__weather__`**, **`flag:__volume__`**: 当前的画面色调、天气和音量。
- **`flag:__events__`**: 当前保存的事件列表,读档时会恢复(适用于在事件中存档)
- **`flag:textAttribute`**, **`flag:globalAttribute`**, **`flag:globalFlags`**: 当前的剧情文本属性,当前的全局属性,当前的全局开关。
- **`flag:cannotMoveDirectly`**, **`flag:__noClickMove__`**: 当前是否不允许瞬间移动,当前用户是否开启了单击瞬移。
- **`flag:hideStatusBar`**, **`flag:showToolbox`**: 是否隐藏状态栏,是否显示工具栏。
- **`flag:debug`**, **`flag:__consoleOpened__`**: 当前是否开启了调试模式,是否开启了控制台
- **`flag:debug`**: 当前是否开启了调试模式。
- **`flag:__seed__`**, **`flag:__rand__`**: 伪随机数生成种子和当前的状态
==========================================================================================

File diff suppressed because it is too large Load Diff

View File

@ -1 +1 @@
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":null,"disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample0","disableBlocklyReplace":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}

View File

@ -130,7 +130,7 @@
.etable table th,
.etable table td {
padding: 6px 13px;
padding: 5px;
border: 1px solid #dfe2e5;
}
@ -201,6 +201,12 @@ div.etableInputDiv {
right: 0;
}
div.checkboxSet {
position: relative !important;
max-height: 250px;
overflow: auto;
}
.etableInputDiv > * {
margin: 0;
padding: 0;
@ -210,11 +216,7 @@ div.etableInputDiv {
border: none;
}
.etableInputDiv input[type="text"] {
}
.etableInputDiv input[type="checkbox"] {
.etableInputDiv .checkbox {
width: 16px;
height: 16px;
position: absolute;
@ -224,8 +226,10 @@ div.etableInputDiv {
margin-top: -8px;
}
.etableInputDiv select {
.etableInputDiv .checkboxSetMember {
width: 16px;
height: 16px;
display: inline-block;
}
.etableInputDiv textarea {

View File

@ -144,7 +144,7 @@
.etable table th,
.etable table td {
padding: 6px 13px;
padding: 5px;
border: 1px solid #dfe2e5;
}
@ -172,11 +172,11 @@
}
.etable tr > :nth-child(3) {
width: 30%;
width: 38%;
}
.etable tr > :nth-child(4) {
width: 30%;
width: 22%;
text-align: center;
}
@ -211,6 +211,12 @@ div.etableInputDiv {
right: 0;
}
div.checkboxSet {
position: relative !important;
max-height: 250px;
overflow: auto;
}
.etableInputDiv > * {
margin: 0;
padding: 0;
@ -220,11 +226,7 @@ div.etableInputDiv {
border: none;
}
.etableInputDiv input[type="text"] {
}
.etableInputDiv input[type="checkbox"] {
.etableInputDiv .checkbox {
width: 16px;
height: 16px;
position: absolute;
@ -234,8 +236,10 @@ div.etableInputDiv {
margin-top: -8px;
}
.etableInputDiv select {
.etableInputDiv .checkboxSetMember {
width: 16px;
height: 16px;
display: inline-block;
}
.etableInputDiv textarea {

View File

@ -52,6 +52,7 @@ function editor() {
left1 : document.getElementById('left1'),
editModeSelect :document.getElementById('editModeSelect'),
mid2 : document.getElementById('mid2'),
clearLastUsedBtn: document.getElementById('clearLastUsedBtn'),
lastUsedDiv: document.getElementById('lastUsedDiv'),
lastUsed: document.getElementById('lastUsed'),
lastUsedCtx: document.getElementById('lastUsed').getContext('2d'),
@ -182,7 +183,6 @@ editor.prototype.init = function (callback) {
core.changeFloor(lastFloorId, null, core.firstData.hero.loc, null, function () {
afterCoreReset();
}, true);
core.events.setInitData(null);
});
}
@ -298,7 +298,7 @@ editor.prototype.drawEventBlock = function () {
&& loc == firstData.hero.loc.x + "," + firstData.hero.loc.y) {
fg.textAlign = 'center';
editor.game.doCoreFunc('fillBoldText', fg, 'S',
32 * i + 16, 32 * j + 28, '#FFFFFF', 'bold 30px Verdana');
32 * i + 16, 32 * j + 28, '#FFFFFF', null, 'bold 30px Verdana');
}
if (editor.currentFloorData.events[loc])
color.push('#FF0000');
@ -329,7 +329,7 @@ editor.prototype.drawEventBlock = function () {
if (index >= 0) {
fg.textAlign = 'right';
editor.game.doCoreFunc("fillBoldText", fg, index + 1,
32 * i + 28, 32 * j + 15, '#FF7F00', '14px Verdana');
32 * i + 28, 32 * j + 15, '#FF7F00', null, '14px Verdana');
}
}
}
@ -629,7 +629,7 @@ editor.prototype.buildMark = function(){
}
}
editor.prototype.setSelectBoxFromInfo=function(thisevent){
editor.prototype.setSelectBoxFromInfo=function(thisevent, scrollTo){
var pos={x: 0, y: 0, images: "terrains"};
var ysize = 32;
if(thisevent==0){
@ -646,6 +646,10 @@ editor.prototype.setSelectBoxFromInfo=function(thisevent){
}
if(pos.x == 0) pos.y+=2;
}
if (!editor.isMobile && scrollTo) {
editor.dom.iconLib.scrollLeft = pos.x * 32 - editor.dom.iconLib.offsetWidth / 2;
editor.dom.iconLib.scrollTop = pos.y * ysize - editor.dom.iconLib.offsetHeight / 2;
}
editor.dom.dataSelection.style.left = pos.x * 32 + 'px';
editor.dom.dataSelection.style.top = pos.y * ysize + 'px';
editor.dom.dataSelection.style.height = ysize - 6 + 'px';

View File

@ -38,16 +38,16 @@ editor_blockly = function () {
},'autoEvent'),
MotaActionBlocks['changeFloor_m'].xmlText(),
MotaActionFunctions.actionParser.parse([{
"id": "moneyShop1",
"name": "贪婪之神",
"icon": "blueShop",
"id": "shop1",
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我\${20+2*flag:shop1}金币就可以:",
"textInList": "1F金币商店",
"use": "money",
"need": "20+10*times*(times+1)",
"text": "勇敢的武士啊,给我\\\${need}金币就可以:",
"choices": [
{"text": "生命+800", "effect": "status:hp+=800"},
{"text": "攻击+4", "effect": "status:atk+=4"},
{"text": "生命+800", "need": "status:money>=20+2*flag:shop1", "action": [
{"type": "comment", "text": "新版商店中需要手动扣减金币和增加访问次数"},
{"type": "setValue", "name": "status:money", "operator": "-=", "value": "20+2*flag:shop1"},
{"type": "setValue", "name": "flag:shop1", "operator": "+=", "value": "1"},
{"type": "setValue", "name": "status:hp", "operator": "+=", "value": "800"}
]}
]
},{
"id": "itemShop",
@ -83,28 +83,21 @@ editor_blockly = function () {
MotaActionBlocks['hideImage_s'].xmlText(),
MotaActionBlocks['showTextImage_s'].xmlText(),
MotaActionBlocks['moveImage_s'].xmlText(),
MotaActionBlocks['showGif_0_s'].xmlText(),
MotaActionBlocks['showGif_1_s'].xmlText(),
MotaActionBlocks['showGif_s'].xmlText(),
MotaActionBlocks['tip_s'].xmlText(),
MotaActionBlocks['win_s'].xmlText(),
MotaActionBlocks['lose_s'].xmlText(),
MotaActionBlocks['restart_s'].xmlText(),
MotaActionBlocks['confirm_s'].xmlText(),
MotaActionBlocks['choices_s'].xmlText([
'选择剑或者盾','流浪者','man',MotaActionBlocks['choicesContext'].xmlText([
'选择剑或者盾','流浪者','man',0,MotaActionBlocks['choicesContext'].xmlText([
'剑','','',null,'',MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [3,3]}]),
MotaActionBlocks['choicesContext'].xmlText([
'盾','','',null,'',MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [9,3]}]),
])
])
]),
],
'数据相关':[
MotaActionBlocks['addValue_s'].xmlText([
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false
]),
MotaActionBlocks['setValue_s'].xmlText([
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '=', '', false
]),
MotaActionBlocks['setEnemy_s'].xmlText(),
MotaActionBlocks['setFloor_s'].xmlText(),
@ -117,8 +110,7 @@ editor_blockly = function () {
MotaActionBlocks['moveHero_s'].xmlText(),
MotaActionBlocks['jumpHero_s'].xmlText(),
MotaActionBlocks['changeFloor_s'].xmlText(),
MotaActionBlocks['changePos_0_s'].xmlText(),
MotaActionBlocks['changePos_1_s'].xmlText(),
MotaActionBlocks['changePos_s'].xmlText(),
MotaActionBlocks['battle_s'].xmlText(),
MotaActionBlocks['useItem_s'].xmlText(),
MotaActionBlocks['loadEquip_s'].xmlText(),
@ -149,14 +141,14 @@ editor_blockly = function () {
MotaActionBlocks['if_s'].xmlText(),
MotaActionFunctions.actionParser.parseList({"type": "switch", "condition": "判别值", "caseList": [
{"action": [{"type": "comment", "text": "当判别值是值的场合执行此事件"}]},
{"action": [], "nobreak": true},
{"case": "default", "action": [{"type": "comment", "text": "当没有符合的值的场合执行default事件"}]},
]}),
MotaActionFunctions.actionParser.parseList({"type": "for", "name": "temp:A", "from": "0", "to": "12", "step": "1", "data": []}),
MotaActionFunctions.actionParser.parseList({"type": "forEach", "name": "temp:A", "list": ["status:atk","status:def"], "data": []}),
MotaActionBlocks['while_s'].xmlText(),
MotaActionBlocks['dowhile_s'].xmlText(),
MotaActionBlocks['break_s'].xmlText(),
MotaActionBlocks['continue_s'].xmlText(),
MotaActionBlocks['revisit_s'].xmlText(),
MotaActionBlocks['exit_s'].xmlText(),
MotaActionBlocks['trigger_s'].xmlText(),
MotaActionBlocks['insert_1_s'].xmlText(),
@ -164,8 +156,8 @@ editor_blockly = function () {
],
'特效/声音':[
MotaActionBlocks['sleep_s'].xmlText(),
MotaActionFunctions.actionParser.parseList({"type": "wait", "data": [
{"case": "keyboard", "keycode": 13, "action": [{"type": "comment", "text": "当按下回车(keycode=13)时执行此事件"}]},
MotaActionFunctions.actionParser.parseList({"type": "wait", "timeout": 0, "data": [
{"case": "keyboard", "keycode": "13,32", "action": [{"type": "comment", "text": "当按下回车(keycode=13)或空格(keycode=32)时执行此事件"}]},
{"case": "mouse", "px": [0,32], "py": [0,32], "action": [{"type": "comment", "text": "当点击地图左上角时执行此事件"}]},
]}),
MotaActionBlocks['waitAsync_s'].xmlText(),
@ -222,14 +214,12 @@ editor_blockly = function () {
MotaActionBlocks['unknown_s'].xmlText(),
],
'值块':[
MotaActionBlocks['addValue_s'].xmlText([
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false
]),
MotaActionBlocks['setValue_s'].xmlText([
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false
MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '=', '', false
]),
MotaActionBlocks['expression_arithmetic_0'].xmlText(),
MotaActionBlocks['evFlag_e'].xmlText(),
MotaActionBlocks['evTemp_e'].xmlText(),
MotaActionBlocks['negate_e'].xmlText(),
MotaActionBlocks['bool_e'].xmlText(),
MotaActionBlocks['idString_e'].xmlText(),
@ -251,30 +241,30 @@ editor_blockly = function () {
}),
'<label text="商店购买属性/钥匙"></label>',
MotaActionFunctions.actionParser.parse([
{"type": "choices", "text": "\\t[老人,man]少年,你需要钥匙吗?\\n我这里有大把的",
"choices": [
{"text": "黄钥匙(\\\${9+flag:shop_times}金币)", "color": [255,255,0,1], "action": [
{"type": "if", "condition": "status:money>=9+flag:shop_times",
"true": [
{"type": "addValue", "name": "status:money", "value": "-(9+flag:shop_times)"},
{"type": "addValue", "name": "item:yellowKey", "value": "1"},
],
"false": [
"\\t[老人,man]你的金钱不足!",
{"type": "revisit"}
]
}
]},
{"text": "蓝钥匙(\\\${18+2*flag:shop_times}金币)", "color": [0,0,255,1], "action": [
]},
{"text": "离开", "action": [
{"type": "exit"}
]}
]
},
{"type": "addValue", "name": "flag:shop_times", "value": "1"},
{"type": "revisit"}
], 'event'),
{"type": "while", "condition": "true", "data": [
{"type": "choices", "text": "\\t[老人,man]少年,你需要钥匙吗?\\n我这里有大把的",
"choices": [
{"text": "黄钥匙(\\\${9+flag:shop_times}金币)", "color": [255,255,0,1], "action": [
{"type": "if", "condition": "status:money>=9+flag:shop_times",
"true": [
{"type": "setValue", "name": "status:money", "operator": "-=", "value": "9+flag:shop_times"},
{"type": "setValue", "name": "item:yellowKey", "operator": "+=", "value": "1"},
],
"false": [
"\\t[老人,man]你的金钱不足!",
{"type": "continue"}
]
}
]},
{"text": "蓝钥匙(\\\${18+2*flag:shop_times}金币)", "color": [0,0,255,1], "action": [
]},
{"text": "离开", "action": [
{"type": "break"}
]}
]
},
{"type": "setValue", "name": "flag:shop_times", "operator": "+=", "value": "1"}
]}], 'event'),
'<label text="战前剧情"></label>',
MotaActionFunctions.actionParser.parse({
"trigger": "action",
@ -295,7 +285,7 @@ editor_blockly = function () {
],'afterBattle'),
'<label text="打怪开门"></label>',
MotaActionFunctions.actionParser.parse([
{"type": "addValue", "name": "flag:__door__", "value": "1"},
{"type": "setValue", "name": "flag:__door__", "operator": "+=", "value": "1"},
{"type": "if", "condition": "flag:__door__==2",
"true": [
{"type": "openDoor", "loc": [10,5]}
@ -315,7 +305,7 @@ editor_blockly = function () {
{"type": "if", "condition": "flag:hasSuperPotion",
"true": [],
"false": [
{"type":"setValue", "name":"status:hp", "value":"status:hp*2"},
{"type":"setValue", "name":"status:hp", "operator": "*=", "value": "2"},
{"type":"setBlock", "number": 1},
{"type":"setValue", "name":"flag:hasSuperPotion", "value": "true"}
]
@ -418,7 +408,7 @@ function omitedcheckUpdateFunction(event) {
}
}
try {
var code = Blockly.JavaScript.workspaceToCode(workspace).replace(/\\\\(i|c|d|e)/g, '\\\\\\\\$1');
var code = Blockly.JavaScript.workspaceToCode(workspace).replace(/\\\\(i|c|d|e|z)/g, '\\\\\\\\$1');
codeAreaHL.setValue(code);
} catch (error) {
codeAreaHL.setValue(String(error));
@ -573,7 +563,7 @@ function omitedcheckUpdateFunction(event) {
MotaActionFunctions.parse(
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g, function (c) {
return {'<': '&lt;', '>': '&gt;', '&': '&amp;'}[c];
}).replace(/\\(r|f|i|c|d|e)/g,'\\\\$1')),
}).replace(/\\(r|f|i|c|d|e|z)/g,'\\\\$1')),
document.getElementById('entryType').value
);
}
@ -647,7 +637,7 @@ function omitedcheckUpdateFunction(event) {
return;
}
var code = Blockly.JavaScript.workspaceToCode(editor_blockly.workspace);
code = code.replace(/\\(i|c|d|e)/g, '\\\\$1');
code = code.replace(/\\(i|c|d|e|z)/g, '\\\\$1');
eval('var obj=' + code);
if (this.checkAsync(obj) && confirm("警告!存在不等待执行完毕的事件但却没有用【等待所有异步事件处理完毕】来等待" +
"它们执行完毕,这样可能会导致录像检测系统出问题。\n你要返回修改么")) return;
@ -682,7 +672,7 @@ function omitedcheckUpdateFunction(event) {
}
}
}
if (one.async && one.type != 'animate') hasAsync = true;
if (one.async && one.type != 'animate' && one.type != 'function') hasAsync = true;
if (one.type == 'waitAsync') hasAsync = false;
}
return hasAsync;
@ -698,7 +688,7 @@ function omitedcheckUpdateFunction(event) {
];
if (b && types.indexOf(b.type)>=0) {
try {
var code = "[" + Blockly.JavaScript.blockToCode(b).replace(/\\(i|c|d|e)/g, '\\\\$1') + "]";
var code = "[" + Blockly.JavaScript.blockToCode(b).replace(/\\(i|c|d|e|z)/g, '\\\\$1') + "]";
eval("var obj="+code);
if (obj.length > 0 && b.type == 'waitContext_2') {
var dt = obj[0];
@ -736,7 +726,7 @@ function omitedcheckUpdateFunction(event) {
'choices_s': 'EvalString_0',
'showTextImage_s': 'EvalString_0',
'function_s': 'RawEvalString_0',
'shopsub': 'EvalString_3',
'shopsub': 'EvalString_1',
'confirm_s': 'EvalString_0',
'drawTextContent_s': 'EvalString_0',
}
@ -757,14 +747,14 @@ function omitedcheckUpdateFunction(event) {
'comment_s',
'show_s',
'hide_s',
'addValue_s',
'setValue_s',
'if_s',
'while_s',
'battle_s',
'openDoor_s',
'choices_s',
'setText_s',
'exit_s',
'revisit_s',
'sleep_s',
'setBlock_s',
'insert_1_s'
@ -837,7 +827,7 @@ function omitedcheckUpdateFunction(event) {
"changeFloor_m": ["Number_0", "Number_1", "IdString_0", true],
"jumpHero_s": ["PosString_0", "PosString_1"],
"changeFloor_s": ["PosString_0", "PosString_1", "IdString_0", true],
"changePos_0_s": ["PosString_0", "PosString_1"],
"changePos_s": ["PosString_0", "PosString_1"],
"battle_1_s": ["PosString_0", "PosString_1"],
"openDoor_s": ["PosString_0", "PosString_1", "IdString_0"],
"closeDoor_s": ["PosString_0", "PosString_1"],
@ -891,9 +881,11 @@ function omitedcheckUpdateFunction(event) {
});
}
editor_blockly.getAutoCompletions = function (content) {
editor_blockly.getAutoCompletions = function (content, type, name) {
// --- content为当前框中输入内容将返回一个列表为后续所有可补全内容
// console.log(type, name);
// 检查 status:xxxitem:xxx和flag:xxx
var index = Math.max(content.lastIndexOf(":"), content.lastIndexOf(""));
if (index >= 0) {
@ -936,7 +928,7 @@ function omitedcheckUpdateFunction(event) {
if (index2 >= 0) {
before = content.substring(0, index2);
if (before.endsWith("怪物") || (ch == ':' && ch2 == ':' && before.endsWith("enemy"))) {
var list = ["name", "hp", "atk", "def", "money", "experience", "point", "special"];
var list = ["name", "hp", "atk", "def", "money", "exp", "point", "special"];
if (before.endsWith("怪物") && MotaActionFunctions) {
list = MotaActionFunctions.pattern.replaceEnemyList.map(function (v) {
return v[1];
@ -985,6 +977,105 @@ function omitedcheckUpdateFunction(event) {
}).sort();
}
var allIds = core.getAllIconIds();
var allIconIds = allIds.concat(Object.keys(core.statusBar.icons).filter(function (x) {
return core.statusBar.icons[x] instanceof Image;
}));
var allImages = Object.keys(core.material.images.images);
var allEnemys = Object.keys(core.material.enemys);
var allItems = Object.keys(core.material.items);
var allAnimates = Object.keys(core.material.animates);
var allBgms = Object.keys(core.material.bgms);
var allSounds = Object.keys(core.material.sounds);
var allShops = Object.keys(core.status.shops);
var allColors = ["aqua青色", "black黑色", "blue蓝色", "fuchsia品红色", "gray灰色", "green深绿色", "lime绿色",
"maroon深红色", "navy深蓝色", "gold金色", "olive黄褐色", "orange橙色", "purple品红色",
"red红色", "silver淡灰色", "teal深青色", "white白色", "yellow黄色"];
var filter = function (list, content) {
return list.filter(function (one) {
return one != content && one.startsWith(content);
}).sort();
}
// 对任意图块提供补全
if ((type == 'text_1_s' && name == 'EvalString_1') || (type == 'autoText_s' && name == 'EvalString_1')
|| (type == 'choices_s' && name == 'IdString_0') || (type == 'choicesContext' && name == 'IdString_0')
|| (type == 'closeDoor_s' && name == 'IdString_0') || (type == 'setBlock_s' && name == 'EvalString_0')
|| (type == 'setBgFgBlock_s' && name == 'EvalString_0') || (type == 'drawIcon_s' && name == 'IdString_0')
|| (type == 'shopsub' && name == 'IdString_1') || (type == 'shopChoices' && name == 'IdString_0')) {
return filter(allIds, content);
}
// 对怪物ID提供补全
if ((type == 'idString_3_e' || type == 'battle_s' || type == 'setEnemy_s') && name == 'IdString_0') {
return filter(allEnemys, content);
}
// 对道具ID进行补全
if ((type == 'useItem_s' || type == 'loadEquip_s') && name == 'IdString_0') {
return filter(allItems, content);
}
// 对图片名进行补全
if ((type == 'showImage_s' || type == 'showImage_1_s' || type == 'showGif_s' || type == 'setHeroIcon_s'
|| type == 'follow_s' || type == 'unfollow_s' || type == 'drawImage_s' || type == 'drawImage_1_s') && name == 'EvalString_0') {
return filter(allImages, content);
}
// 对动画进行补全
if (type == 'animate_s' && name == 'IdString_0') {
return filter(allAnimates, content);
}
// 对音乐进行补全
if ((type == 'playBgm_s' || type == 'loadBgm_s' || type == 'freeBgm_s') && name == 'EvalString_0') {
return filter(allBgms, content);
}
// 对音效进行补全
if (type == 'playSound_s' && name == 'EvalString_0') {
return filter(allSounds, content);
}
// 对全局商店进行补全
if ((type == 'openShop_s' || type == 'disableShop_s') && name == 'IdString_0') {
return filter(allShops, content);
}
// 对\f进行自动补全
index = Math.max(content.lastIndexOf("\f["), content.lastIndexOf("\\f["));
if (index >= 0) {
if (content.charAt(index) == '\\') index++;
var after = content.substring(index + 2);
if (after.indexOf(",") < 0 && after.indexOf("]") < 0) {
return filter(allImages, after);
}
}
// 对\\i进行补全
index = content.lastIndexOf("\\i[");
if (index >= 0) {
var after = content.substring(index + 3);
if (after.indexOf("]") < 0) {
return filter(allIconIds, after);
}
}
// 对\r进行补全
index = Math.max(content.lastIndexOf("\r["), content.lastIndexOf("\\r["));
if (index >= 0) {
if (content.charAt(index) == '\\') index++;
var after = content.substring(index + 2);
if (after.indexOf("]") < 0) {
return filter(allColors, after);
}
}
// 对\进行补全!
if (content.charAt(content.length - 1) == '\\') {
return ["n换行", "f立绘", "r变色", "i图标", "z暂停打字", "t标题图标", "b对话框", "c字体大小", "d粗体", "e斜体"];
}
return [];
}
@ -1087,11 +1178,13 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) {
// --- awesomplete
var awesomplete = new Awesomplete(htmlInput, {
minChars: pb.type == "idString_3_e" ? 1 : 2,
minChars: 1,
maxItems: 12,
autoFirst: true,
replace: function (text) {
text = text.toString();
var index = text.indexOf("");
if (index >= 0) text = text.substring(0, index);
var value = this.input.value, index = this.input.selectionEnd;
if (index == null) index = value.length;
if (index < awesomplete.prefix.length) index = awesomplete.prefix.length;
@ -1132,7 +1225,7 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) {
if (index == null) index = value.length;
value = value.substring(0, index);
// cal prefix
awesomplete.prefix = "";
awesomplete.prefix = value;
for (var i = index - 1; i>=0; i--) {
var c = value.charAt(i);
if (!/^[a-zA-Z0-9_\u4E00-\u9FCC]$/.test(c)) {
@ -1141,13 +1234,7 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) {
}
}
var list = editor_blockly.getAutoCompletions(value);
if (pb.type == "idString_3_e") {
list = list.concat(Object.keys(core.material.enemys).filter(function (one) {
return one != value && one.startsWith(value);
}));
list.sort();
}
var list = editor_blockly.getAutoCompletions(value, pb.type, self.name);
awesomplete.list = list;
awesomplete.ul.style.marginLeft = getCaretCoordinates(htmlInput, htmlInput.selectionStart).left -

View File

@ -6,6 +6,197 @@ editor_datapanel_wrapper = function (editor) {
//////////////////// 地图编辑 //////////////////////////////////////////
///////////////////////////////////////////////////////////////////////
// 由于历史遗留原因, 以下变量作为全局变量使用
// pout exportMap mapEditArea mapEditArea copyMap clearMapButton deleteMap
window.pout = document.getElementById('pout')
window.exportMap = document.getElementById('exportMap')
exportMap.isExport=false
exportMap.onclick=function(){
editor.updateMap();
var sx=editor.map.length-1,sy=editor.map[0].length-1;
var filestr = '';
for (var yy = 0; yy <= sy; yy++) {
filestr += '['
for (var xx = 0; xx <= sx; xx++) {
var mapxy = editor.map[yy][xx];
if (typeof(mapxy) == typeof({})) {
if ('idnum' in mapxy) mapxy = mapxy.idnum;
else {
// mapxy='!!?';
tip.whichShow(3);
return;
}
} else if (typeof(mapxy) == 'undefined') {
tip.whichShow(3);
return;
}
mapxy = String(mapxy);
mapxy = Array(Math.max(4 - mapxy.length, 0)).join(' ') + mapxy;
filestr += mapxy + (xx == sx ? '' : ',')
}
filestr += ']' + (yy == sy ? '' : ',\n');
}
pout.value = filestr;
mapEditArea.mapArr(filestr);
exportMap.isExport = true;
mapEditArea.error(0);
tip.whichShow(2);
}
window.mapEditArea = document.getElementById('mapEditArea')
mapEditArea.errors=[ // 编号1,2
"格式错误!请使用正确格式(请使用地图生成器进行生成,且需要和本地图宽高完全一致)",
"当前有未定义ID在地图区域显示红块请修改ID或者到icons.js和maps.js中进行定义"
]
mapEditArea.formatTimer=null
mapEditArea._mapArr=''
mapEditArea.mapArr=function(value){
if(value!=null){
var val=value
var oldval=mapEditArea._mapArr
if (val==oldval) return;
if (exportMap.isExport) {
exportMap.isExport = false;
return;
}
if (mapEditArea.formatArr()) {
mapEditArea.error(0);
setTimeout(function () {
if (mapEditArea.formatArr())mapEditArea.mapArr(mapEditArea.formatArr());
mapEditArea.drawMap();
tip.whichShow(8)
}, 1000);
clearTimeout(mapEditArea.formatTimer);
mapEditArea.formatTimer = setTimeout(function () {
pout.value = mapEditArea.formatArr();
}, 5000); //5s后再格式化不然光标跳到最后很烦
} else {
mapEditArea.error(1);
}
mapEditArea._mapArr=value
}
return mapEditArea._mapArr
}
pout.oninput=function(){
mapEditArea.mapArr(pout.value)
}
mapEditArea._error=0
mapEditArea.error=function(value){
if(value!=null){
mapEditArea._error=value
if (value>0)
printe(mapEditArea.errors[value-1])
}
return mapEditArea._error
}
mapEditArea.drawMap= function () {
// var mapArray = mapEditArea.mapArr().split(/\D+/).join(' ').trim().split(' ');
var mapArray = JSON.parse('[' + mapEditArea.mapArr() + ']');
var sy=editor.map.length,sx=editor.map[0].length;
for (var y = 0; y < sy; y++)
for (var x = 0; x < sx; x++) {
var num = mapArray[y][x];
if (num == 0)
editor.map[y][x] = 0;
else if (typeof(editor.indexs[num][0]) == 'undefined') {
mapEditArea.error(2);
editor.map[y][x] = undefined;
} else editor.map[y][x] = editor.ids[[editor.indexs[num][0]]];
}
editor.updateMap();
}
mapEditArea.formatArr= function () {
var formatArrStr = '';
console.log(1)
var si=editor.map.length,sk=editor.map[0].length;
if (mapEditArea.mapArr().split(/\D+/).join(' ').trim().split(' ').length != si*sk) return false;
var arr = mapEditArea.mapArr().replace(/\s+/g, '').split('],[');
if (arr.length != si) return;
for (var i = 0; i < si; i++) {
var a = [];
formatArrStr += '[';
if (i == 0 || i == si-1) a = arr[i].split(/\D+/).join(' ').trim().split(' ');
else a = arr[i].split(/\D+/);
if (a.length != sk) {
formatArrStr = '';
return;
}
for (var k = 0; k < sk; k++) {
var num = parseInt(a[k]);
formatArrStr += Array(Math.max(4 - String(num).length, 0)).join(' ') + num + (k == sk-1 ? '' : ',');
}
formatArrStr += ']' + (i == si-1 ? '' : ',\n');
}
return formatArrStr;
}
window.copyMap=document.getElementById('copyMap')
copyMap.err=''
copyMap.onclick=function(){
tip.whichShow(0);
if (pout.value.trim() != '') {
if (mapEditArea.error()) {
copyMap.err = mapEditArea.errors[mapEditArea.error() - 1];
tip.whichShow(5)
return;
}
try {
pout.focus();
pout.setSelectionRange(0, pout.value.length);
document.execCommand("Copy");
tip.whichShow(6);
} catch (e) {
copyMap.err = e;
tip.whichShow(5);
}
} else {
tip.whichShow(7);
}
}
window.clearMapButton=document.getElementById('clearMapButton')
clearMapButton.onclick=function () {
editor.mapInit();
editor_mode.onmode('');
editor.file.saveFloorFile(function (err) {
if (err) {
printe(err);
throw(err)
}
;printf('地图清除成功');
});
editor.updateMap();
clearTimeout(mapEditArea.formatTimer);
clearTimeout(tip.timer);
pout.value = '';
mapEditArea.mapArr('');
tip.whichShow(4);
mapEditArea.error(0);
}
window.deleteMap=document.getElementById('deleteMap')
deleteMap.onclick=function () {
editor_mode.onmode('');
var index = core.floorIds.indexOf(editor.currentFloorId);
if (index>=0) {
core.floorIds.splice(index,1);
editor.file.editTower([['change', "['main']['floorIds']", core.floorIds]], function (objs_) {//console.log(objs_);
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printe('删除成功,请F5刷新编辑器生效');
});
}
else printe('删除成功,请F5刷新编辑器生效');
}
editor.uifunctions.newMap_func = function () {
@ -162,8 +353,8 @@ editor_datapanel_wrapper = function (editor) {
printe('不合法的idnum');
return;
}
if (!/^[0-9a-zA-Z_]+$/.test(id)) {
printe('不合法的id请使用字母、数字或下划线')
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(id)) {
printe('不合法的id请使用字母、数字或下划线,且不能以数字开头');
return;
}
editor.file.changeIdAndIdnum(id, idnum, editor_mode.info, function (err) {
@ -193,8 +384,8 @@ editor_datapanel_wrapper = function (editor) {
changeId.children[1].onclick = function () {
var id = changeId.children[0].value;
if (id) {
if (!/^[0-9a-zA-Z_]+$/.test(id)) {
printe('不合法的id请使用字母、数字或下划线')
if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(id)) {
printe('不合法的id请使用字母、数字或下划线,且不能以数字开头')
return;
}
editor.file.changeIdAndIdnum(id, null, editor_mode.info, function (err) {

View File

@ -8,6 +8,8 @@ editor_file_wrapper = function (editor) {
* }
* 的形式记录所有更改过的文件,save时写入
* <obj>的内容暂时还没想好
*
* Mark相关的思路搁置
*/
this.fileMark = {}
}
@ -136,6 +138,7 @@ editor_file_wrapper = function (editor) {
// 给追加素材使用
}
// Mark相关的思路搁置
editor_file_proto.prototype.addMark = function (name) {
// 把name对应的文件在editor.file.fileMark添加标记
}
@ -143,6 +146,905 @@ editor_file_wrapper = function (editor) {
editor_file_proto.prototype.save = function (callback) {
// 根据 editor.file.fileMark 把游戏对象格式化写入文件
}
}
/////////////////////////////////////////////////////////////////////////
editor_file = function (editor, callback) {
var editor_file = new editor_file_proto();
editor.file=editor_file;
editor.file.loadCommentjs(callback);
editor.file.saveFloorFile = function (callback) {
//callback(err:String)
checkCallback(callback);
/* if (!isset(editor.currentFloorId) || !isset(editor.currentFloorData)) {
callback('未选中文件或无数据');
} */
var filename = 'project/floors/' + editor.currentFloorId + '.js';
var datastr = ['main.floors.', editor.currentFloorId, '=\n'];
if (core.floorIds.indexOf(editor.currentFloorId) >= 0) {
for(var ii=0,name;name=['map','bgmap','fgmap'][ii];ii++){
var mapArray=editor[name].map(function (v) {
return v.map(function (v) {
return v.idnum || v || 0
})
});
editor.currentFloorData[name]=mapArray;
}
}
editor.file.saveFloor(editor.currentFloorData, callback)
}
///////////////////////////////////////////////////////////////////////////
editor.file.saveNewFile = function (saveFilename, callback) {
//saveAsFilename不含'/'不含'.js'
checkCallback(callback);
var currData=editor.currentFloorData;
var saveStatus = document.getElementById('newMapStatus').checked;
var title = saveStatus?currData.title:"新建楼层";
var name = saveStatus?currData.name:"0";
if (/^mt\d+$/i.test(saveFilename)) {
name = saveFilename.substring(2);
title = "主塔 "+name+" 层";
}
var width = parseInt(document.getElementById('newMapWidth').value);
var height = parseInt(document.getElementById('newMapHeight').value);
var row = [], map = [];
for (var i=0;i<width;i++) row.push(0);
for (var i=0;i<height;i++) map.push(row);
editor.currentFloorData = Object.assign(JSON.parse(JSON.stringify(editor.file.comment._data.floors_template)), {
floorId: saveFilename,
title: title,
name: name,
width: width,
height: height,
map: map,
},saveStatus?{
canFlyTo: currData.canFlyTo,
canUseQuickShop: currData.canUseQuickShop,
cannotViewMap: currData.cannotViewMap,
cannotMoveDirectly: currData.cannotMoveDirectly,
item_ratio: currData.item_ratio,
defaultGround: currData.defaultGround,
bgm: currData.bgm,
color: currData.color,
weather: currData.weather,
}:{});
Object.keys(editor.currentFloorData).forEach(function (t) {
if (editor.currentFloorData[t] == null)
delete editor.currentFloorData[t];
})
editor.currentFloorId = saveFilename;
editor.file.saveFloorFile(callback);
}
editor.file.saveNewFiles = function (floorIdList, from, to, callback) {
checkCallback(callback);
var currData=editor.currentFloorData;
var saveStatus = document.getElementById('newMapsStatus').checked;
var calValue = function (text, i) {
return text.replace(/\${(.*?)}/g, function (word, value) {
return eval(value);
});
}
var width = parseInt(document.getElementById('newMapsWidth').value);
var height = parseInt(document.getElementById('newMapsHeight').value);
var row = [], map = [];
for (var i=0;i<width;i++) row.push(0);
for (var i=0;i<height;i++) map.push(row);
var filenames = floorIdList.map(function (v) {return "project/floors/"+v+".js";});
var datas = [];
for (var i=from;i<=to;i++) {
var datastr = ['main.floors.', floorIdList[i-from], '=\n{'];
var data = Object.assign(JSON.parse(JSON.stringify(editor.file.comment._data.floors_template)), {
floorId: floorIdList[i-from],
title: calValue(document.getElementById('newFloorTitles').value, i),
name: calValue(document.getElementById('newFloorNames').value, i),
width: width,
height: height,
map: map,
},saveStatus?{
canFlyTo: currData.canFlyTo,
canUseQuickShop: currData.canUseQuickShop,
cannotViewMap: currData.cannotViewMap,
cannotMoveDirectly: currData.cannotMoveDirectly,
item_ratio: currData.item_ratio,
defaultGround: currData.defaultGround,
bgm: currData.bgm,
color: currData.color,
weather: currData.weather,
}:{});
Object.keys(data).forEach(function (t) {
if (data[t] == null)
delete data[t];
else {
if (t=='map') {
datastr = datastr.concat(['\n"', t, '": [\n', editor.file.formatMap(data[t]), '\n],']);
}
else {
datastr = datastr.concat(['\n"', t, '": ', JSON.stringify(data[t], null, 4), ',']);
}
}
});
datastr = datastr.concat(['\n}']);
datastr = datastr.join('');
datas.push(encode(datastr));
}
editor.file.alertWhenCompress();
fs.writeMultiFiles(filenames, datas, function (err, data) {
callback(err);
});
}
//callback(err:String)
////////////////////////////////////////////////////////////////////
editor.file.autoRegister = function (info, callback) {
var iconActions = [];
var mapActions = [];
var templateActions = [];
var image = info.images;
var bindFaceIds = false;
if (image=='autotile') {
callback('不能对自动元件进行自动注册!');
return;
}
if (image=='npc48' && confirm("你想绑定npc48的朝向么\n如果是则会连续四个一组的对npc48的faceIds进行自动绑定。")) {
bindFaceIds = true;
}
var c=image.toUpperCase().charAt(0);
// terrains id
var terrainsId = [];
Object.keys(core.material.icons.terrains).forEach(function (id) {
terrainsId[core.material.icons.terrains[id]]=id;
})
var allIds = [];
editor.ids.forEach(function (v) {
if (v.images==image) {
allIds[v.y]=v;
}
})
var per_height = image.endsWith('48')?48:32;
var faceIds = []; // down, left, right, up
var idnum=300;
for (var y=0; y<editor.widthsX[image][3]/per_height;y++) {
if (allIds[y] != null) {
faceIds.push(allIds[y]);
continue;
}
while (editor.core.maps.blocksInfo[idnum]) idnum++;
// get id num
var id = c+idnum;
if (image=='terrains' && terrainsId[y] != null) {
id=terrainsId[y];
}
else {
iconActions.push(["add", "['" + image + "']['" + id + "']", y])
}
mapActions.push(["add", "['" + idnum + "']", {'cls': image, 'id': id}]);
faceIds.push({idnum: idnum, id: id});
if (image=='items')
templateActions.push(["add", "['items']['" + id + "']", editor.file.comment._data.items_template]);
else if (image.indexOf('enemy')==0)
templateActions.push(["add", "['" + id + "']", editor.file.comment._data.enemys_template]);
idnum++;
}
if (bindFaceIds) {
for (var i = 0; i < faceIds.length - 3; i+=4) {
var down = faceIds[i], left = faceIds[i+1], right = faceIds[i+2], up = faceIds[i+3];
var obj = {down: down.id, left: left.id, right: right.id, up: up.id};
mapActions.push(["add", "['" + down.idnum + "']['faceIds']", obj]);
mapActions.push(["add", "['" + left.idnum + "']['faceIds']", obj]);
mapActions.push(["add", "['" + right.idnum + "']['faceIds']", obj]);
mapActions.push(["add", "['" + up.idnum + "']['faceIds']", obj]);
}
}
if (mapActions.length==0) {
callback("没有要注册的项!");
return;
}
var templist = [];
var tempcallback = function (err) {
templist.push(err);
if (templist.length == 3) {
if (templist[0] != null || templist[1] != null || templist[2] != null)
callback((templist[0] || '') + '\n' + (templist[1] || '') + '\n' + (templist[2] || ''));
//这里如果一个成功一个失败会出严重bug
else
callback(null);
}
}
if (iconActions.length>0)
saveSetting('icons', iconActions, tempcallback);
else tempcallback(null);
saveSetting('maps', mapActions, tempcallback);
if (image=='items')
saveSetting('items', templateActions, tempcallback);
else if (image.indexOf('enemy')==0)
saveSetting('enemys', templateActions, tempcallback);
else tempcallback(null);
}
editor.file.registerAutotile = function (filename, callback) {
var idnum = 140;
while (editor.core.maps.blocksInfo[idnum]) idnum++;
var iconActions = [];
var mapActions = [];
iconActions.push(["add", "['autotile']['" + filename + "']", 0]);
mapActions.push(["add", "['" + idnum + "']", {'cls': 'autotile', 'id': filename, 'noPass': true}]);
var templist = [];
var tempcallback = function (err) {
templist.push(err);
if (templist.length == 2) {
if (templist[0] != null || templist[1] != null)
callback((templist[0] || '') + '\n' + (templist[1] || ''));
//这里如果一个成功一个失败会出严重bug
else
callback(null);
}
}
saveSetting('icons', iconActions, tempcallback);
saveSetting('maps', mapActions, tempcallback);
}
editor.file.changeIdAndIdnum = function (id, idnum, info, callback) {
checkCallback(callback);
var changeOrNew=core.isset(editor_mode.info.id)?'change':'new'
if(changeOrNew=='new'){
//检查maps中是否有重复的idnum或id
for (var ii in editor.core.maps.blocksInfo) {
if (ii == idnum) {
callback('idnum重复了');
return;
}
if (editor.core.maps.blocksInfo[ii].id == id) {
callback('id重复了');
return;
}
}
var templist = [];
var tempcallback = function (err) {
templist.push(err);
if (templist.length == 2) {
if (templist[0] != null || templist[1] != null)
callback((templist[0] || '') + '\n' + (templist[1] || ''));
//这里如果一个成功一个失败会出严重bug
else
callback(null);
}
}
saveSetting('maps', [["add", "['" + idnum + "']", {'cls': info.images, 'id': id}]], tempcallback);
saveSetting('icons', [["add", "['" + info.images + "']['" + id + "']", info.y]], tempcallback);
if (info.images === 'items') {
saveSetting('items', [["add", "['items']['" + id + "']", editor.file.comment._data.items_template]], function (err) {
if (err) {
printe(err);
throw(err)
}
});
}
if (info.images === 'enemys' || info.images === 'enemy48') {
saveSetting('enemys', [["add", "['" + id + "']", editor.file.comment._data.enemys_template]], function (err) {
if (err) {
printe(err);
throw(err)
}
});
}
callback(null);
}else{
//检查maps中是否有重复的idnum或id
for (var ii in editor.core.maps.blocksInfo) {
if (editor.core.maps.blocksInfo[ii].id == id) {
callback('id重复了');
return;
}
}
idnum = info.idnum;
maps_90f36752_8815_4be8_b32b_d7fad1d0542e[idnum].id = id;
var arr=[icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1,items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a,{enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80:enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80}]
arr.forEach(function (obj) {
for(var jj in obj){
var ii=obj[jj]
if (ii.hasOwnProperty(info.id)){
ii[id]=ii[info.id];
delete(ii[info.id]);
}
}
});
editor.file.save_icons_maps_items_enemys(callback)
}
}
//callback(err:String)
editor.file.editItem = function (id, actionList, callback) {
/*actionList:[
["change","['items']['name']","红宝石的新名字"],
["add","['items']['新的和name同级的属性']",123],
["change","['itemEffectTip']","',攻击力+'+editor.core.values.redJewel"],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) {
var tempindex = value[1].indexOf(']') + 1;
value[1] = [value[1].slice(0, tempindex), "['" + id + "']", value[1].slice(tempindex)].join('');
});
saveSetting('items', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj_ = {};
Object.keys(editor.file.comment._data.items._data).forEach(function (v) {
if (isset(editor.core.items[v][id]) && v !== 'items')
locObj_[v] = editor.core.items[v][id];
else
locObj_[v] = null;
});
locObj_['items'] = (function () {
var locObj = Object.assign({}, editor.core.items.items[id]);
Object.keys(editor.file.comment._data.items._data.items._data).forEach(function (v) {
if (!isset(editor.core.items.items[id][v]))
locObj[v] = null;
});
return locObj;
})();
return locObj_;
})(),
editor.file.comment._data.items,
null]);
}
//只有items.cls是items的才有itemEffect和itemEffectTip,keys和constants和tools只有items
}
//callback([obj,commentObj,err:String])
editor.file.editEnemy = function (id, actionList, callback) {
/*actionList:[
["change","['name']","初级巫师的新名字"],
["add","['新的和name同级的属性']",123],
["change","['bomb']",null],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) {
value[1] = "['" + id + "']" + value[1];
});
saveSetting('enemys', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = Object.assign({}, editor.core.enemys.enemys[id]);
Object.keys(editor.file.comment._data.enemys._data).forEach(function (v) {
if (!isset(editor.core.enemys.enemys[id][v]))
/* locObj[v]=editor.core.enemys.enemys[id][v];
else */
locObj[v] = null;
});
return locObj;
})(),
editor.file.comment._data.enemys,
null]);
}
}
//callback([obj,commentObj,err:String])
editor.file.editMapBlocksInfo = function (idnum, actionList, callback) {
/*actionList:[
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。"]],
["change","['afterBattle']",null],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
var tempmap=[];
for(var ii=0;ii<actionList.length;ii++){
var value=actionList[ii];
// 是tilesets 且未定义 且在这里是第一次定义
if(idnum>=editor.core.icons.tilesetStartOffset && !isset(editor.core.maps.blocksInfo[idnum]) && tempmap.indexOf(idnum)===-1){
actionList.splice(ii,0,["add","['" + idnum + "']",{"cls": "tileset", "id": "X"+idnum, "noPass": true}]);
tempmap.push(idnum);
ii++;
}
value[1] = "['" + idnum + "']" + value[1];
}
saveSetting('maps', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var sourceobj=editor.core.maps.blocksInfo[idnum];
if(!isset(sourceobj) && idnum>=editor.core.icons.tilesetStartOffset)sourceobj={"cls": "tileset", "id": "X"+idnum, "noPass": true}
var locObj = Object.assign({}, sourceobj);
Object.keys(editor.file.comment._data.maps._data).forEach(function (v) {
if (!isset(sourceobj[v]))
locObj[v] = null;
});
locObj.idnum = idnum;
return locObj;
})(),
editor.file.comment._data.maps,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
editor.file.editLoc = function (x, y, actionList, callback) {
/*actionList:[
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。"]],
["change","['afterBattle']",null],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) {
if(/\['autoEvent'\]\['\d+'\]$/.test(value[1]))value[1]=value[1].replace(/\['\d+'\]$/,function(v){return "['" + x + "," + y + "']"+v})
else value[1] = value[1] + "['" + x + "," + y + "']";
});
saveSetting('floorloc', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = {};
Object.keys(editor.file.comment._data.floors._data.loc._data).forEach(function (v) {
if (isset(editor.currentFloorData[v][x + ',' + y]))
locObj[v] = editor.currentFloorData[v][x + ',' + y];
else
locObj[v] = null;
});
return locObj;
})(),
editor.file.comment._data.floors._data.loc,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
editor.file.editFloor = function (actionList, callback) {
/*actionList:[
["change","['title']",'样板 3 层'],
["change","['color']",null],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
saveSetting('floors', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = Object.assign({}, editor.currentFloorData);
Object.keys(editor.file.comment._data.floors._data.floor._data).forEach(function (v) {
if (!isset(editor.currentFloorData[v]))
/* locObj[v]=editor.currentFloorData[v];
else */
locObj[v] = null;
});
Object.keys(editor.file.comment._data.floors._data.loc._data).forEach(function (v) {
delete(locObj[v]);
});
delete(locObj.map);
delete(locObj.bgmap);
delete(locObj.fgmap);
return locObj;
})(),
editor.file.comment._data.floors._data.floor,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
editor.file.editTower = function (actionList, callback) {
/*actionList:[
["change","['firstData']['version']",'Ver 1.0.1 (Beta)'],
["change","['values']['lavaDamage']",200],
]
[]时只查询不修改
*/
var data_obj = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d;
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
saveSetting('data', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
//var locObj=Object.assign({'main':{}},editor.core.data);
var locObj = Object.assign({}, data_obj, {'main': {}});
Object.keys(editor.file.dataComment._data.main._data).forEach(function (v) {
if (isset(editor.main[v]))
locObj.main[v] = data_obj.main[v];
else
locObj.main[v] = null;
});
return locObj;
})(),
editor.file.dataComment,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
var fmap = {};
var fjson = JSON.stringify(functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a, function (k, v) {
if (v instanceof Function) {
var id_ = editor.util.guid();
fmap[id_] = v.toString();
return id_;
} else return v
}, 4);
var fobj = JSON.parse(fjson);
editor.file.functionsMap = fmap;
editor.file.functionsJSON = fjson;
var buildlocobj = function (locObj) {
for (var key in locObj) {
if (typeof(locObj[key]) !== typeof('')) buildlocobj(locObj[key]);
else locObj[key] = fmap[locObj[key]];
}
};
editor.file.editFunctions = function (actionList, callback) {
/*actionList:[
["change","['events']['afterChangeLight']","function(x,y){console.log(x,y)}"],
["change","['ui']['drawAbout']","function(){...}"],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
saveSetting('functions', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = JSON.parse(fjson);
buildlocobj(locObj);
return locObj;
})(),
editor.file.functionsComment,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
editor.file.editCommonEvent = function (actionList, callback) {
/*actionList:[
["change","['test']",['123']],
]
[]时只查询不修改
*/
var data_obj = events_c12a15a8_c380_4b28_8144_256cba95f760.commonEvent;
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) {
value[1] = "['commonEvent']" + value[1];
});
saveSetting('events', actionList, function (err) {
callback([err]);
});
} else {
callback([
Object.assign({},data_obj),
editor.file.eventsComment._data.commonEvent,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
var plmap = {};
var pljson = JSON.stringify(plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1, function (k, v) {
if (v instanceof Function) {
var id_ = editor.util.guid();
plmap[id_] = v.toString();
return id_;
} else if(v===null){
var id_ = editor.util.guid();
plmap[id_] = null;
return id_;
} return v
}, 4);
var plobj = JSON.parse(pljson);
editor.file.pluginsMap = plmap;
editor.file.pluginsObj = plobj;
var buildpllocobj = function (locObj) {
for (var key in locObj) {
if (typeof(locObj[key]) !== typeof('')) buildpllocobj(locObj[key]);
else locObj[key] = plmap[locObj[key]];
}
};
editor.file.editPlugins = function (actionList, callback) {
/*actionList:[
["change","['test']","function(x,y){console.log(x,y)}"],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
saveSetting('plugins', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = JSON.parse(JSON.stringify(plobj));
buildpllocobj(locObj);
return locObj;
})(),
editor.file.pluginsComment,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
var isset = function (val) {
if (val == undefined || val == null) {
return false;
}
return true
}
var checkCallback=function(callback){
if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
}
var encode = editor.util.encode64;
editor.file.save_icons_maps_items_enemys=function(callback){
var check=[]
saveSetting('icons',[],function(err){
if(err){callback(err);return;}
check.push('icons')
if(check.length==4)callback(null);
})
saveSetting('maps',[],function(err){
if(err){callback(err);return;}
check.push('maps')
if(check.length==4)callback(null);
})
saveSetting('items',[],function(err){
if(err){callback(err);return;}
check.push('items')
if(check.length==4)callback(null);
})
saveSetting('enemys',[],function(err){
if(err){callback(err);return;}
check.push('enemys')
if(check.length==4)callback(null);
})
}
var saveSetting = function (file, actionList, callback) {
//console.log(file);
//console.log(actionList);
editor.file.alertWhenCompress();
if (file == 'icons') {
actionList.forEach(function (value) {
eval("icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = \n';
datastr += JSON.stringify(icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1, null, '\t');
fs.writeFile('project/icons.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'maps') {
actionList.forEach(function (value) {
eval("maps_90f36752_8815_4be8_b32b_d7fad1d0542e" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var maps_90f36752_8815_4be8_b32b_d7fad1d0542e = \n';
//datastr+=JSON.stringify(maps_90f36752_8815_4be8_b32b_d7fad1d0542e,null,4);
var emap = {};
var estr = JSON.stringify(maps_90f36752_8815_4be8_b32b_d7fad1d0542e, function (k, v) {
if (v.id != null) {
var id_ = editor.util.guid();
emap[id_] = JSON.stringify(v);
return id_;
} else return v
}, '\t');
for (var id_ in emap) {
estr = estr.replace('"' + id_ + '"', emap[id_])
}
datastr += estr;
fs.writeFile('project/maps.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'items') {
actionList.forEach(function (value) {
eval("items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = \n';
datastr += JSON.stringify(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a, null, '\t');
fs.writeFile('project/items.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'enemys') {
actionList.forEach(function (value) {
eval("enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = \n';
var emap = {};
var estr = JSON.stringify(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80, function (k, v) {
if (v.hp != null) {
var id_ = editor.util.guid();
emap[id_] = JSON.stringify(v);
return id_;
} else return v
}, '\t');
for (var id_ in emap) {
estr = estr.replace('"' + id_ + '"', emap[id_])
}
datastr += estr;
fs.writeFile('project/enemys.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'data') {
actionList.forEach(function (value) {
eval("data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d" + value[1] + '=' + JSON.stringify(value[2]));
});
if (data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds.indexOf(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.floorId) < 0)
data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.floorId = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds[0];
var datastr = 'var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = \n';
datastr += JSON.stringify(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d, null, '\t');
fs.writeFile('project/data.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'functions') {
actionList.forEach(function (value) {
eval("fmap[fobj" + value[1] + ']=' + JSON.stringify(value[2]));
});
var fraw = fjson;
for (var id_ in fmap) {
fraw = fraw.replace('"' + id_ + '"', fmap[id_])
}
var datastr = 'var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = \n';
datastr += fraw;
fs.writeFile('project/functions.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'floorloc') {
actionList.forEach(function (value) {
// 检测null/undefined
if(/\['autoEvent'\]\['\d+,\d+'\]\['\d+'\]$/.test(value[1])){
var tempvalue=value[1].replace(/\['\d+'\]$/,'')
tempvalue="editor.currentFloorData" +tempvalue
tempvalue=tempvalue+'='+tempvalue+'||{}'
eval(tempvalue)
}
if (value[2]==null && value[0]!=='add')
eval("delete editor.currentFloorData" + value[1]);
else
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
});
editor.file.saveFloorFile(callback);
return;
}
if (file == 'floors') {
actionList.forEach(function (value) {
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
});
editor.file.saveFloorFile(callback);
return;
}
if (file == 'events') {
actionList.forEach(function (value) {
eval("events_c12a15a8_c380_4b28_8144_256cba95f760" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var events_c12a15a8_c380_4b28_8144_256cba95f760 = \n';
datastr += JSON.stringify(events_c12a15a8_c380_4b28_8144_256cba95f760, null, '\t');
fs.writeFile('project/events.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'plugins') {
actionList.forEach(function (value) {
if(value[0]==='add'){
eval("plobj" + value[1] + '=' + JSON.stringify(value[2]));
} else {
eval("plmap[plobj" + value[1] + ']=' + JSON.stringify(value[2]));
}
});
var plraw = JSON.stringify(plobj,null,4);
for (var id_ in plmap) {
plraw = plraw.replace('"' + id_ + '"', plmap[id_])
}
var datastr = 'var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = \n';
datastr += plraw;
fs.writeFile('project/plugins.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
callback('出错了,要设置的文件名不识别');
}
editor.file.saveSetting = saveSetting;
return editor_file;
}
//editor_file = editor_file(editor);

View File

@ -1,904 +0,0 @@
editor_file = function (editor, callback) {
var editor_file = new editor_file_proto();
editor.file=editor_file;
editor.file.loadCommentjs(callback);
editor.file.saveFloorFile = function (callback) {
//callback(err:String)
checkCallback(callback);
/* if (!isset(editor.currentFloorId) || !isset(editor.currentFloorData)) {
callback('未选中文件或无数据');
} */
var filename = 'project/floors/' + editor.currentFloorId + '.js';
var datastr = ['main.floors.', editor.currentFloorId, '=\n'];
if (core.floorIds.indexOf(editor.currentFloorId) >= 0) {
for(var ii=0,name;name=['map','bgmap','fgmap'][ii];ii++){
var mapArray=editor[name].map(function (v) {
return v.map(function (v) {
return v.idnum || v || 0
})
});
editor.currentFloorData[name]=mapArray;
}
}
editor.file.saveFloor(editor.currentFloorData, callback)
}
///////////////////////////////////////////////////////////////////////////
editor.file.saveNewFile = function (saveFilename, callback) {
//saveAsFilename不含'/'不含'.js'
checkCallback(callback);
var currData=editor.currentFloorData;
var saveStatus = document.getElementById('newMapStatus').checked;
var title = saveStatus?currData.title:"新建楼层";
var name = saveStatus?currData.name:"0";
if (/^mt\d+$/i.test(saveFilename)) {
name = saveFilename.substring(2);
title = "主塔 "+name+" 层";
}
var width = parseInt(document.getElementById('newMapWidth').value);
var height = parseInt(document.getElementById('newMapHeight').value);
var row = [], map = [];
for (var i=0;i<width;i++) row.push(0);
for (var i=0;i<height;i++) map.push(row);
editor.currentFloorData = Object.assign(JSON.parse(JSON.stringify(editor.file.comment._data.floors_template)), {
floorId: saveFilename,
title: title,
name: name,
width: width,
height: height,
map: map,
},saveStatus?{
canFlyTo: currData.canFlyTo,
canUseQuickShop: currData.canUseQuickShop,
cannotViewMap: currData.cannotViewMap,
cannotMoveDirectly: currData.cannotMoveDirectly,
item_ratio: currData.item_ratio,
defaultGround: currData.defaultGround,
bgm: currData.bgm,
color: currData.color,
weather: currData.weather,
}:{});
Object.keys(editor.currentFloorData).forEach(function (t) {
if (editor.currentFloorData[t] == null)
delete editor.currentFloorData[t];
})
editor.currentFloorId = saveFilename;
editor.file.saveFloorFile(callback);
}
editor.file.saveNewFiles = function (floorIdList, from, to, callback) {
checkCallback(callback);
var currData=editor.currentFloorData;
var saveStatus = document.getElementById('newMapsStatus').checked;
var calValue = function (text, i) {
return text.replace(/\${(.*?)}/g, function (word, value) {
return eval(value);
});
}
var width = parseInt(document.getElementById('newMapsWidth').value);
var height = parseInt(document.getElementById('newMapsHeight').value);
var row = [], map = [];
for (var i=0;i<width;i++) row.push(0);
for (var i=0;i<height;i++) map.push(row);
var filenames = floorIdList.map(function (v) {return "project/floors/"+v+".js";});
var datas = [];
for (var i=from;i<=to;i++) {
var datastr = ['main.floors.', floorIdList[i-from], '=\n{'];
var data = Object.assign(JSON.parse(JSON.stringify(editor.file.comment._data.floors_template)), {
floorId: floorIdList[i-from],
title: calValue(document.getElementById('newFloorTitles').value, i),
name: calValue(document.getElementById('newFloorNames').value, i),
width: width,
height: height,
map: map,
},saveStatus?{
canFlyTo: currData.canFlyTo,
canUseQuickShop: currData.canUseQuickShop,
cannotViewMap: currData.cannotViewMap,
cannotMoveDirectly: currData.cannotMoveDirectly,
item_ratio: currData.item_ratio,
defaultGround: currData.defaultGround,
bgm: currData.bgm,
color: currData.color,
weather: currData.weather,
}:{});
Object.keys(data).forEach(function (t) {
if (data[t] == null)
delete data[t];
else {
if (t=='map') {
datastr = datastr.concat(['\n"', t, '": [\n', editor.file.formatMap(data[t]), '\n],']);
}
else {
datastr = datastr.concat(['\n"', t, '": ', JSON.stringify(data[t], null, 4), ',']);
}
}
});
datastr = datastr.concat(['\n}']);
datastr = datastr.join('');
datas.push(encode(datastr));
}
editor.file.alertWhenCompress();
fs.writeMultiFiles(filenames, datas, function (err, data) {
callback(err);
});
}
//callback(err:String)
////////////////////////////////////////////////////////////////////
editor.file.autoRegister = function (info, callback) {
var iconActions = [];
var mapActions = [];
var templateActions = [];
var image = info.images;
var bindFaceIds = false;
if (image=='autotile') {
callback('不能对自动元件进行自动注册!');
return;
}
if (image=='npc48' && confirm("你想绑定npc48的朝向么\n如果是则会连续四个一组的对npc48的faceIds进行自动绑定。")) {
bindFaceIds = true;
}
var c=image.toUpperCase().charAt(0);
// terrains id
var terrainsId = [];
Object.keys(core.material.icons.terrains).forEach(function (id) {
terrainsId[core.material.icons.terrains[id]]=id;
})
var allIds = [];
editor.ids.forEach(function (v) {
if (v.images==image) {
allIds[v.y]=v;
}
})
var per_height = image.endsWith('48')?48:32;
var faceIds = []; // down, left, right, up
var idnum=300;
for (var y=0; y<editor.widthsX[image][3]/per_height;y++) {
if (allIds[y] != null) {
faceIds.push(allIds[y]);
continue;
}
while (editor.core.maps.blocksInfo[idnum]) idnum++;
// get id num
var id = c+idnum;
if (image=='terrains' && terrainsId[y] != null) {
id=terrainsId[y];
}
else {
iconActions.push(["add", "['" + image + "']['" + id + "']", y])
}
mapActions.push(["add", "['" + idnum + "']", {'cls': image, 'id': id}]);
faceIds.push({idnum: idnum, id: id});
if (image=='items')
templateActions.push(["add", "['items']['" + id + "']", editor.file.comment._data.items_template]);
else if (image.indexOf('enemy')==0)
templateActions.push(["add", "['" + id + "']", editor.file.comment._data.enemys_template]);
idnum++;
}
if (bindFaceIds) {
for (var i = 0; i < faceIds.length - 3; i+=4) {
var down = faceIds[i], left = faceIds[i+1], right = faceIds[i+2], up = faceIds[i+3];
var obj = {down: down.id, left: left.id, right: right.id, up: up.id};
mapActions.push(["add", "['" + down.idnum + "']['faceIds']", obj]);
mapActions.push(["add", "['" + left.idnum + "']['faceIds']", obj]);
mapActions.push(["add", "['" + right.idnum + "']['faceIds']", obj]);
mapActions.push(["add", "['" + up.idnum + "']['faceIds']", obj]);
}
}
if (mapActions.length==0) {
callback("没有要注册的项!");
return;
}
var templist = [];
var tempcallback = function (err) {
templist.push(err);
if (templist.length == 3) {
if (templist[0] != null || templist[1] != null || templist[2] != null)
callback((templist[0] || '') + '\n' + (templist[1] || '') + '\n' + (templist[2] || ''));
//这里如果一个成功一个失败会出严重bug
else
callback(null);
}
}
if (iconActions.length>0)
saveSetting('icons', iconActions, tempcallback);
else tempcallback(null);
saveSetting('maps', mapActions, tempcallback);
if (image=='items')
saveSetting('items', templateActions, tempcallback);
else if (image.indexOf('enemy')==0)
saveSetting('enemys', templateActions, tempcallback);
else tempcallback(null);
}
editor.file.registerAutotile = function (filename, callback) {
var idnum = 140;
while (editor.core.maps.blocksInfo[idnum]) idnum++;
var iconActions = [];
var mapActions = [];
iconActions.push(["add", "['autotile']['" + filename + "']", 0]);
mapActions.push(["add", "['" + idnum + "']", {'cls': 'autotile', 'id': filename, 'noPass': true}]);
var templist = [];
var tempcallback = function (err) {
templist.push(err);
if (templist.length == 2) {
if (templist[0] != null || templist[1] != null)
callback((templist[0] || '') + '\n' + (templist[1] || ''));
//这里如果一个成功一个失败会出严重bug
else
callback(null);
}
}
saveSetting('icons', iconActions, tempcallback);
saveSetting('maps', mapActions, tempcallback);
}
editor.file.changeIdAndIdnum = function (id, idnum, info, callback) {
checkCallback(callback);
var changeOrNew=core.isset(editor_mode.info.id)?'change':'new'
if(changeOrNew=='new'){
//检查maps中是否有重复的idnum或id
for (var ii in editor.core.maps.blocksInfo) {
if (ii == idnum) {
callback('idnum重复了');
return;
}
if (editor.core.maps.blocksInfo[ii].id == id) {
callback('id重复了');
return;
}
}
var templist = [];
var tempcallback = function (err) {
templist.push(err);
if (templist.length == 2) {
if (templist[0] != null || templist[1] != null)
callback((templist[0] || '') + '\n' + (templist[1] || ''));
//这里如果一个成功一个失败会出严重bug
else
callback(null);
}
}
saveSetting('maps', [["add", "['" + idnum + "']", {'cls': info.images, 'id': id}]], tempcallback);
saveSetting('icons', [["add", "['" + info.images + "']['" + id + "']", info.y]], tempcallback);
if (info.images === 'items') {
saveSetting('items', [["add", "['items']['" + id + "']", editor.file.comment._data.items_template]], function (err) {
if (err) {
printe(err);
throw(err)
}
});
}
if (info.images === 'enemys' || info.images === 'enemy48') {
saveSetting('enemys', [["add", "['" + id + "']", editor.file.comment._data.enemys_template]], function (err) {
if (err) {
printe(err);
throw(err)
}
});
}
callback(null);
}else{
//检查maps中是否有重复的idnum或id
for (var ii in editor.core.maps.blocksInfo) {
if (editor.core.maps.blocksInfo[ii].id == id) {
callback('id重复了');
return;
}
}
idnum = info.idnum;
maps_90f36752_8815_4be8_b32b_d7fad1d0542e[idnum].id = id;
var arr=[icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1,items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a,{enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80:enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80}]
arr.forEach(function (obj) {
for(var jj in obj){
var ii=obj[jj]
if (ii.hasOwnProperty(info.id)){
ii[id]=ii[info.id];
delete(ii[info.id]);
}
}
});
editor.file.save_icons_maps_items_enemys(callback)
}
}
//callback(err:String)
editor.file.editItem = function (id, actionList, callback) {
/*actionList:[
["change","['items']['name']","红宝石的新名字"],
["add","['items']['新的和name同级的属性']",123],
["change","['itemEffectTip']","',攻击力+'+editor.core.values.redJewel"],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) {
var tempindex = value[1].indexOf(']') + 1;
value[1] = [value[1].slice(0, tempindex), "['" + id + "']", value[1].slice(tempindex)].join('');
});
saveSetting('items', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj_ = {};
Object.keys(editor.file.comment._data.items._data).forEach(function (v) {
if (isset(editor.core.items[v][id]) && v !== 'items')
locObj_[v] = editor.core.items[v][id];
else
locObj_[v] = null;
});
locObj_['items'] = (function () {
var locObj = Object.assign({}, editor.core.items.items[id]);
Object.keys(editor.file.comment._data.items._data.items._data).forEach(function (v) {
if (!isset(editor.core.items.items[id][v]))
locObj[v] = null;
});
return locObj;
})();
return locObj_;
})(),
editor.file.comment._data.items,
null]);
}
//只有items.cls是items的才有itemEffect和itemEffectTip,keys和constants和tools只有items
}
//callback([obj,commentObj,err:String])
editor.file.editEnemy = function (id, actionList, callback) {
/*actionList:[
["change","['name']","初级巫师的新名字"],
["add","['新的和name同级的属性']",123],
["change","['bomb']",null],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) {
value[1] = "['" + id + "']" + value[1];
});
saveSetting('enemys', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = Object.assign({}, editor.core.enemys.enemys[id]);
Object.keys(editor.file.comment._data.enemys._data).forEach(function (v) {
if (!isset(editor.core.enemys.enemys[id][v]))
/* locObj[v]=editor.core.enemys.enemys[id][v];
else */
locObj[v] = null;
});
return locObj;
})(),
editor.file.comment._data.enemys,
null]);
}
}
//callback([obj,commentObj,err:String])
editor.file.editMapBlocksInfo = function (idnum, actionList, callback) {
/*actionList:[
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。"]],
["change","['afterBattle']",null],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
var tempmap=[];
for(var ii=0;ii<actionList.length;ii++){
var value=actionList[ii];
// 是tilesets 且未定义 且在这里是第一次定义
if(idnum>=editor.core.icons.tilesetStartOffset && !isset(editor.core.maps.blocksInfo[idnum]) && tempmap.indexOf(idnum)===-1){
actionList.splice(ii,0,["add","['" + idnum + "']",{"cls": "tileset", "id": "X"+idnum, "noPass": true}]);
tempmap.push(idnum);
ii++;
}
value[1] = "['" + idnum + "']" + value[1];
}
saveSetting('maps', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var sourceobj=editor.core.maps.blocksInfo[idnum];
if(!isset(sourceobj) && idnum>=editor.core.icons.tilesetStartOffset)sourceobj={"cls": "tileset", "id": "X"+idnum, "noPass": true}
var locObj = Object.assign({}, sourceobj);
Object.keys(editor.file.comment._data.maps._data).forEach(function (v) {
if (!isset(sourceobj[v]))
locObj[v] = null;
});
locObj.idnum = idnum;
return locObj;
})(),
editor.file.comment._data.maps,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
editor.file.editLoc = function (x, y, actionList, callback) {
/*actionList:[
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。"]],
["change","['afterBattle']",null],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) {
if(/\['autoEvent'\]\['\d+'\]$/.test(value[1]))value[1]=value[1].replace(/\['\d+'\]$/,function(v){return "['" + x + "," + y + "']"+v})
else value[1] = value[1] + "['" + x + "," + y + "']";
});
saveSetting('floorloc', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = {};
Object.keys(editor.file.comment._data.floors._data.loc._data).forEach(function (v) {
if (isset(editor.currentFloorData[v][x + ',' + y]))
locObj[v] = editor.currentFloorData[v][x + ',' + y];
else
locObj[v] = null;
});
return locObj;
})(),
editor.file.comment._data.floors._data.loc,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
editor.file.editFloor = function (actionList, callback) {
/*actionList:[
["change","['title']",'样板 3 层'],
["change","['color']",null],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
saveSetting('floors', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = Object.assign({}, editor.currentFloorData);
Object.keys(editor.file.comment._data.floors._data.floor._data).forEach(function (v) {
if (!isset(editor.currentFloorData[v]))
/* locObj[v]=editor.currentFloorData[v];
else */
locObj[v] = null;
});
Object.keys(editor.file.comment._data.floors._data.loc._data).forEach(function (v) {
delete(locObj[v]);
});
delete(locObj.map);
delete(locObj.bgmap);
delete(locObj.fgmap);
return locObj;
})(),
editor.file.comment._data.floors._data.floor,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
editor.file.editTower = function (actionList, callback) {
/*actionList:[
["change","['firstData']['version']",'Ver 1.0.1 (Beta)'],
["change","['values']['lavaDamage']",200],
]
[]时只查询不修改
*/
var data_obj = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d;
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
saveSetting('data', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
//var locObj=Object.assign({'main':{}},editor.core.data);
var locObj = Object.assign({}, data_obj, {'main': {}});
Object.keys(editor.file.dataComment._data.main._data).forEach(function (v) {
if (isset(editor.main[v]))
locObj.main[v] = data_obj.main[v];
else
locObj.main[v] = null;
});
return locObj;
})(),
editor.file.dataComment,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
var fmap = {};
var fjson = JSON.stringify(functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a, function (k, v) {
if (v instanceof Function) {
var id_ = editor.util.guid();
fmap[id_] = v.toString();
return id_;
} else return v
}, 4);
var fobj = JSON.parse(fjson);
editor.file.functionsMap = fmap;
editor.file.functionsJSON = fjson;
var buildlocobj = function (locObj) {
for (var key in locObj) {
if (typeof(locObj[key]) !== typeof('')) buildlocobj(locObj[key]);
else locObj[key] = fmap[locObj[key]];
}
};
editor.file.editFunctions = function (actionList, callback) {
/*actionList:[
["change","['events']['afterChangeLight']","function(x,y){console.log(x,y)}"],
["change","['ui']['drawAbout']","function(){...}"],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
saveSetting('functions', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = JSON.parse(fjson);
buildlocobj(locObj);
return locObj;
})(),
editor.file.functionsComment,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
editor.file.editCommonEvent = function (actionList, callback) {
/*actionList:[
["change","['test']",['123']],
]
[]时只查询不修改
*/
var data_obj = events_c12a15a8_c380_4b28_8144_256cba95f760.commonEvent;
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
actionList.forEach(function (value) {
value[1] = "['commonEvent']" + value[1];
});
saveSetting('events', actionList, function (err) {
callback([err]);
});
} else {
callback([
Object.assign({},data_obj),
editor.file.eventsComment._data.commonEvent,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
var plmap = {};
var pljson = JSON.stringify(plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1, function (k, v) {
if (v instanceof Function) {
var id_ = editor.util.guid();
plmap[id_] = v.toString();
return id_;
} else if(v===null){
var id_ = editor.util.guid();
plmap[id_] = null;
return id_;
} return v
}, 4);
var plobj = JSON.parse(pljson);
editor.file.pluginsMap = plmap;
editor.file.pluginsObj = plobj;
var buildpllocobj = function (locObj) {
for (var key in locObj) {
if (typeof(locObj[key]) !== typeof('')) buildpllocobj(locObj[key]);
else locObj[key] = plmap[locObj[key]];
}
};
editor.file.editPlugins = function (actionList, callback) {
/*actionList:[
["change","['test']","function(x,y){console.log(x,y)}"],
]
[]时只查询不修改
*/
checkCallback(callback);
if (isset(actionList) && actionList.length > 0) {
saveSetting('plugins', actionList, function (err) {
callback([err]);
});
} else {
callback([
(function () {
var locObj = JSON.parse(JSON.stringify(plobj));
buildpllocobj(locObj);
return locObj;
})(),
editor.file.pluginsComment,
null]);
}
}
//callback([obj,commentObj,err:String])
////////////////////////////////////////////////////////////////////
var isset = function (val) {
if (val == undefined || val == null) {
return false;
}
return true
}
var checkCallback=function(callback){
if (!isset(callback)) {
printe('未设置callback');
throw('未设置callback')
}
}
var encode = editor.util.encode64;
var alertWhenCompress = function(){
if(editor.useCompress===true){
editor.useCompress='alerted';
setTimeout("alert('当前游戏使用的是压缩文件,修改完成后请使用启动服务.exe->Js代码压缩工具重新压缩,或者把main.js的useCompress改成false来使用原始文件')",1000)
}
}
editor.file.save_icons_maps_items_enemys=function(callback){
var check=[]
saveSetting('icons',[],function(err){
if(err){callback(err);return;}
check.push('icons')
if(check.length==4)callback(null);
})
saveSetting('maps',[],function(err){
if(err){callback(err);return;}
check.push('maps')
if(check.length==4)callback(null);
})
saveSetting('items',[],function(err){
if(err){callback(err);return;}
check.push('items')
if(check.length==4)callback(null);
})
saveSetting('enemys',[],function(err){
if(err){callback(err);return;}
check.push('enemys')
if(check.length==4)callback(null);
})
}
var saveSetting = function (file, actionList, callback) {
//console.log(file);
//console.log(actionList);
editor.file.alertWhenCompress();
if (file == 'icons') {
actionList.forEach(function (value) {
eval("icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = \n';
datastr += JSON.stringify(icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1, null, '\t');
fs.writeFile('project/icons.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'maps') {
actionList.forEach(function (value) {
eval("maps_90f36752_8815_4be8_b32b_d7fad1d0542e" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var maps_90f36752_8815_4be8_b32b_d7fad1d0542e = \n';
//datastr+=JSON.stringify(maps_90f36752_8815_4be8_b32b_d7fad1d0542e,null,4);
var emap = {};
var estr = JSON.stringify(maps_90f36752_8815_4be8_b32b_d7fad1d0542e, function (k, v) {
if (v.id != null) {
var id_ = editor.util.guid();
emap[id_] = JSON.stringify(v);
return id_;
} else return v
}, '\t');
for (var id_ in emap) {
estr = estr.replace('"' + id_ + '"', emap[id_])
}
datastr += estr;
fs.writeFile('project/maps.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'items') {
actionList.forEach(function (value) {
eval("items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = \n';
datastr += JSON.stringify(items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a, null, '\t');
fs.writeFile('project/items.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'enemys') {
actionList.forEach(function (value) {
eval("enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = \n';
var emap = {};
var estr = JSON.stringify(enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80, function (k, v) {
if (v.hp != null) {
var id_ = editor.util.guid();
emap[id_] = JSON.stringify(v);
return id_;
} else return v
}, '\t');
for (var id_ in emap) {
estr = estr.replace('"' + id_ + '"', emap[id_])
}
datastr += estr;
fs.writeFile('project/enemys.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'data') {
actionList.forEach(function (value) {
eval("data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d" + value[1] + '=' + JSON.stringify(value[2]));
});
if (data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds.indexOf(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.floorId) < 0)
data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.firstData.floorId = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds[0];
var datastr = 'var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = \n';
datastr += JSON.stringify(data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d, null, '\t');
fs.writeFile('project/data.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'functions') {
actionList.forEach(function (value) {
eval("fmap[fobj" + value[1] + ']=' + JSON.stringify(value[2]));
});
var fraw = fjson;
for (var id_ in fmap) {
fraw = fraw.replace('"' + id_ + '"', fmap[id_])
}
var datastr = 'var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = \n';
datastr += fraw;
fs.writeFile('project/functions.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'floorloc') {
actionList.forEach(function (value) {
// 检测null/undefined
if(/\['autoEvent'\]\['\d+,\d+'\]\['\d+'\]$/.test(value[1])){
var tempvalue=value[1].replace(/\['\d+'\]$/,'')
tempvalue="editor.currentFloorData" +tempvalue
tempvalue=tempvalue+'='+tempvalue+'||{}'
eval(tempvalue)
}
if (value[2]==null && value[0]!=='add')
eval("delete editor.currentFloorData" + value[1]);
else
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
});
editor.file.saveFloorFile(callback);
return;
}
if (file == 'floors') {
actionList.forEach(function (value) {
eval("editor.currentFloorData" + value[1] + '=' + JSON.stringify(value[2]));
});
editor.file.saveFloorFile(callback);
return;
}
if (file == 'events') {
actionList.forEach(function (value) {
eval("events_c12a15a8_c380_4b28_8144_256cba95f760" + value[1] + '=' + JSON.stringify(value[2]));
});
var datastr = 'var events_c12a15a8_c380_4b28_8144_256cba95f760 = \n';
datastr += JSON.stringify(events_c12a15a8_c380_4b28_8144_256cba95f760, null, '\t');
fs.writeFile('project/events.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
if (file == 'plugins') {
actionList.forEach(function (value) {
if(value[0]==='add'){
eval("plobj" + value[1] + '=' + JSON.stringify(value[2]));
} else {
eval("plmap[plobj" + value[1] + ']=' + JSON.stringify(value[2]));
}
});
var plraw = JSON.stringify(plobj,null,4);
for (var id_ in plmap) {
plraw = plraw.replace('"' + id_ + '"', plmap[id_])
}
var datastr = 'var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = \n';
datastr += plraw;
fs.writeFile('project/plugins.js', encode(datastr), 'base64', function (err, data) {
callback(err);
});
return;
}
callback('出错了,要设置的文件名不识别');
}
editor.file.saveSetting = saveSetting;
return editor_file;
}
//editor_file = editor_file(editor);

View File

@ -1,379 +0,0 @@
// 由于历史遗留原因, 以下变量作为全局变量使用
// exportMap mapEditArea pout mapEditArea copyMap clearMapButton deleteMap printf printe tip selectBox
// 除对这些量的功能修改外, 误在此文件中增加新变量或函数
exportMap = document.getElementById('exportMap')
exportMap.isExport=false
exportMap.onclick=function(){
editor.updateMap();
var sx=editor.map.length-1,sy=editor.map[0].length-1;
var filestr = '';
for (var yy = 0; yy <= sy; yy++) {
filestr += '['
for (var xx = 0; xx <= sx; xx++) {
var mapxy = editor.map[yy][xx];
if (typeof(mapxy) == typeof({})) {
if ('idnum' in mapxy) mapxy = mapxy.idnum;
else {
// mapxy='!!?';
tip.whichShow(3);
return;
}
} else if (typeof(mapxy) == 'undefined') {
tip.whichShow(3);
return;
}
mapxy = String(mapxy);
mapxy = Array(Math.max(4 - mapxy.length, 0)).join(' ') + mapxy;
filestr += mapxy + (xx == sx ? '' : ',')
}
filestr += ']' + (yy == sy ? '' : ',\n');
}
pout.value = filestr;
mapEditArea.mapArr(filestr);
exportMap.isExport = true;
mapEditArea.error(0);
tip.whichShow(2);
}
mapEditArea = document.getElementById('mapEditArea')
mapEditArea.errors=[ // 编号1,2
"格式错误!请使用正确格式(请使用地图生成器进行生成,且需要和本地图宽高完全一致)",
"当前有未定义ID在地图区域显示红块请修改ID或者到icons.js和maps.js中进行定义"
]
mapEditArea.formatTimer=null
mapEditArea._mapArr=''
mapEditArea.mapArr=function(value){
if(value!=null){
var val=value
var oldval=mapEditArea._mapArr
if (val==oldval) return;
if (exportMap.isExport) {
exportMap.isExport = false;
return;
}
if (mapEditArea.formatArr()) {
mapEditArea.error(0);
setTimeout(function () {
if (mapEditArea.formatArr())mapEditArea.mapArr(mapEditArea.formatArr());
mapEditArea.drawMap();
tip.whichShow(8)
}, 1000);
clearTimeout(mapEditArea.formatTimer);
mapEditArea.formatTimer = setTimeout(function () {
pout.value = mapEditArea.formatArr();
}, 5000); //5s后再格式化不然光标跳到最后很烦
} else {
mapEditArea.error(1);
}
mapEditArea._mapArr=value
}
return mapEditArea._mapArr
}
pout.oninput=function(){
mapEditArea.mapArr(pout.value)
}
mapEditArea._error=0
mapEditArea.error=function(value){
if(value!=null){
mapEditArea._error=value
if (value>0)
printe(mapEditArea.errors[value-1])
}
return mapEditArea._error
}
mapEditArea.drawMap= function () {
// var mapArray = mapEditArea.mapArr().split(/\D+/).join(' ').trim().split(' ');
var mapArray = JSON.parse('[' + mapEditArea.mapArr() + ']');
var sy=editor.map.length,sx=editor.map[0].length;
for (var y = 0; y < sy; y++)
for (var x = 0; x < sx; x++) {
var num = mapArray[y][x];
if (num == 0)
editor.map[y][x] = 0;
else if (typeof(editor.indexs[num][0]) == 'undefined') {
mapEditArea.error(2);
editor.map[y][x] = undefined;
} else editor.map[y][x] = editor.ids[[editor.indexs[num][0]]];
}
editor.updateMap();
}
mapEditArea.formatArr= function () {
var formatArrStr = '';
console.log(1)
var si=editor.map.length,sk=editor.map[0].length;
if (mapEditArea.mapArr().split(/\D+/).join(' ').trim().split(' ').length != si*sk) return false;
var arr = mapEditArea.mapArr().replace(/\s+/g, '').split('],[');
if (arr.length != si) return;
for (var i = 0; i < si; i++) {
var a = [];
formatArrStr += '[';
if (i == 0 || i == si-1) a = arr[i].split(/\D+/).join(' ').trim().split(' ');
else a = arr[i].split(/\D+/);
if (a.length != sk) {
formatArrStr = '';
return;
}
for (var k = 0; k < sk; k++) {
var num = parseInt(a[k]);
formatArrStr += Array(Math.max(4 - String(num).length, 0)).join(' ') + num + (k == sk-1 ? '' : ',');
}
formatArrStr += ']' + (i == si-1 ? '' : ',\n');
}
return formatArrStr;
}
copyMap=document.getElementById('copyMap')
copyMap.err=''
copyMap.onclick=function(){
tip.whichShow(0);
if (pout.value.trim() != '') {
if (mapEditArea.error()) {
copyMap.err = mapEditArea.errors[mapEditArea.error() - 1];
tip.whichShow(5)
return;
}
try {
pout.focus();
pout.setSelectionRange(0, pout.value.length);
document.execCommand("Copy");
tip.whichShow(6);
} catch (e) {
copyMap.err = e;
tip.whichShow(5);
}
} else {
tip.whichShow(7);
}
}
clearMapButton=document.getElementById('clearMapButton')
clearMapButton.onclick=function () {
editor.mapInit();
editor_mode.onmode('');
editor.file.saveFloorFile(function (err) {
if (err) {
printe(err);
throw(err)
}
;printf('地图清除成功');
});
editor.updateMap();
clearTimeout(mapEditArea.formatTimer);
clearTimeout(tip.timer);
pout.value = '';
mapEditArea.mapArr('');
tip.whichShow(4);
mapEditArea.error(0);
}
deleteMap=document.getElementById('deleteMap')
deleteMap.onclick=function () {
editor_mode.onmode('');
var index = core.floorIds.indexOf(editor.currentFloorId);
if (index>=0) {
core.floorIds.splice(index,1);
editor.file.editTower([['change', "['main']['floorIds']", core.floorIds]], function (objs_) {//console.log(objs_);
if (objs_.slice(-1)[0] != null) {
printe(objs_.slice(-1)[0]);
throw(objs_.slice(-1)[0])
}
;printe('删除成功,请F5刷新编辑器生效');
});
}
else printe('删除成功,请F5刷新编辑器生效');
}
printf = function (str_, type) {
selectBox.isSelected(false);
if (!type) {
tip.whichShow(11);
} else {
tip.whichShow(12);
}
setTimeout(function () {
if (!type) {
tip.msgs[11] = String(str_);
tip.whichShow(12);
} else {
tip.msgs[10] = String(str_);
tip.whichShow(11);
}
}, 1);
}
printe = function (str_) {
printf(str_, 'error')
}
tip=document.getElementById('tip')
tip.showHelp = function(value) {
var tips = [
'表格的文本域可以双击进行编辑',
'双击地图可以选中素材,右键可以弹出菜单',
'双击事件编辑器的图块可以进行长文本编辑/脚本编辑/地图选点/UI绘制预览等操作',
'ESC或点击空白处可以自动保存当前修改',
'H键可以打开操作帮助哦',
'tileset贴图模式可以在地图上拖动来一次绘制一个区域右键额外素材也可以绑定宽高',
'可以拖动地图上的图块和事件或按Ctrl+C, Ctrl+X和Ctrl+V进行复制剪切和粘贴Delete删除',
'Alt+数字键保存图块,数字键读取保存的图块',
];
if (value == null) value = Math.floor(Math.random() * tips.length);
printf('tips: ' + tips[value])
}
tip._infos= {}
tip.infos=function(value){
if(value!=null){
var val=value
var oldval=tip._infos
tip.isClearBlock(false);
tip.isAirwall(false);
if (typeof(val) != 'undefined') {
if (val == 0) {
tip.isClearBlock(true);
return;
}
if ('id' in val) {
if (val.idnum == 17) {
tip.isAirwall(true);
return;
}
tip.hasId = true;
} else {
tip.hasId = false;
}
tip.isAutotile = false;
if (val.images == "autotile" && tip.hasId) tip.isAutotile = true;
document.getElementById('isAirwall-else').innerHTML=(tip.hasId?`<p>图块编号:<span class="infoText">${ value['idnum'] }</span></p>
<p>图块ID<span class="infoText">${ value['id'] }</span></p>`:`
<p class="warnText">该图块无对应的数字或ID存在请先前往icons.js和maps.js中进行定义</p>`)+`
<p>图块所在素材<span class="infoText">${ value['images'] + (tip.isAutotile ? '( '+value['id']+' )' : '') }</span>
</p>
<p>图块索引<span class="infoText">${ value['y'] }</span></p>`
}
tip._infos=value
}
return tip._infos
}
tip.hasId= true
tip.isAutotile= false
tip._isSelectedBlock= false
tip.isSelectedBlock=function(value){
if(value!=null){
var dshow=document.getElementById('isSelectedBlock-if')
var dhide=document.getElementById('isSelectedBlock-else')
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
dshow.style.display=''
dhide.style.display='none'
tip._isSelectedBlock=value
}
return tip._isSelectedBlock
}
tip._isClearBlock= false
tip.isClearBlock=function(value){
if(value!=null){
var dshow=document.getElementById('isClearBlock-if')
var dhide=document.getElementById('isClearBlock-else')
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
dshow.style.display=''
dhide.style.display='none'
tip._isClearBlock=value
}
return tip._isClearBlock
}
tip._isAirwall= false
tip.isAirwall=function(value){
if(value!=null){
var dshow=document.getElementById('isAirwall-if')
var dhide=document.getElementById('isAirwall-else')
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
dshow.style.display=''
dhide.style.display='none'
tip._isAirwall=value
}
return tip._isAirwall
}
tip.geneMapSuccess= false
tip.timer= null
tip.msgs= [ //分别编号1,2,3,4,5,6,7,8,9,10奇数警告偶数成功
"当前未选择任何图块,请先在右边选择要画的图块!",
"生成地图成功!可点击复制按钮复制地图数组到剪切板",
"生成失败! 地图中有未定义的图块,建议先用其他有效图块覆盖或点击清除地图!",
"地图清除成功!",
"复制失败!",
"复制成功!可直接粘贴到楼层文件的地图数组中。",
"复制失败!当前还没有数据",
"修改成功!可点击复制按钮复制地图数组到剪切板",
"选择背景图片失败!文件名格式错误或图片不存在!",
"更新背景图片成功!",
"11:警告",
"12:成功"
]
tip._mapMsg= ''
tip.mapMsg=function(value){
if(value!=null){
document.getElementById('whichShow-if').innerText=value
tip._mapMsg=value
}
return tip._mapMsg
}
tip._whichShow= 0
tip.whichShow=function(value){
if(value!=null){
var dshow=document.getElementById('whichShow-if')
var dhide=null
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
if(dshow)dshow.style.display=''
if(dhide)dhide.style.display='none'
if(dshow)dshow.setAttribute('class',(value%2) ? 'warnText' : 'successText')
tip.mapMsg('');
tip.msgs[4] = "复制失败!" + editTip.err;
clearTimeout(tip.timer);
if (value) {
tip.mapMsg(tip.msgs[value - 1]);
tip.timer = setTimeout(function () {
if (!(value % 2))
value = 0;
}, 5000); //5秒后自动清除successwarn不清除
}
tip._whichShow=value
}
return tip._whichShow
}
selectBox=document.getElementById('selectBox')
selectBox._isSelected=false
selectBox.isSelected=function(value){
if(value!=null){
selectBox._isSelected=value;
tip.isSelectedBlock(value);
tip.whichShow(0);
clearTimeout(tip.timer);
editor.dom.dataSelection.style.display=value?'':'none'
}
return selectBox._isSelected
}
// 修改此文件前先看文件开头的说明

View File

@ -35,6 +35,7 @@ editor_listen_wrapper = function (editor) {
editor.dom.clearLoc.onmousedown = editor.uifunctions.clearLoc_click
editor.dom.lastUsed.onmousedown = editor.uifunctions.lastUsed_click;
editor.dom.clearLastUsedBtn.onclick = editor.uifunctions.clearLastUsedBtn_click;
editor.dom.lockMode.onchange = editor.uifunctions.lockMode_onchange;
editor.dom.brushMod.onchange = editor.uifunctions.brushMod_onchange

View File

@ -48,7 +48,7 @@ editor_mappanel_wrapper = function (editor) {
if (editor.uivalues.bindSpecialDoor.loc != null) return;
var loc = editor.uifunctions.eToLoc(e);
var pos = editor.uifunctions.locToPos(loc, true);
editor.setSelectBoxFromInfo(editor[editor.layerMod][pos.y][pos.x]);
editor.setSelectBoxFromInfo(editor[editor.layerMod][pos.y][pos.x], true);
return;
}
@ -472,7 +472,7 @@ editor_mappanel_wrapper = function (editor) {
};
bindSpecialDoor.enemys.forEach(function (loc) {
editor.currentFloorData.afterBattle[loc] = [
{"type": "addValue", "name": doorFlag, "value": "1"}
{"type": "setValue", "name": doorFlag, "operator": "+=", "value": "1"}
]
});
editor.file.saveFloorFile(function (err) {
@ -514,7 +514,7 @@ editor_mappanel_wrapper = function (editor) {
editor.uifunctions.hideMidMenu();
e.stopPropagation();
var thisevent = editor[editor.layerMod][editor.pos.y][editor.pos.x];
editor.setSelectBoxFromInfo(thisevent);
editor.setSelectBoxFromInfo(thisevent, true);
}
/**
@ -742,7 +742,13 @@ editor_mappanel_wrapper = function (editor) {
return;
}
editor.uifunctions.clearLastUsedBtn_click = function () {
if (editor.isMobile) return;
editor.uivalues.lastUsed = [];
editor.config.set('lastUsed', []);
editor.updateLastUsedMap();
}
/////////////////////////////////////////////////////////////////////////////

View File

@ -1,5 +1,21 @@
editor_materialpanel_wrapper = function (editor) {
// 由于历史遗留原因, 以下变量作为全局变量使用
// selectBox
window.selectBox=document.getElementById('selectBox')
selectBox._isSelected=false
selectBox.isSelected=function(value){
if(value!=null){
selectBox._isSelected=value;
tip.isSelectedBlock(value);
tip.whichShow(0);
clearTimeout(tip.timer);
editor.dom.dataSelection.style.display=value?'':'none'
}
return selectBox._isSelected
}
editor.uifunctions.getScrollBarHeight = function () {
var outer = document.createElement("div");
outer.style.visibility = "hidden";

View File

@ -97,12 +97,14 @@ editor_mode = function (editor) {
}
editor_mode.prototype.onmode = function (mode, callback) {
if (editor_mode.mode != mode) {
if (mode === 'save') editor_mode.doActionList(editor_mode.mode, editor_mode.actionList, callback);
if (editor_mode.mode === 'nextChange' && mode) editor_mode.showMode(mode);
if (mode !== 'save') editor_mode.mode = mode;
editor_mode.actionList = [];
}
setTimeout(function(){
if (editor_mode.mode != mode) {
if (mode === 'save') editor_mode.doActionList(editor_mode.mode, editor_mode.actionList, callback);
if (editor_mode.mode === 'nextChange' && mode) editor_mode.showMode(mode);
if (mode !== 'save') editor_mode.mode = mode;
editor_mode.actionList = [];
}
})
}
editor_mode.prototype.showMode = function (mode) {
@ -167,6 +169,25 @@ editor_mode = function (editor) {
return true
}
editor_mode.prototype.checkImages = function (thiseval) {
if (!editor_mode.checkUnique(thiseval)) return false;
fs.readdir('project/images', function (err, data) {
if (err) {
printe(err);
throw Error(err);
}
thiseval.map(function (v) {
var name = v.indexOf('.') < 0 ? (v+'.png') : v;
if (data.indexOf(name) < 0) notExist = name;
return name;
});
if (notExist) {
alert('警告!图片' + notExist + '不存在!保存可能导致工程无法打开,请及时修改!');
}
});
return true;
}
editor_mode.prototype.changeDoubleClickModeByButton = function (mode) {
({
delete: function () {

View File

@ -8,7 +8,7 @@ editor_table_wrapper = function (editor) {
// HTML模板
editor_table.prototype.select = function (value, values) {
let content = editor.table.option(value) +
var content = editor.table.option(value) +
values.map(function (v) {
return editor.table.option(v)
}).join('')
@ -21,16 +21,35 @@ editor_table_wrapper = function (editor) {
return /* html */`<input type='text' spellcheck='false' value='${JSON.stringify(value)}'/>\n`
}
editor_table.prototype.checkbox = function (value) {
return /* html */`<input type='checkbox' ${(value ? 'checked ' : '')}/>\n`
return /* html */`<input type='checkbox' class='checkbox' ${(value ? 'checked ' : '')}/>\n`
}
editor_table.prototype.textarea = function (value, indent) {
return /* html */`<textarea spellcheck='false'>${JSON.stringify(value, null, indent || 0)}</textarea>\n`
}
editor_table.prototype.editGrid = function (showComment) {
var html = "";
if (showComment) html += "<button onclick='editor.table.onCommentBtnClick(this)'>显示完整注释</button><br/>";
html += "<button onclick='editor.table.onEditBtnClick(this)'>编辑表格内容</button>";
return html;
editor_table.prototype.checkboxSet = function (value, keys, prefixStrings) {
if (!(value instanceof Array)) value = [];
keys=Array.from(keys)
prefixStrings=Array.from(prefixStrings)
for (var index = 0; index < value.length; index++) {
if (keys.indexOf(value[index])==-1) {
keys.push(value[index])
prefixStrings.push('<br>'+value[index]+': ')
}
}
var content=[]
for (var index = 0; index < keys.length; index++) {
content.push(editor.table.checkboxSetMember(value.indexOf(keys[index])!=-1,keys[index],prefixStrings[index]))
}
return /* html */`<div class='checkboxSet'>${content.join('')}</div>\n`;
}
editor_table.prototype.checkboxSetMember = function (value,key,prefixString) {
return /* html */`${prefixString}<input key='${key}' ctype='${typeof key}' type='checkbox' class='checkboxSetMember' onchange='editor.table.checkboxSetMemberOnchange(this)' ${(value ? 'checked ' : '')}/>\n`;
}
editor_table.prototype.editGrid = function (showComment, showEdit) {
var list = [];
if (showComment) list.push("<button onclick='editor.table.onCommentBtnClick(this)'>注释</button>");
if (showEdit) list.push("<button onclick='editor.table.onEditBtnClick(this)'>编辑</button>");
return list.join(' ');
}
editor_table.prototype.title = function () {
@ -41,16 +60,39 @@ editor_table_wrapper = function (editor) {
return /* html */`<tr><td>----</td><td>----</td><td>${field}</td><td>----</td></tr>\n`
}
editor_table.prototype.tr = function (guid, field, shortField, commentHTMLescape, cobjstr, shortCommentHTMLescape, tdstr) {
editor_table.prototype.tr = function (guid, field, shortField, commentHTMLescape, cobjstr, shortComment, tdstr, type) {
return /* html */`<tr id="${guid}">
<td title="${field}">${shortField}</td>
<td title="${commentHTMLescape}" cobj="${cobjstr}">${shortCommentHTMLescape}</td>
<td><div class="etableInputDiv">${tdstr}</div></td>
<td>${editor.table.editGrid(commentHTMLescape != shortCommentHTMLescape)}</td>
<td title="${commentHTMLescape}" cobj="${cobjstr}">${shortComment || commentHTMLescape}</td>
<td><div class="etableInputDiv ${type}">${tdstr}</div></td>
<td>${editor.table.editGrid(shortComment, type != 'select' && type != 'checkbox' && type != 'checkboxSet')}</td>
</tr>\n`
}
/**
* checkboxset中checkbox的onchange
*/
editor_table.prototype.checkboxSetMemberOnchange = function (onemember) {
var thisset=onemember.parentNode
var inputs=thisset.children
var value=[]
for (var i in inputs) {
if (inputs[i].nodeName == 'INPUT') {
if (inputs[i].checked) {
var one = inputs[i].getAttribute('key');
if (inputs[i].getAttribute('ctype') == 'number') one = parseFloat(one);
value.push(one);
}
}
}
thiseval = value;
// if (value.length == 0) thiseval = null;
thisset.value=JSON.stringify(thiseval)
thisset.onchange()
}
/////////////////////////////////////////////////////////////////////////////
// 表格生成的控制
@ -197,16 +239,16 @@ editor_table_wrapper = function (editor) {
var thiseval = vobj;
var comment = String(cobj._data);
var charlength = 10;
var charlength = 15;
// "['a']['b']" => "b"
var shortField = field.split("']").slice(-2)[0].split("['").slice(-1)[0];
// 把长度超过 charlength 的字符改成 固定长度+...的形式
// shortField = (shortField.length < charlength ? shortField : shortField.slice(0, charlength) + '...');
shortField = (shortField.length < charlength ? shortField : shortField.slice(0, charlength) + '...');
// 完整的内容转义后供悬停查看
var commentHTMLescape = editor.util.HTMLescape(comment);
// 把长度超过 charlength 的字符改成 固定长度+...的形式
var shortCommentHTMLescape = (comment.length < charlength ? commentHTMLescape : editor.util.HTMLescape(comment.slice(0, charlength)) + '...');
// var shortCommentHTMLescape = (comment.length < charlength ? commentHTMLescape : editor.util.HTMLescape(comment.slice(0, charlength)) + '...');
var cobjstr = Object.assign({}, cobj);
delete cobjstr._data;
@ -214,22 +256,21 @@ editor_table_wrapper = function (editor) {
cobjstr = editor.util.HTMLescape(JSON.stringify(cobjstr));
var tdstr = editor.table.objToTd(obj, commentObj, field, cfield, vobj, cobj)
var outstr = editor.table.tr(guid, field, shortField, commentHTMLescape, cobjstr, shortCommentHTMLescape, tdstr)
var outstr = editor.table.tr(guid, field, shortField, commentHTMLescape, cobjstr, cobj._docs, tdstr, cobj._type)
return [outstr, guid];
}
editor_table.prototype.objToTd = function (obj, commentObj, field, cfield, vobj, cobj) {
var thiseval = vobj;
if (cobj._select) {
var values = cobj._select.values;
return editor.table.select(thiseval, values);
} else if (cobj._input) {
return editor.table.text(thiseval);
} else if (cobj._bool) {
return editor.table.checkbox(thiseval);
} else {
var indent = 0;
return editor.table.textarea(thiseval, indent);
switch (cobj._type) {
case 'select':
return editor.table.select(thiseval, cobj._select.values);
case 'checkbox':
return editor.table.checkbox(thiseval);
case 'checkboxSet':
return editor.table.checkboxSet(thiseval, cobj._checkboxSet.key, cobj._checkboxSet.prefix);
default:
return editor.table.textarea(thiseval, cobj.indent || 0);
}
}

View File

@ -1,5 +1,183 @@
editor_ui_wrapper = function (editor) {
// 由于历史遗留原因, 以下变量作为全局变量使用
// printf printe tip
window.printf = function (str_, type) {
selectBox.isSelected(false);
if (!type) {
tip.whichShow(11);
} else {
tip.whichShow(12);
}
setTimeout(function () {
if (!type) {
tip.msgs[11] = String(str_);
tip.whichShow(12);
} else {
tip.msgs[10] = String(str_);
tip.whichShow(11);
}
}, 1);
}
window.printe = function (str_) {
printf(str_, 'error')
}
window.tip=document.getElementById('tip')
tip.showHelp = function(value) {
var tips = [
'表格的文本域可以双击进行编辑',
'双击地图可以选中素材,右键可以弹出菜单',
'双击事件编辑器的图块可以进行长文本编辑/脚本编辑/地图选点/UI绘制预览等操作',
'ESC或点击空白处可以自动保存当前修改',
'H键可以打开操作帮助哦',
'tileset贴图模式可以在地图上拖动来一次绘制一个区域右键额外素材也可以绑定宽高',
'可以拖动地图上的图块和事件或按Ctrl+C, Ctrl+X和Ctrl+V进行复制剪切和粘贴Delete删除',
'Alt+数字键保存图块,数字键读取保存的图块',
];
if (value == null) value = Math.floor(Math.random() * tips.length);
printf('tips: ' + tips[value])
}
tip._infos= {}
tip.infos=function(value){
if(value!=null){
var val=value
var oldval=tip._infos
tip.isClearBlock(false);
tip.isAirwall(false);
if (typeof(val) != 'undefined') {
if (val == 0) {
tip.isClearBlock(true);
return;
}
if ('id' in val) {
if (val.idnum == 17) {
tip.isAirwall(true);
return;
}
tip.hasId = true;
} else {
tip.hasId = false;
}
tip.isAutotile = false;
if (val.images == "autotile" && tip.hasId) tip.isAutotile = true;
document.getElementById('isAirwall-else').innerHTML=(tip.hasId?`<p>图块编号:<span class="infoText">${ value['idnum'] }</span></p>
<p>图块ID<span class="infoText">${ value['id'] }</span></p>`:`
<p class="warnText">该图块无对应的数字或ID存在请先前往icons.js和maps.js中进行定义</p>`)+`
<p>图块所在素材<span class="infoText">${ value['images'] + (tip.isAutotile ? '( '+value['id']+' )' : '') }</span>
</p>
<p>图块索引<span class="infoText">${ value['y'] }</span></p>`
}
tip._infos=value
}
return tip._infos
}
tip.hasId= true
tip.isAutotile= false
tip._isSelectedBlock= false
tip.isSelectedBlock=function(value){
if(value!=null){
var dshow=document.getElementById('isSelectedBlock-if')
var dhide=document.getElementById('isSelectedBlock-else')
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
dshow.style.display=''
dhide.style.display='none'
tip._isSelectedBlock=value
}
return tip._isSelectedBlock
}
tip._isClearBlock= false
tip.isClearBlock=function(value){
if(value!=null){
var dshow=document.getElementById('isClearBlock-if')
var dhide=document.getElementById('isClearBlock-else')
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
dshow.style.display=''
dhide.style.display='none'
tip._isClearBlock=value
}
return tip._isClearBlock
}
tip._isAirwall= false
tip.isAirwall=function(value){
if(value!=null){
var dshow=document.getElementById('isAirwall-if')
var dhide=document.getElementById('isAirwall-else')
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
dshow.style.display=''
dhide.style.display='none'
tip._isAirwall=value
}
return tip._isAirwall
}
tip.geneMapSuccess= false
tip.timer= null
tip.msgs= [ //分别编号1,2,3,4,5,6,7,8,9,10奇数警告偶数成功
"当前未选择任何图块,请先在右边选择要画的图块!",
"生成地图成功!可点击复制按钮复制地图数组到剪切板",
"生成失败! 地图中有未定义的图块,建议先用其他有效图块覆盖或点击清除地图!",
"地图清除成功!",
"复制失败!",
"复制成功!可直接粘贴到楼层文件的地图数组中。",
"复制失败!当前还没有数据",
"修改成功!可点击复制按钮复制地图数组到剪切板",
"选择背景图片失败!文件名格式错误或图片不存在!",
"更新背景图片成功!",
"11:警告",
"12:成功"
]
tip._mapMsg= ''
tip.mapMsg=function(value){
if(value!=null){
document.getElementById('whichShow-if').innerText=value
tip._mapMsg=value
}
return tip._mapMsg
}
tip._whichShow= 0
tip.whichShow=function(value){
if(value!=null){
var dshow=document.getElementById('whichShow-if')
var dhide=null
if(!value){
var dtemp=dshow
dshow=dhide
dhide=dtemp
}
if(dshow)dshow.style.display=''
if(dhide)dhide.style.display='none'
if(dshow)dshow.setAttribute('class',(value%2) ? 'warnText' : 'successText')
tip.mapMsg('');
tip.msgs[4] = "复制失败!" + editTip.err;
clearTimeout(tip.timer);
if (value) {
tip.mapMsg(tip.msgs[value - 1]);
tip.timer = setTimeout(function () {
if (!(value % 2))
value = 0;
}, 5000); //5秒后自动清除successwarn不清除
}
tip._whichShow=value
}
return tip._whichShow
}
/**
* 根据鼠标点击, 得到从元素向上到body的所有id
@ -367,7 +545,8 @@ editor_ui_wrapper = function (editor) {
uievent.elements.selectPoint.style.display = 'block';
uievent.elements.yes.style.display = 'inline';
uievent.elements.selectBackground.style.display = 'none';
uievent.elements.selectFloor.style.display = hideFloor ? 'none' : 'inline';
// uievent.elements.selectFloor.style.display = hideFloor ? 'none' : 'inline';
uievent.elements.selectFloor.style.display = 'inline';
uievent.elements.selectPointBox.style.display = 'block';
uievent.elements.canvas.style.display = 'block';
uievent.elements.usedFlags.style.display = 'none';
@ -468,7 +647,8 @@ editor_ui_wrapper = function (editor) {
})();
uievent.elements.div.onmousewheel = function (e) {
if (uievent.mode != 'selectPoint' || uievent.values.hideFloor) return;
// if (uievent.mode != 'selectPoint' || uievent.values.hideFloor) return;
if (uievent.mode != 'selectPoint') return;
var index = core.floorIds.indexOf(uievent.values.floorId);
try {
if (e.wheelDelta)

View File

@ -1,6 +1,6 @@
# 重构
> 目前状态: 按功能分类已基本完成, 未完成file/game的重写
> 目前状态: 按功能分类, 维持稳定状态, 在3.0中重写
总体思路
+ 按功能拆分文件

View File

@ -19,37 +19,45 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "select",
"_select": {
"values": [
"keys",
"items",
"constants",
"tools",
"equips"
]
},
"_data": "只能取keys(钥匙) items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
"_docs": "道具类别",
"_data": "只能取items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
},
"name": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "名称"
"_data": "道具名称"
},
"text": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "道具描述",
"_data": "道具在道具栏中显示的描述"
},
"hideInToolbox": {
"_leaf": true,
"_type": "checkbox",
"_docs": "道具栏中隐藏",
"_data": "是否不显示在道具栏中"
},
"equip": {
"_leaf": true,
"_type": "textarea",
"_data": "装备属性设置仅对cls为equips有效。\n如果此项不为null需要是一个对象里面可含\"type\"\"atk\"\"def\"\"mdef\"\"animate\"五项,分别对应装备部位、攻防魔防和动画。\n具体详见文档元件说明-装备)和已有的几个装备的写法。"
"_docs": "道具的装备属性",
"_data": "装备属性设置仅对cls为equips有效。\n如果此项不为null需要是一个对象里面可含\"type\"\"atk\"\"def\"\"mdef\"\"animate\"五项,分别对应装备部位、攻防护盾和动画。\n具体详见文档元件说明-装备)和已有的几个装备的写法。"
},
"hideInReplay": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否回放时绘制道具栏。\n如果此项为true则在回放录像时使用本道具将不会绘制道具栏页面而是直接使用。\n此项建议在会频繁连续多次使用的道具开启如开启技能或者《镜子》那样的镜像切换等等"
"_docs": "回放不绘制道具栏",
"_data": "是否回放时绘制道具栏。\n如果此项为true则在回放录像时使用本道具将不会绘制道具栏页面而是直接使用。\n此项建议在会频繁连续多次使用的道具开启如开启技能或者《镜子》那样的镜像切换等等"
}
}
},
@ -58,6 +66,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_lint": true,
"_docs": "即捡即用效果",
"_data": "即捡即用类物品的效果仅对cls为items有效。"
},
"itemEffectTip": {
@ -65,12 +74,14 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_lint": true,
"_docs": "即捡即用提示",
"_data": "即捡即用类物品在获得时提示的文字仅对cls为items有效。"
},
"useItemEvent": {
"_leaf": true,
"_type": "event",
"_event": "item",
"_docs": "碰触或使用事件",
"_data": "碰触或使用本道具所执行的事件"
},
"useItemEffect": {
@ -78,6 +89,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_lint": true,
"_docs": "使用效果",
"_data": "道具效果仅对cls为tools或constants有效。"
},
"canUseItemEffect": {
@ -85,6 +97,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_lint": true,
"_docs": "能否使用条件",
"_data": "当前能否使用该道具仅对cls为tools或constants有效。"
},
"equipCondition": {
@ -92,11 +105,12 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_lint": true,
"_docs": "能否装备条件",
"_data": "能装备某个装备的条件仅对cls为equips有效。\n与canUseItemEffect不同这里null代表可以装备。"
}
}
},
"items_template": { 'cls': 'items', 'name': '新物品' },
"items_template": { 'cls': 'items', 'name': '新物品', 'canPass': true },
// --------------------------- 【怪物】相关的表格配置 --------------------------- //
@ -113,6 +127,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "手册映射ID",
"_data": "在怪物手册中映射到的怪物ID。如果此项不为null则在怪物手册中将用目标ID来替换该怪物原本的ID。\n此项应被运用在同一个怪物的多朝向上。\n例如如果想定义同一个怪物的向下和向左的行走图则需要建立两个属性完全相同的怪物。\n但是这样会导致在怪物手册中同时存在向下和向左的两种怪物的显示。\n可以将朝向左的怪物的displayIdInBook项指定为朝向下的怪物ID这样在怪物手册中则会归一化只显示一个。"
},
"hp": {
@ -135,7 +150,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_data": "金币"
},
"experience": {
"exp": {
"_leaf": true,
"_type": "textarea",
"_data": "经验"
@ -147,66 +162,85 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
},
"special": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null || thiseval instanceof Array || (thiseval==~~thiseval && thiseval>=0)",
"_data": "特殊属性\n\n0:无,1:先攻,2:魔攻,3:坚固,4:2连击,\n5:3连击,6:n连击,7:破甲,8:反击,9:净化,\n10:模仿,11:吸血,12:中毒,13:衰弱,14:诅咒,\n15:领域,16:夹击,17:仇恨,18:阻击,19:自爆,\n20:无敌,21:退化,22:固伤,23:重生,24:激光,25:光环\n26:支援,27:捕捉\n多个属性例如用[1,4,11]表示先攻2连击吸血"
"_type": "checkboxSet",
"_checkboxSet":function(){
var array=functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.enemys.getSpecials()
var b=[],c=[];
for (var index = 0; index < array.length; index++) {
b.push(array[index][0])
var name = array[index][1];
if (name instanceof Function) name = name({});
c.push((index%2==0&&index>0?'<br>':'')+name+'')
}
return {
"prefix":c,
"key":b
}
},
"_data": "特殊属性"
},
"value": {
"_leaf": true,
"_type": "textarea",
"_docs": "特殊属性值",
"_data": "特殊属性的数值\n如领域/阻激/激光怪的伤害值;吸血怪的吸血比例;光环怪增加生命的比例"
},
"zoneSquare": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "九宫格领域",
"_data": "领域怪是否九宫格伤害"
},
"range": {
"_leaf": true,
"_type": "textarea",
"_range": "(thiseval==~~thiseval && thiseval>0)||thiseval==null",
"_docs": "领域范围",
"_data": "领域伤害的范围不加默认为1"
},
"notBomb": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "是否不可炸",
"_data": "该怪物不可被炸"
},
"n": {
"_leaf": true,
"_type": "textarea",
"_range": "(thiseval==~~thiseval && thiseval>0)||thiseval==null",
"_docs": "连击数",
"_data": "多连击的连击数"
},
"add": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "吸血加自身",
"_data": "吸血后是否加到自身;光环是否叠加"
},
"atkValue": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==~~thiseval||thiseval==null",
"_docs": "退化扣攻击",
"_data": "退化时勇士下降的攻击力点数;光环怪增加攻击的比例"
},
"defValue": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==~~thiseval||thiseval==null",
"_docs": "退化扣防御",
"_data": "退化时勇士下降的防御力点数;光环怪增加防御的比例"
},
"damage": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==~~thiseval||thiseval==null",
"_docs": "固伤",
"_data": "战前扣血的点数"
}
}
},
"enemys_template": { 'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0 },
"enemys_template": { 'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'exp': 0, 'point': 0, 'special': [] },
// --------------------------- 【图块属性】相关的表格配置 --------------------------- //
@ -244,60 +278,71 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"values": [
"null",
"openDoor",
"passNet",
"changeLight",
"pushBox",
"ski",
"custom"
]
},
"_docs": "触发器",
"_data": "该图块的默认触发器"
},
"noPass": {
"canPass": {
"_leaf": true,
"_type": "select",
"_select": {
"values": [
"null",
"true",
"false"
]
},
"_data": "该图块是否不可通行true代表不可通行false代表可通行null代表使用系统缺省值"
"_type": "checkbox",
"_docs": "可通行性",
"_data": "该图块是否可以通行true代表可以通行false代表不可通行"
},
"script": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_lint": true,
"_docs": "碰触脚本",
"_data": "触碰到该图块时自动执行的脚本内容;此脚本会在该点的触发器执行前执行"
},
"cannotOut": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||(thiseval instanceof Array)",
"_type": "checkboxSet",
"_checkboxSet": {
"prefix":["上: ","下: ","<br>左: ","右: "],
"key":["up","down","left","right"]
},
"_docs": "不可出方向",
"_data": "该图块的不可出方向\n可以在这里定义在该图块时不能前往哪个方向可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表在该图块时不能往上和左走\n此值对背景层、事件层、前景层上的图块均有效"
},
"cannotIn": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||(thiseval instanceof Array)",
"_type": "checkboxSet",
"_checkboxSet": {
"prefix":["上: ","下: ","<br>左: ","右: "],
"key":["up","down","left","right"]
},
"_docs": "不可入方向",
"_data": "该图块的不可入方向\n可以在这里定义不能朝哪个方向进入该图块可以达到悬崖之类的效果\n例如 [\"down\"] 代表不能从该图块的上方点朝向下进入此图块\n此值对背景层、事件层、前景层上的图块均有效"
},
"canBreak": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "可破震",
"_data": "该图块是否可被破墙或地震"
},
"animate": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==~~thiseval||thiseval==null",
"_docs": "动画帧数",
"_data": "该图块的全局动画帧数。\n如果此项为null则对于除了npc48外使用素材默认帧数npc48默认是1帧即静止。"
},
"doorInfo": {
"_leaf": true,
"_type": "textarea",
"_docs": "门信息",
"_data": "该图块的门信息,是一个三元数组。\n第一项为所需要的钥匙信息第二项为开此门时的音效第三项为关此门时的音效。仅对animates生效。"
},
"faceIds": {
"_leaf": true,
"_type": "textarea",
"_docs": "行走图朝向",
"_data": "行走图朝向仅对NPC有效。可以在这里定义同一个NPC的多个朝向行走图。\n比如 {\"up\":\"N333\",\"down\":\"N334\",\"left\":\"N335\",\"right\":\"N336\"} 就将该素材的上下左右朝向分别绑定到N333,N334,N335和N336四个图块。\n在勇士撞上NPC时或NPC在移动时会自动选择最合适的朝向图块如果存在定义来进行绘制。"
}
}
@ -315,64 +360,71 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_range": "false",
"_docs": "楼层ID",
"_data": "文件名和floorId需要保持完全一致 \n楼层唯一标识符仅能由字母、数字、下划线组成且不能由数字开头 \n推荐用法第20层就用MT20第38层就用MT38地下6层就用MT_6用下划线代替负号隐藏3层用MT3hh表示隐藏等等 \n楼层唯一标识符需要和名字完全一致 \n这里不能更改floorId,请通过另存为来实现"
},
"title": {
"_leaf": true,
"_type": "textarea",
"_docs": "楼层中文名",
"_data": "楼层中文名,将在切换楼层和浏览地图时显示"
},
"name": {
"_leaf": true,
"_type": "textarea",
"_docs": "状态栏显示",
"_data": "显示在状态栏中的层数"
},
"width": {
"_leaf": true,
"_type": "textarea",
"_range": "false",
"_docs": "宽度",
"_data": "地图x方向大小,这里不能更改,仅能在新建地图时设置,null视为13"
},
"height": {
"_leaf": true,
"_type": "textarea",
"_range": "false",
"_docs": "高度",
"_data": "地图y方向大小,这里不能更改,仅能在新建地图时设置,null视为13"
},
"canFlyTo": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "可飞",
"_data": "该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)"
},
"canUseQuickShop": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "可快捷商店",
"_data": "该层是否允许使用快捷商店"
},
"cannotViewMap": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "不可浏览",
"_data": "该层是否不允许被浏览地图看到;如果勾上则浏览地图会跳过该层"
},
"cannotMoveDirectly": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "不可瞬移",
"_data": "该层是否不允许瞬间移动;如果勾上则不可在此层进行瞬移"
},
"firstArrive": {
"_leaf": true,
"_type": "event",
"_event": "firstArrive",
"_docs": "首次到达事件",
"_data": "第一次到该楼层触发的事件,可以双击进入事件编辑器。"
},
"eachArrive": {
"_leaf": true,
"_type": "event",
"_event": "eachArrive",
"_docs": "每次到达事件",
"_data": "每次到该楼层触发的事件可以双击进入事件编辑器该事件会在firstArrive执行后再执行。"
},
"parallelDo": {
@ -380,41 +432,45 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_lint": true,
"_data": "在该层楼时执行的并行事件处理。\n可以在这里写上任意需要自动执行的脚本比如打怪自动开门等。\n详见文档-事件-并行事件处理。"
"_docs": "并行处理脚本",
"_data": "在该层楼时执行的并行脚本处理。\n可以在这里写上任意需要自动执行的脚本比如打怪自动开门等。\n详见文档-事件-并行事件处理。"
},
"upFloor": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||((thiseval instanceof Array) && thiseval.length==2)",
"_docs": "上楼点",
"_data": "该层上楼点,如[2,3]。\n如果此项不为null则楼层转换时的stair:upFloor以及楼传器的落点会被替换成该点而不是该层的上楼梯。"
},
"downFloor": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||((thiseval instanceof Array) && thiseval.length==2)",
"_docs": "下楼点",
"_data": "该层下楼点,如[2,3]。\n如果此项不为null则楼层转换时的stair:downFloor以及楼传器的落点会被替换成该点而不是该层的下楼梯。"
},
"defaultGround": {
"_leaf": true,
"_type": "select",
"_select": {
"values": Object.keys(editor.core.icons.icons.terrains)
},
"_data": "默认地面的图块ID此项修改后需要刷新才能看到效果。"
"_type": "textarea",
"_docs": "地面图块",
"_data": "默认地面的图块ID此项修改后需要刷新才能看到效果。不填则默认是ground"
},
"images": {
"_leaf": true,
"_type": "textarea",
"_docs": "楼层贴图",
"_data": "背景/前景图;你可以选择若干张图片来作为背景/前景素材。详细用法请参见文档“自定义素材”中的说明。"
},
"color": {
"_leaf": true,
"_type": "textarea",
"_docs": "色调",
"_data": "该层的默认画面色调。本项可不写代表无色调如果写需要是一个RGBA数组如[255,0,0,0.3]"
},
"weather": {
"_leaf": true,
"_type": "textarea",
"_docs": "天气",
"_data": "该层的默认天气。本项可忽略表示晴天,如果写则第一项为\"rain\"\"snow\"或\"fog\"代表雨雪雾第二项为1-10之间的数代表强度。\n如[\"rain\", 8]代表8级雨天。"
},
"bgm": {
@ -423,18 +479,20 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_select": {
"values": [null].concat(Object.keys(editor.core.material.bgms))
},
"_docs": "背景音乐",
"_data": "到达该层后默认播放的BGM。本项可忽略或者为一个定义过的背景音乐如\"bgm.mp3\"。"
},
"item_ratio": {
"_leaf": true,
"_type": "textarea",
"_range": "(thiseval==~~thiseval && thiseval>=0)||thiseval==null",
"_docs": "宝石血瓶效果",
"_data": "每一层的宝石/血瓶效果,即获得宝石和血瓶时框内\"ratio\"的值。"
},
"underGround": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "是否是地下层",
"_data": "是否是地下层如果该项为true则同层传送将传送至上楼梯"
}
}
@ -446,15 +504,16 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "event",
"_event": "event",
"_docs": "普通事件",
"_data": "该点的可能事件列表,可以双击进入事件编辑器。"
},
"autoEvent": {
"_type": "object",
"_leaf": false,
"_action": function (args) {
args.vobj=args.vobj||{};
for(var ii=0;ii<2;ii++){
args.vobj[ii]=args.vobj[ii]||null;
args.vobj = args.vobj || {};
for (var ii = 0; ii < 2; ii++) {
args.vobj[ii] = args.vobj[ii] || null;
}
},
"_data": function (key) {
@ -462,7 +521,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "event",
"_event": "autoEvent",
"_data": "自动事件"
"_data": "自动事件"
}
}
},
@ -470,30 +529,38 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "event",
"_event": "changeFloor",
"_docs": "楼层转换",
"_data": "该点楼层转换事件该事件不能和上面的events同时出现否则会被覆盖"
},
"afterBattle": {
"_leaf": true,
"_type": "event",
"_event": "afterBattle",
"_docs": "战后事件",
"_data": "该点战斗后可能触发的事件列表,可以双击进入事件编辑器。"
},
"afterGetItem": {
"_leaf": true,
"_type": "event",
"_event": "afterGetItem",
"_docs": "道具后事件",
"_data": "该点获得道具后可能触发的事件列表,可以双击进入事件编辑器。"
},
"afterOpenDoor": {
"_leaf": true,
"_type": "event",
"_event": "afterOpenDoor",
"_docs": "开门后事件",
"_data": "该点开完门后可能触发的事件列表,可以双击进入事件编辑器。"
},
"cannotMove": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null||(thiseval instanceof Array)",
"_type": "checkboxSet",
"_checkboxSet": {
"prefix":["上: ","下: ","<br>左: ","右: "],
"key":["up","down","left","right"]
},
"_docs": "不可通行性",
"_data": "该点不可通行的方向 \n 可以在这里定义该点不能前往哪个方向,可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表该点不能往上和左走"
},
}

View File

@ -14,131 +14,153 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_range": "editor.mode.checkFloorIds(thiseval)",
"_docs": "楼层列表",
"_data": "在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器、浏览地图和上/下楼器的顺序"
},
"images": {
"_leaf": true,
"_type": "textarea",
"_range": "editor.mode.checkUnique(thiseval)",
"_range": "editor.mode.checkImages(thiseval)",
"_docs": "本塔使用图片",
"_data": "在此存放所有可能使用的图片tilesets除外 \n图片可以被作为背景图的一部分也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加"
},
"tilesets": {
"_leaf": true,
"_type": "textarea",
"_range": "editor.mode.checkUnique(thiseval)",
"_range": "editor.mode.checkImages(thiseval)",
"_docs": "本塔额外素材",
"_data": "在此存放额外素材的图片名, \n可以自定导入任意张素材图片无需PS无需注册即可直接在游戏中使用 \n 形式如[\"1.png\", \"2.png\"] ,将需要的素材图片放在images目录下 \n 素材的宽高必须都是32的倍数且图片上的总图块数不超过1000即最多有1000个32*32的图块在该图片上"
},
"animates": {
"_leaf": true,
"_type": "textarea",
"_range": "editor.mode.checkUnique(thiseval)",
"_docs": "本塔使用动画",
"_data": "在此存放所有可能使用的动画必须是animate格式在这里不写后缀名 \n动画必须放在animates目录下文件名不能使用中文不能带空格或特殊字符 \n \"jianji\", \"thunder\" 根据需求自行添加"
},
"bgms": {
"_leaf": true,
"_type": "textarea",
"_range": "editor.mode.checkUnique(thiseval)",
"_docs": "本塔使用音乐",
"_data": "在此存放所有的bgm和文件名一致。 \n音频名不能使用中文不能带空格或特殊字符可以直接改名拼音就好"
},
"sounds": {
"_leaf": true,
"_type": "textarea",
"_range": "editor.mode.checkUnique(thiseval)",
"_docs": "本塔使用音效",
"_data": "在此存放所有的SE和文件名一致 \n音频名不能使用中文不能带空格或特殊字符可以直接改名拼音就好"
},
"nameMap": {
"_leaf": true,
"_type": "textarea",
"_docs": "文件名映射",
"_data": "文件名映射目前仅对images, animates, bgms, sounds有效。\n例如定义 {\"精灵石.mp3\":\"jinglingshi.mp3\"} 就可以使用\ncore.playBgm(\"精灵石.mp3\") 或对应的事件来播放该bgm。"
},
"startBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "标题背景",
"_data": "标题界面的背景建议使用jpg格式以压缩背景图空间"
},
"startLogoStyle": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "标题样式",
"_data": "标题样式:可以改变颜色,也可以写\"display: none\"来隐藏标题"
},
"startButtonsStyle": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "标题按钮样式",
"_data": "标题界面按钮的样式caret-color指的是当前选中项的边框颜色"
},
"levelChoose": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Array && thiseval.length>=1 && thiseval[0] instanceof Array && thiseval[0].length==2",
"_docs": "难度分歧",
"_data": "难度选择每个数组的第一个是其在标题界面显示的难度第二个是在游戏内部传输的字符串会显示在状态栏修改此处后需要在project/functions中作相应更改。\n如果需直接开始游戏将下面的startDirectly开关打开即可。"
},
"equipName": {
"_leaf": true,
"_type": "textarea",
"_range": "(thiseval instanceof Array && thiseval.length<=6)||thiseval==null",
"_docs": "装备孔",
"_data": "装备位名称为不超过6个的数组此项的顺序与equiptype数值关联例如可写[\"武器\",\"防具\",\"首饰\"]等等。"
},
"startBgm": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "标题音乐",
"_data": "在标题界面应该播放的bgm内容"
},
"statusLeftBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "横屏状态栏",
"_data": "横屏时左侧状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
},
"statusTopBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "竖屏状态栏",
"_data": "竖屏时上方状态栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
},
"toolsBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "竖屏时下方道具栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
"_docs": "竖屏工具栏",
"_data": "竖屏时下方工具栏的背景样式,可以定义背景图、平铺方式等。\n具体请网上搜索\"css background\"了解写法。\n如果弄一张图片作为背景图推荐写法\n\"url(project/images/XXX.png) 0 0/100% 100% no-repeat\"\n图片最好进行一些压缩等操作节省流量。"
},
"borderColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "边框色",
"_data": "边框颜色,包括游戏边界的边框和对话框边框等。"
},
"statusBarColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "状态栏文字色",
"_data": "状态栏的文字颜色,默认是白色"
},
"hardLabelColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "难度标签色",
"_data": "难度显示的颜色,默认是红色"
},
"floorChangingBackground": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "转场背景色",
"_data": "楼层转换界面的背景样式可以使用纯色默认值black也可以使用图片参见状态栏的图片写法"
},
"floorChangingTextColor": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "转场文字色",
"_data": "楼层转换界面的文字颜色,默认是白色"
},
"font": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "全局字体",
"_data": "游戏中使用的字体默认是Verdana"
}
}
@ -150,6 +172,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "游戏名",
"_data": "游戏名,将显示在标题页面以及切换楼层的界面中"
},
"name": {
@ -157,12 +180,14 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_range": "/^[a-zA-Z0-9_]{1,30}$/.test(thiseval)",
"_docs": "唯一英文标识符",
"_data": "游戏的唯一英文标识符。由英文、数字、下划线组成不能超过30个字符。\n此项必须修改其将直接影响到存档的定位"
},
"version": {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_docs": "游戏版本",
"_data": "当前游戏版本;版本不一致的存档不能通用。"
},
"floorId": {
@ -172,6 +197,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"values": data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds
},
"_range": "data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main.floorIds.indexOf(thiseval)!==-1",
"_docs": "初始楼层",
"_data": "初始楼层的ID"
},
"hero": {
@ -181,33 +207,34 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_data": "勇士名;可以改成喜欢的"
"_data": "勇士名"
},
"lv": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==~~thiseval &&thiseval>0",
"_data": "初始等级,该项必须为正整数"
"_data": "初始等级"
},
"hpmax": {
"_leaf": true,
"_type": "textarea",
"_data": "初始生命上限只有在enableHPMax开启时才有效"
"_data": "初始上限"
},
"hp": {
"_leaf": true,
"_type": "textarea",
"_data": "初始生命"
"_data": "初始生命"
},
"manamax": {
"_leaf": true,
"_type": "textarea",
"_docs": "魔力上限",
"_data": "魔力上限此项非负才会生效null或小于0都不会生效"
},
"mana": {
"_leaf": true,
"_type": "textarea",
"_data": "初始魔力只在enableMana开启时才有效"
"_data": "初始魔力"
},
"atk": {
"_leaf": true,
@ -222,14 +249,14 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"mdef": {
"_leaf": true,
"_type": "textarea",
"_data": "初始魔防"
"_data": "初始护盾"
},
"money": {
"_leaf": true,
"_type": "textarea",
"_data": "初始金币"
},
"experience": {
"exp": {
"_leaf": true,
"_type": "textarea",
"_data": "初始经验"
@ -238,33 +265,30 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Array",
"_data": "初始装上的装,此处建议请直接留空数组"
"_data": "初始装备"
},
"items": {
"_type": "object",
"_data": {
"keys": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
"_data": "初始三种钥匙个数"
},
"constants": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
"_docs": "永久道具",
"_data": "初始永久道具个数,例如初始送手册可以写 {\"book\": 1}"
},
"tools": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
"_docs": "消耗道具",
"_data": "初始消耗道具个数,例如初始有两破可以写 {\"pickaxe\": 2}"
},
"equips": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
"_docs": "初始装备个数",
"_data": "初始装备个数,例如初始送铁剑可以写 {\"sword1\": 1}"
}
}
@ -275,7 +299,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"direction": {
"_leaf": true,
"_type": "select",
"_data": "勇士初始方向",
"_data": "初始朝向",
"_select": {
"values": [
"up",
@ -288,12 +312,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"x": {
"_leaf": true,
"_type": "textarea",
"_data": "勇士初始x坐标"
"_data": "初始x坐标"
},
"y": {
"_leaf": true,
"_type": "textarea",
"_data": "勇士初始y坐标"
"_data": "初始y坐标"
}
}
},
@ -301,12 +325,18 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
"_data": "游戏过程中的变量或flags"
"_data": "游戏变量"
},
"followers": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Array",
"_data": "跟随者列表"
},
"steps": {
"_leaf": true,
"_type": "textarea",
"_data": "行走步数统计"
"_data": "行走步数"
}
}
},
@ -315,6 +345,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "event",
"_event": "firstArrive",
"_range": "thiseval==null || thiseval instanceof Array",
"_docs": "标题事件化",
"_data": "标题界面事件化,可以使用事件流的形式来绘制开始界面等。\n需要开启startUsingCanvas这个开关。\n详见文档-个性化-标题界面事件化。"
},
"startText": {
@ -322,6 +353,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "event",
"_event": "firstArrive",
"_range": "thiseval==null || thiseval instanceof Array",
"_docs": "开场剧情",
"_data": "游戏开始前剧情,可以执行任意自定义事件。\n双击进入事件编辑器。\n如果无剧情直接留一个空数组即可。"
},
"shops": {
@ -329,6 +361,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "event",
"_event": "shop",
"_range": "thiseval instanceof Array",
"_docs": "全局商店",
"_data": "全局商店,是一个数组,可以双击进入事件编辑器。"
},
"levelUp": {
@ -336,6 +369,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "event",
"_event": "level",
"_range": "thiseval==null || thiseval instanceof Array",
"_docs": "等级提升",
"_data": "经验升级所需要的数值,是一个数组,可以双击进行编辑。 \n 第一项为初始等级仅title生效 \n 每一个里面可以含有三个参数 need, title, action \n need为所需要的经验数值可以是个表达式。请确保need依次递增 \n title为该等级的名称也可以省略代表使用系统默认值本项将显示在状态栏中 \n action为本次升级所执行的事件可由若干项组成"
}
}
@ -346,374 +380,275 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"lavaDamage": {
"_leaf": true,
"_type": "textarea",
"_data": "经过血网受到的伤害"
"_data": "血网伤害"
},
"poisonDamage": {
"_leaf": true,
"_type": "textarea",
"_data": "中毒后每步受到的伤害"
"_data": "中毒伤害"
},
"weakValue": {
"_leaf": true,
"_type": "textarea",
"_docs": "衰弱效果",
"_data": "衰弱状态下攻防减少的数值\n如果此项不小于1则作为实际下降的数值比如10就是攻防各下降10\n如果在0到1之间则为下降的比例比如0.3就是下降30%的攻防)"
},
"redJewel": {
"_leaf": true,
"_type": "textarea",
"_docs": "红宝石效果",
"_data": "红宝石加攻击的数值"
},
"blueJewel": {
"_leaf": true,
"_type": "textarea",
"_docs": "蓝宝石效果",
"_data": "蓝宝石加防御的数值"
},
"greenJewel": {
"_leaf": true,
"_type": "textarea",
"_data": "绿宝石加魔防的数值"
"_docs": "绿宝石效果",
"_data": "绿宝石加护盾的数值"
},
"redPotion": {
"_leaf": true,
"_type": "textarea",
"_docs": "红血瓶效果",
"_data": "红血瓶加血数值"
},
"bluePotion": {
"_leaf": true,
"_type": "textarea",
"_docs": "蓝血瓶效果",
"_data": "蓝血瓶加血数值"
},
"yellowPotion": {
"_leaf": true,
"_type": "textarea",
"_docs": "黄血瓶效果",
"_data": "黄血瓶加血数值"
},
"greenPotion": {
"_leaf": true,
"_type": "textarea",
"_docs": "绿血瓶效果",
"_data": "绿血瓶加血数值"
},
"breakArmor": {
"_leaf": true,
"_type": "textarea",
"_docs": "破甲比例",
"_data": "破甲的比例战斗前怪物附加角色防御的x倍作为伤害"
},
"counterAttack": {
"_leaf": true,
"_type": "textarea",
"_docs": "反击比例",
"_data": "反击的比例战斗时怪物每回合附加角色攻击的x倍作为伤害无视角色防御"
},
"purify": {
"_leaf": true,
"_type": "textarea",
"_data": "净化的比例战斗前怪物附加勇士魔防的x倍作为伤害"
"_docs": "净化比例",
"_data": "净化的比例战斗前怪物附加勇士护盾的x倍作为伤害"
},
"hatred": {
"_leaf": true,
"_type": "textarea",
"_docs": "仇恨增值",
"_data": "仇恨属性中,每杀死一个怪物获得的仇恨值"
},
"moveSpeed": {
"_leaf": true,
"_type": "textarea",
"_data": "行走速度即勇士每走一格的时间一般100比较合适"
},
"animateSpeed": {
"_leaf": true,
"_type": "textarea",
"_docs": "全局动画时间",
"_data": "全局动画时间即怪物振动频率一般300比较合适"
},
"floorChangeTime": {
"_leaf": true,
"_type": "textarea",
"_data": "默认楼层切换时间"
}
}
},
"flags": {
"_type": "object",
"_data": {
"enableFloor": {
"statusBarItems": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示当前楼层"
},
"enableName": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示勇士名字"
},
"enableLv": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示当前等级"
},
"enableHPMax": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否是否启用生命上限"
},
"enableMana": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否开启魔力值"
},
"enableMDef": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏及战斗界面显示魔防(护盾)"
},
"enableMoney": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏、怪物手册及战斗界面显示金币"
},
"enableExperience": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏、怪物手册及战斗界面显示经验"
},
"enableLevelUp": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否允许等级提升进阶如果上面enableExperience为false则此项恒视为false"
},
"levelUpLeftMode": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "进阶使用扣除模式即在状态栏显示距离下个等级所需要的经验值只有enableExperience和enableLevelUp均开启时才有效。"
},
"enableKeys": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示三色钥匙数量"
},
"enablePZF": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示破炸飞数量"
},
"enableDebuff": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在状态栏显示毒衰咒"
},
"enableSkill": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否启用技能栏"
"_type": "checkboxSet",
"_checkboxSet": {
"prefix": [
"楼层",
"名字",
"<br>等级",
"血限",
"<br>生命",
"魔力",
"<br>攻击",
"防御",
"<br>护盾",
"金币",
"<br>经验",
"升级",
"<br>升级扣除模式",
"<br>钥匙",
"绿钥",
"<br>破炸",
"负面",
"<br>技能"
],
"key": [
"enableFloor",
"enableName",
"enableLv",
"enableHPMax",
"enableHP",
"enableMana",
"enableAtk",
"enableDef",
"enableMDef",
"enableMoney",
"enableExp",
"enableLevelUp",
"levelUpLeftMode",
"enableKeys",
"enableGreenKey",
"enablePZF",
"enableDebuff",
"enableSkill"
]
},
"_data": "状态栏显示"
},
"flyNearStair": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "楼传楼梯边",
"_data": "传送器是否需要在楼梯边使用如果flyRecordPosition开启则此项对箭头也有效。"
},
"flyRecordPosition": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "楼传平面模式",
"_data": "传送器平面塔模式;此模式下楼层传送器将飞到上次离开该楼层的位置。"
},
"pickaxeFourDirections": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "使用破墙镐是否四个方向都破坏如果false则只破坏面前的墙壁"
},
"bombFourDirections": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "使用炸弹是否四个方向都会炸如果false则只炸面前的怪物即和圣锤等价"
},
"snowFourDirections": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "使用冰冻徽章是否四个方向都会消除熔岩如果false则只消除面前的熔岩"
},
"bigKeyIsBox": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "如果此项为true则视为钥匙盒红黄蓝钥匙+1若为false则视为大黄门钥匙"
},
"steelDoorWithoutKey": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "铁门不消耗",
"_data": "铁门是否不需要钥匙开启。如果此项为true则无需钥匙也可以开铁门。"
},
"itemFirstText": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "首次道具提示",
"_data": "首次获得道具是否提示"
},
"equipment": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "剑和盾是否作为装备。如果此项为true则作为装备需要在装备栏使用否则将直接加属性。"
},
"equipboxButton": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "状态栏装备",
"_data": "状态栏的装备按钮。若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮"
},
"iconInEquipbox": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "在装备栏中的属性变化,是否绘制图标;如果此项开启,则会绘制图标而不是文字"
},
"enableAddPoint": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "加点",
"_data": "是否支持加点"
},
"enableNegativeDamage": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "负伤",
"_data": "是否支持负伤害(回血)"
},
"hatredDecrease": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否在和仇恨怪战斗后减一半的仇恨值此项为false则和仇恨怪不会扣减仇恨值。"
},
"betweenAttackCeil": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "夹击上整还是下整。如果此项为true则夹击伤害值向上取整为false则为向下取整"
},
"betweenAttackMax": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "夹击不超伤害",
"_data": "夹击伤害是否不超过怪物伤害值。"
},
"useLoop": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "二分临界",
"_data": "是否循环计算临界如果此项为true则使用循环法而不是回合数计算法来算临界\n从V2.5.3开始,对于大数据的循环法将改为使用二分法进行计算"
},
"startUsingCanvas": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "标题事件化",
"_data": "是否开始菜单canvas化如果此项为true则将使用canvas来绘制开始菜单"
},
"startDirectly": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "不选择难度",
"_data": "点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面"
},
"statusCanvas": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "自绘状态栏",
"_data": "是否状态栏canvas化即手动自定义绘制状态栏。\n如果此项开启则可在脚本编辑的drawStatusBar中自定义绘制菜单栏。"
},
"statusCanvasRowsOnMobile": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null || (thiseval>0 && thiseval<=4)",
"_docs": "竖屏自绘行数",
"_data": "竖屏模式下顶端状态栏canvas化后的行数。\n此项将决定竖屏的状态栏高度如果设置则不小于1且不大于4。\n仅在statusCanvas开启时才有效"
},
"displayEnemyDamage": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "怪物显伤",
"_data": "是否地图怪物显伤;用户可以手动在菜单栏中开关"
},
"displayCritical": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "临界显伤",
"_data": "是否地图显示临界;用户可以手动在菜单栏中开关"
},
"displayExtraDamage": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "高级显伤",
"_data": "是否地图高级显伤(领域、夹击等);用户可以手动在菜单栏中开关"
},
"enableGentleClick": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "允许轻按",
"_data": "是否允许轻触(获得面前物品)"
},
"potionWhileRouting": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "寻路算法是否经过血瓶如果该项为false则寻路算法会自动尽量绕过血瓶"
},
"ignoreChangeFloor": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "允许穿透楼梯",
"_data": "经过楼梯、传送门时是否能“穿透”。\n穿透的意思是自动寻路得到的的路径中间经过了楼梯行走时是否触发楼层转换事件"
},
"canGoDeadZone": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "允许将死领域",
"_data": "是否允许走到将死的领域上。如果此项为true则可以走到将死的领域上"
},
"enableMoveDirectly": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "允许瞬移",
"_data": "是否允许瞬间移动"
},
"enableDisabledShop": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否允许查看未开启状态的快捷商店内容;如果此项为真,则对于未开启状态的商店允许查看其内容(但不能购买)"
},
"disableShopOnDamage": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "伤害禁用商店",
"_data": "是否在经过领域/夹击/路障等伤害后禁用快捷商店。"
},
"blurFg": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_docs": "虚化前景层",
"_data": "是否虚化前景层;如果此项开启,则在游戏中事件层有东西(如宝石等)时虚化前景层。"
},
"checkConsole": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否检查控制台的开启情况。"
}
}
}

View File

@ -16,14 +16,14 @@ var events_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "event",
"_range": "thiseval instanceof Array",
"_event": "commonEvent",
"_data": "打败怪物后加点"
"_data": "加点事件"
},
"毒衰咒处理": {
"_leaf": true,
"_type": "event",
"_range": "thiseval instanceof Array",
"_event": "commonEvent",
"_data": "毒衰咒效果处理"
"_data": "毒衰咒处理"
},
"滑冰事件": {
"_leaf": true,
@ -38,7 +38,7 @@ var events_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "event",
"_event": "commonEvent",
"_data": "自定义公共事件,可以双击进入事件编辑器"
"_data": "公共事件"
}
}
}

View File

@ -14,25 +14,19 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "重置整个游戏"
},
"setInitData": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "设置初始属性"
"_data": "重置游戏"
},
"win": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "游戏获胜事件"
"_data": "游戏获胜"
},
"lose": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "游戏失败事件"
"_data": "游戏失败"
},
"changingFloor": {
"_leaf": true,
@ -56,55 +50,31 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "战前事件"
"_data": "战前判定"
},
"afterBattle": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "战后事件"
"_data": "战后脚本"
},
"afterOpenDoor": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "开门后事件"
"_data": "开门后脚本"
},
"afterGetItem": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "获得道具后事件"
},
"afterChangeLight": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "改变亮灯事件"
"_data": "道具后脚本"
},
"afterPushBox": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "推箱子事件"
},
"afterUseBomb": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "炸弹事件"
},
"afterPassNet": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "经过特殊地形后的事件"
},
"canUseQuickShop": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "能否用快捷商店"
"_data": "推箱子后"
}
}
},
@ -115,19 +85,19 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "怪物特殊属性定义"
"_data": "怪物特殊属性"
},
"getEnemyInfo": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "获得怪物真实属性"
"_data": "怪物真实属性"
},
"getDamageInfo": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "获得战斗伤害信息"
"_data": "战斗伤害信息"
}
}
},
@ -144,6 +114,7 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_docs": "点击状态栏",
"_data": "状态栏点击事件,仅在开启自绘状态栏时生效"
}
}
@ -179,19 +150,19 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "每步后操作"
"_data": "每步后操作"
},
"moveDirectly": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "瞬间移动处理"
"_data": "瞬间移动"
},
"parallelDo": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "并行事件处理"
"_data": "并行脚本"
}
}
},
@ -208,13 +179,13 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "地图数据统计"
"_data": "数据统计"
},
"drawAbout": {
"_leaf": true,
"_type": "textarea",
"_lint": true,
"_data": "绘制关于界面"
"_data": "关于界面"
}
}
}

View File

@ -1,197 +0,0 @@
var maps_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
{
////////////////////////// 地形部分 //////////////////////////
// 0-20 地形
'1':' 黄墙',
'2':' 白墙',
'3':' 蓝墙',
'4':' 星空',
'5':' 岩浆',
'6':' 冰面',
'7':' 蓝色商店左',
'8':' 蓝色商店右',
'9':' 粉色商店左',
'10':' 粉色商店左',
'11':' 血网',
'12':' 毒网',
'13':' 衰网',
'14':' 咒网',
'15':' 水',
// 在这里添加更多地形
// 如果空位不足可以从180以后开始继续放只要不和现有的数字冲突即可
// Autotile
'20':' autotile',
// 更多的autotile从151到160等只要不和现有的数字冲突即可
'151':'',
'152':'',
'153':'',
////////////////////////// 物品部分 //////////////////////////
// 21-80 物品
'21':' 黄钥匙',
'22':' 蓝钥匙',
'23':' 红钥匙',
'24':' 绿钥匙',
'25':' 铁门钥匙',
'26':' 大黄门钥匙(钥匙盒)',
'27':' 红宝石',
'28':' 蓝宝石',
'29':' 绿宝石',
'30':' 黄宝石',
'31':' 红血瓶',
'32':' 蓝血瓶',
'33':' 绿血瓶',
'34':' 黄血瓶',
'35':' 铁剑',
'36':' 铁盾',
'37':' 银剑',
'38':' 银盾',
'39':' 骑士剑',
'40':' 骑士盾',
'41':' 圣剑',
'42':' 圣盾',
'43':' 神圣剑',
'44':' 神圣盾',
'45':' 怪物手册',
'46':' 楼层传送器',
'47':' 破墙镐',
'48':' 破冰镐',
'49':' 炸弹',
'50':' 中心对称',
'51':' 上楼器',
'52':' 下楼器',
'53':' 幸运金币',
'54':' 冰冻徽章',
'55':' 十字架',
'56':' 圣水',
'57':' 地震卷轴',
'58':' 解毒药水',
'59':' 解衰药水',
'60':' 解咒药水',
'61':' 万能药水',
'62':' 屠龙匕首',
'63':' 金钱袋',
'64':' 绿鞋',
'65':' 圣锤',
////////////////////////// 门、楼梯、传送点部分 //////////////////////////
// 81-100 门
'81':' 黄门',
'82':' 蓝门',
'83':' 红门',
'84':' 绿门',
'85':' 机关门左',
'86':' 铁门',
'87':' 上楼梯',
'88':' 下楼梯',
'89':' 传送门',
'90':' 星空传送门',
'91':' 上箭头',
'92':' 左箭头',
'93':' 下箭头',
'94':' 右箭头',
////////////////////////// NPC部分 //////////////////////////
// 121-150 NPC
'121':'',
'122':'',
'123':'',
'124':'',
'125':'',
'126':'',
'127':'',
'128':'',
'129':'',
'130':'',
'131':'',
'132':'',
////////////////////////// 其他部分 //////////////////////////
// 161-200 其他(单向箭头、灯、箱子等等)
'161':' 单向上箭头',
'162':' 单向下箭头',
'163':' 单向左箭头',
'164':' 单向右箭头',
'165':' 灯',
'166':' 暗灯',
'167':' 滑冰',
'168':' 花',
'169':' 箱子',
'170':' 完成的箱子',
////////////////////////// 怪物部分 //////////////////////////
// 201-300 怪物
'201':'',
'202':'',
'203':'',
'204':'',
'205':'',
'206':'',
'207':'',
'208':'',
'209':'',
'210':'',
'211':'',
'212':'',
'213':'',
'214':'',
'215':'',
'216':'',
'217':'',
'218':'',
'219':'',
'220':'',
'221':'',
'222':'',
'223':'',
'224':'',
'225':'',
'226':'',
'227':'',
'228':'',
'229':'',
'230':'',
'231':'',
'232':'',
'233':'',
'234':'',
'235':'',
'236':'',
'237':'',
'238':'',
'239':'',
'240':'',
'241':'',
'242':'',
'243':'',
'244':'',
'245':'',
'246':'',
'247':'',
'248':'',
'249':'',
'250':'',
'251':'',
'252':'',
'253':'',
'254':'',
'255':'',
'256':'',
'257':'',
'258':'',
'259':'',
'260':'',
////////////////////////// 待定... //////////////////////////
// 目前ID暂时不要超过400
}

View File

@ -14,23 +14,29 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_range": "typeof(thiseval)=='string'",
"_data": "自定义插件"
},
"shop": {
"_leaf": true,
"_type": "textarea",
"_range": "typeof(thiseval)=='string'",
"_data": "全局商店"
},
"drawLight": {
"_leaf": true,
"_type": "textarea",
"_range": "typeof(thiseval)=='string' || thiseval==null",
"_data": "绘制灯光效果"
"_data": "灯光效果"
},
"drawItemShop": {
"itemShop": {
"_leaf": true,
"_type": "textarea",
"_range": "typeof(thiseval)=='string' || thiseval==null",
"_data": "道具商店插件"
"_data": "道具商店"
},
"smoothCamera": {
"_leaf": true,
"_type": "textarea",
"_range": "typeof(thiseval)=='string' || thiseval==null",
"_data": "平滑移动镜头效果"
"_data": "平滑移动镜头"
},
}
if (obj[key]) return obj[key];

View File

@ -315,7 +315,7 @@
</div>
<div id="mid2" style="display: none">
<p style="margin: 10px">最近使用的图块列表:</p>
<p style="margin: 10px">最近使用的图块列表: <button id='clearLastUsedBtn'>清除</button></p>
<div class="map" style="height: 160px; margin-top: 25px" id="lastUsedDiv">
<canvas class='gameCanvas' id='lastUsed' width='416' height='160'></canvas>
</div>
@ -471,9 +471,9 @@
<img id="img-money">
<p class='statusLabel statusText' id='money'></p>
</div>
<div class="status" id="experienceCol">
<img id="img-experience">
<p class='statusLabel statusText' id='experience'></p>
<div class="status" id="expCol">
<img id="img-exp">
<p class='statusLabel statusText' id='exp'></p>
</div>
<div class="status" id="upCol">
<img id="img-up">
@ -487,6 +487,7 @@
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
<span class='statusLabel' id='greenKey' style="color:#88FF88"></span>
</div>
<div class="status" id='pzfCol'>
<span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>
@ -588,7 +589,6 @@
<script src='_server/editor_util.js'></script>
<script src='_server/editor_game.js'></script>
<script src='_server/editor_file.js'></script>
<script src='_server/editor_file_unsorted.js'></script>
<script src='_server/editor_table.js'></script>
<script src='_server/editor_mode.js'></script>
<script src='_server/editor_ui.js'></script>
@ -596,7 +596,6 @@
<script src='_server/editor_datapanel.js'></script>
<script src='_server/editor_materialpanel.js'></script>
<script src='_server/editor_listen.js'></script>
<script src='_server/editor_legacy.js'></script>
<script src='libs/thirdparty/lz-string.min.js'></script>
<script src='libs/thirdparty/localforage.min.js'></script>
<script src='libs/thirdparty/zip.min.js'></script>

View File

@ -359,7 +359,7 @@
</div>
</div>
<div id="mid2">
<p style="margin: 10px">最近使用的图块列表</p>
<p style="margin: 10px">最近使用的图块列表Ctrl+滚轮放缩) <button id='clearLastUsedBtn'>清除</button></p>
<div class="map" id="lastUsedDiv">
<canvas id='lastUsed' width='416' height='416' style="overflow: hidden"></canvas>
</div>
@ -453,9 +453,9 @@
<img id="img-money">
<p class='statusLabel statusText' id='money'></p>
</div>
<div class="status" id="experienceCol">
<img id="img-experience">
<p class='statusLabel statusText' id='experience'></p>
<div class="status" id="expCol">
<img id="img-exp">
<p class='statusLabel statusText' id='exp'></p>
</div>
<div class="status" id="upCol">
<img id="img-up">
@ -469,6 +469,7 @@
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
<span class='statusLabel' id='greenKey' style="color:#88FF88"></span>
</div>
<div class="status" id='pzfCol'>
<span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>
@ -572,7 +573,6 @@
<script src='_server/editor_util.js'></script>
<script src='_server/editor_game.js'></script>
<script src='_server/editor_file.js'></script>
<script src='_server/editor_file_unsorted.js'></script>
<script src='_server/editor_table.js'></script>
<script src='_server/editor_mode.js'></script>
<script src='_server/editor_ui.js'></script>
@ -580,7 +580,6 @@
<script src='_server/editor_datapanel.js'></script>
<script src='_server/editor_materialpanel.js'></script>
<script src='_server/editor_listen.js'></script>
<script src='_server/editor_legacy.js'></script>
<script src='libs/thirdparty/lz-string.min.js'></script>
<script src='libs/thirdparty/localforage.min.js'></script>
<script src='libs/thirdparty/zip.min.js'></script>

View File

@ -359,7 +359,7 @@ dynamicMapEditor.prototype.refreshToolBox = function() {
core.formatBigNumber(core.getRealStatus("mdef"), true);
core.fillText(this.canvas, text1, this.offsetX + 60, 380, '#FF7F00', 120);
var text2 = core.formatBigNumber(core.getRealStatus('money', true)) + "/" +
core.formatBigNumber(core.getRealStatus('experience'), true) + "/" +
core.formatBigNumber(core.getRealStatus('exp'), true) + "/" +
core.itemCount('yellowKey') + '/' + core.itemCount('blueKey') + '/' +
core.itemCount('redKey');
core.fillText(this.canvas, text2, this.offsetX + 60, 395, '#FF7F00', 120);
@ -396,7 +396,7 @@ dynamicMapEditor.prototype.showHelp = function (fromButton) {
text += " - [ 键将开关此模式;\n - ] 键将会把改动保存到文件;\n - \\ 键将撤销上步操作。\n";
text += " - Alt+0~9 保存当前图块 \n - 0~9 读取当前图块\n";
text += "最下面三行数据分别是:\n"
text += "血攻防魔防金经黄蓝红破炸飞和debuff。";
text += "血攻防护盾金经黄蓝红破炸飞和debuff。";
if (!fromButton) text += "\n\n点取消将不再提示本页面。";
core.myconfirm(text, null, function () {
if (!fromButton) core.setLocalStorage("_dynamicMapEditor_help", true);

View File

@ -111,9 +111,9 @@
<img id="img-money">
<p class='statusLabel statusText' id='money'></p>
</div>
<div class="status" id="experienceCol">
<img id="img-experience">
<p class='statusLabel statusText' id='experience'></p>
<div class="status" id="expCol">
<img id="img-exp">
<p class='statusLabel statusText' id='exp'></p>
</div>
<div class="status" id="upCol">
<img id="img-up">
@ -127,6 +127,7 @@
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>
<span class='statusLabel' id='blueKey' style="color:#AAAADD"></span>
<span class='statusLabel' id='redKey' style="color:#FF8888"></span>
<span class='statusLabel' id='greenKey' style="color:#88FF88"></span>
</div>
<div class="status" id='pzfCol'>
<span class='statusLabel' id='pickaxe' style="color: #BC6E27"></span>

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
/*
actions.js用户交互的事件的处理
键盘鼠标触摸屏事件相关
@ -36,17 +38,14 @@ actions.prototype._init = function () {
this.registerAction('keyUp', '_sys_keyUp', this._sys_keyUp, 0);
// --- ondown注册
this.registerAction('ondown', '_sys_checkReplay', this._sys_checkReplay, 100);
this.registerAction('ondown', '_sys_ondown_paint', this._sys_ondown_paint, 60);
this.registerAction('ondown', '_sys_ondown_lockControl', this._sys_ondown_lockControl, 30);
this.registerAction('ondown', '_sys_ondown', this._sys_ondown, 0);
// --- onmove注册
this.registerAction('onmove', '_sys_checkReplay', this._sys_checkReplay, 100);
this.registerAction('onmove', '_sys_onmove_paint', this._sys_onmove_paint, 50);
this.registerAction('onmove', '_sys_onmove_choices', this._sys_onmove_choices, 30);
this.registerAction('onmove', '_sys_onmove', this._sys_onmove, 0);
// --- onup注册
this.registerAction('onup', '_sys_checkReplay', this._sys_checkReplay, 100);
this.registerAction('onup', '_sys_onup_paint', this._sys_onup_paint, 50);
this.registerAction('onup', '_sys_onup', this._sys_onup, 0);
// --- onclick注册
this.registerAction('onclick', '_sys_checkReplay', this._sys_checkReplay, 100);
@ -261,9 +260,6 @@ actions.prototype._sys_keyDown_lockControl = function (keyCode) {
case 'replayRemain':
this._keyDownSL(keyCode);
break;
case 'shop':
this._keyDownShop(keyCode);
break;
case 'selectShop':
case 'switchs':
case 'settings':
@ -347,9 +343,6 @@ actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) {
case 'viewMaps':
this._keyUpViewMaps(keyCode);
break;
case 'shop':
this._keyUpShop(keyCode);
break;
case 'selectShop':
this._keyUpQuickShop(keyCode);
break;
@ -398,9 +391,6 @@ actions.prototype._sys_keyUp_lockControl = function (keyCode, altKey) {
case 'centerFly':
this._keyUpCenterFly(keyCode);
break;
case 'paint':
this._keyUpPaint(keyCode);
break;
}
return true;
}
@ -423,19 +413,12 @@ actions.prototype.ondown = function (loc) {
this.doRegisteredAction('ondown', x, y, px, py);
}
actions.prototype._sys_ondown_paint = function (x, y, px, py) {
// 画板
if (core.status.played && (core.status.event || {}).id == 'paint') {
this._ondownPaint(px, py);
return true;
}
}
actions.prototype._sys_ondown_lockControl = function (x, y, px, py) {
if (core.status.played && !core.status.lockControl) return false;
// --- wait事件也要提供px和py
if (core.status.event.id == 'action' && core.status.event.data.type == 'wait') {
clearTimeout(core.status.event.interval);
core.setFlag('type', 1);
core.setFlag('x', x);
core.setFlag('y', y);
@ -481,21 +464,12 @@ actions.prototype.onmove = function (loc) {
this.doRegisteredAction('onmove', x, y, px, py);
}
actions.prototype._sys_onmove_paint = function (x, y, px, py) {
// 画板
if (core.status.played && (core.status.event || {}).id == 'paint') {
core.actions._onmovePaint(px, py);
return true;
}
}
actions.prototype._sys_onmove_choices = function (x, y) {
if (!core.status.lockControl) return false;
switch (core.status.event.id) {
case 'action':
if (core.status.event.data.type != 'choices') break;
case 'shop':
case 'selectShop':
case 'switchs':
case 'settings':
@ -507,6 +481,9 @@ actions.prototype._sys_onmove_choices = function (x, y) {
case 'gameInfo':
this._onMoveChoices(x, y);
return true;
case 'confirmBox':
this._onMoveConfirmBox(x, y);
return true;
default:
break;
}
@ -543,14 +520,6 @@ actions.prototype.onup = function (loc) {
this.doRegisteredAction('onup', x, y, px, py);
}
actions.prototype._sys_onup_paint = function () {
// 画板
if (core.status.played && (core.status.event || {}).id == 'paint') {
this._onupPaint();
return true;
}
}
actions.prototype._sys_onup = function () {
clearTimeout(core.timeout.onDownTimeout);
core.timeout.onDownTimeout = null;
@ -641,9 +610,6 @@ actions.prototype._sys_onclick_lockControl = function (x, y) {
case 'settings':
this._clickSettings(x, y);
break;
case 'shop':
this._clickShop(x, y);
break;
case 'selectShop':
this._clickQuickShop(x, y);
break;
@ -752,6 +718,7 @@ actions.prototype._sys_onmousewheel = function (direct) {
// wait事件
if (core.status.lockControl && core.status.event.id == 'action' && core.status.event.data.type == 'wait') {
clearTimeout(core.status.event.interval);
core.setFlag('type', 0);
var keycode = direct == 1 ? 33 : 34;
core.setFlag('keycode', keycode);
@ -818,10 +785,6 @@ actions.prototype._sys_longClick_lockControl = function (x, y) {
return true;
}
}
// 长按商店连续购买
if (core.status.event.id == 'shop' && x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
return this._clickShop(x, y);
}
// 长按可以跳过等待事件
if (core.status.event.id == 'action' && core.status.event.data.type == 'sleep'
&& !core.status.event.data.current.noSkip) {
@ -867,12 +830,6 @@ actions.prototype._selectChoices = function (length, keycode, callback) {
if (keycode == 13 || keycode == 32 || keycode == 67) {
callback.apply(this, [this.HSIZE, topIndex + core.status.event.selection]);
}
//左右方向键调整 音量 行走速度
if(core.status.event.id == "switchs" && (core.status.event.selection == 2 || core.status.event.selection == 3))
{
if (keycode == 37) callback.apply(this, [this.HSIZE - 2, topIndex + core.status.event.selection]);
if (keycode == 39) callback.apply(this, [this.HSIZE + 2, topIndex + core.status.event.selection]);
}
if (keycode >= 49 && keycode <= 57) {
var index = keycode - 49;
@ -918,7 +875,7 @@ actions.prototype._clickCenterFly = function (x, y) {
core.useItem('centerFly');
}
else {
core.drawTip('当前不能使用中心对称飞行器');
core.drawTip('当前不能使用' + core.material.items['centerFly'].name);
}
}
}
@ -930,7 +887,7 @@ actions.prototype._keyUpCenterFly = function (keycode) {
core.useItem('centerFly');
}
else {
core.drawTip('当前不能使用中心对称飞行器');
core.drawTip('当前不能使用' + core.material.items['centerFly'].name);
}
}
}
@ -971,6 +928,22 @@ actions.prototype._keyUpConfirmBox = function (keycode) {
}
}
////// 鼠标在确认框上移动时 //////
actions.prototype._onMoveConfirmBox = function (x, y) {
if (y == this.HSIZE + 1) {
if (x == this.HSIZE - 2 || x == this.HSIZE - 1) {
core.status.event.selection = 0;
core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no);
return;
}
if (x == this.HSIZE + 2 || x == this.HSIZE + 1) {
core.status.event.selection = 1;
core.ui.drawConfirmBox(core.status.event.ui, core.status.event.data.yes, core.status.event.data.no);
return;
}
}
}
////// 自定义事件时的点击操作 //////
actions.prototype._clickAction = function (x, y) {
if (core.status.event.data.type == 'text') {
@ -993,6 +966,7 @@ actions.prototype._clickAction = function (x, y) {
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
if (y >= topIndex && y < topIndex + choices.length) {
clearTimeout(core.status.event.interval);
// 选择
core.status.route.push("choices:" + (y - topIndex));
core.insertAction(choices[y - topIndex].action);
@ -1004,11 +978,13 @@ actions.prototype._clickAction = function (x, y) {
if (core.status.event.data.type == 'confirm') {
if ((x == this.HSIZE-2 || x == this.HSIZE-1) && y == this.HSIZE+1) {
clearTimeout(core.status.event.interval);
core.status.route.push("choices:0");
core.insertAction(core.status.event.ui.yes);
core.doAction();
}
else if ((x == this.HSIZE+2 || x == this.HSIZE+1) && y == this.HSIZE+1) {
clearTimeout(core.status.event.interval);
core.status.route.push("choices:1");
core.insertAction(core.status.event.ui.no);
core.doAction();
@ -1041,6 +1017,7 @@ actions.prototype._keyUpAction = function (keycode) {
return;
}
if (core.status.event.data.type == 'wait') {
clearTimeout(core.status.event.interval);
core.setFlag('type', 0);
core.setFlag('keycode', keycode);
core.status.route.push("input:" + keycode);
@ -1214,11 +1191,6 @@ actions.prototype._clickViewMaps = function (x, y) {
core.ui.drawMaps(index, cx, cy);
return;
}
if (x <= per - 2 && y >= this.SIZE + 1 - per) {
core.status.event.data.paint = !core.status.event.data.paint;
core.ui.drawMaps(index, cx, cy);
return;
}
if (x >= this.SIZE + 1 - per && y <= per - 2) {
core.status.event.data.all = !core.status.event.data.all;
core.ui.drawMaps(index, cx, cy);
@ -1302,11 +1274,6 @@ actions.prototype._keyUpViewMaps = function (keycode) {
core.ui.drawMaps(core.status.event.data);
return;
}
if (keycode == 77) {
core.status.event.data.paint = !core.status.event.data.paint;
core.ui.drawMaps(core.status.event.data);
return;
}
if (keycode == 88 || (core.isReplaying() && keycode == 67)) {
if (core.isReplaying()) {
core.bookReplay();
@ -1318,66 +1285,28 @@ actions.prototype._keyUpViewMaps = function (keycode) {
return;
}
////// 商店界面时的点击操作 //////
actions.prototype._clickShop = function (x, y) {
var shop = core.status.event.data.shop;
var choices = shop.choices;
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = this.HSIZE - parseInt(choices.length / 2) + (core.status.event.ui.offset || 0);
if (y >= topIndex && y < topIndex + choices.length) {
return core.events._useShop(shop, y - topIndex);
}
// 离开
else if (y == topIndex + choices.length) {
core.events._exitShop();
}
else return false;
}
return true;
}
actions.prototype._keyDownShop = function (keycode) {
// 商店界面长按空格连续购买
if (keycode == 32 && core.status.event.selection != core.status.event.data.shop.choices.length) {
this._selectChoices(core.status.event.data.shop.choices.length + 1, keycode, this._clickShop);
return;
}
this._keyDownChoices(keycode);
}
////// 商店界面时,放开某个键的操作 //////
actions.prototype._keyUpShop = function (keycode) {
if (keycode == 27 || keycode == 88) {
core.events._exitShop();
return;
}
if (keycode != 32 || core.status.event.selection == core.status.event.data.shop.choices.length) {
this._selectChoices(core.status.event.data.shop.choices.length + 1, keycode, this._clickShop);
return;
}
return;
}
////// 快捷商店界面时的点击操作 //////
actions.prototype._clickQuickShop = function (x, y) {
var keys = Object.keys(core.status.shops).filter(function (shopId) {
return core.status.shops[shopId].visited || !core.status.shops[shopId].mustEnable
});
var shopIds = core.listShopIds();
if (x >= this.CHOICES_LEFT && x <= this.CHOICES_RIGHT) {
var topIndex = this.HSIZE - parseInt(keys.length / 2) + (core.status.event.ui.offset || 0);
if (y >= topIndex && y < topIndex + keys.length) {
var reason = core.events.canUseQuickShop(keys[y - topIndex]);
if (!core.flags.enableDisabledShop && reason) {
core.drawText(reason);
var topIndex = this.HSIZE - parseInt(shopIds.length / 2) + (core.status.event.ui.offset || 0);
if (y >= topIndex && y < topIndex + shopIds.length) {
var shopId = shopIds[y - topIndex];
if (!core.canOpenShop(shopId)) {
core.drawTip('当前项尚未开启');
return;
}
core.events.openShop(keys[y - topIndex], true);
if (core.status.event.id == 'shop')
core.status.event.data.fromList = true;
var message = core.canUseQuickShop(shopId);
if (message == null) {
// core.ui.closePanel();
core.openShop(shopIds[y - topIndex], false);
} else {
core.drawTip(message);
}
}
// 离开
else if (y == topIndex + keys.length)
else if (y == topIndex + shopIds.length)
core.ui.closePanel();
return;
}
@ -1390,15 +1319,17 @@ actions.prototype._keyUpQuickShop = function (keycode) {
core.ui.closePanel();
return;
}
var keys = Object.keys(core.status.shops).filter(function (shopId) {
return core.status.shops[shopId].visited || !core.status.shops[shopId].mustEnable
});
this._selectChoices(keys.length + 1, keycode, this._clickQuickShop);
this._selectChoices(core.listShopIds().length + 1, keycode, this._clickQuickShop);
return;
}
////// 工具栏界面时的点击操作 //////
actions.prototype._clickToolbox = function (x, y) {
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
// 装备栏
if (x >= this.LAST - 2 && y == 0) {
core.ui.closePanel();
@ -1428,11 +1359,11 @@ actions.prototype._clickToolbox = function (x, y) {
}
// 下一页
if (x == this.HSIZE+2 || x == this.HSIZE+3) {
if (y == this.LAST - 5 && toolsPage < Math.ceil(Object.keys(core.status.hero.items.tools).length / this.LAST)) {
if (y == this.LAST - 5 && toolsPage < Math.ceil(tools.length / this.LAST)) {
core.status.event.data.toolsPage++;
core.ui.drawToolbox(core.status.event.selection);
}
if (y == this.LAST && constantsPage < Math.ceil(Object.keys(core.status.hero.items.constants).length / this.LAST)) {
if (y == this.LAST && constantsPage < Math.ceil(constants.length / this.LAST)) {
core.status.event.data.constantsPage++;
core.ui.drawToolbox(core.status.event.selection);
}
@ -1450,15 +1381,20 @@ actions.prototype._clickToolbox = function (x, y) {
////// 选择工具栏界面中某个Index后的操作 //////
actions.prototype._clickToolboxIndex = function (index) {
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var items = null;
var select;
if (index < this.LAST) {
select = index + this.LAST * (core.status.event.data.toolsPage - 1);
items = Object.keys(core.status.hero.items.tools).sort();
items = tools;
}
else {
select = index % this.LAST + this.LAST * (core.status.event.data.constantsPage - 1);
items = Object.keys(core.status.hero.items.constants).sort();
items = constants;
}
if (items == null) return;
if (select >= items.length) return;
@ -1478,8 +1414,10 @@ actions.prototype._keyDownToolbox = function (keycode) {
var last_index = this.LAST - 1;
var tools = Object.keys(core.status.hero.items.tools).sort();
var constants = Object.keys(core.status.hero.items.constants).sort();
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var index = core.status.event.selection;
var toolsPage = core.status.event.data.toolsPage;
var constantsPage = core.status.event.data.constantsPage;
@ -1981,9 +1919,11 @@ actions.prototype._clickSwitchs = function (x, y) {
var topIndex = this.HSIZE - parseInt((choices.length - 1) / 2) + (core.status.event.ui.offset || 0);
var selection = y - topIndex;
if (x < this.CHOICES_LEFT || x > this.CHOICES_RIGHT) {
if (selection != 2 && selection != 3) return;
if (x != this.HSIZE - 2 && x != this.HSIZE + 2) return;
if (selection != 2 && selection != 3 && selection != 4) return;
}
var width = choices[selection].width;
var leftPos = (core.__PIXELS__ - width) / 2, rightPos = (core.__PIXELS__ + width) / 2;
var leftGrid = parseInt(leftPos / 32), rightGrid = parseInt(rightPos / 32) - 1;
if (selection >= 0 && selection < choices.length) {
core.status.event.selection = selection;
switch (selection) {
@ -1992,24 +1932,28 @@ actions.prototype._clickSwitchs = function (x, y) {
case 1:
return this._clickSwitchs_sound();
case 2:
if (x == this.HSIZE - 2) return this._clickSwitchs_userVolume(-1);
if (x == this.HSIZE + 2) return this._clickSwitchs_userVolume(1);
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_userVolume(-1);
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_userVolume(1);
return;
case 3:
if (x == this.HSIZE - 2) return this._clickSwitchs_moveSpeed(-10);
if (x == this.HSIZE + 2) return this._clickSwitchs_moveSpeed(10);
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_moveSpeed(-10);
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_moveSpeed(10);
return;
case 4:
return this._clickSwitchs_displayEnemyDamage();
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_floorChangeTime(-100);
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_floorChangeTime(100);
return;
case 5:
return this._clickSwitchs_displayCritical();
return this._clickSwitchs_displayEnemyDamage();
case 6:
return this._clickSwitchs_displayExtraDamage();
return this._clickSwitchs_displayCritical();
case 7:
return this._clickSwitchs_localForage();
return this._clickSwitchs_displayExtraDamage();
case 8:
return this._clickSwitchs_clickMove();
return this._clickSwitchs_potionNoRouting();
case 9:
return this._clickSwitchs_clickMove();
case 10:
core.status.event.selection = 0;
core.ui.drawSettings();
break;
@ -2030,6 +1974,7 @@ actions.prototype._clickSwitchs_sound = function () {
actions.prototype._clickSwitchs_userVolume = function (delta) {
var value = Math.round(Math.sqrt(100 * core.musicStatus.userVolume));
if (value == 0 && delta < 0) return;
core.musicStatus.userVolume = core.clamp(Math.pow(value + delta, 2) / 100, 0, 1);
//audioContext 音效 不受designVolume 影响
if (core.musicStatus.gainNode != null) core.musicStatus.gainNode.gain.value = core.musicStatus.userVolume;
@ -2044,6 +1989,12 @@ actions.prototype._clickSwitchs_moveSpeed = function (delta) {
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_floorChangeTime = function (delta) {
core.values.floorChangeTime = core.clamp(core.values.floorChangeTime + delta, 0, 2000);
core.setLocalStorage("floorChangeTime", core.values.floorChangeTime);
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_displayEnemyDamage = function () {
core.flags.displayEnemyDamage = !core.flags.displayEnemyDamage;
core.updateDamage();
@ -2065,12 +2016,9 @@ actions.prototype._clickSwitchs_displayExtraDamage = function () {
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_localForage = function () {
core.platform.useLocalForage = !core.platform.useLocalForage;
core.setLocalStorage('useLocalForage', core.platform.useLocalForage);
core.control.getSaveIndexes(function (indexes) {
core.saves.ids = indexes;
});
actions.prototype._clickSwitchs_potionNoRouting = function () {
if (core.hasFlag('__potionNoRouting__')) core.removeFlag('__potionNoRouting__');
else core.setFlag('__potionNoRouting__', true);
core.ui.drawSwitchs();
}
@ -2087,6 +2035,19 @@ actions.prototype._keyUpSwitchs = function (keycode) {
core.ui.drawSettings();
return;
}
if (keycode == 37) {
switch (core.status.event.selection) {
case 2: return this._clickSwitchs_userVolume(-1);
case 3: return this._clickSwitchs_moveSpeed(-10);
case 4: this._clickSwitchs_floorChangeTime(-100);
}
} else if (keycode == 39) {
switch (core.status.event.selection) {
case 2: return this._clickSwitchs_userVolume(1);
case 3: return this._clickSwitchs_moveSpeed(10);
case 4: this._clickSwitchs_floorChangeTime(100);
}
}
this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs);
}
@ -2111,20 +2072,16 @@ actions.prototype._clickSettings = function (x, y) {
core.ui.drawMaps();
break;
case 3:
core.clearUI();
core.ui.drawPaint();
break;
case 4:
core.status.event.selection = 0;
core.ui.drawSyncSave();
break;
case 5:
case 4:
core.status.event.selection = 0;
core.ui.drawGameInfo();
break;
case 6:
case 5:
return core.confirmRestart();
case 7:
case 6:
core.ui.closePanel();
break;
}
@ -2617,107 +2574,3 @@ actions.prototype._keyUpCursor = function (keycode) {
return;
}
}
////// 绘图相关 //////
actions.prototype._ondownPaint = function (x, y) {
x += core.bigmap.offsetX;
y += core.bigmap.offsetY;
if (!core.status.event.data.erase) {
core.dymCanvas.paint.beginPath();
core.dymCanvas.paint.moveTo(x, y);
}
core.status.event.data.x = x;
core.status.event.data.y = y;
}
actions.prototype._onmovePaint = function (x, y) {
if (core.status.event.data.x == null) return;
x += core.bigmap.offsetX;
y += core.bigmap.offsetY;
if (core.status.event.data.erase) {
core.clearMap('paint', x - 10, y - 10, 20, 20);
return;
}
var midx = (core.status.event.data.x + x) / 2, midy = (core.status.event.data.y + y) / 2;
core.dymCanvas.paint.quadraticCurveTo(midx, midy, x, y);
core.dymCanvas.paint.stroke();
core.status.event.data.x = x;
core.status.event.data.y = y;
}
actions.prototype._onupPaint = function () {
core.status.event.data.x = null;
core.status.event.data.y = null;
// 保存
core.paint[core.status.floorId] = lzw_encode(core.utils._encodeCanvas(core.dymCanvas.paint).join(","));
}
actions.prototype.setPaintMode = function (mode) {
if (mode == 'paint') core.status.event.data.erase = false;
else if (mode == 'erase') core.status.event.data.erase = true;
else return;
core.drawTip("进入" + (core.status.event.data.erase ? "擦除" : "绘图") + "模式");
}
actions.prototype.clearPaint = function () {
core.clearMap('paint');
delete core.paint[core.status.floorId];
core.drawTip("已清空绘图内容");
}
actions.prototype.savePaint = function () {
var data = {};
for (var floorId in core.paint) {
if (core.paint[floorId])
data[floorId] = lzw_decode(core.paint[floorId]);
}
core.download(core.firstData.name + ".h5paint", JSON.stringify({
'name': core.firstData.name,
'paint': data
}));
}
actions.prototype.loadPaint = function () {
core.readFile(function (obj) {
if (obj.name != core.firstData.name) {
alert("绘图文件和游戏不一致!");
return;
}
if (!obj.paint) {
alert("无效的绘图文件!");
return;
}
core.paint = {};
for (var floorId in obj.paint) {
if (obj.paint[floorId])
core.paint[floorId] = lzw_encode(obj.paint[floorId]);
}
core.clearMap('paint');
var value = core.paint[core.status.floorId];
if (value) value = lzw_decode(value).split(",");
core.utils._decodeCanvas(value, 32 * core.bigmap.width, 32 * core.bigmap.height);
core.drawImage('paint', core.bigmap.tempCanvas.canvas, 0, 0);
core.drawTip("读取绘图文件成功");
})
}
actions.prototype.exitPaint = function () {
core.deleteCanvas('paint');
core.ui.closePanel();
core.statusBar.image.keyboard.style.opacity = 1;
core.statusBar.image.shop.style.opacity = 1;
core.drawTip("退出绘图模式");
}
actions.prototype._keyUpPaint = function (keycode) {
if (keycode == 27 || keycode == 88 || keycode == 77 || keycode == 13 || keycode == 32 || keycode == 67) {
this.exitPaint();
return;
}
}
////// 绘图相关 END //////

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
/*
control.js游戏主要逻辑控制
主要负责status相关内容以及各种变量获取/存储
@ -22,9 +24,8 @@ control.prototype._init = function () {
this.registerAnimationFrame("animate", true, this._animationFrame_animate);
this.registerAnimationFrame("heroMoving", true, this._animationFrame_heroMoving);
this.registerAnimationFrame("weather", true, this._animationFrame_weather);
this.registerAnimationFrame("tips", true, this._animateFrame_tips);
this.registerAnimationFrame("tip", true, this._animateFrame_tip);
this.registerAnimationFrame("parallelDo", false, this._animationFrame_parallelDo);
this.registerAnimationFrame("checkConsoleOpened", true, this._animationFrame_checkConsoleOpened);
// --- 注册系统的replay
this.registerReplayAction("move", this._replayAction_move);
this.registerReplayAction("item", this._replayAction_item);
@ -181,7 +182,7 @@ control.prototype._animationFrame_animate = function (timestamp) {
control.prototype._animationFrame_heroMoving = function (timestamp) {
if (core.status.heroMoving <= 0) return;
// 换腿
if (timestamp - core.animateFrame.moveTime > (core.values.moveSpeed||100)) {
if (timestamp - core.animateFrame.moveTime > core.values.moveSpeed) {
core.animateFrame.leftLeg = !core.animateFrame.leftLeg;
core.animateFrame.moveTime = timestamp;
}
@ -283,48 +284,37 @@ control.prototype._animationFrame_weather_fog = function () {
}
}
control.prototype._animateFrame_tips = function (timestamp) {
var tips = core.animateFrame.tips;
if (timestamp - tips.time <= 30) return;
var delta = timestamp - tips.time;
tips.time = timestamp;
if (tips.list.length == 0) return;
control.prototype._animateFrame_tip = function (timestamp) {
if (core.animateFrame.tip == null) return;
var tip = core.animateFrame.tip;
if (timestamp - tip.time <= 30) return;
var delta = timestamp - tip.time;
tip.time = timestamp;
var currentOffset = Math.max(tips.offset - 5, 0), firstOffset = null;
var currList = [];
core.setFont('data', "16px Arial");
core.setTextAlign('data', 'left');
core.clearMap('data', 0, 0, this.PIXEL, tips.lastSize * 50);
tips.lastLength = tips.list.length;
while (tips.list.length > 0) {
var one = tips.list.shift();
core.ui._drawTip_drawOne(one, currentOffset);
if (one.stage == 1) {
one.opacity += 0.05;
if (one.opacity >= 0.7) one.stage = 2;
} else if (one.stage == 2) {
one.time += delta;
if (one.time >= 2000) one.stage = 3;
} else one.opacity -= 0.05;
if (one.opacity > 0) {
currList.push(one);
if (firstOffset == null) firstOffset = currentOffset;
core.clearMap('data', 0, 0, core.__PIXELS__, 50);
core.ui._drawTip_drawOne(tip);
if (tip.stage == 1) {
tip.opacity += 0.05;
if (tip.opacity >= 0.6) {
tip.stage = 2;
tip.displayTime = 0;
}
currentOffset += 50;
} else if (tip.stage == 2) {
tip.displayTime += delta;
if (tip.displayTime >= 1000) tip.stage = 3;
} else tip.opacity -= 0.05;
if (tip.opacity <= 0) {
core.animateFrame.tip = null;
}
tips.list = currList;
tips.offset = firstOffset || 0;
}
control.prototype._animationFrame_parallelDo = function (timestamp) {
core.control.controldata.parallelDo(timestamp);
}
control.prototype._animationFrame_checkConsoleOpened = function (timestamp) {
if (core.consoleOpened()) core.setFlag('__consoleOpened__', true);
}
// ------ 标题界面的处理 ------ //
////// 显示游戏开始界面 //////
@ -399,7 +389,7 @@ control.prototype._initStatistics = function (totalTime) {
'hp': 0,
"battle": 0,
'money': 0,
'experience': 0,
'exp': 0,
'battleDamage': 0,
'poisonDamage': 0,
'extraDamage': 0,
@ -498,7 +488,7 @@ control.prototype._setAutomaticRoute_isMoving = function (destX, destY) {
core.control.tryMoveDirectly(destX, destY);
}
core.status.automaticRoute.moveDirectly = false;
}, core.values.moveSpeed || 100);
}, core.values.moveSpeed);
}
return true;
}
@ -614,7 +604,7 @@ control.prototype.setHeroMoveInterval = function (callback) {
core.moveOneStep(core.nextX(), core.nextY());
if (callback) callback();
}
}, (core.values.moveSpeed||100) / 8 * toAdd / core.status.replay.speed);
}, core.values.moveSpeed / 8 * toAdd / core.status.replay.speed);
}
////// 每移动一格后执行的事件 //////
@ -666,10 +656,9 @@ control.prototype._moveAction_moving = function (callback) {
// 执行该点事件
if (!hasTrigger)
core.events._trigger(nowx, nowy);
core.updateStatusBar();
// 检查该点是否是滑冰
if (core.getBgNumber() == 167) {
if (core.onSki()) {
core.insertAction("滑冰事件", null, null, null, true);
}
@ -755,7 +744,7 @@ control.prototype.waitHeroToStop = function(callback) {
core.setHeroLoc('direction', lastDirection);
core.drawHero();
callback();
}, 30);
}, core.status.replay.speed == 24 ? 0 : 30);
}
}
@ -837,14 +826,14 @@ control.prototype._drawHero_getDrawObjs = function (direction, x, y, status, off
"status": status,
"index": index++,
});
(core.status.hero.followers||[]).forEach(function (t) {
core.status.hero.followers.forEach(function (t) {
drawObjs.push({
"img": core.material.images.images[t.name],
"width": core.material.images.images[t.name].width/4,
"height": core.material.images.images[t.name].height/4,
"heroIcon": heroIconArr[t.direction],
"posx": 32*t.x - core.bigmap.offsetX + (t.stop?0:core.utils.scan[t.direction].x*offset),
"posy": 32*t.y - core.bigmap.offsetY + (t.stop?0:core.utils.scan[t.direction].y*offset),
"posx": 32*t.x - core.bigmap.offsetX + (t.stop?0:core.utils.scan[t.direction].x*Math.abs(offset)),
"posy": 32*t.y - core.bigmap.offsetY + (t.stop?0:core.utils.scan[t.direction].y*Math.abs(offset)),
"status": t.stop?"stop":status,
"index": index++
});
@ -909,7 +898,7 @@ control.prototype.setViewport = function (x, y) {
////// 移动视野范围 //////
control.prototype.moveViewport = function (steps, time, callback) {
time = time || core.values.moveSpeed || 300;
time = time || core.values.moveSpeed;
var step = 0, moveSteps = (steps||[]).filter(function (t) {
return ['up','down','left','right'].indexOf(t)>=0;
});
@ -959,7 +948,7 @@ control.prototype.nearHero = function (x, y, n) {
////// 聚集跟随者 //////
control.prototype.gatherFollowers = function () {
var x=core.getHeroLoc('x'), y=core.getHeroLoc('y'), dir=core.getHeroLoc('direction');
(core.status.hero.followers||[]).forEach(function (t) {
core.status.hero.followers.forEach(function (t) {
t.x = x;
t.y = y;
t.stop = true;
@ -969,7 +958,7 @@ control.prototype.gatherFollowers = function () {
////// 更新跟随者坐标 //////
control.prototype.updateFollowers = function () {
(core.status.hero.followers||[]).forEach(function (t) {
core.status.hero.followers.forEach(function (t) {
if (!t.stop) {
t.x += core.utils.scan[t.direction].x;
t.y += core.utils.scan[t.direction].y;
@ -977,7 +966,7 @@ control.prototype.updateFollowers = function () {
})
var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');
(core.status.hero.followers||[]).forEach(function (t) {
core.status.hero.followers.forEach(function (t) {
t.stop = true;
var dx = nowx - t.x, dy = nowy - t.y;
for (var dir in core.utils.scan) {
@ -1001,7 +990,8 @@ control.prototype.checkBlock = function () {
var damage = core.status.checkBlock.damage[loc];
if (damage) {
core.status.hero.hp -= damage;
core.drawTip("受到"+(core.status.checkBlock.type[loc]||"伤害")+damage+"点");
var text = (Object.keys(core.status.checkBlock.type[loc] || {}).join("")) || "伤害";
core.drawTip("受到"+text+damage+"点");
core.drawHeroAnimate("zone");
this._checkBlock_disableQuickShop();
core.status.hero.statistics.extraDamage += damage;
@ -1010,6 +1000,8 @@ control.prototype.checkBlock = function () {
core.updateStatusBar();
core.events.lose();
return;
} else {
core.updateStatusBar();
}
}
this._checkBlock_snipe(core.status.checkBlock.snipe[loc]);
@ -1019,9 +1011,9 @@ control.prototype.checkBlock = function () {
control.prototype._checkBlock_disableQuickShop = function () {
// 禁用快捷商店
if (core.flags.disableShopOnDamage) {
for (var shopId in core.status.shops) {
core.status.shops[shopId].visited = false;
}
Object.keys(core.status.shops).forEach(function (shopId) {
core.setShopVisited(shopId, false);
});
}
}
@ -1030,7 +1022,7 @@ control.prototype._checkBlock_snipe = function (snipe) {
if (!snipe || snipe.length == 0) return;
var actions = [];
snipe.forEach(function (t) {
actions.push({"type": "move", "loc": [t[0],t[1]], "steps": [t[3]], "time": 500, "keep": true, "async": true});
actions.push({"type": "move", "loc": [t[0],t[1]], "steps": [t[3]], "time": 250, "keep": true, "async": true});
});
actions.push({"type": "waitAsync"});
core.insertAction(actions);
@ -1042,12 +1034,14 @@ control.prototype._checkBlock_ambush = function (ambush) {
// 捕捉效果
var actions = [];
ambush.forEach(function (t) {
actions.push({"type": "move", "loc": [t[0],t[1]], "steps": [t[3]], "time": 500, "keep": false, "async":true});
actions.push({"type": "move", "loc": [t[0],t[1]], "steps": [t[3]], "time": 250, "keep": false, "async":true});
});
actions.push({"type": "waitAsync"});
// 强制战斗
ambush.forEach(function (t) {
actions.push({"type": "battle", "id": t[2]});
actions.push({"type": "function", "function": "function() { "+
"core.battle('" + t[2] + "', " + t[0]+ "," + t[1] + ", true, core.doAction); "+
"}", "async": true});
});
core.insertAction(actions);
}
@ -1275,7 +1269,7 @@ control.prototype.bookReplay = function () {
if (core.isMoving() || core.status.replay.animate
|| (core.status.event.id && core.status.event.id != 'viewMaps'))
return core.drawTip("请等待当前事件的处理结束");
if (!core.hasItem('book')) return core.drawTip('你没有怪物手册');
if (!core.hasItem('book')) return core.drawTip('你没有'+core.material.items['book'].name);
// 从“浏览地图”页面打开
if (core.status.event.id=='viewMaps')
@ -1440,12 +1434,14 @@ control.prototype._replayAction_item = function (action) {
if (action.indexOf("item:")!=0) return false;
var itemId = action.substring(5);
if (!core.canUseItem(itemId)) return false;
if (core.material.items[itemId].hideInReplay) {
if (core.material.items[itemId].hideInReplay || core.status.replay.speed == 24) {
core.useItem(itemId, false, core.replay);
return true;
}
var tools = Object.keys(core.status.hero.items.tools).sort();
var constants = Object.keys(core.status.hero.items.constants).sort();
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var index, per = core.__SIZE__-1;
if ((index=tools.indexOf(itemId))>=0) {
core.status.event.data = {"toolsPage": Math.floor(index/per)+1, "constantsPage":1};
@ -1471,7 +1467,7 @@ control.prototype._replayAction_equip = function (action) {
var index = ownEquipment.indexOf(equipId), per = core.__SIZE__-1;
if (index<0) return false;
core.status.route.push(action);
if (core.material.items[equipId].hideInReplay) {
if (core.material.items[equipId].hideInReplay || core.status.replay.speed == 24) {
core.loadEquip(equipId, core.replay);
return true;
}
@ -1491,6 +1487,10 @@ control.prototype._replayAction_unEquip = function (action) {
if (!core.isset(equipType)) return false;
core.ui.drawEquipbox(equipType);
core.status.route.push(action);
if (core.status.replay.speed == 24) {
core.unloadEquip(equipType, core.replay);
return true;
}
setTimeout(function () {
core.ui.closePanel();
core.unloadEquip(equipType, core.replay);
@ -1504,6 +1504,11 @@ control.prototype._replayAction_fly = function (action) {
var toIndex=core.floorIds.indexOf(floorId);
if (!core.canUseItem('fly')) return false;
core.ui.drawFly(toIndex);
if (core.status.replay.speed == 24) {
if (!core.flyTo(floorId, core.replay))
core.control._replay_error(action);
return true;
}
setTimeout(function () {
if (!core.flyTo(floorId, core.replay))
core.control._replay_error(action);
@ -1513,36 +1518,13 @@ control.prototype._replayAction_fly = function (action) {
control.prototype._replayAction_shop = function (action) {
if (action.indexOf("shop:")!=0) return false;
var sps=action.substring(5).split(":");
var shopId=sps[0], selections=sps[1].split("");
if (selections.length == 0) return false;
var shop=core.status.shops[shopId];
if (!shop || !shop.visited) return false;
// --- 判定commonEvent或item
if (shop.commonEvent || shop.item) {
core.openShop(shopId, false);
setTimeout(core.replay);
var shopId = action.substring(5);
if (core.canUseQuickShop(shopId) != null || !core.canOpenShop(shopId)) {
this._replay_error(shopId);
return true;
}
var choices = shop.choices;
core.status.event.selection = parseInt(selections.shift());
core.events.openShop(shopId, false);
var topIndex = core.__HALF_SIZE__ - parseInt(choices.length / 2) + (core.status.event.ui.offset || 0);
var shopInterval = setInterval(function () {
if (!core.actions._clickShop(core.__HALF_SIZE__, topIndex+core.status.event.selection)) {
clearInterval(shopInterval);
core.control._replay_error(action);
return;
}
if (selections.length==0) {
clearInterval(shopInterval);
core.actions._clickShop(core.__HALF_SIZE__, topIndex+choices.length);
core.replay();
return;
}
core.status.event.selection = parseInt(selections.shift());
core.events.openShop(shopId, false);
}, core.control.__replay_getTimeout());
core.openShop(shopId, false);
core.replay();
return true;
}
@ -1550,14 +1532,14 @@ control.prototype._replayAction_turn = function (action) {
if (action != 'turn' && action.indexOf('turn:') != 0) return false;
if (action == 'turn') core.turnHero();
else core.turnHero(action.substring(5));
setTimeout(core.replay);
core.replay();
return true;
}
control.prototype._replayAction_getNext = function (action) {
if (action != "getNext") return false;
if (!core.getNextItem()) return false;
setTimeout(core.replay);
core.replay();
return true;
}
@ -1574,6 +1556,11 @@ control.prototype._replayAction_moveDirectly = function (action) {
var x=parseInt(pos[0]), y=parseInt(pos[1]);
var nowx=core.getHeroLoc('x'), nowy=core.getHeroLoc('y');
if (!core.moveDirectly(x, y)) return false;
if (core.status.replay.speed == 24) {
core.replay();
return true;
}
core.ui.drawArrow('ui', 32*nowx+16-core.bigmap.offsetX, 32*nowy+16-core.bigmap.offsetY,
32*x+16-core.bigmap.offsetX, 32*y+16-core.bigmap.offsetY, '#FF0000', 3);
setTimeout(function () {
@ -1586,7 +1573,7 @@ control.prototype._replayAction_moveDirectly = function (action) {
control.prototype._replayAction_key = function (action) {
if (action.indexOf("key:") != 0) return false;
core.actions.keyUp(parseInt(action.substring(4)), false, true);
setTimeout(core.replay);
core.replay();
return true;
}
@ -1718,16 +1705,13 @@ control.prototype._doSL_load_afterGet = function (id, data) {
var _replay = function () {
core.startGame(data.hard, data.hero.flags.__seed__, core.decodeRoute(data.route));
};
if (core.flags.checkConsole && data.hashCode != null && data.hashCode != core.hashCode(data.hero)) {
core.myconfirm("存档校验失败,请勿修改存档文件!\n你想回放此存档的录像吗\n可以随时停止录像播放以继续游戏。", _replay);
return;
}
if (data.version != core.firstData.version) {
core.myconfirm("存档版本不匹配!\n你想回放此存档的录像吗\n可以随时停止录像播放以继续游戏。", _replay);
return;
}
core.ui.closePanel();
core.loadData(data, function() {
core.removeFlag('__fromLoad__');
core.drawTip("读档成功");
if (id!="autoSave") {
core.saves.saveIndex=id;
@ -2006,7 +1990,6 @@ control.prototype._updateFavoriteSaves = function () {
////// 设置勇士属性 //////
control.prototype.setStatus = function (name, value) {
if (!core.status.hero) return;
if (name == 'exp') name = 'experience';
if (name == 'x' || name == 'y' || name == 'direction')
this.setHeroLoc(name, value);
else
@ -2023,7 +2006,6 @@ control.prototype.getStatus = function (name) {
if (!core.status.hero) return null;
if (name == 'x' || name == 'y' || name == 'direction')
return this.getHeroLoc(name);
if (name == 'exp') name = 'experience';
return core.status.hero[name];
}
@ -2075,14 +2057,7 @@ control.prototype.getHeroLoc = function (name) {
return core.status.hero.loc[name];
}
////// 获得某个属性的中文名 //////
control.prototype.getStatusName = function (name) {
var map = {
name: "名称", lv: "等级", hpmax: "生命上限", hp: "生命", manamax: "魔力上限", mana: "魔力",
atk: "攻击", def: "防御", mdef: "魔防", money: "金币", exp: "经验", experience: "经验", steps: "步数"
};
return map[name] || name;
}
////// 获得某个等级的名称 //////
control.prototype.getLvName = function (lv) {
@ -2318,6 +2293,7 @@ control.prototype.pauseBgm = function () {
if (main.mode!='play')return;
try {
if (core.musicStatus.playingBgm) {
core.musicStatus.pauseTime = core.material.bgms[core.musicStatus.playingBgm].currentTime;
core.material.bgms[core.musicStatus.playingBgm].pause();
core.musicStatus.playingBgm = null;
}
@ -2330,10 +2306,11 @@ control.prototype.pauseBgm = function () {
}
////// 恢复背景音乐的播放 //////
control.prototype.resumeBgm = function () {
control.prototype.resumeBgm = function (resumeTime) {
if (main.mode!='play')return;
try {
core.playBgm(core.musicStatus.playingBgm || core.musicStatus.lastBgm || main.startBgm);
core.playBgm(core.musicStatus.playingBgm || core.musicStatus.lastBgm || main.startBgm,
resumeTime ? core.musicStatus.pauseTime : 0);
}
catch (e) {
console.log("无法恢复BGM");
@ -2628,20 +2605,25 @@ control.prototype._shouldDisplayStatus = function(id) {
}
return toDraw;
}
var obj = {};
core.flags.statusBarItems.forEach(function (v) { obj[v] = true; })
switch (id) {
case 'floor': return core.flags.enableFloor;
case 'name': return core.flags.enableName;
case 'lv': return core.flags.enableLv;
case 'hpmax': return core.flags.enableHPMax;
case 'mana': return core.flags.enableMana;
case 'mdef': return core.flags.enableMDef;
case 'money': return core.flags.enableMoney;
case 'experience': return core.flags.enableExperience && !core.flags.levelUpLeftMode;
case 'up': return core.flags.enableLevelUp;
case 'skill': return core.flags.enableSkill;
case 'key': return core.flags.enableKeys;
case 'pzf': return core.flags.enablePZF;
case 'debuff': return core.flags.enableDebuff;
case 'floor': return obj.enableFloor;
case 'name': return obj.enableName;
case 'lv': return obj.enableLv;
case 'hp': return obj.enableHP;
case 'hpmax': return obj.enableHPMax;
case 'mana': return obj.enableMana;
case 'atk': return obj.enableAtk;
case 'def': return obj.enableDef;
case 'mdef': return obj.enableMDef;
case 'money': return obj.enableMoney;
case 'exp': return obj.enableExp && !obj.levelUpLeftMode;
case 'up': return obj.enableLevelUp;
case 'skill': return obj.enableSkill;
case 'key': return obj.enableKeys;
case 'pzf': return obj.enablePZF;
case 'debuff': return obj.enableDebuff;
default: return true;
}
}
@ -2837,6 +2819,14 @@ control.prototype._resize_status = function (obj) {
for (var i = 0; i < core.dom.statusTexts.length; ++i) {
core.dom.statusTexts[i].style.color = obj.globalAttribute.statusBarColor;
}
// keys
if (core.flags.statusBarItems.indexOf('enableGreenKey')>=0) {
core.dom.keyCol.style.fontSize = '0.75em';
core.statusBar.greenKey.style.display = '';
} else {
core.dom.keyCol.style.fontSize = '';
core.statusBar.greenKey.style.display = 'none';
}
}
control.prototype._resize_toolBar = function (obj) {

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
/**
* 初始化 start
*/
@ -45,12 +47,7 @@ function core() {
'data': null,
'fog': null,
},
"tips": {
'time': 0,
'offset': 0,
'list': [],
'lastSize': 0,
},
"tip": null,
"asyncId": {}
}
this.musicStatus = {
@ -58,6 +55,7 @@ function core() {
'bgmStatus': false, // 是否播放BGM
'soundStatus': true, // 是否播放SE
'playingBgm': null, // 正在播放的BGM
'pauseTime': 0, // 上次暂停的时间
'lastBgm': null, // 上次播放的bgm
'gainNode': null,
'playingSounds': {}, // 正在播放的SE
@ -98,7 +96,6 @@ function core() {
height: this.__SIZE__,
tempCanvas: null, // A temp canvas for drawing
}
this.paint = {};
this.saves = {
"saveIndex": null,
"ids": {},
@ -280,19 +277,17 @@ core.prototype._init_flags = function () {
// 初始化怪物、道具等
core.material.enemys = core.enemys.getEnemys();
core.material.items = core.items.getItems();
core.items._resetItems();
core.material.icons = core.icons.getIcons();
}
core.prototype._init_sys_flags = function () {
if (!core.flags.enableExperience) core.flags.enableLevelUp = false;
if (!core.flags.enableLevelUp) core.flags.levelUpLeftMode = false;
if (core.flags.equipboxButton) core.flags.equipment = true;
core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
core.flags.displayCritical = core.getLocalStorage('critical', core.flags.displayCritical);
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
// 行走速度
core.values.moveSpeed = core.getLocalStorage('moveSpeed', core.values.moveSpeed);
core.values.moveSpeed = core.getLocalStorage('moveSpeed', 100);
core.values.floorChangeTime = core.getLocalStorage('floorChangeTime', 500);
}
core.prototype._init_platform = function () {

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
"use strict";
function data() {

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
"use strict";
function enemys() {
@ -113,27 +115,6 @@ enemys.prototype.canBattle = function (enemy, x, y, floorId) {
return damage != null && damage < core.status.hero.hp;
}
////// 获得某个怪物的伤害 //////
enemys.prototype.getDamage = function (enemy, x, y, floorId) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
var damage = this._calDamage(enemy, null, x, y, floorId);
if (damage == null) return null;
return damage + this.getExtraDamage(enemy, x, y, floorId);
}
////// 获得某个怪物的额外伤害 //////
enemys.prototype.getExtraDamage = function (enemy, x, y, floorId) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
var extra_damage = 0;
if (this.hasSpecial(enemy.special, 17)) { // 仇恨
extra_damage += core.getFlag('hatred', 0);
}
if (this.hasSpecial(enemy.special, 22)) { // 固伤
extra_damage += enemy.damage || 0;
}
return extra_damage;
}
enemys.prototype.getDamageString = function (enemy, x, y, floorId) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
var damage = this.getDamage(enemy, x, y, floorId);
@ -279,26 +260,33 @@ enemys.prototype._nextCriticals_useTurn = function (enemy, info, number, x, y, f
enemys.prototype.getDefDamage = function (enemy, k, x, y, floorId) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
k = k || 1;
var nowDamage = this._calDamage(enemy, null, x, y, floorId);
var nextDamage = this._calDamage(enemy, {"def": core.status.hero.def + k}, x, y, floorId);
var nowDamage = this._getDamage(enemy, null, x, y, floorId);
var nextDamage = this._getDamage(enemy, {"def": core.status.hero.def + k}, x, y, floorId);
if (nowDamage == null || nextDamage == null) return "???";
return nowDamage - nextDamage;
}
enemys.prototype.getEnemyInfo = function (enemy, hero, x, y, floorId) {
if (enemy == null) return null;
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
return this.enemydata.getEnemyInfo(enemy, hero, x, y, floorId)
}
////// 获得战斗伤害信息(实际伤害计算函数) //////
enemys.prototype.getDamageInfo = function (enemy, hero, x, y, floorId) {
if (enemy == null) return null;
// 移动到了脚本编辑 - getDamageInfo中
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
return this.enemydata.getDamageInfo(enemy, hero, x, y, floorId);
}
////// 获得在某个勇士属性下怪物伤害 //////
enemys.prototype._calDamage = function (enemy, hero, x, y, floorId) {
enemys.prototype.getDamage = function (enemy, x, y, floorId) {
return this._getDamage(enemy, null, x, y, floorId);
}
enemys.prototype._getDamage = function (enemy, hero, x, y, floorId) {
if (enemy == null) return null;
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
var info = this.getDamageInfo(enemy, hero, x, y, floorId);
@ -307,9 +295,6 @@ enemys.prototype._calDamage = function (enemy, hero, x, y, floorId) {
return info.damage;
}
////// 更新怪物数据。已经不再使用,这里留空进行兼容。 //////
enemys.prototype.updateEnemys = function () {}
////// 获得当前楼层的怪物列表 //////
enemys.prototype.getCurrentEnemys = function (floorId) {
floorId = floorId || core.status.floorId;
@ -373,14 +358,18 @@ enemys.prototype._getCurrentEnemys_sort = function (enemys) {
enemys.prototype.hasEnemyLeft = function (enemyId, floorId) {
if (floorId == null) floorId = core.status.floorId;
if (floorId instanceof Array) {
for (var i = 0; i < floorId.length; ++i) {
if (core.hasEnemyLeft(enemyId, floorId[i]))
return true;
if (!(floorId instanceof Array)) floorId = [floorId];
var enemyMap = {};
if (enemyId instanceof Array) enemyId.forEach(function(v) { enemyMap[v] = true;});
else if (enemyId) enemyMap[enemyId] = true;
else enemyMap = null;
for (var i = 0; i < floorId.length; i++) {
var mapBlocks = core.status.maps[floorId[i]].blocks;
for (var b = 0; b < mapBlocks.length; b++) {
if (!mapBlocks[b].disable && mapBlocks[b].event.cls.indexOf('enemy') === 0) {
if (enemyMap === null || enemyMap[mapBlocks[b].event.id]) return true;
}
}
return false;
}
return core.getCurrentEnemys(floorId).filter(function (enemy) {
return enemyId == null || enemy.id == enemyId;
}).length > 0;
return false;
}

File diff suppressed because it is too large Load Diff

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
/*
extensions.js负责拓展插件
*/

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
"use strict";
function icons() {
@ -25,6 +27,15 @@ icons.prototype.getClsFromId = function (id) {
return null;
}
icons.prototype.getAllIconIds = function () {
if (this.allIconIds) return this.allIconIds;
this.allIconIds = [];
for (var type in this.icons) {
this.allIconIds = this.allIconIds.concat(Object.keys(this.icons[type]));
}
return this.allIconIds;
}
icons.prototype._getAnimateFrames = function (cls, useOriginValue) {
if (cls == 'enemys' || cls == 'npcs') {
return 2;

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
"use strict";
function items() {
@ -24,35 +26,6 @@ items.prototype.getItems = function () {
return core.clone(this.items);
}
items.prototype._resetItems = function () {
// 只有运行时才能执行此函数!
if (main.mode != 'play') return;
// 根据flag来对道具进行修改
if (core.flags.bigKeyIsBox) {
core.material.items.bigKey.cls = 'items';
core.material.items.bigKey.name = '钥匙盒';
}
if (core.flags.pickaxeFourDirections)
core.material.items.pickaxe.text = "可以破坏勇士四周的墙";
if (core.flags.bombFourDirections)
core.material.items.bomb.text = "可以炸掉勇士四周的怪物";
if (core.flags.snowFourDirections)
core.material.items.snow.text = "可以将四周的熔岩变成平地";
if (core.flags.equipment) {
core.material.items.sword1.cls = 'equips';
core.material.items.sword2.cls = 'equips';
core.material.items.sword3.cls = 'equips';
core.material.items.sword4.cls = 'equips';
core.material.items.sword5.cls = 'equips';
core.material.items.shield1.cls = 'equips';
core.material.items.shield2.cls = 'equips';
core.material.items.shield3.cls = 'equips';
core.material.items.shield4.cls = 'equips';
core.material.items.shield5.cls = 'equips';
}
}
////// “即捡即用类”道具的使用效果 //////
items.prototype.getItemEffect = function (itemId, itemNum) {
var itemCls = core.material.items[itemId].cls;
@ -79,6 +52,7 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
main.log(e);
}
}
core.updateStatusBar();
}
else {
core.addItem(itemId, itemNum);
@ -145,9 +119,6 @@ items.prototype._afterUseItem = function (itemId) {
core.status.hero.items[itemCls][itemId]--;
if (core.status.hero.items[itemCls][itemId] <= 0)
delete core.status.hero.items[itemCls][itemId];
if (!core.status.event.id)
core.status.event.ui = null;
core.updateStatusBar();
}
@ -156,21 +127,15 @@ items.prototype.canUseItem = function (itemId) {
// 没有道具
if (!core.hasItem(itemId)) return false;
var able = false;
if (itemId in this.canUseItemEffect) {
try {
able = eval(this.canUseItemEffect[itemId]);
return eval(this.canUseItemEffect[itemId]);
}
catch (e) {
main.log(e);
return false;
}
}
if (!able) {
core.status.event.data = null;
core.status.event.ui = null;
}
return able;
}
////// 获得某个物品的个数 //////
@ -209,8 +174,7 @@ items.prototype.setItem = function (itemId, itemNum) {
core.status.hero.items[itemCls][itemId] = itemNum;
if (core.status.hero.items[itemCls][itemId] <= 0) {
if (itemCls != 'keys') delete core.status.hero.items[itemCls][itemId];
else core.status.hero.items[itemCls][itemId] = 0;
delete core.status.hero.items[itemCls][itemId];
}
core.updateStatusBar();
}
@ -226,8 +190,7 @@ items.prototype.addItem = function (itemId, itemNum) {
}
core.status.hero.items[itemCls][itemId] += itemNum;
if (core.status.hero.items[itemCls][itemId] <= 0) {
if (itemCls != 'keys') delete core.status.hero.items[itemCls][itemId];
else core.status.hero.items[itemCls][itemId] = 0;
delete core.status.hero.items[itemCls][itemId];
}
// 永久道具只能有一个
if (itemCls == 'constants' && core.status.hero.items[itemCls][itemId] > 1)
@ -242,8 +205,7 @@ items.prototype.removeItem = function (itemId, itemNum) {
var itemCls = core.material.items[itemId].cls;
core.status.hero.items[itemCls][itemId] -= itemNum;
if (core.status.hero.items[itemCls][itemId] <= 0) {
if (itemCls != 'keys') delete core.status.hero.items[itemCls][itemId];
else core.status.hero.items[itemCls][itemId] = 0;
delete core.status.hero.items[itemCls][itemId];
}
core.updateStatusBar();
return true;

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
/*
loader.js负责对资源的加载

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
"use strict";
function maps() {
@ -88,6 +90,10 @@ maps.prototype.getBlockByNumber = function (number) {
return core.status.number2Block[number] = this.initBlock(null, null, number, true);
}
maps.prototype.getBlockById = function (id) {
return this.getBlockByNumber(this.getNumberById(id));
}
////// 数字和ID的对应关系 //////
maps.prototype.initBlock = function (x, y, id, addInfo, eventFloor) {
var disable = null;
@ -103,8 +109,14 @@ maps.prototype.initBlock = function (x, y, id, addInfo, eventFloor) {
else if (core.icons.getTilesetOffset(id)) block.event = {"cls": "tileset", "id": "X" + id, "noPass": true};
else block.event = {'cls': 'terrains', 'id': 'none', 'noPass': false};
if (typeof block.event.noPass === 'string')
block.event.noPass = JSON.parse(block.event.noPass);
if (block.event.noPass == null) {
if (block.event.canPass == null) {
block.event.noPass = block.event.cls != 'items';
} else {
block.event.noPass = !block.event.canPass;
}
}
delete block.event.canPass;
if (addInfo) this._addInfo(block);
if (eventFloor) {
@ -124,11 +136,6 @@ maps.prototype._addInfo = function (block) {
if (block.event.cls == 'items' && !block.event.trigger) {
block.event.trigger = 'getItem';
}
if (block.event.noPass == null) {
if (block.event.cls != 'items') {
block.event.noPass = true;
}
}
if (block.event.animate == null) {
block.event.animate = core.icons._getAnimateFrames(block.event.cls, false);
}
@ -509,6 +516,7 @@ maps.prototype._canMoveHero_checkCannotInOut = function (number, name, direction
}
return false;
}
if (name == 'cannotIn') direction = core.reverseDirection(direction);
return core.inArray((this.getBlockByNumber(number).event || {})[name], direction);
}
@ -588,7 +596,7 @@ maps.prototype._canMoveDirectly_bfs = function (sx, sy, locs, number, ans) {
if (!core.inArray(canMoveArray[x][y], direction)) continue;
var nx = x + core.utils.scan[direction].x, ny = y + core.utils.scan[direction].y, nindex = nx + "," + ny;
if (visited[nindex]) continue;
if (bgMap[ny][nx] == 167) continue;
if (core.onSki(bgMap[ny][nx])) continue;
if (!this._canMoveDirectly_checkNextPoint(blocksObj, nx, ny)) continue;
visited[nindex] = visited[now] + 1;
// if (nx == ex && ny == ey) return visited[nindex];
@ -612,7 +620,8 @@ maps.prototype._canMoveDirectly_bfs = function (sx, sy, locs, number, ans) {
maps.prototype._canMoveDirectly_checkNextPoint = function (blocksObj, x, y) {
var index = x + "," + y;
// 该点是否有事件
if (blocksObj[index] && (blocksObj[index].event.trigger || blocksObj[index].event.noPass)) return false;
if (blocksObj[index] && (blocksObj[index].event.trigger || blocksObj[index].event.noPass
|| blocksObj[index].event.script)) return false;
// 是否存在阻激夹域伤害
if (core.status.checkBlock.damage[index]) return false;
// 是否存在捕捉
@ -678,8 +687,8 @@ maps.prototype._automaticRoute_deepAdd = function (x, y) {
if (id == "light") deepAdd += 100;
// 绕过路障
if (id.endsWith("Net")) deepAdd += 100;
// 绕过血瓶
if (!core.flags.potionWhileRouting && id.endsWith("Potion")) deepAdd += 100;
// 绕过血瓶和绿宝石
if (core.hasFlag('__potionNoRouting__') && (id.endsWith("Potion") || id == 'greenJewel')) deepAdd += 100;
// 绕过传送点
// if (block.block.event.trigger == 'changeFloor') deepAdd+=10;
}
@ -743,8 +752,10 @@ maps.prototype._drawBlockInfo_bgfg = function (blockInfo, name, x, y) {
maps.prototype.generateGroundPattern = function (floorId) {
// 生成floorId层的groundPattern盒子内的怪物动画
var groundId = ((core.status.maps || core.floors)[floorId || core.status.floorId] || {}).defaultGround || "ground";
var groundInfo = core.getBlockInfo(groundId);
if (groundInfo == null) return;
core.material.groundCanvas.clearRect(0, 0, 32, 32);
core.material.groundCanvas.drawImage(core.material.images.terrains, 0, 32 * core.material.icons.terrains[groundId], 32, 32, 0, 0, 32, 32);
core.material.groundCanvas.drawImage(groundInfo.image, 32 * groundInfo.posX, groundInfo.height * groundInfo.posY, 32, 32, 0, 0, 32, 32);
core.material.groundPattern = core.material.groundCanvas.createPattern(core.material.groundCanvas.canvas, 'repeat');
// 如果需要用纯色可以直接将下面代码改成改成
// core.material.groundPattern = '#000000';
@ -813,11 +824,11 @@ maps.prototype.drawBg = function (floorId, ctx) {
maps.prototype._drawBg_drawBackground = function (floorId, ctx) {
var width = core.floors[floorId].width, height = core.floors[floorId].height;
var groundId = (core.status.maps || core.floors)[floorId].defaultGround || "ground";
var yOffset = core.material.icons.terrains[groundId];
if (yOffset != null) {
var groundInfo = core.getBlockInfo(groundId);
if (groundInfo != null) {
for (var i = 0; i < width; i++) {
for (var j = 0; j < height; j++) {
ctx.drawImage(core.material.images.terrains, 0, yOffset * 32, 32, 32, i * 32, j * 32, 32, 32);
ctx.drawImage(groundInfo.image, 32 * groundInfo.posX, groundInfo.height * groundInfo.posY, 32, 32, i * 32, j * 32, 32, 32);
}
}
}
@ -1408,7 +1419,7 @@ maps.prototype.searchBlock = function (id, floorId, showDisable) {
}
for (var i = 0; i < core.status.maps[floorId].blocks.length; ++i) {
var block = core.status.maps[floorId].blocks[i];
if ((showDisable || !block.disable) && core.matchWildcard(id, block.event.id)) {
if ((showDisable || !block.disable) && (core.matchWildcard(id, block.event.id) || core.matchRegex(id, block.event.id))) {
result.push({floorId: floorId, index: i, block: block, x: block.x, y: block.y});
}
}
@ -1460,10 +1471,10 @@ maps.prototype.hideBlock = function (x, y, floorId) {
////// 将某个块从启用变成禁用状态 //////
maps.prototype.removeBlock = function (x, y, floorId) {
floorId = floorId || core.status.floorId;
if (!floorId) return;
if (!floorId) return false;
var block = core.getBlock(x, y, floorId, true);
if (block == null) return; // 不存在
if (block == null) return false; // 不存在
var index = block.index;
@ -1477,12 +1488,13 @@ maps.prototype.removeBlock = function (x, y, floorId) {
}
// 删除Index
core.removeBlockById(index, floorId);
core.removeBlockByIndex(index, floorId);
core.updateStatusBar();
return true;
}
////// 根据block的索引尽可能删除该块 //////
maps.prototype.removeBlockById = function (index, floorId) {
maps.prototype.removeBlockByIndex = function (index, floorId) {
floorId = floorId || core.status.floorId;
if (!floorId) return;
@ -1497,13 +1509,11 @@ maps.prototype.removeBlockById = function (index, floorId) {
}
////// 一次性删除多个block //////
maps.prototype.removeBlockByIds = function (floorId, ids) {
floorId = floorId || core.status.floorId;
if (!floorId) return;
ids.sort(function (a, b) {
return b - a
}).forEach(function (id) {
core.removeBlockById(id, floorId);
maps.prototype.removeBlockByIndexes = function (indexes, floorId) {
indexes.sort(function (a, b) {
return b - a;
}).forEach(function (index) {
core.removeBlockByIndex(index, floorId);
});
}
@ -1769,6 +1779,7 @@ maps.prototype._getAndRemoveBlock = function (x, y) {
////// 显示移动某块的动画,达到{“type”:”move”}的效果 //////
maps.prototype.moveBlock = function (x, y, steps, time, keep, callback) {
if (core.status.replay.speed == 24) time = 1;
time = time || 500;
var blockArr = this._getAndRemoveBlock(x, y);
if (blockArr == null) {
@ -1930,6 +1941,7 @@ maps.prototype._moveJumpBlock_finished = function (blockInfo, canvases, info, an
////// 显示/隐藏某个块时的动画效果 //////
maps.prototype.animateBlock = function (loc, type, time, callback) {
if (core.status.replay.speed == 24) time = 1;
var isHide = type == 'hide';
if (typeof loc[0] == 'number' && typeof loc[1] == 'number')
loc = [loc];
@ -2048,7 +2060,7 @@ maps.prototype.drawBoxAnimate = function () {
}
////// 绘制动画 //////
maps.prototype.drawAnimate = function (name, x, y, callback) {
maps.prototype.drawAnimate = function (name, x, y, alignWindow, callback) {
name = core.getMappedName(name);
// 正在播放录像:不显示动画
@ -2059,6 +2071,10 @@ maps.prototype.drawAnimate = function (name, x, y, callback) {
// 开始绘制
var animate = core.material.animates[name], centerX = 32 * x + 16, centerY = 32 * y + 16;
if (alignWindow) {
centerX += core.bigmap.offsetX;
centerY += core.bigmap.offsetY;
}
// 播放音效
core.playSound(animate.se);

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
/**
* ui.js负责所有和UI界面相关的绘制
* 包括
@ -101,13 +103,15 @@ ui.prototype._fillTextWithMaxWidth = function (ctx, text, x, y, maxWidth) {
}
////// 在某个canvas上绘制粗体 //////
ui.prototype.fillBoldText = function (name, text, x, y, style, font) {
ui.prototype.fillBoldText = function (name, text, x, y, style, strokeStyle, font) {
var ctx = this.getContextByName(name);
if (!ctx) return;
if (font) ctx.font = font;
if (!style) style = ctx.fillStyle;
if (style instanceof Array) style = core.arrayToRGBA(style);
ctx.fillStyle = '#000000';
if (!strokeStyle) strokeStyle = '#000000';
if (strokeStyle instanceof Array) strokeStyle = core.arrayToRGBA(strokeStyle);
ctx.fillStyle = strokeStyle;
ctx.fillText(text, x-1, y-1);
ctx.fillText(text, x-1, y+1);
ctx.fillText(text, x+1, y-1);
@ -118,7 +122,7 @@ ui.prototype.fillBoldText = function (name, text, x, y, style, font) {
ui.prototype._uievent_fillBoldText = function (data) {
this._createUIEvent();
this.fillBoldText('uievent', core.replaceText(data.text), core.calValue(data.x), core.calValue(data.y), data.style, data.font);
this.fillBoldText('uievent', core.replaceText(data.text), core.calValue(data.x), core.calValue(data.y), data.style, data.strokeStyle, data.font);
}
////// 在某个canvas上绘制一个矩形 //////
@ -356,23 +360,56 @@ ui.prototype.splitLines = function (name, text, maxWidth, font) {
if (!ctx) return [text];
if (font) core.setFont(name, font);
// 不能在行首的标点
var forbidStart = ")】》>﹞>)]»›〕〉}]」}〗』" + ",。?!:;·…,.?!:;、……~&@#";
// 不能在行尾的标点
var forbidEnd = "(【《<﹝<([«‹〔〈{[「{〖『";
var contents = [];
var last = 0;
var forceChangeLine = false; // 是否强制换行避免多个连续forbidStart存在
for (var i = 0; i < text.length; i++) {
if (text.charAt(i) == '\n') {
contents.push(text.substring(last, i));
last = i + 1;
forceChangeLine = false;
}
else if (text.charAt(i) == '\\' && text.charAt(i + 1) == 'n') {
contents.push(text.substring(last, i));
last = i + 2;
forceChangeLine = false;
}
else {
var curr = text.charAt(i);
var toAdd = text.substring(last, i + 1);
var width = core.calWidth(name, toAdd);
if (maxWidth && width > maxWidth) {
// --- 当前应当换行然而还是检查一下是否是forbidStart
if (!forceChangeLine && forbidStart.indexOf(curr) >= 0) {
forceChangeLine = true;
continue;
}
contents.push(text.substring(last, i));
last = i;
forceChangeLine = false;
} else {
// --- 当前不应该换行;但是提前检查一下是否是行尾标点
var curr = text.charAt(i);
if (forbidEnd.indexOf(curr) >= 0 && i < text.length -1) {
// 检查是否是行尾
var nextcurr = text.charAt(i+1);
// 确认不是手动换行
if (nextcurr != '\n' && !(nextcurr == '\\' && text.charAt(i+2) == 'n')) {
var toAdd = text.substring(last, i+2);
var width = core.calWidth(name, toAdd);
if (maxWidth && width > maxWidth) {
// 下一项会换行,因此在此处换行
contents.push(text.substring(last, i));
last = i;
forceChangeLine = false;
}
}
}
}
}
}
@ -411,7 +448,8 @@ ui.prototype._uievent_drawImage = function (data) {
core.calValue(data.x1), core.calValue(data.y1), core.calValue(data.w1), core.calValue(data.h1));
}
ui.prototype.drawIcon = function (name, id, x, y, w, h) {
ui.prototype.drawIcon = function (name, id, x, y, w, h, frame) {
frame = frame || 0;
var ctx = this.getContextByName(name);
if (!ctx) return;
var info = core.getBlockInfo(id);
@ -421,7 +459,7 @@ ui.prototype.drawIcon = function (name, id, x, y, w, h) {
info = {image: core.statusBar.icons[id], posX: 0, posY: 0, height: 32};
else return;
}
ctx.drawImage(info.image, 32 * info.posX, info.height * info.posY, 32, info.height, x, y, w || 32, h || info.height);
ctx.drawImage(info.image, 32 * (info.posX + frame), info.height * info.posY, 32, info.height, x, y, w || 32, h || info.height);
}
ui.prototype._uievent_drawIcon = function (data) {
@ -431,13 +469,21 @@ ui.prototype._uievent_drawIcon = function (data) {
id = core.calValue(data.id);
if (typeof id !== 'string') id = data.id;
} catch (e) { id = data.id; }
this.drawIcon('uievent', id, core.calValue(data.x), core.calValue(data.y), core.calValue(data.width), core.calValue(data.height));
this.drawIcon('uievent', id, core.calValue(data.x), core.calValue(data.y), core.calValue(data.width), core.calValue(data.height), data.frame||0);
}
///////////////// UI绘制
////// 结束一切事件和绘制关闭UI窗口返回游戏进程 //////
ui.prototype.closePanel = function () {
if (core.status.hero && core.status.hero.flags) {
// 清除全部临时变量
Object.keys(core.status.hero.flags).forEach(function (name) {
if (name.startsWith("@temp@")) {
delete core.status.hero.flags[name];
}
});
}
this.clearUI();
core.maps.generateGroundPattern();
core.updateStatusBar(true);
@ -458,14 +504,14 @@ ui.prototype.clearUI = function () {
}
////// 左上角绘制一段提示 //////
ui.prototype.drawTip = function (text, id, clear) {
this.clearTip();
ui.prototype.drawTip = function (text, id, frame) {
var one = {
text: text,
textX: 21,
width: 26 + core.calWidth('data', text, "16px Arial"),
opacity: 0.1,
stage: 1,
frame: frame || 0,
time: 0
};
if (id != null) {
@ -473,7 +519,7 @@ ui.prototype.drawTip = function (text, id, clear) {
if (info == null || !info.image) {
// 检查状态栏图标
if (core.statusBar.icons[id] instanceof Image) {
id = {image: core.statusBar.icons[id], posX: 0, posY: 0, height: 32};
info = {image: core.statusBar.icons[id], posX: 0, posY: 0, height: 32};
}
else info = null;
}
@ -486,25 +532,21 @@ ui.prototype.drawTip = function (text, id, clear) {
one.width += 24;
}
}
core.animateFrame.tips.list.push(one);
if (core.animateFrame.tips.list.length > 3) {
core.animateFrame.tips.list.shift();
}
core.animateFrame.tip = one;
}
ui.prototype._drawTip_drawOne = function (one, offset) {
core.setAlpha('data', one.opacity);
core.fillRect('data', 5, offset+ 5, one.width, 42, '#000000');
if (one.image)
core.drawImage('data', one.image, one.posX * 32, one.posY * one.height, 32, 32, 10, offset + 10, 32, 32);
core.fillText('data', one.text, one.textX, offset + 33, '#FFFFFF');
ui.prototype._drawTip_drawOne = function (tip) {
core.setAlpha('data', tip.opacity);
core.fillRect('data', 5, 5, tip.width, 42, '#000000');
if (tip.image)
core.drawImage('data', tip.image, (tip.posX + tip.frame) * 32, tip.posY * tip.height, 32, 32, 10, 10, 32, 32);
core.fillText('data', tip.text, tip.textX, 33, '#FFFFFF');
core.setAlpha('data', 1);
}
ui.prototype.clearTip = function () {
core.animateFrame.tips.list = [];
core.animateFrame.tips.offset = 0;
core.animateFrame.tips.lastSize = 0;
core.clearMap('data', 0, 0, this.PIXEL, 50);
core.animateFrame.tip = null;
}
////// 地图中间绘制一段文字 //////
@ -606,7 +648,7 @@ ui.prototype._getPosition = function (content) {
var str = s3.split(',');
px = py = null;
if (str.length == 1) {
var follower = (core.status.hero.followers||[])[parseInt(str[0])-1];
var follower = core.status.hero.followers[parseInt(str[0])-1];
if (follower) {
px = follower.x;
py = follower.y;
@ -651,6 +693,14 @@ ui.prototype._uievent_drawSelector = function (data) {
this._drawSelector(ctx, background, w, h);
}
ui.prototype._clearUIEventSelector = function (codes) {
if (codes instanceof Array) {
codes.forEach(function (code) { core.ui._clearUIEventSelector(code); });
return;
}
core.deleteCanvas('_uievent_selector_' + (codes || 0));
}
ui.prototype._drawSelector = function (ctx, background, w, h, left, top) {
left = left || 0;
top = top || 0;
@ -866,7 +916,7 @@ ui.prototype.drawTextContent = function (ctx, content, config) {
config.index = 0;
config.currcolor = config.color;
config.currfont = config.fontSize;
config.lineMargin = Math.max(0, config.lineHeight - config.fontSize);
config.lineMargin = Math.max(Math.round(config.fontSize / 4), config.lineHeight - config.fontSize);
config.topMargin = parseInt(config.lineMargin / 2);
config.lineMaxHeight = config.lineMargin + config.fontSize;
config.offsetX = 0;
@ -906,9 +956,11 @@ ui.prototype._drawTextContent_draw = function (ctx, tempCtx, content, config) {
var _drawNext = function () {
if (config.index >= config.blocks.length) return false;
var block = config.blocks[config.index++];
ctx.drawImage(tempCtx.canvas, block.left, block.top, block.width, block.height,
config.left + block.left + block.marginLeft, config.top + block.top + block.marginTop,
block.width, block.height);
if (block != null) {
ctx.drawImage(tempCtx.canvas, block.left, block.top, block.width, block.height,
config.left + block.left + block.marginLeft, config.top + block.top + block.marginTop,
block.width, block.height);
}
return true;
}
if (config.time == 0) {
@ -960,6 +1012,7 @@ ui.prototype._drawTextContent_drawChar = function (tempCtx, content, config, ch)
tempCtx.font = this._buildFont(config.currfont, config.bold, config.italic);
return true;
}
if (c == 'z') return this._drawTextContent_emptyChar(tempCtx, content, config);
}
// \\e 斜体切换
if (ch == '\\' && content.charAt(config.index)=='e') {
@ -993,6 +1046,7 @@ ui.prototype._drawTextContent_newLine = function (tempCtx, config) {
marginLeft = totalWidth - width;
config.blocks.forEach(function (b) {
if (b == null) return;
if (b.line == config.line) {
b.marginLeft = marginLeft;
// b.marginTop = 0; // 上对齐
@ -1037,6 +1091,23 @@ ui.prototype._drawTextContent_changeFont = function (tempCtx, content, config) {
return this._drawTextContent_next(tempCtx, content, config);
}
ui.prototype._drawTextContent_emptyChar = function (tempCtx, content, config) {
config.index++;
var index = config.index, index2;
if (content.charAt(index) == '[' && ((index2=content.indexOf(']', index))>=0)) {
var str = content.substring(index+1, index2);
if (/^\d+$/.test(str)) {
var value = parseInt(str);
for (var i = 0; i < value; ++i) {
config.blocks.push(null); // Empty char
}
} else config.blocks.push(null);
config.index = index2 + 1;
}
else config.blocks.push(null);
return this._drawTextContent_next(tempCtx, content, config);
}
ui.prototype._drawTextContent_drawIcon = function (tempCtx, content, config) {
// 绘制一个 \i 效果
var index = config.index, index2;
@ -1071,7 +1142,7 @@ ui.prototype.getTextContentHeight = function (content, config) {
}
ui.prototype._getRealContent = function (content) {
return content.replace(/(\r|\\(r|c|d|e))(\[.*?])?/g, "").replace(/(\\i)(\[.*?])?/g, "占1");
return content.replace(/(\r|\\(r|c|d|e|z))(\[.*?])?/g, "").replace(/(\\i)(\[.*?])?/g, "占1");
}
////// 绘制一个对话框 //////
@ -1165,7 +1236,7 @@ ui.prototype._drawTextBox_getHorizontalPosition = function (content, titleInfo,
ui.prototype._drawTextBox_getVerticalPosition = function (content, titleInfo, posInfo, validWidth) {
var textAttribute = core.status.textAttribute || core.initStatus.textAttribute;
var lineHeight = textAttribute.textfont + 6;
var lineHeight = textAttribute.lineHeight || (textAttribute.textfont + 6);
var height = 45 + this.getTextContentHeight(content, {
lineHeight: lineHeight, maxWidth: validWidth
});
@ -1416,7 +1487,7 @@ ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, v
core.fillText('ui', choices[i].text, offset, vPos.choice_top + 32 * i, color);
}
if (choices.length>0) {
if (choices.length>0 && core.status.event.selection != 'none') {
core.status.event.selection = core.status.event.selection || 0;
while (core.status.event.selection < 0) core.status.event.selection += choices.length;
while (core.status.event.selection >= choices.length) core.status.event.selection -= choices.length;
@ -1442,7 +1513,7 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
core.status.event.data = {'yes': yesCallback, 'no': noCallback};
}
if (core.status.event.selection != 0) core.status.event.selection = 1;
if (core.status.event.selection != 0 && core.status.event.selection != 'none') core.status.event.selection = 1;
this.clearUI();
core.setFont('ui', this._buildFont(19, true));
@ -1458,14 +1529,15 @@ ui.prototype.drawConfirmBox = function (text, yesCallback, noCallback) {
core.fillText('ui', "确定", this.HPIXEL - 38, rect.bottom - 35, null, this._buildFont(17, true));
core.fillText('ui', "取消", this.HPIXEL + 38, rect.bottom - 35);
var len=core.calWidth('ui', "确定");
var strokeLeft = this.HPIXEL + (76*core.status.event.selection-38) - parseInt(len/2) - 5;
if (isWindowSkin)
this.drawWindowSelector(core.status.textAttribute.background, strokeLeft, rect.bottom-35-20, len+10, 28);
else
core.strokeRect('ui', strokeLeft, rect.bottom-35-20, len+10, 28, "#FFD700", 2);
if (core.status.event.selection != 'none') {
var len=core.calWidth('ui', "确定");
var strokeLeft = this.HPIXEL + (76*core.status.event.selection-38) - parseInt(len/2) - 5;
if (isWindowSkin)
this.drawWindowSelector(core.status.textAttribute.background, strokeLeft, rect.bottom-35-20, len+10, 28);
else
core.strokeRect('ui', strokeLeft, rect.bottom-35-20, len+10, 28, "#FFD700", 2);
}
}
ui.prototype._drawConfirmBox_getRect = function (contents) {
@ -1501,10 +1573,11 @@ ui.prototype.drawSwitchs = function() {
" < 音量:" + Math.round(Math.sqrt(100 * core.musicStatus.userVolume)) + " > ",
//数值越大耗时越长
" < 步时:" + core.values.moveSpeed + " > ",
" < 转场:" + core.values.floorChangeTime + " > ",
"怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
"新版存档: "+(core.platform.useLocalForage ? "[ON]":"[OFF]"),
"血瓶绕路: "+(core.hasFlag('__potionNoRouting__') ? "[ON]":"[OFF]"),
"单击瞬移: "+(!core.hasFlag("__noClickMove__") ? "[ON]":"[OFF]"),
"返回主菜单"
];
@ -1515,18 +1588,16 @@ ui.prototype.drawSwitchs = function() {
ui.prototype.drawSettings = function () {
core.status.event.id = 'settings';
this.drawChoices(null, [
"系统设置", "虚拟键盘", "浏览地图", "绘图模式", "同步存档", "游戏信息", "返回标题", "返回游戏"
"系统设置", "虚拟键盘", "浏览地图", "同步存档", "游戏信息", "返回标题", "返回游戏"
]);
}
////// 绘制快捷商店选择栏 //////
ui.prototype.drawQuickShop = function () {
core.status.event.id = 'selectShop';
var shopList = core.status.shops, keys = Object.keys(shopList).filter(function (shopId) {
return shopList[shopId].visited || !shopList[shopId].mustEnable
});
var shopList = core.status.shops, keys = core.listShopIds();
var choices = keys.map(function (shopId) {
return {"text": shopList[shopId].textInList, "color": shopList[shopId].visited?null:"#999999"};
return {"text": shopList[shopId].textInList, "color": core.isShopVisited(shopId) ? null : "#999999"};
});
choices.push("返回游戏");
this.drawChoices(null, choices);
@ -1738,9 +1809,9 @@ ui.prototype._drawBook_drawRow2 = function (index, enemy, top, left, width, posi
var col1 = left, col2 = left + width * 9 / 25, col3 = left + width * 17 / 25;
// 获得第二行绘制的内容
var second_line = [];
if (core.flags.enableMoney) second_line.push(["金币", core.formatBigNumber(enemy.money || 0)]);
if (core.flags.statusBarItems.indexOf('enableMoney')>=0) second_line.push(["金币", core.formatBigNumber(enemy.money || 0)]);
if (core.flags.enableAddPoint) second_line.push(["加点", core.formatBigNumber(enemy.point || 0)]);
if (core.flags.enableExperience) second_line.push(["经验", core.formatBigNumber(enemy.experience || 0)]);
if (core.flags.statusBarItems.indexOf('enableExp')>=0) second_line.push(["经验", core.formatBigNumber(enemy.exp || 0)]);
var damage_offset = col1 + (this.PIXEL - col1) / 2 - 12;
// 第一列
@ -2004,37 +2075,10 @@ ui.prototype.drawCenterFly = function () {
offsetY = core.clamp(toY - core.__HALF_SIZE__, 0, core.bigmap.height - core.__SIZE__);
core.fillRect('ui', (toX - offsetX) * 32, (toY - offsetY) * 32, 32, 32, fillstyle);
core.status.event.data = {"x": toX, "y": toY, "posX": toX - offsetX, "posY": toY - offsetY};
core.drawTip("请确认当前中心对称飞行器的位置");
core.drawTip("请确认当前"+core.material.items['centerFly'].name+"的位置");
return;
}
////// 绘制全局商店
ui.prototype.drawShop = function (shopId) {
var shop = core.status.shops[shopId];
var actions = [], fromList = (core.status.event.data||{}).fromList, selection = core.status.event.selection;
if (core.status.event.data && core.status.event.data.actions) actions=core.status.event.data.actions;
core.ui.closePanel();
core.lockControl();
core.status.event.id = 'shop';
core.status.event.data = {'id': shopId, 'shop': shop, 'actions': actions, 'fromList': fromList};
core.status.event.selection = selection;
var times = shop.times, need=core.calValue(shop.need, null, null, times);
var content = "\t["+shop.name+","+shop.icon+"]" + core.replaceText(shop.text, need, times);
var use = shop.use=='experience'?'经验':'金币';
var choices = [];
for (var i=0;i<shop.choices.length;i++) {
var choice = shop.choices[i];
var text = core.replaceText(choice.text, need, times);
if (choice.need != null)
text += ""+core.calValue(choice.need, null, null, times)+use+"";
choices.push({"text": text, "color":shop.visited?null:"#999999"});
}
choices.push("离开");
core.ui.drawChoices(content, choices);
}
////// 绘制浏览地图界面 //////
ui.prototype.drawMaps = function (index, x, y) {
core.lockControl();
@ -2046,15 +2090,6 @@ ui.prototype.drawMaps = function (index, x, y) {
var data = this._drawMaps_buildData(index, x, y);
core.drawThumbnail(data.floorId, null, {damage: data.damage},
{ctx: 'ui', centerX: data.x, centerY: data.y, all: data.all});
// 绘图
if (data.paint) {
var offsetX = 32 * (data.x - this.HSIZE), offsetY = 32 * (data.y - this.HSIZE);
var value = core.paint[data.floorId];
if (value) value = lzw_decode(value).split(",");
core.utils._decodeCanvas(value, 32 * data.mw, 32 * data.mh);
core.drawImage('ui', core.bigmap.tempCanvas.canvas, offsetX * 32, offsetY * 32,
this.PIXEL, this.PIXEL, 0, 0, this.PIXEL, this.PIXEL);
}
core.clearMap('data');
core.setTextAlign('data', 'left');
core.setFont('data', '16px Arial');
@ -2081,14 +2116,13 @@ ui.prototype._drawMaps_drawHint = function () {
stroke(per, this.SIZE - per - 3, 9, 3); // next
stroke(0, 0, per-1, per-1); // left top
stroke(this.SIZE-(per - 1), 0, per-1, per-1); // right top
stroke(0, this.SIZE-(per-1), per-1, per-1); // left bottom
// stroke(0, this.SIZE-(per-1), per-1, per-1); // left bottom
core.setTextBaseline('ui', 'middle');
core.fillText('ui', "上移地图 [W]", this.HPIXEL, per * 16, '#FFD700', '20px Arial');
core.fillText('ui', "下移地图 [S]", this.HPIXEL, this.PIXEL - per * 16);
core.fillText('ui', 'V', (per-1)*16, (per-1)*16);
core.fillText('ui', 'Z', this.PIXEL - (per-1)*16, (per-1)*16);
core.fillText('ui', 'M', (per-1)*16, this.PIXEL - (per-1)*16);
var top = this.HPIXEL - 66, left = per * 16, right = this.PIXEL - left;
var lt = ["左", "移", "地", "图", "[A]"], rt = ["右", "移", "地", "图", "[D]"];
@ -2100,17 +2134,15 @@ ui.prototype._drawMaps_drawHint = function () {
core.fillText('ui', "后张地图 [▼ / PGDN]", this.HPIXEL, this.PIXEL - (32 * per + 48));
core.fillText('ui', "退出 [ESC / ENTER]", this.HPIXEL, this.HPIXEL);
core.fillText('ui', "[X] 可查看怪物手册", this.HPIXEL + 77, this.HPIXEL + 32, null, '13px Arial');
core.fillText('ui', "[X] 可查看" + core.material.items['book'].name, this.HPIXEL + 77, this.HPIXEL + 32, null, '13px Arial');
core.setTextBaseline('ui', 'alphabetic');
}
ui.prototype._drawMaps_buildData = function (index, x, y) {
var damage = (core.status.event.data||{}).damage;
var paint = (core.status.event.data||{}).paint;
var all = (core.status.event.data||{all: true}).all;
if (index.damage != null) damage=index.damage;
if (index.paint != null) paint=index.paint;
if (index.all != null) all=index.all;
if (index.index != null) { x=index.x; y=index.y; index=index.index; }
index = core.clamp(index, 0, core.floorIds.length-1);
@ -2123,7 +2155,7 @@ ui.prototype._drawMaps_buildData = function (index, x, y) {
y = core.clamp(y, this.HSIZE, mh - this.HSIZE - 1);
core.status.event.data = {index: index, x: x, y: y, floorId: floorId, mw: mw, mh: mh,
damage: damage, paint: paint, all: all };
damage: damage, all: all };
return core.status.event.data;
}
@ -2160,8 +2192,10 @@ ui.prototype._drawToolbox_getInfo = function (index) {
if (!core.status.event.data || core.status.event.data.toolsPage == null)
core.status.event.data = {"toolsPage":1, "constantsPage":1, "selectId":null}
// 获取物品列表
var tools = Object.keys(core.status.hero.items.tools).sort();
var constants = Object.keys(core.status.hero.items.constants).sort();
var tools = Object.keys(core.status.hero.items.tools)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
var constants = Object.keys(core.status.hero.items.constants)
.filter(function (id) { return !core.material.items[id].hideInToolbox; }).sort();
// 处理页数
var toolsPage = core.status.event.data.toolsPage;
var constantsPage = core.status.event.data.constantsPage;
@ -2377,15 +2411,8 @@ ui.prototype._drawEquipbox_drawStatusChanged = function (info, y, equip, equipTy
// --- 变化值...
core.setFont('ui', this._buildFont(14, true));
for (var name in compare) {
var img = core.statusBar.icons[name];
var text = core.getStatusName(name);
if (img && core.flags.iconInEquipbox) { // 绘制图标
core.drawImage('ui', img, 0, 0, 32, 32, obj.drawOffset, obj.y - 13, 16, 16);
obj.drawOffset += 20;
}
else { // 绘制文字
this._drawEquipbox_drawStatusChanged_draw(text + " ", '#CCCCCC', obj);
}
var text = this._drawEquipbox_getStatusName(name);
this._drawEquipbox_drawStatusChanged_draw(text + " ", '#CCCCCC', obj);
var nowValue = core.getStatus(name) * core.getBuff(name), newValue = (core.getStatus(name) + compare[name]) * core.getBuff(name);
if (equip.equip.percentage) {
var nowBuff = core.getBuff(name), newBuff = nowBuff + compare[name] / 100;
@ -2400,6 +2427,14 @@ ui.prototype._drawEquipbox_drawStatusChanged = function (info, y, equip, equipTy
}
}
ui.prototype._drawEquipbox_getStatusName = function (name) {
var map = {
name: "名称", lv: "等级", hpmax: "生命上限", hp: "生命", manamax: "魔力上限", mana: "魔力",
atk: "攻击", def: "防御", mdef: "护盾", money: "金币", exp: "经验", exp: "经验", steps: "步数"
};
return map[name] || name;
}
ui.prototype._drawEquipbox_drawStatusChanged_draw = function (text, color, obj) {
var len = core.calWidth('ui', text);
if (obj.drawOffset + len >= core.__PIXELS__) { // 换行
@ -2531,7 +2566,7 @@ ui.prototype._drawSLPanel_drawRecord = function(title, data, x, y, size, cho, hi
var v2 = "/"+core.formatBigNumber(data.hero.mdef,true);
if (core.calWidth('ui', v + v2, this._buildFont(10, false)) <= size) v += v2;
core.fillText('ui', v, x, y+30+size, '#FFD700');
core.fillText('ui', core.formatDate(new Date(data.time)), x, y+43+size, data.hero.flags.__consoleOpened__||data.hero.flags.debug?'#FF6A6A':'#FFFFFF');
core.fillText('ui', core.formatDate(new Date(data.time)), x, y+43+size, data.hero.flags.debug?'#FF6A6A':'#FFFFFF');
}
else {
core.fillRect('ui', x-size/2, y+15, size, size, '#333333', 2);
@ -2632,10 +2667,10 @@ ui.prototype.drawStatistics = function (floorIds) {
+",总游戏时长"+core.formatTime(statistics.totalTime)
+"。\n瞬间移动次数"+statistics.moveDirectly+",共计少走"+statistics.ignoreSteps+"步。"
+"\n\n总计通过血瓶恢复生命值为"+core.formatBigNumber(statistics.hp)+"点。\n\n"
+"总计打死了"+statistics.battle+"个怪物,得到了"+core.formatBigNumber(statistics.money)+"金币,"+core.formatBigNumber(statistics.experience)+"点经验。\n\n"
+"总计打死了"+statistics.battle+"个怪物,得到了"+core.formatBigNumber(statistics.money)+"金币,"+core.formatBigNumber(statistics.exp)+"点经验。\n\n"
+"受到的总伤害为"+core.formatBigNumber(statistics.battleDamage+statistics.poisonDamage+statistics.extraDamage)
+",其中战斗伤害"+core.formatBigNumber(statistics.battleDamage)+"点"
+(core.flags.enableDebuff?(",中毒伤害"+core.formatBigNumber(statistics.poisonDamage)+"点"):"")
+(core.flags.statusBarItems.indexOf('enableDebuff')>=0?(",中毒伤害"+core.formatBigNumber(statistics.poisonDamage)+"点"):"")
+",领域/夹击/阻击/血网伤害"+core.formatBigNumber(statistics.extraDamage)+"点。",
"\t[说明]1. 地图数据统计的效果仅模拟当前立刻获得该道具的效果。\n2. 不会计算“不可被浏览地图”的隐藏层的数据。\n" +
"3. 不会计算任何通过事件得到的道具(显示事件、改变图块、或直接增加道具等)。\n"+
@ -2663,7 +2698,7 @@ ui.prototype._drawStatistics_buildObj = function () {
else cls[e] = core.material.items[e].cls;
cnt[e] = 0;
})
var order = ["doors", "keys", "items", "tools", "constants", "equips"];
var order = ["doors", "items", "tools", "constants", "equips"];
ids.sort(function (a, b) {
var c1 = order.indexOf(cls[a]), c2 = order.indexOf(cls[b]);
if (c1==c2) return ori.indexOf(a)-ori.indexOf(b);
@ -2671,7 +2706,7 @@ ui.prototype._drawStatistics_buildObj = function () {
});
var obj = {
'monster': {
'count': 0, 'money': 0, 'experience': 0, 'point': 0,
'count': 0, 'money': 0, 'exp': 0, 'point': 0,
},
'count': cnt,
'add': {
@ -2708,7 +2743,7 @@ ui.prototype._drawStatistics_floorId = function (floorId, obj) {
ui.prototype._drawStatistics_enemy = function (floorId, id, obj) {
var enemy = core.material.enemys[id];
this._drawStatistics_add(floorId, obj, 'monster', 'money', enemy.money);
this._drawStatistics_add(floorId, obj, 'monster', 'experience', enemy.experience);
this._drawStatistics_add(floorId, obj, 'monster', 'exp', enemy.exp);
this._drawStatistics_add(floorId, obj, 'monster', 'point', enemy.point);
this._drawStatistics_add(floorId, obj, 'monster', 'count', 1);
}
@ -2737,7 +2772,7 @@ ui.prototype._drawStatistics_items = function (floorId, floor, id, obj) {
var t = "";
if (atk > 0) t += atk + "攻";
if (def > 0) t += def + "防";
if (mdef > 0) t += mdef + "魔防";
if (mdef > 0) t += mdef + "护盾";
if (t != "") obj.ext[id] = t;
}
this._drawStatistics_add(floorId, obj, 'count', id, 1);
@ -2750,8 +2785,8 @@ ui.prototype._drawStatistics_items = function (floorId, floor, id, obj) {
ui.prototype._drawStatistics_generateText = function (obj, type, data) {
var text = type+"地图中:\n";
text += "共有怪物"+data.monster.count+"个";
if (core.flags.enableMoney) text+=",总金币数"+data.monster.money;
if (core.flags.enableExperience) text+=",总经验数"+data.monster.experience;
if (core.flags.statusBarItems.indexOf('enableMoney')>=0) text+=",总金币数"+data.monster.money;
if (core.flags.statusBarItems.indexOf('enableExp')>=0) text+=",总经验数"+data.monster.exp;
if (core.flags.enableAddPoint) text+=",总加点数"+data.monster.point;
text+="。\n";
@ -2765,71 +2800,26 @@ ui.prototype._drawStatistics_generateText = function (obj, type, data) {
}
else text += "";
prev = obj.cls[key];
text+=core.ui._drawStatistics_getName(key)+value+"个";
var name = ((core.material.items[key] || (core.getBlockById(key) || {}).event)||{}).name || key;
text+=name+value+"个";
if (obj.ext[key])
text+="("+obj.ext[key]+")";
})
if (prev!="") text+="。";
text+="\n\n";
text+="\n";
text+="共加生命值"+core.formatBigNumber(data.add.hp)+"点,攻击"
+core.formatBigNumber(data.add.atk)+"点,防御"
+core.formatBigNumber(data.add.def)+"点,魔防"
+core.formatBigNumber(data.add.def)+"点,护盾"
+core.formatBigNumber(data.add.mdef)+"点。";
return text;
}
ui.prototype._drawStatistics_getName = function (key) {
return {"yellowDoor": "黄门", "blueDoor": "蓝门", "redDoor": "红门", "greenDoor": "绿门",
"steelDoor": "铁门"}[key] || core.material.items[key].name;
}
////// 绘制“关于”界面 //////
ui.prototype.drawAbout = function () {
return this.uidata.drawAbout();
}
////// 绘制“画图”界面 //////
ui.prototype.drawPaint = function () {
core.drawText(
"\t[进入绘图模式]你可以在此页面上任意进行绘图和标记操作。\nM键可以进入或退出此模式。\n\n"+
"绘图的内容会自动保存,且以页面为生命周期,和存读档无关,重新开始游戏或读档后绘制的内容仍有效,但刷新页面就会消失。\n"+
"你可以将绘制内容保存到文件,也可以从文件读取保存的绘制内容。\n"+
"浏览地图页面可以按楼传按钮或M键来开启/关闭该层的绘图显示。\n\n更多功能请详见文档-元件-绘图模式。",
this._drawPaint_draw
);
}
ui.prototype._drawPaint_draw = function () {
core.drawTip("打开绘图模式,现在可以任意在界面上绘图标记");
core.lockControl();
core.status.event.id = 'paint';
core.status.event.data = {"x": null, "y": null, "erase": false};
core.clearUI();
core.createCanvas('paint', -core.bigmap.offsetX, -core.bigmap.offsetY, 32*core.bigmap.width, 32*core.bigmap.height, 95);
// 将已有的内容绘制到route上
var value = core.paint[core.status.floorId];
if (value) value = lzw_decode(value).split(",");
core.utils._decodeCanvas(value, 32*core.bigmap.width, 32*core.bigmap.height);
core.drawImage('paint', core.bigmap.tempCanvas.canvas, 0, 0);
core.setLineWidth('paint', 3);
core.setStrokeStyle('paint', '#FF0000');
core.statusBar.image.keyboard.style.opacity = 0;
core.statusBar.image.shop.style.opacity = 0;
core.statusBar.image.book.src = core.statusBar.icons.paint.src;
core.statusBar.image.fly.src = core.statusBar.icons.erase.src;
core.statusBar.image.toolbox.src = core.statusBar.icons.empty.src;
core.statusBar.image.settings.src = core.statusBar.icons.exit.src;
core.statusBar.image.book.style.opacity = 1;
core.statusBar.image.fly.style.opacity = 1;
}
////// 绘制帮助页面 //////
ui.prototype.drawHelp = function () {
core.clearUI();
@ -2844,13 +2834,13 @@ ui.prototype.drawHelp = function () {
core.drawText([
"\t[键盘快捷键列表]"+
"[CTRL] 跳过对话 [Z] 转向\n" +
"[X] 怪物手册 [G] 楼层传送\n" +
"[A] 读取自动存档 [S/D] 存读档页面\n" +
"[X] "+core.material.items['book'].name + " [G] "+core.material.items['fly'].name+"\n" +
"[A] 读取自动存档 [W] 撤销读取自动存档\n" +
"[S/D] 存读档页面 [SPACE] 轻按\n" +
"[V] 快捷商店 [ESC] 系统菜单\n" +
"[T] 道具页面 [Q] 装备页面\n" +
"[B] 数据统计 [H] 帮助页面\n" +
"[R] 回放录像 [E] 显示光标\n" +
"[SPACE] 轻按 [M] 绘图模式\n" +
"[N] 返回标题页面 [P] 游戏主页\n" +
"[O] 查看工程 [F7] 打开debug穿墙模式\n" +
"[PgUp/PgDn] 浏览地图\n"+

View File

@ -1,3 +1,5 @@
/// <reference path="../runtime.d.ts" />
/*
utils.js 工具类
@ -60,9 +62,10 @@ utils.prototype._init = function () {
}
////// 将文字中的${和}(表达式)进行替换 //////
utils.prototype.replaceText = function (text, need, times) {
utils.prototype.replaceText = function (text, prefix) {
if (typeof text != 'string') return text;
return text.replace(/\${(.*?)}/g, function (word, value) {
return core.calValue(value, null, need, times);
return core.calValue(value, prefix);
});
}
@ -79,19 +82,21 @@ utils.prototype.replaceValue = function (value) {
if (value.indexOf('global:') >= 0)
value = value.replace(/global:([a-zA-Z0-9_\u4E00-\u9FCC]+)/g, "core.getGlobal('$1', 0)");
if (value.indexOf('enemy:')>=0)
value = value.replace(/enemy:([a-zA-Z0-9_]+)\.([a-zA-Z0-9_]+)/g, "core.material.enemys['$1'].$2");
value = value.replace(/enemy:([a-zA-Z0-9_]+)[\.:]([a-zA-Z0-9_]+)/g, "core.material.enemys['$1'].$2");
if (value.indexOf('blockId:')>=0)
value = value.replace(/blockId:(\d+),(\d+)/g, "core.getBlockId($1, $2)");
if (value.indexOf('blockCls:')>=0)
value = value.replace(/blockCls:(\d+),(\d+)/g, "core.getBlockCls($1, $2)");
if (value.indexOf('equip:')>=0)
value = value.replace(/equip:(\d)/g, "core.getEquip($1)");
if (value.indexOf('temp:')>=0)
value = value.replace(/temp:([a-zA-Z0-9_]+)/g, "core.getFlag('@temp@$1', 0)");
}
return value;
}
////// 计算表达式的值 //////
utils.prototype.calValue = function (value, prefix, need, times) {
utils.prototype.calValue = function (value, prefix) {
if (!core.isset(value)) return null;
if (typeof value === 'string') {
if (value.indexOf(':') >= 0) {
@ -591,7 +596,7 @@ utils.prototype._decodeRoute_decodeOne = function (decodeObj, c) {
decodeObj.ans.push("choices:" + nxt);
break;
case "S":
decodeObj.ans.push("shop:" + nxt + ":" + this._decodeRoute_getNumber(decodeObj, true));
decodeObj.ans.push("shop:" + nxt);
break;
case "T":
decodeObj.ans.push("turn");
@ -692,9 +697,23 @@ utils.prototype.reverseDirection = function (direction) {
}
utils.prototype.matchWildcard = function (pattern, string) {
return new RegExp('^' + pattern.split(/\*+/).map(function (s) {
return s.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
}).join('.*') + '$').test(string);
try {
return new RegExp('^' + pattern.split(/\*+/).map(function (s) {
return s.replace(/[|\\{}()[\]^$+*?.]/g, '\\$&');
}).join('.*') + '$').test(string);
} catch (e) {
return false;
}
}
utils.prototype.matchRegex = function (pattern, string) {
try {
if (pattern.startsWith("^")) pattern = pattern.substring(1);
if (pattern.endsWith("$")) pattern = pattern.substring(0, pattern.length - 1);
return new RegExp("^" + pattern + "$").test(string);
} catch (e) {
return false;
}
}
////// Base64加密 //////
@ -711,26 +730,6 @@ utils.prototype.decodeBase64 = function (str) {
}).join(''));
}
////// 任意进制转换 //////
utils.prototype.convertBase = function (str, fromBase, toBase) {
var map = "0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ~`!@#$%^&*()_-+={}[]\\|:;<>,.?/";
if (fromBase == toBase) return str;
var len = str.length, ans = "";
var t = [];
for (var i = 0; i < len; i++) t[i] = map.indexOf(str.charAt(i));
t[len] = 0;
while (len > 0) {
for (var i = len; i >= 1; i--) {
t[i - 1] += t[i] % toBase * fromBase;
t[i] = parseInt(t[i] / toBase);
}
ans += map.charAt(t[0] % toBase);
t[0] = parseInt(t[0] / toBase);
while (len > 0 && t[len - 1] == 0) len--;
}
return ans;
}
utils.prototype.rand = function (num) {
var rand = core.getFlag('__rand__');
rand = this.__next_rand(rand);
@ -1073,17 +1072,6 @@ utils.prototype._decodeCanvas = function (arr, width, height) {
tempCanvas.putImageData(imgData, 0, 0);
}
utils.prototype.consoleOpened = function () {
if (!core.flags.checkConsole) return false;
if (window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized)
return true;
if (!core.platform.isPC) return false;
var threshold = 160;
var zoom = Math.min(window.outerWidth / window.innerWidth, window.outerHeight / window.innerHeight);
return window.outerWidth - zoom * window.innerWidth > threshold
|| window.outerHeight - zoom * window.innerHeight > threshold;
}
utils.prototype.hashCode = function (obj) {
if (typeof obj == 'string') {
var hash = 0, i, chr;

64
main.js
View File

@ -61,7 +61,7 @@ function main() {
'defCol': document.getElementById('defCol'),
'mdefCol': document.getElementById('mdefCol'),
'moneyCol': document.getElementById('moneyCol'),
'experienceCol': document.getElementById('experienceCol'),
'expCol': document.getElementById('expCol'),
'upCol': document.getElementById('upCol'),
'keyCol': document.getElementById('keyCol'),
'pzfCol': document.getElementById('pzfCol'),
@ -100,7 +100,7 @@ function main() {
'def': document.getElementById("img-def"),
'mdef': document.getElementById("img-mdef"),
'money': document.getElementById("img-money"),
'experience': document.getElementById("img-experience"),
'exp': document.getElementById("img-exp"),
'up': document.getElementById("img-up"),
'skill': document.getElementById('img-skill'),
'book': document.getElementById("img-book"),
@ -130,7 +130,7 @@ function main() {
'def': 5,
'mdef': 6,
'money': 7,
'experience': 8,
'exp': 8,
'up': 9,
'book': 10,
'fly': 11,
@ -149,18 +149,14 @@ function main() {
'equipbox': 24,
'mana': 25,
'skill': 26,
'paint': 27,
'erase': 28,
'empty': 29,
'exit': 30,
'btn1': 31,
'btn2': 32,
'btn3': 33,
'btn4': 34,
'btn5': 35,
'btn6': 36,
'btn7': 37,
'btn8': 38
'btn1': 27,
'btn2': 28,
'btn3': 29,
'btn4': 30,
'btn5': 31,
'btn6': 32,
'btn7': 33,
'btn8': 34
},
'floor': document.getElementById('floor'),
'name': document.getElementById('name'),
@ -172,12 +168,13 @@ function main() {
'def': document.getElementById("def"),
'mdef': document.getElementById('mdef'),
'money': document.getElementById("money"),
'experience': document.getElementById("experience"),
'exp': document.getElementById("exp"),
'up': document.getElementById('up'),
'skill': document.getElementById('skill'),
'yellowKey': document.getElementById("yellowKey"),
'blueKey': document.getElementById("blueKey"),
'redKey': document.getElementById("redKey"),
'greenKey': document.getElementById("greenKey"),
'poison': document.getElementById('poison'),
'weak':document.getElementById('weak'),
'curse': document.getElementById('curse'),
@ -536,11 +533,6 @@ main.statusBar.image.book.onclick = function (e) {
return;
}
if (main.core.isPlaying() && (core.status.event||{}).id=='paint') {
core.actions.setPaintMode('paint');
return;
}
if (main.core.isPlaying())
main.core.openBook(true);
}
@ -555,12 +547,6 @@ main.statusBar.image.fly.onclick = function (e) {
return;
}
// 绘图模式
if (main.core.isPlaying() && (core.status.event||{}).id=='paint') {
core.actions.setPaintMode('erase');
return;
}
if (main.core.isPlaying()) {
if (!main.core.flags.equipboxButton) {
main.core.useFly(true);
@ -580,11 +566,6 @@ main.statusBar.image.toolbox.onclick = function (e) {
return;
}
if (main.core.isPlaying() && (core.status.event||{}).id=='paint') {
core.actions.clearPaint();
return;
}
if (main.core.isPlaying()) {
main.core.openToolbox(core.status.event.id != 'equipbox');
}
@ -616,7 +597,7 @@ main.statusBar.image.keyboard.onclick = function (e) {
main.core.openKeyBoard(true);
}
////// 点击状态栏中的快捷商店键盘时 //////
////// 点击状态栏中的快捷商店时 //////
main.statusBar.image.shop.onclick = function (e) {
e.stopPropagation();
@ -629,7 +610,7 @@ main.statusBar.image.shop.onclick = function (e) {
main.core.openQuickShop(true);
}
////// 点击金币时也可以开启虚拟键盘 //////
////// 点击金币时也可以开启快捷商店 //////
main.statusBar.image.money.onclick = function (e) {
e.stopPropagation();
@ -646,11 +627,6 @@ main.statusBar.image.save.onclick = function (e) {
return;
}
if (main.core.isPlaying() && (core.status.event||{}).id=='paint') {
core.actions.savePaint();
return;
}
if (main.core.isPlaying())
main.core.save(true);
}
@ -664,11 +640,6 @@ main.statusBar.image.load.onclick = function (e) {
return;
}
if (main.core.isPlaying() && (core.status.event||{}).id=='paint') {
core.actions.loadPaint();
return;
}
if (main.core.isPlaying())
main.core.load(true);
}
@ -682,11 +653,6 @@ main.statusBar.image.settings.onclick = function (e) {
return;
}
if (main.core.isPlaying() && (core.status.event||{}).id=='paint') {
core.actions.exitPaint();
return;
}
if (main.core.isPlaying())
main.core.openSettings(true);
}

View File

@ -91,14 +91,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"def": 100,
"mdef": 0,
"money": 0,
"experience": 0,
"exp": 0,
"equipment": [],
"items": {
"keys": {
"yellowKey": 0,
"blueKey": 0,
"redKey": 0
},
"constants": {},
"tools": {},
"equips": {}
@ -109,6 +104,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"y": 10
},
"flags": {},
"followers": [],
"steps": 0
},
"startCanvas": [
@ -128,8 +124,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
0,
0
],
"dw": 100,
"dh": 100,
"opacity": 1,
"time": 0
},
@ -165,11 +159,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"true": [
{
"type": "comment",
"text": "直接开始游戏,设置初始化数据"
},
{
"type": "function",
"function": "function(){\ncore.events.setInitData('')\n}"
"text": "直接开始游戏"
}
],
"false": [
@ -179,7 +169,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
},
{
"type": "function",
"function": "function(){\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\"text\": one[0], \"action\": [\n\t\t{\"type\": \"function\", \"function\": \"function() { core.status.hard = '\"+one[1]+\"'; core.events.setInitData('\"+one[1]+\"'); }\"}\n\t]});\n})\ncore.insertAction({\"type\": \"choices\", \"choices\": choices});\n}"
"function": "function(){\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\n\t\t\"text\": one[0],\n\t\t\"action\": [\n\t\t\t{ \"type\": \"function\", \"function\": \"function() { core.status.hard = '\" + one[1] + \"'; }\" }\n\t\t]\n\t});\n})\ncore.insertAction({ \"type\": \"choices\", \"choices\": choices });\n}"
}
]
},
@ -232,8 +222,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"type": "function",
"function": "function(){\ncore.chooseReplayFile()\n}"
}
],
"false": []
]
}
]
}
@ -247,43 +236,163 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
}
],
"startText": [
"Hi欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔",
"这里游戏开始时的剧情。\n定义在data.js的startText处。\n\n你可以在这里写上自己的内容。",
"赶快来试一试吧!"
],
"shops": [
{
"id": "moneyShop1",
"name": "贪婪之神",
"icon": "blueShop",
"textInList": "1F金币商店",
"commonTimes": false,
"mustEnable": false,
"use": "money",
"need": "20+10*times*(times+1)",
"text": "勇敢的武士啊,给我${need}金币就可以:",
"choices": [
"type": "comment",
"text": "根据难度分歧设置<flag:hard>并给其他初始值"
},
{
"type": "switch",
"condition": "core.status.hard",
"caseList": [
{
"text": "生命+800",
"effect": "status:hp+=800"
"case": "'Easy'",
"action": [
{
"type": "setValue",
"name": "flag:hard",
"value": "1"
},
{
"type": "comment",
"text": "可以在这里修改初始道具或属性,比如赠送黄钥匙等"
}
]
},
{
"case": "'Normal'",
"action": [
{
"type": "setValue",
"name": "flag:hard",
"value": "2"
}
]
},
{
"case": "'Hard'",
"action": [
{
"type": "setValue",
"name": "flag:hard",
"value": "3"
}
]
},
{
"case": "'Hell'",
"action": [
{
"type": "setValue",
"name": "flag:hard",
"value": "4"
}
]
}
]
},
{
"id": "expShop1",
"name": "经验之神",
"icon": "pinkShop",
"textInList": "1F经验商店",
"commonTimes": false,
"type": "comment",
"text": "初始剧情"
},
"Hi欢迎来到 HTML5 魔塔样板!\n\n本样板由艾之葵制作可以让你在不会写任何代码\n的情况下也能做出属于自己的H5魔塔",
"这里游戏开始时的剧情。\n\n你可以在这里写上自己的内容。\n赶快来试一试吧"
],
"shops": [
{
"id": "shop1",
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
"textInList": "1F金币商店",
"mustEnable": false,
"use": "experience",
"need": "-1",
"text": "勇敢的武士啊,给我若干经验就可以:",
"disablePreview": false,
"choices": [
{
"text": "等级+1",
"need": "100",
"effect": "status:hp+=1000"
"text": "生命+800",
"need": "status:money>=20+2*flag:shop1",
"action": [
{
"type": "comment",
"text": "新版商店中需要手动扣减金币和增加访问次数"
},
{
"type": "setValue",
"name": "status:money",
"operator": "-=",
"value": "20+2*flag:shop1"
},
{
"type": "setValue",
"name": "flag:shop1",
"operator": "+=",
"value": "1"
},
{
"type": "setValue",
"name": "status:hp",
"operator": "+=",
"value": "800"
}
]
},
{
"text": "攻击+4",
"need": "status:money>=20+2*flag:shop1",
"action": [
{
"type": "comment",
"text": "新版商店中需要手动扣减金币和增加访问次数"
},
{
"type": "setValue",
"name": "status:money",
"operator": "-=",
"value": "20+2*flag:shop1"
},
{
"type": "setValue",
"name": "flag:shop1",
"operator": "+=",
"value": "1"
},
{
"type": "setValue",
"name": "status:atk",
"operator": "+=",
"value": "4"
}
]
}
]
},
{
"id": "shop2",
"text": "\t[贪婪之神,pinkShop]勇敢的武士啊, 给我一定经验就可以:",
"textInList": "1F经验商店",
"mustEnable": false,
"disablePreview": true,
"choices": [
{
"text": "等级+1100经验",
"need": "status:exp>=100",
"action": [
{
"type": "setValue",
"name": "status:exp",
"operator": "-=",
"value": "100"
},
{
"type": "setValue",
"name": "status:lv",
"operator": "+=",
"value": "1"
},
{
"type": "setValue",
"name": "status:hp",
"operator": "+=",
"value": "1000"
}
]
}
]
},
@ -296,12 +405,13 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
{
"id": "yellowKey",
"number": 10,
"money": 10
"money": "10",
"sell": "5"
}
]
},
{
"id": "keyShop1",
"id": "keyShop",
"textInList": "回收钥匙商店",
"mustEnable": false,
"commonEvent": "回收钥匙商店"
@ -320,17 +430,19 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
},
{
"need": "20",
"title": "第二级",
"title": "",
"action": [
{
"type": "setValue",
"name": "status:atk",
"value": "status:atk+10"
"operator": "+=",
"value": "10"
},
{
"type": "setValue",
"name": "status:def",
"value": "status:def+10"
"operator": "+=",
"value": "10"
}
]
},
@ -361,40 +473,25 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"counterAttack": 0.1,
"purify": 3,
"hatred": 2,
"moveSpeed": 100,
"animateSpeed": 400,
"floorChangeTime": 800
"animateSpeed": 400
},
"flags": {
"enableFloor": true,
"enableName": false,
"enableLv": false,
"enableHPMax": false,
"enableMana": false,
"enableMDef": true,
"enableMoney": true,
"enableExperience": false,
"enableLevelUp": false,
"levelUpLeftMode": false,
"enableKeys": true,
"enablePZF": false,
"enableDebuff": false,
"enableSkill": false,
"statusBarItems": [
"enableFloor",
"enableHP",
"enableAtk",
"enableDef",
"enableMDef",
"enableMoney",
"enableKeys"
],
"flyNearStair": true,
"flyRecordPosition": false,
"pickaxeFourDirections": false,
"bombFourDirections": false,
"snowFourDirections": false,
"bigKeyIsBox": false,
"steelDoorWithoutKey": false,
"itemFirstText": false,
"equipment": false,
"equipboxButton": false,
"iconInEquipbox": false,
"enableAddPoint": false,
"enableNegativeDamage": false,
"hatredDecrease": true,
"betweenAttackCeil": false,
"betweenAttackMax": false,
"useLoop": false,
"startUsingCanvas": false,
@ -405,13 +502,10 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"displayCritical": true,
"displayExtraDamage": true,
"enableGentleClick": true,
"potionWhileRouting": false,
"ignoreChangeFloor": true,
"canGoDeadZone": false,
"enableMoveDirectly": true,
"enableDisabledShop": true,
"disableShopOnDamage": false,
"blurFg": false,
"checkConsole": false
"blurFg": false
}
}

View File

@ -1,67 +1,67 @@
var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 =
{
"greenSlime": {"name":"绿头怪","hp":100,"atk":120,"def":0,"money":1,"experience":1,"point":0,"special":[1,5,7,8]},
"redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":[16,18],"value":10},
"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"slimelord": {"name":"怪王","hp":100,"atk":120,"def":0,"money":10,"experience":0,"point":0,"special":[1,9]},
"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"experience":0,"point":0,"special":1},
"bigBat": {"name":"大蝙蝠","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"redBat": {"name":"红蝙蝠","hp":100,"atk":120,"def":0,"money":5,"experience":0,"point":0,"special":4},
"vampire": {"name":"冥灵魔王","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"skeletonSoilder": {"name":"骷髅士兵","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"ghostSkeleton": {"name":"冥队长","hp":100,"atk":120,"def":0,"money":8,"experience":0,"point":0,"special":7},
"zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"rock": {"name":"石头人","hp":100,"atk":120,"def":0,"money":4,"experience":0,"point":0,"special":3},
"slimeMan": {"name":"影子战士","hp":100,"atk":0,"def":0,"money":11,"experience":0,"point":0,"special":[10,21],"atkValue":2,"defValue":3},
"bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"experience":0,"point":1,"special":2},
"redPriest": {"name":"高级法师","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"brownWizard": {"name":"初级巫师","hp":100,"atk":120,"def":0,"money":16,"experience":0,"point":0,"special":15,"value":100,"range":2},
"redWizard": {"name":"高级巫师","hp":1000,"atk":1200,"def":0,"money":160,"experience":0,"point":0,"special":15,"value":200,"zoneSquare":true},
"yellowGuard": {"name":"初级卫兵","hp":100,"atk":120,"def":0,"money":10,"experience":0,"point":0,"special":0},
"blueGuard": {"name":"中级卫兵","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"redGuard": {"name":"高级卫兵","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"swordsman": {"name":"双手剑士","hp":100,"atk":120,"def":0,"money":6,"experience":0,"point":0,"special":[5,23]},
"soldier": {"name":"冥战士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"yellowKnight": {"name":"金骑士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"redKnight": {"name":"红骑士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"darkKnight": {"name":"黑骑士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"blackKing": {"name":"黑衣魔王","hp":1000,"atk":500,"def":0,"money":1000,"experience":1000,"point":0,"special":0,"notBomb":true},
"yellowKing": {"name":"黄衣魔王","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"greenKing": {"name":"青衣武士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"blueKnight": {"name":"蓝骑士","hp":100,"atk":120,"def":0,"money":9,"experience":0,"point":0,"special":8},
"goldSlime": {"name":"黄头怪","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"poisonSkeleton": {"name":"紫骷髅","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"poisonBat": {"name":"紫蝙蝠","hp":100,"atk":120,"def":0,"money":14,"experience":0,"point":0,"special":13},
"steelRock": {"name":"铁面人","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"skeletonPriest": {"name":"骷髅法师","hp":100,"atk":100,"def":0,"money":0,"experience":0,"point":0,"special":18,"value":20},
"skeletonKing": {"name":"骷髅王","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"skeletonWizard": {"name":"骷髅巫师","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"redSkeletonCaption": {"name":"骷髅武士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"badHero": {"name":"迷失勇者","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"demon": {"name":"魔神武士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"demonPriest": {"name":"魔神法师","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"goldHornSlime": {"name":"金角怪","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"redKing": {"name":"红衣魔王","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"whiteKing": {"name":"白衣武士","hp":100,"atk":120,"def":0,"money":17,"experience":0,"point":0,"special":16},
"blackMagician": {"name":"黑暗大法师","hp":100,"atk":120,"def":0,"money":12,"experience":0,"point":0,"special":11,"value":0.3333333333333333,"add":true,"notBomb":true},
"silverSlime": {"name":"银头怪","hp":100,"atk":120,"def":0,"money":15,"experience":0,"point":0,"special":14},
"swordEmperor": {"name":"剑圣","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"whiteHornSlime": {"name":"尖角怪","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"badPrincess": {"name":"痛苦魔女","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"badFairy": {"name":"黑暗仙子","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"grayPriest": {"name":"中级法师","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"redSwordsman": {"name":"剑王","hp":100,"atk":120,"def":0,"money":7,"experience":0,"point":0,"special":6,"n":8},
"whiteGhost": {"name":"水银战士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"poisonZombie": {"name":"绿兽人","hp":100,"atk":120,"def":0,"money":13,"experience":0,"point":0,"special":12},
"magicDragon": {"name":"魔龙","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"octopus": {"name":"血影","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"darkFairy": {"name":"仙子","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"greenKnight": {"name":"强盾骑士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"angel": {"name":"天使","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"elemental": {"name":"元素生物","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"steelGuard": {"name":"铁守卫","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":18,"value":20},
"evilBat": {"name":"邪恶蝙蝠","hp":1000,"atk":1,"def":0,"money":0,"experience":0,"point":0,"special":[2,3]}
"greenSlime": {"name":"绿头怪","hp":100,"atk":120,"def":0,"money":1,"exp":1,"point":0,"special":[1,5,7,8]},
"redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[16,18],"value":10},
"blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"slimelord": {"name":"怪王","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[1,9]},
"bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1]},
"bigBat": {"name":"大蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"redBat": {"name":"红蝙蝠","hp":100,"atk":120,"def":0,"money":5,"exp":0,"point":0,"special":[4]},
"vampire": {"name":"冥灵魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"skeletonSoilder": {"name":"骷髅士兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"ghostSkeleton": {"name":"冥队长","hp":100,"atk":120,"def":0,"money":8,"exp":0,"point":0,"special":[7]},
"zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"rock": {"name":"石头人","hp":100,"atk":120,"def":0,"money":4,"exp":0,"point":0,"special":[3]},
"slimeMan": {"name":"影子战士","hp":100,"atk":0,"def":0,"money":11,"exp":0,"point":0,"special":[10,21],"atkValue":2,"defValue":3},
"bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":[2]},
"redPriest": {"name":"高级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"brownWizard": {"name":"初级巫师","hp":100,"atk":120,"def":0,"money":16,"exp":0,"point":0,"special":[15],"value":100,"range":2},
"redWizard": {"name":"高级巫师","hp":1000,"atk":1200,"def":0,"money":160,"exp":0,"point":0,"special":[15],"value":200,"zoneSquare":true},
"yellowGuard": {"name":"初级卫兵","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[]},
"blueGuard": {"name":"中级卫兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"redGuard": {"name":"高级卫兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"swordsman": {"name":"双手剑士","hp":100,"atk":120,"def":0,"money":6,"exp":0,"point":0,"special":[5,23]},
"soldier": {"name":"冥战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"yellowKnight": {"name":"金骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"redKnight": {"name":"红骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"darkKnight": {"name":"黑骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"blackKing": {"name":"黑衣魔王","hp":1000,"atk":500,"def":0,"money":1000,"exp":1000,"point":0,"special":[],"notBomb":true},
"yellowKing": {"name":"黄衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"greenKing": {"name":"青衣武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"blueKnight": {"name":"蓝骑士","hp":100,"atk":120,"def":0,"money":9,"exp":0,"point":0,"special":[8]},
"goldSlime": {"name":"黄头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"poisonSkeleton": {"name":"紫骷髅","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"poisonBat": {"name":"紫蝙蝠","hp":100,"atk":120,"def":0,"money":14,"exp":0,"point":0,"special":[13]},
"steelRock": {"name":"铁面人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"skeletonPriest": {"name":"骷髅法师","hp":100,"atk":100,"def":0,"money":0,"exp":0,"point":0,"special":[18],"value":20},
"skeletonKing": {"name":"骷髅王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"skeletonWizard": {"name":"骷髅巫师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"redSkeletonCaption": {"name":"骷髅武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"badHero": {"name":"迷失勇者","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"demon": {"name":"魔神武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"demonPriest": {"name":"魔神法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"goldHornSlime": {"name":"金角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"redKing": {"name":"红衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"whiteKing": {"name":"白衣武士","hp":100,"atk":120,"def":0,"money":17,"exp":0,"point":0,"special":[16]},
"blackMagician": {"name":"黑暗大法师","hp":100,"atk":120,"def":0,"money":12,"exp":0,"point":0,"special":[11],"value":0.3333333333333333,"add":true,"notBomb":true},
"silverSlime": {"name":"银头怪","hp":100,"atk":120,"def":0,"money":15,"exp":0,"point":0,"special":[14]},
"swordEmperor": {"name":"剑圣","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"whiteHornSlime": {"name":"尖角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"badPrincess": {"name":"痛苦魔女","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"badFairy": {"name":"黑暗仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"grayPriest": {"name":"中级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"redSwordsman": {"name":"剑王","hp":100,"atk":120,"def":0,"money":7,"exp":0,"point":0,"special":[6],"n":8},
"whiteGhost": {"name":"水银战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"poisonZombie": {"name":"绿兽人","hp":100,"atk":120,"def":0,"money":13,"exp":0,"point":0,"special":[12]},
"magicDragon": {"name":"魔龙","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"octopus": {"name":"血影","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"darkFairy": {"name":"仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"greenKnight": {"name":"强盾骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"angel": {"name":"天使","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"elemental": {"name":"元素生物","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[]},
"steelGuard": {"name":"铁守卫","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[18],"value":20},
"evilBat": {"name":"邪恶蝙蝠","hp":1000,"atk":1,"def":0,"money":0,"exp":0,"point":0,"special":[2,3]}
}

View File

@ -15,7 +15,8 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
{
"type": "setValue",
"name": "status:atk",
"value": "status:atk+1*flag:arg1"
"operator": "+=",
"value": "1*flag:arg1"
}
]
},
@ -25,7 +26,8 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
{
"type": "setValue",
"name": "status:def",
"value": "status:def+2*flag:arg1"
"operator": "+=",
"value": "2*flag:arg1"
}
]
},
@ -35,7 +37,8 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
{
"type": "setValue",
"name": "status:hp",
"value": "status:hp+200*flag:arg1"
"operator": "+=",
"value": "200*flag:arg1"
}
]
}
@ -97,14 +100,16 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
"text": ">=1直接扣数值"
},
{
"type": "addValue",
"type": "setValue",
"name": "status:atk",
"value": "-core.values.weakValue"
"operator": "-=",
"value": "core.values.weakValue"
},
{
"type": "addValue",
"type": "setValue",
"name": "status:def",
"value": "-core.values.weakValue"
"operator": "-=",
"value": "core.values.weakValue"
}
],
"false": [
@ -158,90 +163,88 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
},
{
"type": "if",
"condition": "core.canMoveHero()",
"condition": "core.onSki()",
"true": [
{
"type": "comment",
"text": "检测下一个点是否可通行"
},
{
"type": "setValue",
"name": "flag:nx",
"value": "core.nextX()"
},
{
"type": "setValue",
"name": "flag:ny",
"value": "core.nextY()"
},
{
"type": "if",
"condition": "core.noPass(flag:nx, flag:ny)",
"condition": "core.canMoveHero()",
"true": [
{
"type": "comment",
"text": "不可通行,触发下一个点的事件"
"text": "检测下一个点是否可通行"
},
{
"type": "trigger",
"loc": [
"flag:nx",
"flag:ny"
]
}
],
"false": [
{
"type": "comment",
"text": "可通行,先移动到下个点,然后检查阻激夹域,并尝试触发该点事件"
"type": "setValue",
"name": "flag:nx",
"value": "core.nextX()"
},
{
"type": "moveHero",
"time": 80,
"steps": [
"forward"
]
},
{
"type": "function",
"function": "function(){\ncore.checkBlock();\n}"
},
{
"type": "comment",
"text": "【触发事件】如果该点存在事件则会立刻结束当前事件"
},
{
"type": "trigger",
"loc": [
"flag:nx",
"flag:ny"
]
},
{
"type": "comment",
"text": "如果该点不存在事件,则继续检测该点是否是滑冰点"
"type": "setValue",
"name": "flag:ny",
"value": "core.nextY()"
},
{
"type": "if",
"condition": "core.getBgNumber() == 167",
"condition": "core.noPass(flag:nx, flag:ny)",
"true": [
{
"type": "comment",
"text": "不可通行,触发下一个点的事件"
},
{
"type": "trigger",
"loc": [
"flag:nx",
"flag:ny"
]
}
],
"false": [
{
"type": "comment",
"text": "可通行,先移动到下个点,然后检查阻激夹域,并尝试触发该点事件"
},
{
"type": "moveHero",
"time": 80,
"steps": [
"forward"
]
},
{
"type": "function",
"function": "function(){\ncore.checkBlock();\n}"
},
{
"type": "comment",
"text": "【触发事件】如果该点存在事件则会立刻结束当前事件"
},
{
"type": "trigger",
"loc": [
"flag:nx",
"flag:ny"
]
},
{
"type": "comment",
"text": "如果该点不存在事件,则继续检测该点是否是滑冰点"
},
{
"type": "function",
"function": "function(){\ncore.insertAction(\"滑冰事件\",null,null,null,true)\n}"
}
],
"false": []
]
}
]
}
],
"false": []
]
}
],
"回收钥匙商店": [
{
"type": "comment",
"text": "此事件在全局商店中被引用了(全局商店keyShop1)"
"text": "此事件在全局商店中被引用了(全局商店keyShop)"
},
{
"type": "comment",
@ -273,13 +276,15 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
"condition": "item:yellowKey >= 1",
"true": [
{
"type": "addValue",
"type": "setValue",
"name": "item:yellowKey",
"value": "-1"
"operator": "-=",
"value": "1"
},
{
"type": "addValue",
"type": "setValue",
"name": "status:money",
"operator": "+=",
"value": "10"
}
],
@ -303,13 +308,15 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
"condition": "item:blueKey >= 1",
"true": [
{
"type": "addValue",
"type": "setValue",
"name": "item:blueKey",
"value": "-1"
"operator": "-=",
"value": "1"
},
{
"type": "addValue",
"type": "setValue",
"name": "status:money",
"operator": "+=",
"value": "50"
}
],

View File

@ -1,15 +1,15 @@
main.floors.MT0=
{
"floorId": "MT0",
"title": "主塔 0 层",
"name": "0",
"canFlyTo": true,
"canUseQuickShop": true,
"cannotViewMap": false,
"defaultGround": "ground",
"images": [],
"item_ratio": 1,
"map": [
"floorId": "MT0",
"title": "主塔 0 层",
"name": "0",
"canFlyTo": true,
"canUseQuickShop": true,
"cannotViewMap": false,
"defaultGround": "ground",
"images": [],
"item_ratio": 1,
"map": [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@ -24,18 +24,21 @@ main.floors.MT0=
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
"firstArrive": [],
"parallelDo": "",
"events": {},
"changeFloor": {},
"afterBattle": {},
"afterGetItem": {},
"afterOpenDoor": {},
"cannotMove": {},
"bgmap": [
"firstArrive": [],
"parallelDo": "",
"events": {},
"changeFloor": {},
"afterBattle": {},
"afterGetItem": {},
"afterOpenDoor": {},
"cannotMove": {},
"bgmap": [
],
"fgmap": [
"fgmap": [
],
"width": 13,
"height": 13,
"autoEvent": {}
}

View File

@ -1,15 +1,15 @@
main.floors.sample0=
{
"floorId": "sample0",
"title": "样板 0 层",
"name": "0",
"canFlyTo": true,
"canUseQuickShop": true,
"defaultGround": "ground",
"images": [],
"bgm": "bgm.mp3",
"item_ratio": 1,
"map": [
"floorId": "sample0",
"title": "样板 0 层",
"name": "0",
"canFlyTo": true,
"canUseQuickShop": true,
"defaultGround": "ground",
"images": [],
"bgm": "bgm.mp3",
"item_ratio": 1,
"map": [
[ 0, 0,220, 0, 0, 20, 87, 3, 65, 64, 44, 43, 42],
[ 0,246, 0,246, 0, 20, 0, 3, 58, 59, 60, 61, 41],
[219, 0, 0, 0,219, 20, 0, 3, 57, 26, 62, 63, 40],
@ -24,199 +24,202 @@ main.floors.sample0=
[ 87, 11, 12, 13, 14, 4, 4, 2, 2, 2,122, 2, 2],
[ 88, 89, 90, 91, 92, 93, 94, 2, 81, 82, 83, 84, 86]
],
"firstArrive": [
{
"type": "setText",
"background": "winskin.png",
"time": 0
},
"\t[样板提示]首次到达某层可以触发 firstArrive 事件该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型常常用来触发对话例如",
"\t[hero]\b[up,hero]我是谁?我从哪来?我又要到哪去?",
"\t[仙子,fairy]你问我...?我也不知道啊...",
"本层主要对道具、门、怪物等进行介绍,有关事件的各种信息在下一层会有更为详细的说明。"
],
"events": {
"10,9": [
"\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为四类items, constants, toolsequips。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\nequips 为装备,例如剑盾等。",
"\t[老人,man]\b[up]有关道具效果定义在items.js中。\n目前大多数道具已有默认行为如有自定义的需求则需在items.js中修改代码。",
"\t[老人,man]\b[up]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
"firstArrive": [
{
"type": "hide",
"time": 500
}
"type": "setText",
"background": "winskin.png",
"time": 0
},
"\t[样板提示]首次到达某层可以触发 firstArrive 事件该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型常常用来触发对话例如",
"\t[hero]\b[up,hero]我是谁?我从哪来?我又要到哪去?",
"\t[仙子,fairy]你问我...?我也不知道啊...",
"本层主要对道具、门、怪物等进行介绍,有关事件的各种信息在下一层会有更为详细的说明。"
],
"10,11": [
"\t[老人,woman]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。",
"\t[老人,woman]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
{
"type": "hide",
"time": 500
}
],
"2,10": [
"\t[少女,npc0]这些是路障、楼梯、传送门。",
"\t[少女,npc0]血网的伤害数值、中毒后每步伤害数值、衰弱时攻防下降的数值,都在 data.js 内定义。\n\n路障同样会尽量被自动寻路绕过。",
"\t[少女,npc0]楼梯和传送门需要在changeFloor中定义目标楼层和位置可参见样板里已有的的写法。",
{
"type": "hide",
"time": 500
}
],
"2,8": [
"\t[老人,magician]这些都是各种各样的怪物所有怪物的数据都在enemys.js中设置。",
"\t[老人,magician]这批怪物分别为普通、先攻、魔攻、坚固、2连击、3连击、4连击、破甲、反击、净化。",
"\t[老人,magician]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
{
"type": "hide",
"time": 500
}
],
"2,5": [
"\t[老人,magician]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值可参见样板中黑暗大法师的写法。",
{
"type": "hide",
"time": 500
}
],
"2,3": [
"\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。",
"\t[老人,magician]夹击和领域同时发生时先计算领域,再夹击。\n自动寻路同样会尽量绕过你设置的这些点。",
{
"type": "hide",
"time": 500
}
],
"12,10": {
"enable": false,
"data": [
"\t[仙子,fairy]只有楼上启用事件后,才能看到我并可以和我对话来触发事件。",
"events": {
"10,9": [
"\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为四类items, constants, toolsequips。\nitems 为即捡即用类道具,例如宝石、血瓶、剑盾等。\nconstants 为永久道具,例如怪物手册、楼层传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中心对称飞行器等。\nequips 为装备,例如剑盾等。",
"\t[老人,man]\b[up]有关道具效果定义在items.js中。\n目前大多数道具已有默认行为如有自定义的需求则需在items.js中修改代码。",
"\t[老人,man]\b[up]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
{
"type": "hide",
"time": 500
}
]
}
},
"changeFloor": {
"6,0": {
"floorId": "sample1",
"stair": "downFloor"
],
"10,11": [
"\t[老人,woman]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。",
"\t[老人,woman]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
{
"type": "hide",
"time": 500
}
],
"2,10": [
"\t[少女,npc0]这些是路障、楼梯、传送门。",
"\t[少女,npc0]血网的伤害数值、中毒后每步伤害数值、衰弱时攻防下降的数值,都在 data.js 内定义。\n\n路障同样会尽量被自动寻路绕过。",
"\t[少女,npc0]楼梯和传送门需要在changeFloor中定义目标楼层和位置可参见样板里已有的的写法。",
{
"type": "hide",
"time": 500
}
],
"2,8": [
"\t[老人,magician]这些都是各种各样的怪物所有怪物的数据都在enemys.js中设置。",
"\t[老人,magician]这批怪物分别为普通、先攻、魔攻、坚固、2连击、3连击、4连击、破甲、反击、净化。",
"\t[老人,magician]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
{
"type": "hide",
"time": 500
}
],
"2,5": [
"\t[老人,magician]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值可参见样板中黑暗大法师的写法。",
{
"type": "hide",
"time": 500
}
],
"2,3": [
"\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。",
"\t[老人,magician]夹击和领域同时发生时先计算领域,再夹击。\n自动寻路同样会尽量绕过你设置的这些点。",
{
"type": "hide",
"time": 500
}
],
"12,10": {
"enable": false,
"data": [
"\t[仙子,fairy]只有楼上启用事件后,才能看到我并可以和我对话来触发事件。",
{
"type": "hide",
"time": 500
}
]
}
},
"0,11": {
"floorId": "sample0",
"loc": [
0,
12
"changeFloor": {
"6,0": {
"floorId": "sample1",
"stair": "downFloor"
},
"0,11": {
"floorId": "sample0",
"loc": [
0,
12
]
},
"0,12": {
"floorId": "sample0",
"stair": "upFloor"
},
"1,12": {
"floorId": "sample0",
"loc": [
1,
12
]
},
"2,12": {
"floorId": "sample0",
"loc": [
2,
12
]
},
"3,12": {
"floorId": "sample0",
"loc": [
6,
1
],
"direction": "up"
},
"4,12": {
"floorId": "sample0",
"loc": [
0,
9
],
"direction": "left",
"time": 1000
},
"5,12": {
"floorId": "sample0",
"loc": [
6,
10
],
"time": 0,
"portalWithoutTrigger": false
},
"6,12": {
"floorId": "sample0",
"loc": [
10,
10
],
"direction": "left",
"time": 1000
}
},
"afterBattle": {
"2,6": [
"\t[ghostSkeleton]不可能,你怎么可能打败我!\n一个打败怪物触发的事件"
]
},
"0,12": {
"floorId": "sample0",
"stair": "upFloor"
},
"1,12": {
"floorId": "sample0",
"loc": [
1,
12
"afterGetItem": {
"11,8": [
"由于状态栏放不下绿钥匙和铁门钥匙均视为tools放入工具栏中。\n碰到绿门和铁门仍然会自动使用开门。"
],
"8,6": [
"由于吸血和夹击等的存在,血瓶默认自动被绕路。\n你可以修改data.js中的系统Flag来设置这一项。"
],
"8,7": [
"如需修改消耗品的效果,请前往 data.js 找到并修改values内对应的具体数值即可。\n如果有更高级的需求如每个区域宝石数值变化详见doc文档内的做法说明。"
],
"9,5": [
"每层楼的 canFlyTo 决定了该楼层能否被飞到。\n\n不能被飞到的楼层也无法使用楼层传送器。",
"飞行的楼层顺序由 main.js 中 floorIds 加载顺序所决定。\n\n是否必须在楼梯边使用楼传器由 data.js 中的系统Flag所决定。"
],
"10,5": [
"破墙镐是破面前的墙壁还是四个方向的墙壁由data.js中的系统Flag所决定。"
],
"8,4": [
"炸弹是只能炸面前的怪物还是四个方向的怪物由data.js中的系统Flag所决定。\n如只能炸前方怪物则和上面的圣锤等价。\n不能被炸的怪物在enemys中可以定义可参见样板里黑衣魔王和黑暗大法师的写法。"
],
"10,4": [
"“上楼”和“下楼”的目标层由 main.js 的 floorIds顺序所决定。"
],
"9,2": [
"该道具默认是大黄门钥匙,如需改为钥匙盒直接修改 data.js 中的系统Flag即可。"
],
"10,2": [
"屠龙匕首目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。"
],
"12,7": [
"在 data.js 的系统Flag中设置是否启用装备栏。\n如果不启用则装备会直接增加属性。"
],
"12,6": [
"在 data.js 的系统Flag中设置是否启用装备栏按钮。\n如果启用则装备栏按钮会替代楼传按钮。"
],
"12,5": [
"装备的种类由全塔属性中的equipName决定,type的值就是该类型在equipName中的位次例如默认情况下equiptype为0代表武器同时只有type为0的装备的animate属性生效"
]
},
"2,12": {
"floorId": "sample0",
"loc": [
2,
12
"afterOpenDoor": {
"11,12": [
"你开了一个绿门触发了一个afterOpenDoor事件"
]
},
"3,12": {
"floorId": "sample0",
"loc": [
6,
1
],
"direction": "up"
},
"4,12": {
"floorId": "sample0",
"loc": [
0,
9
],
"direction": "left",
"time": 1000
},
"5,12": {
"floorId": "sample0",
"loc": [
6,
10
],
"time": 0,
"portalWithoutTrigger": false
},
"6,12": {
"floorId": "sample0",
"loc": [
10,
10
],
"direction": "left",
"time": 1000
}
},
"afterBattle": {
"2,6": [
"\t[ghostSkeleton]不可能,你怎么可能打败我!\n一个打败怪物触发的事件"
]
},
"afterGetItem": {
"11,8": [
"由于状态栏放不下绿钥匙和铁门钥匙均视为tools放入工具栏中。\n碰到绿门和铁门仍然会自动使用开门。"
],
"8,6": [
"由于吸血和夹击等的存在,血瓶默认自动被绕路。\n你可以修改data.js中的系统Flag来设置这一项。"
],
"8,7": [
"如需修改消耗品的效果,请前往 data.js 找到并修改values内对应的具体数值即可。\n如果有更高级的需求如每个区域宝石数值变化详见doc文档内的做法说明。"
],
"9,5": [
"每层楼的 canFlyTo 决定了该楼层能否被飞到。\n\n不能被飞到的楼层也无法使用楼层传送器。",
"飞行的楼层顺序由 main.js 中 floorIds 加载顺序所决定。\n\n是否必须在楼梯边使用楼传器由 data.js 中的系统Flag所决定。"
],
"10,5": [
"破墙镐是破面前的墙壁还是四个方向的墙壁由data.js中的系统Flag所决定。"
],
"8,4": [
"炸弹是只能炸面前的怪物还是四个方向的怪物由data.js中的系统Flag所决定。\n如只能炸前方怪物则和上面的圣锤等价。\n不能被炸的怪物在enemys中可以定义可参见样板里黑衣魔王和黑暗大法师的写法。"
],
"10,4": [
"“上楼”和“下楼”的目标层由 main.js 的 floorIds顺序所决定。"
],
"9,2": [
"该道具默认是大黄门钥匙,如需改为钥匙盒直接修改 data.js 中的系统Flag即可。"
],
"10,2": [
"屠龙匕首目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。"
],
"12,7": [
"在 data.js 的系统Flag中设置是否启用装备栏。\n如果不启用则装备会直接增加属性。"
],
"12,6": [
"在 data.js 的系统Flag中设置是否启用装备栏按钮。\n如果启用则装备栏按钮会替代楼传按钮。"
],
"12,5": [
"装备的种类由全塔属性中的equipName决定,type的值就是该类型在equipName中的位次例如默认情况下equiptype为0代表武器同时只有type为0的装备的animate属性生效"
]
},
"afterOpenDoor": {
"11,12": [
"你开了一个绿门触发了一个afterOpenDoor事件"
]
},
"cannotMove": {},
"bgmap": [
"cannotMove": {},
"bgmap": [
],
"fgmap": [
"fgmap": [
],
"width": 13,
"height": 13,
"autoEvent": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -1,15 +1,15 @@
main.floors.sample2=
{
"floorId": "sample2",
"title": "样板 2 层",
"name": "2",
"canFlyTo": true,
"canUseQuickShop": true,
"cannotViewMap": false,
"defaultGround": "ground",
"images": [],
"item_ratio": 1,
"map": [
"floorId": "sample2",
"title": "样板 2 层",
"name": "2",
"canFlyTo": true,
"canUseQuickShop": true,
"cannotViewMap": false,
"defaultGround": "ground",
"images": [],
"item_ratio": 1,
"map": [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 1,121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@ -37,36 +37,37 @@ main.floors.sample2=
[ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
"width": 26,
"height": 26,
"firstArrive": [],
"events": {
"3,2": [
"123"
],
"12,12": [
"234"
]
},
"changeFloor": {
"6,10": {
"floorId": "sample1",
"stair": "upFloor"
"width": 26,
"height": 26,
"firstArrive": [],
"events": {
"3,2": [
"123"
],
"12,12": [
"234"
]
},
"7,12": {
"floorId": "sample3",
"stair": "downFloor"
}
},
"afterBattle": {},
"afterGetItem": {},
"afterOpenDoor": {},
"cannotMove": {},
"upFloor": null,
"bgmap": [
"changeFloor": {
"6,10": {
"floorId": "sample1",
"stair": "upFloor"
},
"7,12": {
"floorId": "sample3",
"stair": "downFloor"
}
},
"afterBattle": {},
"afterGetItem": {},
"afterOpenDoor": {},
"cannotMove": {},
"upFloor": null,
"bgmap": [
],
"fgmap": [
"fgmap": [
],
"autoEvent": {}
}

File diff suppressed because it is too large Load Diff

View File

@ -29,7 +29,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 初始化怪物和道具
core.material.enemys = core.enemys.getEnemys();
core.material.items = core.items.getItems();
core.items._resetItems();
// 初始化全局数值和全局开关
core.values = core.clone(core.data.values);
for (var key in values || {})
@ -49,28 +48,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.showStatusBar();
// 隐藏右下角的音乐按钮
core.dom.musicBtn.style.display = 'none';
},
"setInitData": function () {
// 不同难度分别设置初始属性
if (core.status.hard == 'Easy') { // 简单难度
core.setFlag('hard', 1); // 可以用flag:hard来获得当前难度
// 可以在此设置一些初始福利,比如设置初始生命值可以调用:
// core.setStatus("hp", 10000);
// 赠送一把黄钥匙可以调用
// core.setItem("yellowKey", 1);
}
if (core.status.hard == 'Normal') { // 普通难度
core.setFlag('hard', 2); // 可以用flag:hard来获得当前难度
}
if (core.status.hard == 'Hard') { // 困难难度
core.setFlag('hard', 3); // 可以用flag:hard来获得当前难度
}
if (core.status.hard == 'Hell') { // 噩梦难度
core.setFlag('hard', 4); // 可以用flag:hard来获得当前难度
}
// 设置已经到过的楼层
core.setFlag("__visited__", {});
},
"win": function (reason, norank, noexit) {
// 游戏获胜事件
@ -114,15 +91,16 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
});
})
},
"changingFloor": function (floorId, heroLoc, fromLoad) {
"changingFloor": function (floorId, heroLoc) {
// 正在切换楼层过程中执行的操作;此函数的执行时间是“屏幕完全变黑“的那一刻
// floorId为要切换到的楼层IDheroLoc表示勇士切换到的位置fromLoad表示是否是从读档造成的切换
// floorId为要切换到的楼层IDheroLoc表示勇士切换到的位置
// ---------- 此时还没有进行切换当前floorId还是原来的 ---------- //
var currentId = core.status.floorId || null; // 获得当前的floorId可能为null
var fromLoad = core.hasFlag('__fromLoad__'); // 是否是读档造成的切换
if (!fromLoad) {
if (!core.hasFlag("__leaveLoc__")) core.setFlag("__leaveLoc__", {});
if (currentId != null) core.getFlag("__leaveLoc__")[currentId] = core.status.hero.loc;
if (currentId != null) core.getFlag("__leaveLoc__")[currentId] = core.clone(core.status.hero.loc);
}
// 可以对currentId进行判定比如删除某些自定义图层等
@ -132,6 +110,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 重置画布尺寸
core.maps.resizeMap(floorId);
// 设置勇士的位置
core.status.hero.loc = heroLoc;
// 检查重生怪并重置
if (!fromLoad) {
core.status.maps[floorId].blocks.forEach(function (block) {
@ -139,10 +119,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
block.disable = false;
}
});
core.control.gatherFollowers();
}
// 设置勇士的位置
core.status.hero.loc = heroLoc;
core.control.gatherFollowers();
// ---------- 重绘新地图这一步将会设置core.status.floorId ---------- //
core.drawMap(floorId);
@ -171,12 +149,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// ...可以新增一些其他内容,比如创建个画布在右上角显示什么内容等等
},
"afterChangeFloor": function (floorId, fromLoad) {
"afterChangeFloor": function (floorId) {
// 转换楼层结束的事件;此函数会在整个楼层切换完全结束后再执行
// floorId是切换到的楼层fromLoad若为true则代表是从读档行为造成的楼层切换
// floorId是切换到的楼层
// 如果是读档,则进行检查(是否需要恢复事件)
if (fromLoad) {
if (core.hasFlag('__fromLoad__')) {
core.events.recoverEvents(core.getFlag("__events__"));
core.removeFlag("__events__");
} else {
@ -308,16 +286,16 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.status.hero.money += money;
core.status.hero.statistics.money += money;
var experience = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].experience;
}, enemy.experience);
if (core.hasFlag('curse')) experience = 0;
core.status.hero.experience += experience;
core.status.hero.statistics.experience += experience;
var exp = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].exp;
}, enemy.exp);
if (core.hasFlag('curse')) exp = 0;
core.status.hero.exp += exp;
core.status.hero.statistics.exp += exp;
var hint = "打败 " + enemy.name;
if (core.flags.enableMoney) hint += ",金币+" + money;
if (core.flags.enableExperience) hint += ",经验+" + experience;
if (core.flags.statusBarItems.indexOf('enableMoney')>=0) hint += ",金币+" + money;
if (core.flags.statusBarItems.indexOf('enableExp')>=0) hint += ",经验+" + exp;
core.drawTip(hint, enemy.id);
// 事件的处理
@ -336,8 +314,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (core.enemys.hasSpecial(special, 14)) {
core.push(todo, [{ "type": "insert", "name": "毒衰咒处理", "args": [2] }]);
}
// 仇恨属性:减半
if (core.flags.hatredDecrease && core.enemys.hasSpecial(special, 17)) {
// 仇恨属性
if (core.enemys.hasSpecial(special, 17)) {
core.setFlag('hatred', Math.floor(core.getFlag('hatred', 0) / 2));
}
// 自爆
@ -356,7 +334,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.setFlag('hatred', core.getFlag('hatred', 0) + core.values.hatred);
// 战后的技能处理,比如扣除魔力值
if (core.flags.enableSkill) {
if (core.flags.statusBarItems.indexOf('enableSkill') >=0 ) {
// 检测当前开启的技能类型
var skill = core.getFlag('skill', 0);
if (skill == 1) { // 技能1二倍斩
@ -402,6 +380,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 开一个门后触发的事件
var todo = [];
// 检查该点的获得开门后事件。
var event = core.floors[core.status.floorId].afterOpenDoor[x + "," + y];
if (event) core.unshift(todo, event);
@ -414,21 +393,22 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (callback) callback();
},
"afterGetItem": function (itemId, x, y, callback) {
"afterGetItem": function (itemId, x, y, isGentleClick, callback) {
// 获得一个道具后触发的事件
// itemId获得的道具IDx和y是该道具所在的坐标
// isGentleClick是否是轻按触发的
core.playSound('item.mp3');
var todo = [];
// 检查该点的获得道具后事件。
var event = core.floors[core.status.floorId].afterGetItem[x + "," + y];
if (event) core.unshift(todo, event);
if (event && (event instanceof Array || !isGentleClick || !event.disableOnGentleClick)) {
core.unshift(todo, event);
}
if (todo.length > 0) core.insertAction(todo, x, y);
if (callback) callback();
},
"afterChangeLight": function(x,y) {
// 改变亮灯之后,可以触发的事件
},
"afterPushBox": function () {
// 推箱子后的事件
@ -443,40 +423,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
*/
}
},
"afterUseBomb": function () {
// 使用炸弹/圣锤后的事件
// 这是一个使用炸弹也能开门的例子
/*
if (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在
&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在
{
core.insertAction([ // 插入事件
{"type": "openDoor", "loc": [x0,y0]} // 开门
])
}
*/
},
"afterPassNet": function (x, y, id) {
// 经过特殊地形后的事件x和y为当前坐标id为当前的图块id
// 这是个一次性血网的例子
// if (id == 'lavaNet') core.removeBlock(x, y);
},
"canUseQuickShop": function(shopId) {
// 当前能否使用某个快捷商店
// shopId快捷商店ID
// 如果返回一个字符串,表示不能,字符串为不能使用的提示
// 返回null代表可以使用
// 检查当前楼层的canUseQuickShop选项是否为false
if (core.status.thisMap.canUseQuickShop === false)
return '当前楼层不能使用快捷商店。';
return null;
}
},
"enemys": {
"getSpecials": function () {
@ -489,10 +435,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
[3, "坚固", "勇士每回合最多只能对怪物造成1点伤害"],
[4, "2连击", "怪物每回合攻击2次"],
[5, "3连击", "怪物每回合攻击3次"],
[6, function (enemy) { return (enemy.n || 4) + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }],
[6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }],
[7, "破甲", "战斗前,怪物附加角色防御的" + Math.floor(100 * core.values.breakArmor || 0) + "%作为伤害"],
[8, "反击", "战斗时,怪物每回合附加角色攻击的" + Math.floor(100 * core.values.counterAttack || 0) + "%作为伤害,无视角色防御"],
[9, "净化", "战斗前,怪物附加勇士魔防的" + core.values.purify + "倍作为伤害"],
[9, "净化", "战斗前,怪物附加勇士护盾的" + core.values.purify + "倍作为伤害"],
[10, "模仿", "怪物的攻防和勇士攻防相等"],
[11, "吸血", function (enemy) { return "战斗前,怪物首先吸取角色的" + Math.floor(100 * enemy.value || 0) + "%生命(约" + Math.floor((enemy.value || 0) * core.getStatus('hp')) + "点)作为伤害" + (enemy.add ? ",并把伤害数值加到自身生命上" : ""); }],
[12, "中毒", "战斗后,勇士陷入中毒状态,每一步损失生命" + core.values.poisonDamage + "点"],
@ -500,12 +446,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
[14, "诅咒", "战斗后,勇士陷入诅咒状态,战斗无法获得金币和经验"],
[15, "领域", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "范围内" + (enemy.range || 1) + "格时自动减生命" + (enemy.value || 0) + "点"; }],
[16, "夹击", "经过两只相同的怪物中间,勇士生命值变成一半"],
[17, "仇恨", "战斗前,怪物附加之前积累的仇恨值作为伤害" + (core.flags.hatredDecrease ? ";战斗后,释放一半的仇恨值" : "") + "。(每杀死一个怪物获得" + (core.values.hatred || 0) + "点仇恨值)"],
[17, "仇恨", "战斗前,怪物附加之前积累的仇恨值作为伤害;战斗后,释放一半的仇恨值。(每杀死一个怪物获得" + (core.values.hatred || 0) + "点仇恨值)"],
[18, "阻击", function (enemy) { return "经过怪物的十字领域时自动减生命" + (enemy.value || 0) + "点,同时怪物后退一格"; }],
[19, "自爆", "战斗后勇士的生命值变成1"],
[20, "无敌", "勇士无法打败怪物,除非拥有十字架"],
[21, "退化", function (enemy) { return "战斗后勇士永久下降" + (enemy.atkValue || 0) + "点攻击和" + (enemy.defValue || 0) + "点防御"; }],
[22, "固伤", function (enemy) { return "战斗前,怪物对勇士造成" + (enemy.damage || 0) + "点固定伤害,无视勇士魔防。"; }],
[22, "固伤", function (enemy) { return "战斗前,怪物对勇士造成" + (enemy.damage || 0) + "点固定伤害,无视勇士护盾。"; }],
[23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现"],
[24, "激光", function (enemy) { return "经过怪物同行或同列时自动减生命" + (enemy.value || 0) + "点"; }],
[25, "光环", function (enemy) { return "同楼层所有怪物生命提升" + (enemy.value || 0) + "%,攻击提升" + (enemy.atkValue || 0) + "%,防御提升" + (enemy.defValue || 0) + "%" + (enemy.add ? "可叠加" : "不可叠加"); }],
@ -519,7 +465,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
//
// 参数说明:
// enemy该怪物信息
// hero_hp,hero_atk,hero_def,hero_mdef勇士的生命攻防魔防数据
// hero_hp,hero_atk,hero_def,hero_mdef勇士的生命攻防护盾数据
// x,y该怪物的坐标查看手册和强制战斗时为undefined
// floorId该怪物所在的楼层
// 后面三个参数主要是可以在光环等效果上可以适用(也可以按需制作部分范围光环效果)
@ -534,7 +480,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
mon_def = enemy.def,
mon_special = enemy.special;
var mon_money = enemy.money,
mon_experience = enemy.experience,
mon_exp = enemy.exp,
mon_point = enemy.point;
// 模仿
if (core.hasSpecial(mon_special, 10)) {
@ -625,7 +571,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
"atk": Math.floor(mon_atk),
"def": Math.floor(mon_def),
"money": Math.floor(mon_money),
"experience": Math.floor(mon_experience),
"exp": Math.floor(mon_exp),
"point": Math.floor(mon_point),
"special": mon_special,
"guards": guards, // 返回支援情况
@ -673,7 +619,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (core.hasSpecial(mon_special, 20) && !core.hasItem("cross"))
return null; // 不可战斗
// 战前造成的额外伤害(可被魔防抵消)
// 战前造成的额外伤害(可被护盾抵消)
var init_damage = 0;
// 吸血
@ -761,13 +707,21 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 最终伤害:初始伤害 + 怪物对勇士造成的伤害 + 反击伤害
var damage = init_damage + (turn - 1) * per_damage + turn * counterDamage;
// 再扣去魔防
// 再扣去护盾
damage -= hero_mdef;
// 检查是否允许负伤
if (!core.flags.enableNegativeDamage)
damage = Math.max(0, damage);
// 最后处理仇恨和固伤(因为这两个不能被护盾减伤)
if (core.hasSpecial(mon_special, 17)) { // 仇恨
damage += core.getFlag('hatred', 0);
}
if (core.hasSpecial(mon_special, 22)) { // 固伤
damage += enemy.damage || 0;
}
return {
"mon_hp": Math.floor(mon_hp),
"mon_atk": Math.floor(mon_atk),
@ -832,7 +786,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
case 90: // Z转向
core.turnHero();
break;
case 75:
case 86: // V打开快捷商店列表
core.openQuickShop(true);
break;
@ -846,9 +799,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
case 34: // PgUp/PgDn浏览地图
core.ui.drawMaps();
break;
case 77: // M绘图模式
core.ui.drawPaint();
break;
case 66: // B打开数据统计
core.ui.drawStatistics();
break;
@ -866,30 +816,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
break;
case 49: // 快捷键1: 破
if (core.hasItem('pickaxe')) {
if (core.canUseItem('pickaxe')) {
core.status.route.push("key:49"); // 将按键记在录像中
core.useItem('pickaxe', true); // 第二个参数true代表该次使用道具是被按键触发的使用过程不计入录像
} else {
core.drawTip('当前不能使用破墙镐');
}
core.status.route.push("key:49"); // 将按键记在录像中
core.useItem('pickaxe', true); // 第二个参数true代表该次使用道具是被按键触发的使用过程不计入录像
}
break;
case 50: // 快捷键2: 炸
if (core.hasItem('bomb')) {
if (core.canUseItem('bomb')) {
core.status.route.push("key:50"); // 将按键记在录像中
core.useItem('bomb', true); // 第二个参数true代表该次使用道具是被按键触发的使用过程不计入录像
} else {
core.drawTip('当前不能使用炸弹');
}
} else if (core.hasItem('hammer')) {
if (core.canUseItem('hammer')) {
core.status.route.push("key:50"); // 将按键记在录像中
core.useItem('hammer', true); // 第二个参数true代表该次使用道具是被按键触发的使用过程不计入录像
} else {
core.drawTip('当前不能使用圣锤');
}
core.status.route.push("key:50"); // 将按键记在录像中
core.useItem('bomb', true); // 第二个参数true代表该次使用道具是被按键触发的使用过程不计入录像
}
break;
case 51: // 快捷键3: 飞
@ -983,20 +917,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
'maps': core.maps.saveMap(),
'route': core.encodeRoute(core.status.route),
'values': values,
'shops': {},
'version': core.firstData.version,
"time": new Date().getTime()
};
if (core.flags.checkConsole) {
data.hashCode = core.utils.hashCode(data.hero);
}
// 设置商店次数
for (var shopId in core.status.shops) {
data.shops[shopId] = {
'times': core.status.shops[shopId].times || 0,
'visited': core.status.shops[shopId].visited || false
};
}
return data;
},
@ -1006,13 +929,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 重置游戏和路线
core.resetGame(data.hero, data.hard, data.floorId, core.maps.loadMap(data.maps), data.values);
core.status.route = core.decodeRoute(data.route);
// 加载商店信息
for (var shopId in core.status.shops) {
if (data.shops[shopId]) {
core.status.shops[shopId].times = data.shops[shopId].times;
core.status.shops[shopId].visited = data.shops[shopId].visited;
}
}
// 文字属性,全局属性
core.status.textAttribute = core.getFlag('textAttribute', core.status.textAttribute);
var toAttribute = core.getFlag('globalAttribute', core.status.globalAttribute);
@ -1030,6 +946,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.material.icons.hero.width = core.material.images.images[icon].width / 4;
core.material.icons.hero.height = core.material.images.images[icon].height / 4;
}
core.setFlag('__fromLoad__', true);
// TODO增加自己的一些读档处理
@ -1041,7 +958,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
if (callback) callback();
}, true);
});
},
"updateStatusBar": function () {
// 更新状态栏
@ -1050,7 +967,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.events.checkLvUp();
// 检查HP上限
if (core.flags.enableHPMax) {
if (core.flags.statusBarItems.indexOf('enableHPMax') >= 0) {
core.setStatus('hp', Math.min(core.getStatus('hpmax'), core.getStatus('hp')));
}
@ -1064,8 +981,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 设置等级名称
core.setStatusBarInnerHTML('lv', core.getLvName());
// 设置生命上限、生命值、攻防魔防金币和经验值
var statusList = ['hpmax', 'hp', 'mana', 'atk', 'def', 'mdef', 'money', 'experience'];
// 设置生命上限、生命值、攻防护盾金币和经验值
var statusList = ['hpmax', 'hp', 'mana', 'atk', 'def', 'mdef', 'money', 'exp'];
statusList.forEach(function (item) {
// 向下取整
core.status.hero[item] = Math.floor(core.status.hero[item]);
@ -1073,22 +990,17 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.setStatusBarInnerHTML(item, core.getRealStatus(item));
});
// 设置魔力值
if (core.flags.enableMana) {
// 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);
}
// 设置魔力值; 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);
}
// 设置技能栏
if (core.flags.enableSkill) {
// 可以用flag:skill表示当前开启的技能类型flag:skillName显示技能名详见文档-个性化-技能塔的支持
core.setStatusBarInnerHTML('skill', core.getFlag('skillName', '无'));
}
// 可以用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");
@ -1096,31 +1008,27 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 如果是自定义添加的状态栏,也需要在这里进行设置显示的数值
// 进阶
if (core.flags.enableLevelUp && core.status.hero.lv < core.firstData.levelUp.length) {
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.levelUpLeftMode)
core.setStatusBarInnerHTML('up', core.formatBigNumber(need - core.getStatus('experience')) || "");
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'];
var keys = ['yellowKey', 'blueKey', 'redKey', 'greenKey'];
keys.forEach(function (key) {
core.setStatusBarInnerHTML(key, core.setTwoDigits(core.itemCount(key)));
});
// 毒衰咒
if (core.flags.enableDebuff) {
core.setStatusBarInnerHTML('poison', core.hasFlag('poison') ? "毒" : "");
core.setStatusBarInnerHTML('weak', core.hasFlag('weak') ? "衰" : "");
core.setStatusBarInnerHTML('curse', core.hasFlag('curse') ? "咒" : "");
}
core.setStatusBarInnerHTML('poison', core.hasFlag('poison') ? "毒" : "");
core.setStatusBarInnerHTML('weak', core.hasFlag('weak') ? "衰" : "");
core.setStatusBarInnerHTML('curse', core.hasFlag('curse') ? "咒" : "");
// 破炸飞
if (core.flags.enablePZF) {
core.setStatusBarInnerHTML('pickaxe', "破" + core.itemCount('pickaxe'));
core.setStatusBarInnerHTML('bomb', "炸" + core.itemCount('bomb'));
core.setStatusBarInnerHTML('fly', "飞" + core.itemCount('centerFly'));
}
core.setStatusBarInnerHTML('pickaxe', "破" + core.itemCount('pickaxe'));
core.setStatusBarInnerHTML('bomb', "炸" + core.itemCount('bomb'));
core.setStatusBarInnerHTML('fly', "飞" + core.itemCount('centerFly'));
// 难度
core.statusBar.hard.innerText = core.status.hard;
@ -1154,10 +1062,12 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
id = block.event.id,
enemy = core.material.enemys[id];
type[loc] = type[loc] || {};
// 血网
if (id == 'lavaNet' && block.event.trigger == 'passNet' && !core.hasItem('shoes')) {
if (id == 'lavaNet' && !core.hasItem('shoes')) {
damage[loc] = (damage[loc] || 0) + core.values.lavaDamage;
type[loc] = "血网伤害";
type[loc]["血网伤害"] = true;
}
// 领域
@ -1179,7 +1089,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 如果是十字领域,则还需要满足 |dx|+|dy|<=range
if (!zoneSquare && Math.abs(dx) + Math.abs(dy) > range) continue;
damage[currloc] = (damage[currloc] || 0) + (enemy.value || 0);
type[currloc] = "领域伤害";
type[currloc] = type[currloc] || {};
type[currloc]["领域伤害"] = true;
}
}
}
@ -1193,7 +1104,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
currloc = nx + "," + ny;
if (nx < 0 || nx >= width || ny < 0 || ny >= height) continue;
damage[currloc] = (damage[currloc] || 0) + (enemy.value || 0);
type[currloc] = "阻击伤害";
type[currloc] = type[currloc] || {};
type[currloc]["阻击伤害"] = true;
var rdir = core.reverseDirection(dir);
// 检查下一个点是否存在事件(从而判定是否移动)
@ -1214,21 +1126,23 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var currloc = nx + "," + y;
if (nx != x) {
damage[currloc] = (damage[currloc] || 0) + (enemy.value || 0);
type[currloc] = "激光伤害";
type[currloc] = type[currloc] || {};
type[currloc]["激光伤害"] = true;
}
}
for (var ny = 0; ny < height; ny++) {
var currloc = x + "," + ny;
if (ny != y) {
damage[currloc] = (damage[currloc] || 0) + (enemy.value || 0);
type[currloc] = "激光伤害";
type[currloc] = type[currloc] || {};
type[currloc]["激光伤害"] = true;
}
}
}
// 捕捉
// 如果要防止捕捉效果,可以直接简单的将 flag:no_ambush 设为true
if (enemy && core.enemys.hasSpecial(enemy.special, 27)) {
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,
@ -1249,36 +1163,40 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
for (var y = 0; y < height; y++) {
var loc = x + "," + y;
// 夹击怪物的ID
var enemyId = null;
var enemyId1 = null, enemyId2 = null;
// 检查左右夹击
var leftBlock = blocks[(x - 1) + "," + y],
rightBlock = blocks[(x + 1) + "," + y];
if (leftBlock && rightBlock && leftBlock.id == rightBlock.id) {
if (core.hasSpecial(leftBlock.event.id, 16))
enemyId = leftBlock.event.id;
enemyId1 = leftBlock.event.id;
}
// 检查上下夹击
var topBlock = blocks[x + "," + (y - 1)],
bottomBlock = blocks[x + "," + (y + 1)];
if (topBlock && bottomBlock && topBlock.id == bottomBlock.id) {
if (core.hasSpecial(topBlock.event.id, 16))
enemyId = topBlock.event.id;
enemyId2 = topBlock.event.id;
}
if (enemyId != null) {
if (enemyId1 != null || enemyId2 != null) {
var leftHp = core.status.hero.hp - (damage[loc] || 0);
if (leftHp > 1) {
// 上整/下整
var value = Math.floor((leftHp + (core.flags.betweenAttackCeil ? 1 : 0)) / 2);
// 夹击伤害值
var value = Math.floor(leftHp / 2);
// 是否不超过怪物伤害值
if (core.flags.betweenAttackMax) {
var enemyDamage = core.getDamage(enemyId, x, y, floorId);
if (enemyDamage != null && enemyDamage < value)
value = enemyDamage;
var enemyDamage1 = core.getDamage(enemyId1, x, y, floorId);
if (enemyDamage1 != null && enemyDamage1 < value)
value = enemyDamage1;
var enemyDamage2 = core.getDamage(enemyId2, x, y, floorId);
if (enemyDamage2 != null && enemyDamage2 < value)
value = enemyDamage2;
}
if (value > 0) {
damage[loc] = (damage[loc] || 0) + value;
type[loc] = "夹击伤害";
type[loc] = type[loc] || {};
type[loc]["夹击伤害"] = true;
}
}
}
@ -1317,9 +1235,18 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.status.hero.hp = 0;
core.updateStatusBar();
core.events.lose();
return;
} else {
core.updateStatusBar();
}
}
// 从v2.7开始,每一步行走不会再刷新状态栏。
// 如果有特殊要求如每走一步都加buff之类可手动取消注释下面这一句
// core.updateStatusBar(true);
// 检查自动事件
core.checkAutoEvents();
// 如需强行终止行走可以在这里条件判定:
// core.stopAutomaticRoute();
},
@ -1379,7 +1306,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 如果是隐藏状态栏模式,直接返回
if (!core.domStyle.showStatusBar) return;
// 作为样板,只绘制楼层、生命、攻击、防御、魔防、金币、钥匙这七个内容
// 作为样板,只绘制楼层、生命、攻击、防御、护盾、金币、钥匙这七个内容
// 需要其他的请自行进行修改;横竖屏都需要进行适配绘制。
// 可以使用Chrome浏览器开控制台来模拟手机上的竖屏模式的显示效果具体方式自行百度
// 横屏模式下的画布大小是 129*416

View File

@ -32,48 +32,39 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"ground": 0,
"grass": 1,
"grass2": 2,
"yellowWall": 3,
"whiteWall": 4,
"blueWall": 5,
"snowGround": 6,
"ground2": 7,
"ground3": 8,
"ground4": 9,
"sand": 10,
"ground5": 11,
"yellowWall2": 12,
"whiteWall2": 13,
"blueWall2": 14,
"blockWall": 15,
"grayWall": 16,
"white": 17,
"ground6": 18,
"soil": 19,
"ground7": 20,
"ground8": 21,
"ice": 22,
"downFloor": 23,
"upFloor": 24,
"yellowDoor": 25,
"blueDoor": 26,
"redDoor": 27,
"greenDoor": 28,
"specialDoor": 29,
"steelDoor": 30,
"blueShop-left": 31,
"blueShop-right": 32,
"pinkShop-left": 33,
"pinkShop-right": 34,
"arrowUp": 35,
"arrowDown": 36,
"arrowLeft": 37,
"arrowRight": 38,
"light": 39,
"darkLight": 40,
"ski": 41,
"flower": 42,
"box": 43,
"boxed": 44
"snowGround": 3,
"ground2": 4,
"ground3": 5,
"ground4": 6,
"sand": 7,
"ground5": 8,
"yellowWall2": 9,
"whiteWall2": 10,
"blueWall2": 11,
"blockWall": 12,
"grayWall": 13,
"white": 14,
"ground6": 15,
"soil": 16,
"ground7": 17,
"ground8": 18,
"ice": 19,
"downFloor": 20,
"upFloor": 21,
"blueShopLeft": 22,
"blueShopRight": 23,
"pinkShopLeft": 24,
"pinkShopRight": 25,
"arrowUp": 26,
"arrowDown": 27,
"arrowLeft": 28,
"arrowRight": 29,
"light": 30,
"darkLight": 31,
"ski": 32,
"flower": 33,
"box": 34,
"boxed": 35
},
"animates": {
"star": 0,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 22 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 32 KiB

After

Width:  |  Height:  |  Size: 42 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 75 KiB

0
project/images/npc48.png Executable file → Normal file
View File

Before

Width:  |  Height:  |  Size: 5.4 KiB

After

Width:  |  Height:  |  Size: 5.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 29 KiB

After

Width:  |  Height:  |  Size: 25 KiB

View File

@ -2,19 +2,22 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
{
"items": {
"yellowKey": {
"cls": "keys",
"cls": "tools",
"name": "黄钥匙",
"text": "可以打开一扇黄门"
"text": "可以打开一扇黄门",
"hideInToolbox": true
},
"blueKey": {
"cls": "keys",
"cls": "tools",
"name": "蓝钥匙",
"text": "可以打开一扇蓝门"
"text": "可以打开一扇蓝门",
"hideInToolbox": true
},
"redKey": {
"cls": "keys",
"cls": "tools",
"name": "红钥匙",
"text": "可以打开一扇红门"
"text": "可以打开一扇红门",
"hideInToolbox": true
},
"redJewel": {
"cls": "items",
@ -29,7 +32,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"greenJewel": {
"cls": "items",
"name": "绿宝石",
"text": "'魔防+${core.values.greenJewel}'"
"text": "'护盾+${core.values.greenJewel}'"
},
"yellowJewel": {
"cls": "items",
@ -182,13 +185,15 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"book": {
"cls": "constants",
"name": "怪物手册",
"text": "可以查看当前楼层各怪物属性"
"text": "可以查看当前楼层各怪物属性",
"hideInToolbox": true
},
"fly": {
"cls": "constants",
"name": "楼层传送器",
"text": "可以自由往来去过的楼层",
"hideInReplay": true
"hideInReplay": true,
"hideInToolbox": true
},
"coin": {
"cls": "constants",
@ -288,7 +293,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"hammer": {
"cls": "tools",
"name": "圣锤",
"text": "可以炸掉勇士面前的怪物"
"text": "该道具尚未被定义"
},
"lifeWand": {
"cls": "tools",
@ -339,7 +344,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"itemEffectTip": {
"redJewel": "',攻击+'+core.values.redJewel * ratio",
"blueJewel": "',防御+'+core.values.blueJewel * ratio",
"greenJewel": "'魔防+'+core.values.greenJewel * ratio",
"greenJewel": "'护盾+'+core.values.greenJewel * ratio",
"yellowJewel": "',全属性提升'",
"redPotion": "',生命+'+core.values.redPotion * ratio",
"bluePotion": "',生命+'+core.values.bluePotion * ratio",
@ -356,7 +361,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield2": "',防御+20'",
"shield3": "',防御+40'",
"shield4": "',防御+80'",
"shield5": "',防御+100魔防+100'",
"shield5": "',防御+100护盾+100'",
"bigKey": "',全钥匙+1'",
"superPotion": "',生命值翻倍'",
"moneyPocket": "',金币+500'"
@ -364,22 +369,21 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"useItemEffect": {
"book": "core.ui.drawBook(0);",
"fly": "core.ui.drawFly(core.floorIds.indexOf(core.status.floorId));",
"earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"pickaxe": "core.playSound('pickaxe.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"snow": "core.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"bigKey": "(function () {\n\tvar actions = core.status.event.ui.map(function (id) {\n\t\tvar block = core.status.thisMap.blocks[id];\n\t\treturn { \"type\": \"openDoor\", \"loc\": [block.x, block.y], \"async\": true };\n\t});\n\tactions.push({ \"type\": \"waitAsync\" });\n\tactions.push({ \"type\": \"tip\", \"text\": core.material.items[itemId].name + \"使用成功\" });\n\tcore.insertAction(actions);\n})();",
"bomb": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"hammer": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.ui);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"centerFly": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', core.bigmap.width-1-core.getHeroLoc('x'));\ncore.setHeroLoc('y', core.bigmap.height-1-core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.ui.x, 'y': core.status.event.ui.y};\nif (core.status.event.id == 'action') {\n\tcore.insertAction([\n\t\t{\"type\": \"changeFloor\", \"loc\": [loc.x, loc.y], \"direction\": loc.direction, \"floorId\": core.status.event.ui.id},\n\t\t{\"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功'}\n\t]);\n}\nelse {\n\tcore.changeFloor(core.status.event.ui.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\tcore.replay();\n\t});\n}",
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.ui.x, 'y': core.status.event.ui.y};\nif (core.status.event.id == 'action') {\n\tcore.insertAction([\n\t\t{\"type\": \"changeFloor\", \"loc\": [loc.x, loc.y], \"direction\": loc.direction, \"floorId\": core.status.event.ui.id},\n\t\t{\"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功'}\n\t]);\n}\nelse {\n\tcore.changeFloor(core.status.event.ui.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\tcore.replay();\n\t});\n}\n",
"earthquake": "(function () {\n\tvar indexes = [];\n\tfor (var index in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[index];\n\t\tif (!block.disable && block.event.canBreak) {\n\t\t\tindexes.push(index);\n\t\t}\n\t}\n\tcore.removeBlockByIndexes(indexes);\n\tcore.drawMap(core.status.floorId, function () {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t});\n})();",
"pickaxe": "(function () {\n\tvar canBreak = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable) return false;\n\t\treturn block.block.event.canBreak;\n\t};\n\n\tvar success = false;\n\tvar pickaxeFourDirections = false; // 是否四方向破如果是将其改成true\n\tif (pickaxeFourDirections) {\n\t\t// 四方向破\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBreak(nx, ny)) {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅破当前\n\t\tif (canBreak(core.nextX(), core.nextY())) {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.playSound('pickaxe.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\t// 无法使用\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
"icePickaxe": "(function () {\n\tcore.removeBlock(core.nextX(), core.nextY());\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n})();",
"snow": "(function () {\n\tvar success = false;\n\n\tvar snowFourDirections = false; // 是否四方向雪花如果是将其改成true\n\tif (snowFourDirections) {\n\t\t// 四方向雪花\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (core.getBlockId(nx, ny) == 'lava') {\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t\tsuccess = true;\n\t\t\t}\n\t\t}\n\t} else {\n\t\tif (core.getBlockId(core.nextX(), core.nextY()) == 'lava') {\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t\tsuccess = true;\n\t\t}\n\t}\n\n\tif (success) {\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip(\"当前无法使用\" + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n})();",
"bigKey": "(function () {\n\tvar actions = core.searchBlock(\"yellowDoor\").map(function (block) {\n\t\treturn { \"type\": \"openDoor\", \"loc\": [block.x, block.y], \"async\": true };\n\t});\n\tactions.push({ \"type\": \"waitAsync\" });\n\tactions.push({ \"type\": \"tip\", \"text\": core.material.items[itemId].name + \"使用成功\" });\n\tcore.insertAction(actions);\n})();",
"bomb": "(function () {\n\tvar canBomb = function (x, y) {\n\t\tvar block = core.getBlock(x, y);\n\t\tif (block == null || block.block.disable || block.block.event.cls.indexOf('enemy') != 0) return false;\n\t\tvar enemy = core.material.enemys[block.block.event.id];\n\t\treturn enemy && !enemy.notBomb;\n\t};\n\n\tvar bombList = []; // 炸掉的怪物坐标列表\n\tvar bombFourDirections = false; // 是否四方向可炸如果是将其改成true。\n\tif (bombFourDirections) {\n\t\t// 四方向炸\n\t\tfor (var direction in core.utils.scan) {\n\t\t\tvar delta = core.utils.scan[direction];\n\t\t\tvar nx = core.getHeroLoc('x') + delta.x,\n\t\t\t\tny = core.getHeroLoc('y') + delta.y;\n\t\t\tif (canBomb(nx, ny)) {\n\t\t\t\tbombList.push([nx, ny]);\n\t\t\t\tcore.removeBlock(nx, ny);\n\t\t\t}\n\t\t}\n\t} else {\n\t\t// 仅炸当前\n\t\tif (canBomb(core.nextX(), core.nextY())) {\n\t\t\tbombList.push([core.nextX(), core.nextY()]);\n\t\t\tcore.removeBlock(core.nextX(), core.nextY());\n\t\t}\n\t}\n\n\tif (bombList.length > 0) {\n\t\tcore.playSound('bomb.mp3');\n\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t} else {\n\t\tcore.drawTip('当前无法使用' + core.material.items[itemId].name);\n\t\tcore.addItem(itemId, 1);\n\t\treturn;\n\t}\n\n\t// 炸弹后事件\n\t// 这是一个使用炸弹也能开门的例子\n\t/*\n\tif (core.status.floorId=='xxx' && core.terrainExists(x0,y0,'specialDoor') // 某个楼层,该机关门存在\n\t\t&& !core.enemyExists(x1,y1) && !core.enemyExists(x2,y2)) // 且守门的怪物都不存在\n\t{\n\t\tcore.insertAction([ // 插入事件\n\t\t\t{\"type\": \"openDoor\", \"loc\": [x0,y0]} // 开门\n\t\t])\n\t}\n\t*/\n})();",
"centerFly": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', core.bigmap.width - 1 - core.getHeroLoc('x'));\ncore.setHeroLoc('y', core.bigmap.height - 1 - core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
"upFly": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) + 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
"downFly": "(function () {\n\tvar floorId = core.floorIds[core.floorIds.indexOf(core.status.floorId) - 1];\n\tif (core.status.event.id == 'action') {\n\t\tcore.insertAction([\n\t\t\t{ \"type\": \"changeFloor\", \"loc\": [core.getHeroLoc('x'), core.getHeroLoc('y')], \"floorId\": floorId },\n\t\t\t{ \"type\": \"tip\", \"text\": core.material.items[itemId].name + '使用成功' }\n\t\t]);\n\t} else {\n\t\tcore.changeFloor(floorId, null, core.status.hero.loc, null, function () {\n\t\t\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\t\t\tcore.replay();\n\t\t});\n\t}\n})();",
"poisonWine": "core.removeFlag('poison');",
"weakWine": "core.removeFlag('weak');\nif (core.values.weakValue>=1) { // >=1直接扣数值\n\tcore.status.hero.atk += core.values.weakValue;\n\tcore.status.hero.def += core.values.weakValue;\n}\nelse { // <1扣比例\n\tcore.addBuff(\"atk\", core.values.weakValue);\n\tcore.addBuff(\"def\", core.values.weakValue);\n}",
"curseWine": "core.removeFlag('curse');",
"superWine": "core.removeFlag('poison');\nif (core.hasFlag('weak')) {\n\tcore.removeFlag('weak');\n\tif (core.values.weakValue>=1) { // >=1直接扣数值\n\t\tcore.status.hero.atk += core.values.weakValue;\n\t\tcore.status.hero.def += core.values.weakValue;\n\t}\n\telse { // <1扣比例\n\t\tcore.addBuff(\"atk\", core.values.weakValue);\n\t\tcore.addBuff(\"def\", core.values.weakValue);\n\t}\n}\ncore.removeFlag('curse');",
"lifeWand": "core.insertAction([\n\t{\"type\": \"input\", \"text\": \"请输入生命魔杖使用次数:(0-${item:lifeWand})\"},\n\t{\"type\": \"if\", \"condition\": \"flag:input<=item:lifeWand\",\n\t\t\"true\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"item:lifeWand\", \"value\": \"item:lifeWand-flag:input\"},\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+flag:input*100\"},\n\t\t\t\"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。\"\n\t\t],\n\t\t\"false\": [\"输入不合法!\"]\n\t},\n]);\ncore.addItem('lifeWand', 1);",
"jumpShoes": "core.insertAction({\"type\":\"jumpHero\",\"loc\":[core.nextX(2),core.nextY(2)]});",
"lifeWand": null,
"jumpShoes": "core.insertAction({ \"type\": \"jumpHero\", \"loc\": [core.nextX(2), core.nextY(2)] });",
"redPotion": "core.status.hero.hp += core.values.redPotion",
"bluePotion": "core.status.hero.hp += core.values.bluePotion",
"greenPotion": "core.status.hero.hp += core.values.greenPotion",
@ -387,28 +391,27 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"redJewel": "core.status.hero.atk += core.values.redJewel",
"blueJewel": "core.status.hero.def += core.values.blueJewel",
"greenJewel": "core.status.hero.mdef += core.values.greenJewel",
"yellowJewel": "core.insertAction([\n\t{\"type\": \"choices\", \"choices\": [\n\t\t{\"text\": \"攻击+1\", \"action\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:atk\", \"value\": \"status:atk+1\"}\n\t\t]},\n\t\t{\"text\": \"防御+2\", \"action\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:def\", \"value\": \"status:def+2\"}\n\t\t]},\n\t\t{\"text\": \"生命+200\", \"action\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+200\"}\n\t\t]},\n\t]}\n]);",
"yellowJewel": null,
"skill1": "// 二倍斩的flag:skill为1\nif (core.getFlag('skill', 0)==0) { // 判断当前是否已经开了技能\n\tif (core.getStatus('mana')>=5) { // 这里要写当前能否开技能的条件判断,比如魔力值至少要多少\n\t\tcore.setFlag('skill', 1); // 开技能1\n\t\tcore.setFlag('skillName', '二倍斩'); // 设置技能名\n\t}\n\telse {\n\t\tcore.drawTip(\"魔力不足,无法开启技能\");\n\t}\n}\nelse { // 关闭技能\n\tcore.setFlag('skill', 0); // 关闭技能状态\n\tcore.setFlag('skillName', '无');\n}"
},
"canUseItemEffect": {
"book": "true",
"fly": "(function () {\n\treturn core.status.maps[core.status.floorId].canFlyTo;\n})();",
"pickaxe": "(function() {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && core.nearHero(block.x, block.y) && \n\t\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) { // 能破哪些墙\n\t\t\t// 四个方向\n\t\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse id2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\telse if (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"icePickaxe": "(function() {\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\t\tcore.status.event.ui = [i];\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"bomb": "(function () {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.event.cls.indexOf('enemy')==0 && core.nearHero(block.x, block.y)) {\n\t\t\tvar enemy = core.material.enemys[block.event.id];\n\t\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse\n\t\t\t\tid2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\tif (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"hammer": "(function() {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.event.cls.indexOf('enemy')==0 && core.nearHero(block.x, block.y)) {\n\t\t\tvar enemy = core.material.enemys[block.event.id];\n\t\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\t\tids.push(i);\n\t\t\telse\n\t\t\t\tid2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\telse if (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"earthquake": "(function () {\n\tvar able=false;\n\tvar ids = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable &&\n\t\t\t(block.event.canBreak || block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) { // 能炸的墙壁\n\t\t\tids.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\table=true;\n\t}\n\treturn able;\n})();",
"centerFly": "(function () {\n\tvar toX = core.bigmap.width-1-core.getHeroLoc('x'), toY = core.bigmap.height-1-core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();",
"upFly": "(function() {\n\tvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\n\tif (index<core.floorIds.length-1) {\n\t\tvar toId = core.floorIds[index+1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width, mh = core.floors[toId].height;\n\t\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\t\tcore.status.event.ui = {'id': toId, 'x': toX, 'y': toY};\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"downFly": "(function() {\n\tvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\n\tif (index>0) {\n\t\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width, mh = core.floors[toId].height;\n\t\tif (toX>=0 && toX<mw && toY>=0 && toY<mh && core.getBlock(toX, toY, toId)==null) {\n\t\t\tcore.status.event.ui = {'id': toId, 'x': toX, 'y': toY};\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"snow": "(function () {\n\tvar ids = [], id2s = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.event.id == 'lava' && core.nearHero(block.x, block.y)) {\n\t\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\t\tids.push(i);\n\t\t\telse id2s.push(i);\n\t\t}\n\t}\n\tif (ids.length>0) {\n\t\tcore.status.event.ui = ids;\n\t\treturn true;\n\t}\n\tif (id2s.length==1) {\n\t\tcore.status.event.ui = id2s;\n\t\treturn true;\n\t}\n\treturn false;\n})();",
"bigKey": "(function () {\n\tvar able = false,\n\t\tids = [];\n\tfor (var i in core.status.thisMap.blocks) {\n\t\tvar block = core.status.thisMap.blocks[i];\n\t\tif (!block.disable && block.event.id == 'yellowDoor') {\n\t\t\tids.push(i);\n\t\t}\n\t}\n\tif (ids.length > 0) {\n\t\tcore.status.event.ui = ids;\n\t\table = true;\n\t}\n\treturn able;\n})();",
"pickaxe": "true",
"icePickaxe": "(function () {\n\treturn core.getBlockId(core.nextX(), core.nextY()) == 'ice';\n})();",
"bomb": "true",
"earthquake": "(function () {\n\treturn core.status.thisMap.blocks.filter(function (block) {\n\t\treturn !block.disable && block.event.canBreak;\n\t}).length > 0;\n})();",
"centerFly": "(function () {\n\tvar toX = core.bigmap.width - 1 - core.getHeroLoc('x'),\n\t\ttoY = core.bigmap.height - 1 - core.getHeroLoc('y');\n\tvar id = core.getBlockId(toX, toY);\n\treturn id == null;\n})();",
"upFly": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index < core.floorIds.length - 1) {\n\t\tvar toId = core.floorIds[index + 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"downFly": "(function () {\n\tvar floorId = core.status.floorId,\n\t\tindex = core.floorIds.indexOf(floorId);\n\tif (index > 0) {\n\t\tvar toId = core.floorIds[index - 1],\n\t\t\ttoX = core.getHeroLoc('x'),\n\t\t\ttoY = core.getHeroLoc('y');\n\t\tvar mw = core.floors[toId].width,\n\t\t\tmh = core.floors[toId].height;\n\t\tif (toX >= 0 && toX < mw && toY >= 0 && toY < mh && core.getBlock(toX, toY, toId) == null) {\n\t\t\treturn true;\n\t\t}\n\t}\n\treturn false;\n})();",
"snow": "true",
"bigKey": "(function () {\n\treturn core.searchBlock('yellowDoor').length > 0;\n})();",
"poisonWine": "core.hasFlag('poison');",
"weakWine": "core.hasFlag('weak');",
"curseWine": "core.hasFlag('curse');",
"superWine": "(function() {\n\treturn core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse');\n})();",
"lifeWand": "true",
"jumpShoes": "(function() {\n\tvar nx=core.nextX(2), ny=core.nextY(2);\n\treturn nx>=0 && nx<core.bigmap.width && ny>=0 && ny<core.bigmap.height && core.getBlockId(nx,ny)==null;\n})();",
"jumpShoes": "(function () {\n\tvar nx = core.nextX(2),\n\t\tny = core.nextY(2);\n\treturn nx >= 0 && nx < core.bigmap.width && ny >= 0 && ny < core.bigmap.height && core.getBlockId(nx, ny) == null;\n})();",
"redPotion": "true",
"bluePotion": "true",
"greenPotion": "true",
@ -419,5 +422,83 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"yellowJewel": "true",
"skill1": "true"
},
"equipCondition": {}
"equipCondition": {},
"useItemEvent": {
"yellowJewel": [
{
"type": "choices",
"choices": [
{
"text": "攻击+1",
"action": [
{
"type": "setValue",
"name": "status:atk",
"operator": "+=",
"value": "1"
}
]
},
{
"text": "防御+2",
"action": [
{
"type": "setValue",
"name": "status:def",
"operator": "+=",
"value": "2"
}
]
},
{
"text": "生命+200",
"action": [
{
"type": "setValue",
"name": "status:hp",
"operator": "+=",
"value": "200"
}
]
}
]
}
],
"lifeWand": [
{
"type": "comment",
"text": "先恢复一个魔杖(因为使用道具必须消耗一个)"
},
{
"type": "function",
"function": "function(){\ncore.addItem('lifeWand', 1);\n}"
},
{
"type": "input",
"text": "请输入生命魔杖使用次数:(0-${item:lifeWand})"
},
{
"type": "if",
"condition": "flag:input<=item:lifeWand",
"true": [
{
"type": "setValue",
"name": "item:lifeWand",
"operator": "-=",
"value": "flag:input"
},
{
"type": "setValue",
"name": "status:hp",
"operator": "+=",
"value": "flag:input*100"
},
"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。"
],
"false": [
"输入不合法!"
]
}
]
}
}

View File

@ -1,22 +1,22 @@
var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
{
"1": {"cls":"terrains","id":"yellowWall","canBreak":true},
"2": {"cls":"terrains","id":"whiteWall","canBreak":true},
"3": {"cls":"terrains","id":"blueWall","canBreak":true},
"4": {"cls":"animates","id":"star","noPass":true},
"5": {"cls":"animates","id":"lava","noPass":true},
"1": {"cls":"animates","id":"yellowWall","canBreak":true,"animate":1,"doorInfo":[null,"door.mp3","door.mp3"]},
"2": {"cls":"animates","id":"whiteWall","canBreak":true,"animate":1,"doorInfo":[null,"door.mp3","door.mp3"]},
"3": {"cls":"animates","id":"blueWall","canBreak":true,"animate":1,"doorInfo":[null,"door.mp3","door.mp3"]},
"4": {"cls":"animates","id":"star","name":"星空"},
"5": {"cls":"animates","id":"lava","name":"岩浆"},
"6": {"cls":"terrains","id":"ice"},
"7": {"cls":"terrains","id":"blueShop-left"},
"8": {"cls":"terrains","id":"blueShop-right"},
"9": {"cls":"terrains","id":"pinkShop-left"},
"10": {"cls":"terrains","id":"pinkShop-right"},
"11": {"cls":"animates","id":"lavaNet","noPass":false,"trigger":"passNet"},
"12": {"cls":"animates","id":"poisonNet","noPass":false,"trigger":"passNet"},
"13": {"cls":"animates","id":"weakNet","noPass":false,"trigger":"passNet"},
"14": {"cls":"animates","id":"curseNet","noPass":false,"trigger":"passNet"},
"15": {"cls":"animates","id":"blueWater","noPass":true},
"16": {"cls":"animates","id":"water","noPass":true},
"20": {"cls":"autotile","id":"autotile","noPass":true},
"7": {"cls":"terrains","id":"blueShopLeft"},
"8": {"cls":"terrains","id":"blueShopRight"},
"9": {"cls":"terrains","id":"pinkShopLeft"},
"10": {"cls":"terrains","id":"pinkShopRight"},
"11": {"cls":"animates","id":"lavaNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 血网的伤害效果移动到 checkBlock 中处理\n\n\t// 如果要做一次性血网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})();","name":"血网"},
"12": {"cls":"animates","id":"poisonNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行毒处理\n\tif (!core.hasItem('shoes')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [0] });\n\t}\n\n\t// 如果要做一次性毒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"毒网"},
"13": {"cls":"animates","id":"weakNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行衰处理\n\tif (!core.hasItem('shoes')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [1] });\n\t}\n\n\t// 如果要做一次性衰网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"衰网"},
"14": {"cls":"animates","id":"curseNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行咒处理\n\tif (!core.hasItem('shoes')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [2] });\n\t}\n\n\t// 如果要做一次性咒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"咒网"},
"15": {"cls":"animates","id":"blueWater"},
"16": {"cls":"animates","id":"water"},
"20": {"cls":"autotile","id":"autotile"},
"21": {"cls":"items","id":"yellowKey"},
"22": {"cls":"items","id":"blueKey"},
"23": {"cls":"items","id":"redKey"},
@ -68,20 +68,20 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"71": {"cls":"items","id":"shield0"},
"72": {"cls":"items","id":"skill1"},
"73": {"cls":"items","id":"wand"},
"81": {"cls":"terrains","id":"yellowDoor","trigger":"openDoor"},
"82": {"cls":"terrains","id":"blueDoor","trigger":"openDoor"},
"83": {"cls":"terrains","id":"redDoor","trigger":"openDoor"},
"84": {"cls":"terrains","id":"greenDoor","trigger":"openDoor"},
"85": {"cls":"terrains","id":"specialDoor","trigger":"openDoor"},
"86": {"cls":"terrains","id":"steelDoor","trigger":"openDoor"},
"87": {"cls":"terrains","id":"upFloor","noPass":false},
"88": {"cls":"terrains","id":"downFloor","noPass":false},
"89": {"cls":"animates","id":"portal","noPass":false},
"90": {"cls":"animates","id":"starPortal","noPass":false},
"91": {"cls":"animates","id":"upPortal","noPass":false},
"92": {"cls":"animates","id":"leftPortal","noPass":false},
"93": {"cls":"animates","id":"downPortal","noPass":false},
"94": {"cls":"animates","id":"rightPortal","noPass":false},
"81": {"cls":"animates","id":"yellowDoor","trigger":"openDoor","animate":1,"doorInfo":[{"yellowKey":1},"door.mp3","door.mp3"],"name":"黄门"},
"82": {"cls":"animates","id":"blueDoor","trigger":"openDoor","animate":1,"doorInfo":[{"blueKey":1},"door.mp3","door.mp3"],"name":"蓝门"},
"83": {"cls":"animates","id":"redDoor","trigger":"openDoor","animate":1,"doorInfo":[{"redKey":1},"door.mp3","door.mp3"],"name":"红门"},
"84": {"cls":"animates","id":"greenDoor","trigger":"openDoor","animate":1,"doorInfo":[{"greenKey":1},"door.mp3","door.mp3"],"name":"绿门"},
"85": {"cls":"animates","id":"specialDoor","trigger":"openDoor","animate":1,"doorInfo":[null,"door.mp3","door.mp3"],"name":"机关门"},
"86": {"cls":"animates","id":"steelDoor","trigger":"openDoor","animate":1,"doorInfo":[{"steelKey":1},"door.mp3","door.mp3"],"name":"铁门"},
"87": {"cls":"terrains","id":"upFloor","canPass":true},
"88": {"cls":"terrains","id":"downFloor","canPass":true},
"89": {"cls":"animates","id":"portal","canPass":true},
"90": {"cls":"animates","id":"starPortal","canPass":true},
"91": {"cls":"animates","id":"upPortal","canPass":true},
"92": {"cls":"animates","id":"leftPortal","canPass":true},
"93": {"cls":"animates","id":"downPortal","canPass":true},
"94": {"cls":"animates","id":"rightPortal","canPass":true},
"101": {"cls":"animates","id":"crystalUp"},
"102": {"cls":"animates","id":"crystalBottom"},
"103": {"cls":"animates","id":"fire"},
@ -102,19 +102,19 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"134": {"cls":"npc48","id":"npc1","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}},
"135": {"cls":"npc48","id":"npc2","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}},
"136": {"cls":"npc48","id":"npc3","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}},
"151": {"cls":"autotile","id":"autotile1","noPass":true},
"152": {"cls":"autotile","id":"autotile2","noPass":true},
"153": {"cls":"autotile","id":"autotile3","noPass":true},
"161": {"cls":"terrains","id":"arrowUp","noPass":false,"cannotOut":["left","right","down"],"cannotIn":["down"]},
"162": {"cls":"terrains","id":"arrowDown","noPass":false,"cannotOut":["left","right","up"],"cannotIn":["up"]},
"163": {"cls":"terrains","id":"arrowLeft","noPass":false,"cannotOut":["up","down","right"],"cannotIn":["right"]},
"164": {"cls":"terrains","id":"arrowRight","noPass":false,"cannotOut":["up","down","left"],"cannotIn":["left"]},
"165": {"cls":"terrains","id":"light","trigger":"changeLight","noPass":false},
"166": {"cls":"terrains","id":"darkLight","noPass":true},
"167": {"cls":"terrains","id":"ski","trigger":"ski","noPass":false},
"168": {"cls":"terrains","id":"flower","noPass":false},
"169": {"cls":"terrains","id":"box","trigger":"pushBox","noPass":true},
"170": {"cls":"terrains","id":"boxed","trigger":"pushBox","noPass":true},
"151": {"cls":"autotile","id":"autotile1"},
"152": {"cls":"autotile","id":"autotile2"},
"153": {"cls":"autotile","id":"autotile3"},
"161": {"cls":"terrains","id":"arrowUp","canPass":true,"cannotOut":["left","right","down"],"cannotIn":["up"]},
"162": {"cls":"terrains","id":"arrowDown","canPass":true,"cannotOut":["left","right","up"],"cannotIn":["down"]},
"163": {"cls":"terrains","id":"arrowLeft","canPass":true,"cannotOut":["up","down","right"],"cannotIn":["left"]},
"164": {"cls":"terrains","id":"arrowRight","canPass":true,"cannotOut":["up","down","left"],"cannotIn":["right"]},
"165": {"cls":"terrains","id":"light","trigger":"null","canPass":true,"script":"(function () {\n\tcore.setBlock(core.getNumberById('darkLight'), core.getHeroLoc('x'), core.getHeroLoc('y'));\n})();"},
"166": {"cls":"terrains","id":"darkLight"},
"167": {"cls":"terrains","id":"ski","trigger":"ski","canPass":true},
"168": {"cls":"terrains","id":"flower","canPass":true},
"169": {"cls":"terrains","id":"box","trigger":"pushBox"},
"170": {"cls":"terrains","id":"boxed","trigger":"pushBox"},
"181": {"cls":"npcs","id":"wlt"},
"182": {"cls":"npcs","id":"wt"},
"183": {"cls":"npcs","id":"wrt"},
@ -194,5 +194,24 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"261": {"cls":"enemy48","id":"angel"},
"262": {"cls":"enemy48","id":"elemental"},
"263": {"cls":"enemy48","id":"steelGuard"},
"264": {"cls":"enemy48","id":"evilBat"}
"264": {"cls":"enemy48","id":"evilBat"},
"300": {"cls":"terrains","id":"ground"},
"301": {"cls":"terrains","id":"grass"},
"302": {"cls":"terrains","id":"grass2"},
"303": {"cls":"terrains","id":"snowGround"},
"304": {"cls":"terrains","id":"ground2"},
"305": {"cls":"terrains","id":"ground3"},
"306": {"cls":"terrains","id":"ground4"},
"307": {"cls":"terrains","id":"sand"},
"308": {"cls":"terrains","id":"ground5"},
"309": {"cls":"terrains","id":"yellowWall2"},
"310": {"cls":"terrains","id":"whiteWall2"},
"311": {"cls":"terrains","id":"blueWall2"},
"312": {"cls":"terrains","id":"blockWall"},
"313": {"cls":"terrains","id":"grayWall"},
"314": {"cls":"terrains","id":"white"},
"315": {"cls":"terrains","id":"ground6"},
"316": {"cls":"terrains","id":"soil"},
"317": {"cls":"terrains","id":"ground7"},
"318": {"cls":"terrains","id":"ground8"}
}

View File

@ -39,7 +39,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// core.plugin.drawLight('ui', 0.95, [[25,11,46]]); // 在ui层绘制全图不透明度0.95,其中在(25,11)点存在一个半径为46的灯光效果。
// core.plugin.drawLight('test', 0.2, [[25,11,46,0.1]]); // 创建一个test图层不透明度0.2,其中在(25,11)点存在一个半径为46的灯光效果灯光中心不透明度0.1。
// core.plugin.drawLight('test2', 0.9, [[25,11,46],[105,121,88],[301,221,106]]); // 创建test2图层且存在三个灯光效果分别是中心(25,11)半径46中心(105,121)半径88中心(301,221)半径106。
// core.plugin.drawLight('xxx', 0.3, [[25,11,46],[105,121,88,0.2]], 0.4); // 存在两个灯光效果它们在内圈40%范围内保持全亮,40%后才开始衰减。
// core.plugin.drawLight('xxx', 0.3, [[25,11,46],[105,121,88,0.2]], 0.4); // 存在两个灯光效果它们在内圈40%范围内保持全亮,40%后才开始衰减。
this.drawLight = function (name, color, lights, lightDec) {
// 清空色调层也可以修改成其它层比如animate/weather层或者用自己创建的canvas
@ -84,6 +84,142 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
ctx.globalCompositeOperation = 'source-over';
// 可以在任何地方如afterXXX或自定义脚本事件调用函数方法为 core.plugin.xxx();
}
},
"shop": function () {
// 【全局商店】相关的功能
//
// 打开一个全局商店
// shopId要打开的商店idnoRoute是否不计入录像
this.openShop = function (shopId, noRoute) {
var shop = core.status.shops[shopId];
// Step 1: 检查能否打开此商店
if (!this.canOpenShop(shopId)) {
core.drawTip("该商店尚未开启");
return false;
}
// Step 2: (如有必要)记录打开商店的脚本事件
if (!noRoute) {
core.status.route.push("shop:" + shopId);
}
// Step 3: 检查道具商店 or 公共事件
if (shop.item) {
if (core.openItemShop) {
core.openItemShop(shopId);
} else {
core.insertAction("道具商店插件不存在!请检查是否存在该插件!");
}
return;
}
if (shop.commonEvent) {
core.insertAction({ "type": "insert", "name": shop.commonEvent, "args": shop.args });
return;
}
// Step 4: 执行标准公共商店
core.insertAction(this._convertShop(shop));
return true;
}
////// 将一个全局商店转变成可预览的公共事件 //////
this._convertShop = function (shop) {
return [{
"type": "while",
"condition": "true",
"data": [
// 检测能否访问该商店
{
"type": "if",
"condition": "core.isShopVisited('" + shop.id + "')",
"true": [
// 可以访问,直接插入执行效果
{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', false) }" },
],
"false": [
// 不能访问的情况下:检测能否预览
{
"type": "if",
"condition": shop.disablePreview,
"true": [
// 不可预览,提示并退出
"当前无法访问该商店!",
{ "type": "break" },
],
"false": [
// 可以预览:将商店全部内容进行替换
{ "type": "tip", "text": "当前处于预览模式,不可购买" },
{ "type": "function", "function": "function() { core.plugin._convertShop_replaceChoices('" + shop.id + "', true) }" },
]
}
]
}
]
}];
}
this._convertShop_replaceChoices = function (shopId, previewMode) {
var shop = core.status.shops[shopId];
var choices = (shop.choices || []).filter(function (choice) {
if (choice.condition == null || choice.condition == '') return true;
try { return core.calValue(choice.condition); } catch (e) { return true; }
}).map(function (choice) {
var ableToBuy = core.calValue(choice.need);
return {
"text": choice.text,
"icon": choice.icon,
"color": ableToBuy && !previewMode ? choice.color : [153, 153, 153, 1],
"action": ableToBuy && !previewMode ? choice.action : [
{ "type": "tip", "text": previewMode ? "预览模式下不可购买" : "购买条件不足" }
]
};
}).concat({ "text": "离开", "action": [{ "type": "break" }] });
core.insertAction({ "type": "choices", "text": shop.text, "choices": choices });
}
/// 是否访问过某个快捷商店
this.isShopVisited = function (id) {
if (!core.hasFlag("__shops__")) core.setFlag("__shops__", {});
var shops = core.getFlag("__shops__");
if (!shops[id]) shops[id] = {};
return shops[id].visited;
}
/// 当前应当显示的快捷商店列表
this.listShopIds = function () {
return Object.keys(core.status.shops).filter(function (id) {
return core.isShopVisited(id) || !core.status.shops[id].mustEnable;
});
}
/// 是否能够打开某个商店
this.canOpenShop = function (id) {
if (this.isShopVisited(id)) return true;
var shop = core.status.shops[id];
if (shop.item || shop.commonEvent || shop.mustEnable) return false;
return true;
}
/// 启用或禁用某个快捷商店
this.setShopVisited = function (id, visited) {
if (!core.hasFlag("__shops__")) core.setFlag("__shops__", {});
var shops = core.getFlag("__shops__");
if (!shops[id]) shops[id] = {};
if (visited) shops[id].visited = true;
else delete shops[id].visited;
}
/// 能否使用快捷商店
this.canUseQuickShop = function (id) {
// 如果返回一个字符串,表示不能,字符串为不能使用的提示
// 返回null代表可以使用
// 检查当前楼层的canUseQuickShop选项是否为false
if (core.status.thisMap.canUseQuickShop === false)
return '当前楼层不能使用快捷商店。';
return null;
}
},
"itemShop": function () {
// 道具商店相关的插件
@ -97,6 +233,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
var totalPage = 0;
var totalMoney = 0;
var list = [];
var shopInfo = null; // 商店信息
var choices = []; // 商店选项
var bigFont = core.ui._buildFont(20, false),
middleFont = core.ui._buildFont(18, false);
@ -107,16 +245,15 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// Step 1: 背景和固定的几个文字
core.ui._createUIEvent();
core.clearMap('uievent');
core.ui._uievent_drawSelector({ "code": 1 });
core.ui._uievent_drawSelector({ "code": 2 });
core.ui._clearUIEventSelector([1, 2]);
core.setTextAlign('uievent', 'left');
core.setTextBaseline('uievent', 'top');
core.fillRect('uievent', 0, 0, 416, 416, 'black');
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 0, y: 0, width: 416, height: 56 });
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 0, y: 56, width: 312, height: 56 });
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 0, y: 112, width: 312, height: 304 });
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 312, y: 56, width: 104, height: 56 });
core.ui._uievent_drawBackground({ background: 'winskin.png', x: 312, y: 112, width: 104, height: 304 });
core.drawWindowSkin('winskin.png', 'uievent', 0, 0, 416, 56);
core.drawWindowSkin('winskin.png', 'uievent', 0, 56, 312, 56);
core.drawWindowSkin('winskin.png', 'uievent', 0, 112, 312, 304);
core.drawWindowSkin('winskin.png', 'uievent', 312, 56, 104, 56);
core.drawWindowSkin('winskin.png', 'uievent', 312, 112, 104, 304);
core.setFillStyle('uievent', 'white');
core.setStrokeStyle('uievent', 'white');
core.fillText("uievent", "购买", 32, 74, 'white', bigFont);
@ -138,14 +275,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
if (selectItem != null) {
core.setTextAlign('uievent', 'center');
core.fillText("uievent", type == 0 ? "买入个数" : "卖出个数", 364, 320, null, bigFont);
core.fillText("uievent", "◀ " + selectCount + " ▶", 364, 350);
core.fillText("uievent", "< " + selectCount + " >", 364, 350);
core.fillText("uievent", "确定", 364, 380);
}
// Step 2获得列表并展示
var choices = core.status.shops[shopId].choices;
list = choices.filter(function (one) {
if (one.condition != null) {
if (one.condition != null && one.condition != '') {
try { if (!core.calValue(one.condition)) return false; } catch (e) {}
}
return (type == 0 && one.money != null) || (type == 1 && one.sell != null);
@ -181,7 +317,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
var text = core.material.items[item.id].text || "该道具暂无描述";
try { text = core.replaceText(text); } catch (e) {}
for (var fontSize = 20; fontSize >= 8; fontSize -= 2) {
var config = { left: 10, fontSize: fontSize, maxWidth: 403, lineHeight: 1.4 };
var config = { left: 10, fontSize: fontSize, maxWidth: 403 };
var height = core.getTextContentHeight(text, config);
if (height <= 50) {
config.top = (56 - height) / 2;
@ -319,7 +455,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
}
if (px >= 222 && px <= 282 && py >= 71 && py <= 102) // 离开
return core.insertAction({ "type": "break" });
// ◀,▶
// < >
if (px >= 318 && px <= 341 && py >= 348 && py <= 376)
return _add(item, -1);
if (px >= 388 && px <= 416 && py >= 348 && py <= 376)
@ -330,11 +466,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
// 上一页/下一页
if (px >= 45 && px <= 105 && py >= 388) {
if (page > 1) selectItem -= 6;
if (page > 1) {
selectItem -= 6;
selectCount = 0;
}
return;
}
if (px >= 208 && px <= 268 && py >= 388) {
if (page < totalPage) selectItem = Math.min(selectItem + 6, list.length - 1);
if (page < totalPage) {
selectItem = Math.min(selectItem + 6, list.length - 1);
selectCount = 0;
}
return;
}
@ -363,6 +505,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
page = 0;
selectItem = null;
selectCount = 0;
shopInfo = flags.__shops__[shopId];
if (shopInfo.choices == null) shopInfo.choices = core.clone(core.status.shops[shopId].choices);
choices = shopInfo.choices;
core.insertAction([{
"type": "while",
"condition": "true",
@ -372,44 +518,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
{ "type": "function", "function": "function() { core.performItemShopAction(); }" }
]
},
{ "type": "function", "function": "function () { " +
"core.deleteCanvas('uievent'); " +
"core.ui._uievent_drawSelector({ \"code\": 1 }); " +
"core.ui._uievent_drawSelector({ \"code\": 2 }); " +
"}" }
{
"type": "function",
"function": "function () { core.deleteCanvas('uievent'); core.ui._clearUIEventSelector([1, 2]); }"
}
]);
}
// Write item number to save
core.control.saveData = function () {
var data = this.controldata.saveData();
for (var shopId in core.status.shops) {
if (core.status.shops[shopId].item) {
data.shops[shopId].choices = core.status.shops[shopId].choices.map(function (t) {
return {
number: t.number,
money_count: t.money_count || 0,
sell_count: t.sell_count || 0
}
});
}
}
return data;
}
core.control.loadData = function (data, callback) {
this.controldata.loadData(data, callback);
for (var shopId in data.shops) {
if (data.shops[shopId].choices) {
for (var i = 0; i < data.shops[shopId].choices.length; ++i) {
core.status.shops[shopId].choices[i].number = data.shops[shopId].choices[i].number;
core.status.shops[shopId].choices[i].money_count = data.shops[shopId].choices[i].money_count;
core.status.shops[shopId].choices[i].sell_count = data.shops[shopId].choices[i].sell_count;
}
}
}
}
},
"smoothCamera": function () {
@ -552,8 +667,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
};
// 更变楼层的行为追加,重置镜头
events.prototype.changingFloor = function (floorId, heroLoc, fromLoad) {
this.eventdata.changingFloor(floorId, heroLoc, fromLoad);
events.prototype.changingFloor = function (floorId, heroLoc) {
this.eventdata.changingFloor(floorId, heroLoc);
core.plugin.camera.resetCamera();
};

28
runtime.d.ts vendored
View File

@ -58,7 +58,7 @@ type Enemy = {
atk: number
def: number
money: number
experience: number
exp: number
point: number
[key: string]: any
}
@ -81,8 +81,6 @@ type SystemFlags = {
enableXxx: boolean
flyNearStair: boolean
steelDoorWithoutKey: boolean
hatredDecrease: boolean
betweenAttackCeil: boolean
betweenAttackMax: boolean
ignoreChangeFloor: boolean
disableShopOnDamage: boolean
@ -105,7 +103,7 @@ type HeroStatus = {
def: number
mdef: number
money: number
experience: number
exp: number
loc: {
direction: direction
x: number
@ -123,7 +121,7 @@ type HeroStatus = {
battle: number
battleDamage: number
currTime: number
experience: number
exp: number
extraDamage: number
hp: number
ignoreSteps: number
@ -407,7 +405,7 @@ declare class control {
/**
*
* @example core.setStatus('loc', {x : 0, y : 0, direction : 'up'}); // 设置主角位置为地图左上角,脸朝上
* @param name 'x''y''direction' core.setHeroLoc(name, value)('exp''experience') core.status.hero[name]
* @param name 'x''y''direction' core.setHeroLoc(name, value)('exp''exp') core.status.hero[name]
* @param value
*/
setStatus<K extends keyof HeroStatus>(name: K, value: HeroStatus[K]): void
@ -423,7 +421,7 @@ declare class control {
/**
*
* @example core.getStatus('loc'); // 读取主角的坐标和朝向
* @param name 'x''y''direction' core.getHeroLoc(name)('exp''experience') core.status.hero[name]
* @param name 'x''y''direction' core.getHeroLoc(name)('exp''exp') core.status.hero[name]
* @returns
*/
getStatus<K extends keyof HeroStatus>(name: K): HeroStatus[K]
@ -833,17 +831,6 @@ declare class enemys {
*/
getDamage(enemy: string | Enemy, x?: number, y?: number, floorId?: string): number
/**
*
* @example core.getExtraDamage('greenSlime',0,0,'MT0') // 绿头怪的固伤加仇恨伤害
* @param enemy id或敌人对象
* @param x
* @param y
* @param floorId
* @returns
*/
getExtraDamage(enemy: string | Enemy, x?: number, y?: number, floorId?: string): number
/**
*
* @example core.getDamageString('greenSlime', 0, 0, 'MT0') // 绿头怪的地图显伤
@ -1203,7 +1190,7 @@ declare class maps {
* @param callback
* @returns core.stopAnimate()
*/
drawAnimate(name: string, x: number, y: number, callback?: () => void): number
drawAnimate(name: string, x: number, y: number, alignWindow: boolean, callback?: () => void): number
}
/** @file items.js 主要负责一切和道具相关的内容。 */
@ -1506,7 +1493,7 @@ declare class utils {
* @param times
* @returns
*/
replaceText(text: string, need?: number, times?: number): string
replaceText(text: string, prefix?: string, need?: number, times?: number): string
/**
* 如status:xxx等
@ -1880,7 +1867,6 @@ type core = {
height: number
tempCanvas: CanvasRenderingContext2D // A temp canvas for drawing
}
paint: {};
saves: {
saveIndex: number
ids: { [key: number]: boolean }

View File

@ -24,7 +24,7 @@ except:
p("需要flask才可使用本服务。\n安装方式:%s install flask" % ("pip3" if isPy3 else "pip"))
exit(1)
app = Flask(__name__, static_folder='')
app = Flask(__name__, static_folder='__static__')
app.config['SEND_FILE_MAX_AGE_DEFAULT'] = 0
@app.after_request
@ -45,7 +45,7 @@ def get_mimetype(path):
return mimetypes.guess_type(path)[0] or 'application/octet-stream'
def get_file(path):
if not os.path.exists(path):
if not os.path.isfile(path):
abort(404)
return None
if not is_sub(path):
@ -61,6 +61,12 @@ def root():
@app.route('/<path:path>', methods=['GET'])
def static_file(path):
if os.path.isdir(path):
if not path.endswith('/'): path += '/'
path += 'index.html'
if not os.path.isfile(path):
abort(404)
return None
return Response(get_file(path), mimetype = get_mimetype(path))
def process_request():

View File

@ -219,6 +219,7 @@
}
#statusBar span{
font: bold italic 1.1em Verdana;
display: inline;
}
#statusBar p {
display: inline-block;
@ -294,22 +295,27 @@ p#name {
#bg {
z-index: 10;
image-rendering: pixelated;
}
#event {
z-index: 30;
image-rendering: pixelated;
}
#hero {
z-index: 40;
image-rendering: pixelated;
}
#event2 {
z-index: 50;
image-rendering: pixelated;
}
#fg {
z-index: 60;
image-rendering: pixelated;
}
#damage {

135
v2.x-final更新.txt Normal file
View File

@ -0,0 +1,135 @@
(已完成!) 1.(来自鹿神)门和像三种基础墙一样的墙应当提供一个“需要消耗多少把哪种钥匙、开关门分别播放什么音效”的属性,如[{"yellowKey": 2, "blueKey": 1}, "door.mp3", "close.mp3"],多种钥匙之间的关系可以为&&或||
(已完成!) 2.来自小艾请求修复瞬移判定无视图块属性script项的bug
(已完成!) 3. 请求修复如果还没修复core.drawTip()不能使用系统图标和clear参数的bug建议增加一个参数来表示多帧图块绘制第几帧
(已完成!) 3.1 “UI绘制”类事件中的“绘制图标”同理
(已完成!\b[up,null]可实现此效果) 4. 建议显示文章的\b[]提供top和bottom这两种新写法来实现在顶部或底部显示对话框目前只有startText、firstArrive、eachArrive、useItemEvent和公共事件等没有当前点的事件中才能用up和down来临时实现这种效果否则就得设置剧情文本的属性这在频繁来回切换时是致命的就像《无上之光》RMXP版地上40层一样
(已完成!) 5. 建议优化core.splitLines()来避免把单词打断和触犯标点禁则,如点号和右标号禁止用于行首,左标号禁止用于行尾
(已完成!) 6. core.drawAnimate()和对应的事件建议增加一个boolean型参数来表示坐标是绝对坐标即当前的实现还是在视野中的相对坐标以13*13为例相对坐标总是在0~12之间以实现形如“在视野正中心播放某某动画”的需求小地图可以写6,6大地图怎么办
(已完成!) 7. 建议把core.playBgm(bgm, startTime)的startTime参数在事件中也提供出来以用于一些演出比如适当的剧情处直接从高潮开始。同理可以让“暂停背景音乐”记录下当前播放到了第几秒并在“恢复背景音乐”中自动从这个秒数恢复。作者还可以手动配合音量渐变效果
(已完成!) 8. 系统设置菜单中“音量”和“步时”的点击区并不是根据文本长度自动适配的,这导致作者修改文本(包括但不限于翻译)后玩家难以找到准确的点击区,建议优化
(已完成!) 9. 建议给“显示选择项”、“显示确认框”、“等待用户操作”这三个事件添加一个“若多少毫秒内不响应则触发的分支”用来实现一些如新新2的QTE录像中可以记录“choice: timeout”、“confirm: timeout”和“wait: timeout”来表示触发了超时分支
10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点
(已完成!) 11. 建议修复勇士后退时跟随者的鬼畜行为并推出一套能够对跟随者位置和朝向进行读写的API甚至事件且允许这些信息被计入存档以实现一些演出效果甚至游戏要素如新新2用公主占位防冰块
(已完成!) 12. “设置怪物属性”事件的下拉框目前只支持一部分另一部分只能通过手敲json再解析来得到希望提供完整支持
13. 建议给core.moveAction(callback)提供对应的事件,用于在事件中让勇士像事件外一样移动,从而正常触发跑毒和阻激夹域捕等
(已完成!) 14. core.openShop()和对应的事件,建议在用于公共事件时简单地退化为“插入公共事件”而不要打断当前事件,把决定权交给作者
(已完成!) 15. “等待用户操作”虽然提供了场合块但还不支持将多个按键的场合合并比如空格、回车和C键一般会被作者予以合并执行内容如果只是大致相同也值得合并在块内由作者根据flag再行分歧建议支持一下
(已完成!) 16. “绘制描边文本”事件建议加一个“描边颜色”参数,目前只能描黑边
(已完成!) 17. “设置画布属性”的基准线建议增加'hanging'和'ideographic'这两种模式
(已完成!) 18. 建议修复“绘制多行文本”时行距比字号大不太多会导致各行下缘丢失的bug加大行距又会导致第一行的纵坐标难以估计此bug在道具商店和1.3倍行距英文看的很明显
(已完成!) 19.(来自群友)建议给第一代全局商店的子选项像“显示选择项”一样提供图标、颜色和出现条件(注意长按的适配)
(已完成!) 20. 很多事件对应的脚本有默认参数但在事件中省略参数却会变成0建议修复
-------------
(已完成!) defaultGround全局可用
(已完成!) 对floorIds和图片进行检测
(已完成!) 删除绘图模式
(已完成!) 清除最近使用图块
(已完成!) cannotIn / cannotOut使用选项框
(已完成!) noPass->canPass改成选择框
初始化&读档优化:不一次读取全部楼层并创建
(已完成!) 绿钥匙进状态栏
(已完成!) 图块ID不可全数字
怪物详细信息富文本化
(已完成!) for和forEach事件
转向:顺时针/逆时针/反向
事件转向
(已完成!) 合并数值操作事件
(已完成!) fromLoad聚集问题
(已完成!) 注释优化
(已完成!) 状态栏显示项的优化
(已完成!) 动画/音乐/音效自动补全
(已完成!) 重构全局商店!
(已完成!) 读档时色调数据丢失
圆角边框
像素高分辨率问题
(已完成!) 道具效果优化,删除部分道具相关的开关
素材列表选择
-------------
(不处理) 0. 部分文案的修改,如“地图编辑器”(启动服务.exe中、“enemys”、“snipe”
(造塔工具相关都给鹿神) 1. 便捷PS工具希望加入自定义单位宽高功能希望把“白底转透明”增强为“纯色底转透明”弹窗由作者输入RGB或RGBA值
(已修复) 2. 请求修复如果还没修复新建单张空白地图无法自定义宽高的bug
(文档相关给秋橙) 3. 希望给M键“追加素材”功能写个更详细的说明在线文档中没有所以离线文档中也没写成
(已解决;现在注册会进行判定) 4. 请求修复图块id可以使用“0-9A-Za-z和下划线”以外的字符的bug如贪婪之神和经验之神的两个耳朵使用了减号它们会干扰显示文章等事件块的解析
(已修复) 5. (接上)请求修复\t[xxx,yyy.png]解析后全部被放入标题框的bugyyy.png应放入图像框才对
(已删除此函数) 6. 增强core.getStatusName()的适用面目前它只用于装备栏属性变化非图标模式的绘制事实上很多写死的文案值得改为此函数的调用如rmxp默认的“力量”、“灵巧”、“G”同理还有一些道具名称文案也存在此问题如“楼层传送器似乎失效了”
(不处理) 7. 来自鹿神core.insertAction()在接受单个字符串参数时存在不稳定性(如跨塔抄别人脚本时),建议优化
(不处理) 8. core.changeFloor()等函数的参数列表过于混乱,建议优化
(文档相关给秋橙) 9. useItemEvent用于有afterGetItem事件浅蓝点的即捡即用类道具时其执行次序与itemEffect相反建议在表格注释中强调一下
(文档相关给秋橙) 10. 装备孔的最大总个数在15*15为8而不再是6在线文档没有提到
(已完成!) 11. (来自鹿神)门和像三种基础墙一样的墙应当提供一个“需要消耗多少把哪种钥匙、开关门分别播放什么音效”(如[{"yellowKey": 1}, "door.mp3", "close.mp3"])的属性(还可以提供多种钥匙组合,关系可以为&&和||而不是通过id去机械地对应
(不处理) 12. 来自鹿神和君浪坚固属性建议按照描述来去修改turn或hero_per_damage而不是mon_defrmxp魔塔的坚固属性是通过一个全局量去指定hero_per_damage的默认为1以免和模仿或者说仿防冲突
(不处理) 13. 破甲、反击、净化倍率、仇恨增量和是否减半,建议允许使用怪物的属性去覆盖全塔属性中的值,如不同的破甲怪破甲倍率不同
(已完成!) 14. (来自小艾)仇恨伤害和固伤合并进总伤害以免和负伤抵消
(已完成!) 15. 单点阻激夹域和血网伤害同时存在多种时,气泡提示的伤害类型存在覆盖现象,建议优化
(已完成!) 16. 来自小艾建议修复瞬移判定无视图快属性script项的bug
(已完成!) 17. 建议修复如果还没修复core.drawTip()不能使用系统图标和clear参数的bug并建议增加一个参数来表示多帧图块使用第几帧UI绘制事件中的绘制图标同理增加另一个参数来表示32*48图块绘制上2/3当前实现和手册一致还是下2/3
(不处理) 18. 来自群友推箱子、阻击、捕捉、重生、炸锤和afterXxx事件的系列问题...
(不处理) 19. 来自群友建议删除2连击和3连击
(不处理) 20. 来自群友建议优化怪物图块属性中value的结构退化和攻防光环同理君浪为此配置了一个独立的表格可供使用基于在getEnemyInfo、getDamageInfo和afterBattle中各eval一串脚本
(不处理) 21. (来自群友)建议大幅缩减表格的长度,譬如把勾选项和单个数值类紧凑摆放
(已完成!) 22. betweenAttackMax在被四个怪同时夹击时比如上下楼后或通过事件使勇士和其中一只怪重合了目前是以上下方向的怪为准建议在表格注释中予以强调更合理的做法是在两种怪的战损中取max或min
(不处理) 23. displayIdInBook属性不能用于夹击QAQ同时建议给core.getBlockId()追加一个“如果是怪物是否按displayIdInBook进行映射”的参数。此外此属性会导致core.hasEnemyLeft()在指定id时失真不一定是坏事
(已完成!) 24. core.hasEnemyLeft()不应该调用core.getCurrentEnemys()因为后者是用于手册的它为了按伤害升序排列而调用了core.getDamageInfo()而core.getDamageInfo()又会调用core.getEnemyInfo()但作者完全可能在core.getDamageInfo()或core.getEnemyInfo()中使用core.hasEnemyLeft()判断特定id的怪物是否存在从而实现一些类似光环的效果如协同这样就会造成死递归
25. 建议新增一个类似“勇士转向”的事件指令————“图块转向”用于NPC甚至怪物比如基于索引/数字对4取余毕竟用转变图块的话不够通用
(已完成!) 26. “勇士转向”会导致跟随者聚集这不利于演出建议改成像core.turnHero()一样不聚集跟随者
(已完成!) 27. 勇士后退时跟随者很鬼畜,建议优化(每步聚集算是一种简陋的办法)
(不处理) 28. 勇士的移动帧只有2建议改为允许作者指定
(不处理) 29. 建议加一对“勇士开始抖动”和“勇士停止抖动”事件指令,来让勇士像图块一样原地抖动(即全局动画)。目前这个效果还只能通过隐藏勇士(或切换透明行走图)并转变图块/图层块来实现且只能用于事件处理中QAQ
30. 建议加一个“视角锁定”事件指令,从而允许用事件改变勇士位置、朝向或行走图时不会使视角重置到以其为中心,用于一些演出效果
(已完成!) 31. 楼层切换事件绿点一旦使用blockly编辑就会无视全塔属性的切换时间只能手动在表格中删除时间数据相关“楼层切换”事件指令也有这个问题有群友还希望这个默认时间能像步时和音量一样由玩家设定来节约拆塔时间。使用blockly编辑也无法做出“ignoretrue”的效果用来覆盖全塔属性的禁止穿透建议优化
(已完成!) 32. 关于CC的来回回档优化版据其称清空存档后会出现bug此外他使用了W键导致二倍斩失效了js的switch语句遇到duplicate cases居然不报错吗...
(已完成!) 33. 疑似已被CC修复楼传平面塔模式在记录离开位置时会错误地把读档也算作离开
(已完成!) 34. 接上还有很多像这样在楼层切换中对读档处理不当的问题如天气色调bgm前两者应当像bgm一样提供keep勾选项
(已完成!) 35. (来自群友)自动寻路有绕过血瓶的勾选项,但不会绕过绿宝石,这在卡血的净化塔是噩梦
(已修复!) 36. (疑似)一年前小雨等人提到“可穿透的楼梯”旁边没有不可通行图块时,桌面端和移动端中只有一种端能停在楼梯上。如果确有此现象,希望修复
(不处理) 37. animates.png的四种箭头的右键绑定目前都只有":next",希望也提供":before"
(已修复!) 38. 建议移除afterUseBomb函数合并进炸弹和圣锤的useItemEffect甚至useItemEvent
(已修复!) 38.1 现在强制要求面向要破的墙/要炸的怪物了
(已修复!) 38.2 移除圣锤道具的定义
(不处理) 39. 建议把样板自带的大部分tools类道具的useItemEffect用useItemEvent重写以方便作者参照学习我能说266都几个月了好多新作者和老作者压根不知道useItemEvent的存在吗
(已修复!) 40. 希望显示文章的\b提供top和bottom这两种新写法来实现在顶部或底部显示对话框目前只有firstArrive和eachArrive等没有当前点的事件中才能用up和down来临时实现这种效果否则就得设置剧情文本的属性这在频繁来回切换时是致命的就像《无上之光》RMXP版地上40层一样
(已完成!) 41. 建议优化core.splitLines()来避免出现标点禁则(如点号和右标号不能用于行首,左标号不能用于行尾),同时也能更好地支持字母文字语言如英语(日语韩语等同样是方块字的倒不要紧)
(已修复!) 42. core.drawAnimate()和对应的事件指令建议增加一个参数来表示坐标是绝对坐标即当前的实现还是在视野中的相对坐标以13*13为例相对坐标总是在0~12之间毕竟有些动画按相对坐标绘制才是作者的演出需求。
(不处理) 43. 来自鹿神希望给animate文件支持多音效、画面闪烁和图块闪烁
(已修复!) 44. 希望给“播放背景音乐”事件像core.playBgm()函数一样添加“从第几秒开始”的参数,以用于一些演出(比如适当的剧情处直接从高潮开始)。同理可以让“暂停背景音乐”记录下当前播放到了第几秒,并在“恢复背景音乐”中自动从这个秒数恢复。作者还可以手动配合音量渐变效果
(文档相关给秋橙) 45. 希望API列表和在线文档介绍一下多个bgm同时播放和独立启停甚至独立调节音量的具体用法以用于一些演出。
(已修复!) 46. 希望在线文档提供一两个“事件中原生脚本勾选async并以core.doAction作为回调”的用法举例并修复它也会导致弹窗警告缺少{"type": "waitAsync"}的bug
(不处理) 47. 来自灯绫建议标题画面右下角的圆形bgm开关按钮在进入游戏后也一直显示
(文档相关给秋橙) 48. statusBarOnClick在横屏时的有效点击区并不包括最下方六个按钮和难度单词建议改正该函数的注释
(已修复!) 49. 系统设置菜单中音量和步时的点击区并不是根据文本长度自动适配的,这导致作者修改文本(包括但不限于翻译)后玩家难以找到准确的点击区,建议优化
(不处理) 50. 建议给录像播放时的N键提供一个对应的移动端操作以方便移动端作者
(已完成!) 51. 希望给“显示选择项”、“显示确认框”、“等待用户操作”这三个事件添加一个“若多少毫秒内不响应则触发的分支”用来实现一些QTE录像中可以记录“choice: timeout”、“confirm: timeout”和“wait: timeout”来表示触发了超时分支
52. 希望给“转变图块”加一个淡入时间参数显隐和转变图层块也希望加个淡入淡出时间参数图层块也希望提供移动和跳跃事件专门用于原本是空地或空气墙的情况。目前要实现这样的效果必须使用红点然而红点有着“推箱子、阻击、捕捉、重生、炸锤和afterXxx事件”的系列问题且会导致core.removeBlock()隐藏事件退化为core.hideBlock()
(不处理) 53. 希望“移动事件”的移速和淡出速度拆开成两个参数,目前这样捆绑在一起不太自由
(已完成) 54. 建议把图块属性的noPass改为勾选框而不是下拉框因为null一定表示不可通行道具根本没有noPass
(不处理,可以转变图块) 55. “移动事件”和“跳跃事件”会导致本来勾选了不显伤的怪物突然有了显伤,非常难看,建议优化
(不处理) 56. 希望推出一套能够对跟随者位置和坐标进行读写的API甚至事件指令并允许这些信息被计入存档以实现一些演出甚至游戏性效果如新新2用公主占位防冰块
(不处理) 57. 希望\t[hero]和\t[xxx,hero]能像图块一样绘制原地抖动的4帧全局动画而不是不动希望能使用勇士的当前朝向而不是一直朝下希望能使用\t[hero1]和\t[xxx,hero1]这样的写法来使用跟随者的行走图作为头像
(文档相关给秋橙) 58. 建议在在线文档中给\r支持的颜色单词做一下枚举并写出对应的RGB值
(不处理) 59. 在标题画面调用core.hideStartAnimate(core.startGame)会立即开始游戏并跳过难度选择,可能造成非作者预期的效果,有办法优化吗?
(已完成!) 60. “设置怪物属性”事件的下拉框目前只支持一部分另一部分只能通过手敲json再解析来得到希望提供完整支持
(已完成!) 61. 在事件编辑器中进行地图选点时,有些事件指令虽然只能用于同楼层,但实际生效时勇士可能已经不在当前正在编辑的楼层(比如在一个楼层切换事件指令后)了,所以希望地图选点始终提供楼层下拉表
(文档相关给秋橙) 62. 希望在线文档介绍一下楼层和startText的独立开关的flag表示
63. 希望给core.moveAction(callback)函数提供一个对应的事件指令用于在事件流处理中让勇士进行一些有游戏性意义即非纯演出的移动。如果做不到的话希望参照本文的46号issue作为原生脚本勾选async的例子讲解如何使用
(已完成!) 64. “打开全局商店”事件指令建议在用于公共事件版商店时简单地退化为“插入公共事件”而不要打断当前事件流,由作者在这个公共事件结尾去决定“立刻结束当前事件”还是不结束
(已修复!) 65. “显隐贴图”的参数应为像素坐标而不是网格坐标,请修正在线文档的描述。同时建议加个淡入淡出时间参数,还建议贴图能像图片一样有透明度和被移动
(不处理) 66. 读档建议换个和floor.mp3不一样的音效
(不处理) 67. “画面震动”事件希望不要光左右晃至少做成QQ窗口抖动的效果吧w
(不处理) 68. “自动存档”事件希望加一个“读此档后打断当前事件”的勾选项,否则这种自动存档用于强制战斗之前就没什么意义了,读了档还是会强制战斗。录像兼容性方面,不知道如果这种自动存档只用于事件开头是不是就不会有问题
(已修复!) 69. “等待用户操作”虽然提供了场合块但还不支持将多个按键的场合合并比如空格、回车和C键一般会被作者予以合并执行内容如果只是大致相同也值得合并在块内再行分歧希望支持一下
70. “显隐勇士”事件指令希望加个淡入淡出时间参数
(不处理,请用等待事件) 1. 希望给core.drawTip()和core.playSound()出个同步版本,目前只有异步版本,后者如果要模拟同步就得绑在一个透明动画上
(已完成!) 72. “绘制描边文本”事件希望加一个“描边颜色”参数,目前只能描黑边
73. 画弧既然有现成的API那建议也作为UI绘制事件提供。甚至希望提供画椭圆功能长短轴水平或铅直的那种参数为中心坐标和长短轴长度
(已完成!) 74. “设置画布属性”的基准线建议增加'hanging'和'ideographic'这两种模式
(已完成!) 75. 建议修复“绘制多行文本”时行距比字号大不太多会导致各行下缘丢失的bug加大行距又会导致第一行的纵坐标难以估计此bug在道具商店和1.3倍行距英文看的很明显
(已完成!) 76. (来自群友)建议给第一代全局商店像“显示选择项”一样提供图标、颜色和出现条件
(已完成!增加正则匹配) 77. 建议给core.searchBlock()新增问号通配符(匹配一个任意字符)
(已完成!) 78. 建议移除core.setInitData()并将其内容写在startText以方便作者仿照修改
(不处理;有跟随情况下处理很麻烦) 79. 建议给core.drawHero()添加纵横两个偏移参数(目前只有一个),以用于做一些斜向移动的演出
(文档都给秋橙) 80. 在线文档中“系统使用的flag变量”不够完整建议加以补充
(不处理,新增样板非常麻烦) 81. 来自群友建议做一个17*13的纯横屏样板大地图只能纵向实现状态栏自绘在最右边四列从而彻底摆脱乱七八糟的dom操作