Merge pull request #12 from ckcz123/v2.x

V2.x
This commit is contained in:
tocque 2020-05-23 11:18:33 +08:00 committed by GitHub
commit c61ca71f58
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
67 changed files with 3970 additions and 3878 deletions

View File

@ -685,10 +685,6 @@ core.updateHeroIcon()
更新状态栏上的勇士图标。
core.updateGlobalAttribute()
更新全局属性,例如状态栏的背景图等。
core.setToolbarButton(useButtom)
设置工具栏是否是拓展键盘。

View File

@ -684,10 +684,6 @@ core.updateHeroIcon()
更新状态栏上的勇士图标。
core.updateGlobalAttribute()
更新全局属性,例如状态栏的背景图等。
core.setToolbarButton(useButtom)
设置工具栏是否是拓展键盘。

View File

@ -139,7 +139,7 @@ N连击怪物的special是6且我们可以为它定义n代表实际连击数
领域怪还可以设置`range`选项代表该领域怪的范围不写则默认为1。
<br>**将 `flags.no_zone` 设置为 `true` 可以免疫领域效果。**<br>
阻击怪同样需要设置value代表阻击伤害的数值。如果勇士生命值扣减到0则直接死亡触发lose事件。
<br>**将`flags.no_snipe`设置为true可以免疫阻击效果包括伤害和移动。**<br>
<br>**将`flags.no_repulse`设置为true可以免疫阻击效果包括伤害和移动。**<br>
!> 阻击怪后退的地点不能有任何事件存在,即使是已经被禁用的红绿事件或重生怪!(会导致此事件意外被重新启用)<br>
激光怪同样需要设置value代表激光伤害的数值。
<br>请注意如果吸血、领域、阻击、生命光环中任何两个同时存在,则 `value` 会冲突。**因此请勿将吸血、领域、阻击或激光放置在同一个怪物身上。退化和攻防光环同理!<br>**

View File

@ -383,7 +383,7 @@ value为必填项代表要修改到的内容。对于修改名称的必须
{"type": "setFloor", "name": "title", "value": "'主塔 0 层'" } // 设置当前楼层的中文名为主塔0层
{"type": "setFloor", "name": "canFlyTo", "floorId": "MT2", "value": "false" } // 设置MT2层不可飞行
{"type": "setFloor", "name": "cannotViewMap", "floorId": "MT0", "value": "true" } // 设置MT0层不可被浏览地图
{"type": "setFloor", "name": "item_ratio", "value": "5" } // 设置当前楼层的宝石血瓶属性加成为5
{"type": "setFloor", "name": "ratio", "value": "5" } // 设置当前楼层的宝石血瓶属性加成为5
{"type": "setFloor", "name": "images", "value": "[[0,0,'tree.png',2]]" } // 设置当前楼层的楼层贴图
{"type": "setFloor", "name": "upFloor", "value": "[2,3]" } // 设置当前楼层的上楼梯
{"type": "setFloor", "name": "bgm", "floorId": "MT10", "value": "'233.mp3'" } // 设置当前楼层的背景音乐
@ -2174,7 +2174,7 @@ if (core.flags.enableAddPoint && point > 0) {
``` json
"shops": [{
"id": "shop1",
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
"text": "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
"textInList": "1F金币商店",
"mustEnable": false,
"disablePreview": false,

View File

@ -236,7 +236,7 @@ ID必须由数字字母下划线组成数字在1000以内且均不能和
除此之外,额外素材在游戏中的使用和正式素材都是一致的,也能在前景或背景图层绘制。
额外素材可以使用“tileset贴图”的方式进行绘制,一次绘制一个矩形区域。
额外素材可以使用“tileset平铺”的方式进行绘制,一次绘制一个矩形区域。
“辅助工具”中提供了“额外素材合并”如果使用此功能请不要对额外素材进行基于ID、索引和数字的判定和读写等操作如确有此需求可以创建一些玩家不可达也不可预览的隐藏样板层然后用等量代换的办法去从样板层取用。
## 自定义道具效果
@ -249,21 +249,18 @@ ID必须由数字字母下划线组成数字在1000以内且均不能和
如果你想要同种宝石在不同层效果不同的话,可以进行如下操作:
1. 在楼层的item_ratio中定义宝石的比率比如1-10的写111-20层写2等
1. 在楼层的ratio中定义宝石的比率比如1-10的写111-20层写2等
2. 修改获得道具的itemEffect函数编辑器中双击进行编辑
``` js
// ratio为楼层的item_ratio值可以进行翻倍宝石属性
core.status.hero.atk += core.values.redJewel * ratio
core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio
```
这里我们可以直接写ratio来取用该楼层中定义的`item_ratio`的值。
如果不是倍数增加(比如线性增加)也可以类似来写
``` js
// 一个二倍线性增加的例子
core.status.hero.atk += core.values.redJewel + 2*ratio
core.status.hero.atk += core.values.redGem + 2*core.status.thisMap.ratio
```
### 消耗类道具cls: tools永久类道具cls: constants
@ -308,11 +305,11 @@ function (enemy, hero_hp, hero_atk, hero_def, hero_mdef, x, y, floorId) {
[ // 写在获得道具后事件
// 设置不同的flag可以分别无视对应的阻激夹域效果
{"type": "setValue", "name": "flag:no_zone", "value": "true"}, // 免疫领域
{"type": "setValue", "name": "flag:no_snipe", "value": "true"}, // 免疫阻击
{"type": "setValue", "name": "flag:no_repulse", "value": "true"}, // 免疫阻击
{"type": "setValue", "name": "flag:no_laser", "value": "true"}, // 免疫激光
{"type": "setValue", "name": "flag:no_betweenAttack", "value": "true"}, // 免疫夹击
{"type": "setValue", "name": "flag:no_ambush", "value": "true"}, // 免疫捕捉
{"type": "setValue", "name": "item:shoes", "value": "1"} // 免疫路障
{"type": "setValue", "name": "item:amulet", "value": "1"} // 免疫路障
]
```
4. 如果有更高的需求,例如想让吸血效果变成一半,则还是在上面这些地方进行对应的修改即可。
@ -666,7 +663,7 @@ if (core.flags.statusBarItems.indexOf('enableSkill')>=0) {
- **`flag:hard`**: 当前的难度标志此flag变量在setInitData中被定义可以直接取用来判定当前难度分歧。上传成绩时将根据此flag来对不同难度进行排序。
- **`flag:posion`**, **`flag:weak`**, **`flag:curse`**: 中毒、衰弱、诅咒状态。
- **`flag:no_zone`**, **`flag:no_snipe`**, **`flag:no_laser`**, **`flag:no_betweenAttack`**: 是否分别免疫领域、阻击、激光、夹击效果。
- **`flag:no_zone`**, **`flag:no_repulse`**, **`flag:no_laser`**, **`flag:no_betweenAttack`**: 是否分别免疫领域、阻击、激光、夹击效果。
- **`flag:hatred`**: 当前的仇恨数值。
- **`flag:commonTimes`**: 全局商店共用次数时的访问次数。
- **`flag:input`**: 接受用户输入的事件后,存放用户输入的结果。

File diff suppressed because it is too large Load Diff

1396
_server/MotaActionParser.js Normal file

File diff suppressed because it is too large Load Diff

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"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}}
{"lastUsed":[],"foldPerCol":50,"folded":false,"editorLastFloorId":"sample0","disableBlocklyReplace":false,"disableBlocklyExpandCompare":false,"shortcut":{"48":0,"49":0,"50":0,"51":0,"52":0,"53":0,"54":0,"55":0,"56":0,"57":0}}

View File

@ -20,7 +20,7 @@ function editor() {
chooseThis : document.getElementById('chooseThis'),
chooseInRight : document.getElementById('chooseInRight'),
copyLoc : document.getElementById('copyLoc'),
moveLoc : document.getElementById('moveLoc'),
pasteLoc : document.getElementById('pasteLoc'),
clearEvent : document.getElementById('clearEvent'),
clearLoc : document.getElementById('clearLoc'),
brushMod:document.getElementById('brushMod'),
@ -69,6 +69,12 @@ function editor() {
mouseOutCheck : 2,
startPos:null,
endPos:null,
lastMoveE:{buttons:0,clientX:0,clientY:0},
selectedArea: null,
// 材料区拖动有关
lastMoveMaterE:null,
tileSize: [1,1],
startLoc: null,
// 撤销/恢复
preMapData : [],
preMapMax: 10,
@ -80,13 +86,12 @@ function editor() {
scrollBarHeight :0,
folded:false,
foldPerCol: 50,
// 画图区菜单
lastRightButtonPos:[{x:0,y:0},{x:0,y:0}],
lastCopyedInfo : [null, null],
//
ratio : 1,
// blockly转义
disableBlocklyReplace: false,
// blockly展开比较
disableBlocklyExpandCompare: false,
// 绑定机关门事件相关
bindSpecialDoor: {
@ -102,7 +107,6 @@ function editor() {
},
// tile
tileSize: [1,1],
lockMode: false,
// 最近使用的图块
@ -280,6 +284,7 @@ editor.prototype.changeFloor = function (floorId, callback) {
editor.viewportLoc = editor.viewportLoc || {};
var loc = editor.viewportLoc[floorId] || [], x = loc[0] || 0, y = loc[1] || 0;
editor.setViewport(x, y);
editor.uifunctions.unhighlightSaveFloorButton();
editor.config.set('editorLastFloorId', floorId, function() {
if (callback) callback();
@ -680,6 +685,7 @@ editor.prototype.setSelectBoxFromInfo=function(thisevent, scrollTo){
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';
editor.dom.dataSelection.style.width = 32 - 6 + 'px';
setTimeout(function(){
selectBox.isSelected(true);
editor.updateLastUsedMap();

View File

@ -1,490 +1,6 @@
editor_blockly = function () {
var editor_blockly = {};
/////////////////initscript start/////////////////////////////
// do not use String.raw because of highlighting
// Comment tagged templates
// https://marketplace.visualstudio.com/items?itemName=bierner.comment-tagged-templates
initscript = /* js */`
(function(){
var getCategory = function(name,custom){
for(var node of document.getElementById('toolbox').children) {
if(node.getAttribute('name')==name) return node;
}
var node = document.createElement('category');
node.setAttribute('name',name);
if(custom)node.setAttribute('custom',custom);
document.getElementById('toolbox').appendChild(node);
return node;
}
var toolboxObj = {
'入口方块':[
MotaActionFunctions.actionParser.parse([
"欢迎使用事件编辑器",
"本事件触发一次后会消失",
{"type": "hide", "time": 500},
],'event'),
MotaActionFunctions.actionParser.parse({
"condition": "flag:__door__==2",
"currentFloor": true,
"priority": 0,
"delayExecute": false,
"multiExecute": false,
"data": [
{"type": "openDoor", "loc": [10,5]}
],
},'autoEvent'),
MotaActionBlocks['changeFloor_m'].xmlText(),
MotaActionFunctions.actionParser.parse([{
"id": "shop1",
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我\${20+2*flag:shop1}金币就可以:",
"textInList": "1F金币商店",
"choices": [
{"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",
"item": true,
"textInList": "道具商店",
"choices": [
{"id": "yellowKey", "number": 10, "money": 10}
]
},{
"id": "keyShop1",
"textInList": "回收钥匙商店",
"commonEvent": "回收钥匙商店",
"args": ""
}],'shop'),
MotaActionBlocks['afterBattle_m'].xmlText(),
MotaActionBlocks['afterGetItem_m'].xmlText(),
MotaActionBlocks['afterOpenDoor_m'].xmlText(),
MotaActionBlocks['firstArrive_m'].xmlText(),
MotaActionBlocks['eachArrive_m'].xmlText(),
MotaActionBlocks['level_m'].xmlText(),
MotaActionBlocks['commonEvent_m'].xmlText(),
MotaActionBlocks['item_m'].xmlText(),
],
'显示文字':[
MotaActionBlocks['text_0_s'].xmlText(),
MotaActionBlocks['text_1_s'].xmlText(),
MotaActionBlocks['comment_s'].xmlText(),
MotaActionBlocks['autoText_s'].xmlText(),
MotaActionBlocks['scrollText_s'].xmlText(),
MotaActionBlocks['setText_s'].xmlText(),
MotaActionBlocks['showImage_s'].xmlText(),
MotaActionBlocks['showImage_1_s'].xmlText(),
MotaActionBlocks['hideImage_s'].xmlText(),
MotaActionBlocks['showTextImage_s'].xmlText(),
MotaActionBlocks['moveImage_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',0,MotaActionBlocks['choicesContext'].xmlText([
'剑','','',null,'',MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [3,3]}]),
])
]),
],
'数据相关':[
MotaActionBlocks['setValue_s'].xmlText([
MotaActionBlocks['idIdList_e'].xmlText(['status','生命']), '=', '', false
]),
MotaActionBlocks['setEnemy_s'].xmlText(),
MotaActionBlocks['setFloor_s'].xmlText(),
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
MotaActionBlocks['setGlobalValue_s'].xmlText(),
MotaActionBlocks['setGlobalFlag_s'].xmlText(),
MotaActionBlocks['input_s'].xmlText(),
MotaActionBlocks['input2_s'].xmlText(),
MotaActionBlocks['update_s'].xmlText(),
MotaActionBlocks['moveAction_s'].xmlText(),
MotaActionBlocks['moveHero_s'].xmlText(),
MotaActionBlocks['jumpHero_s'].xmlText(),
MotaActionBlocks['changeFloor_s'].xmlText(),
MotaActionBlocks['changePos_s'].xmlText(),
MotaActionBlocks['battle_s'].xmlText(),
MotaActionBlocks['useItem_s'].xmlText(),
MotaActionBlocks['loadEquip_s'].xmlText(),
MotaActionBlocks['unloadEquip_s'].xmlText(),
MotaActionBlocks['openShop_s'].xmlText(),
MotaActionBlocks['disableShop_s'].xmlText(),
MotaActionBlocks['setHeroIcon_s'].xmlText(),
MotaActionBlocks['follow_s'].xmlText(),
MotaActionBlocks['unfollow_s'].xmlText(),
],
'地图处理':[
MotaActionBlocks['battle_1_s'].xmlText(),
MotaActionBlocks['openDoor_s'].xmlText(),
MotaActionBlocks['closeDoor_s'].xmlText(),
MotaActionBlocks['show_s'].xmlText(),
MotaActionBlocks['hide_s'].xmlText(),
MotaActionBlocks['setBlock_s'].xmlText(),
MotaActionBlocks['turnBlock_s'].xmlText(),
MotaActionBlocks['move_s'].xmlText(),
MotaActionBlocks['jump_s'].xmlText(),
MotaActionBlocks['showBgFgMap_s'].xmlText(),
MotaActionBlocks['hideBgFgMap_s'].xmlText(),
MotaActionBlocks['setBgFgBlock_s'].xmlText(),
MotaActionBlocks['showFloorImg_s'].xmlText(),
MotaActionBlocks['hideFloorImg_s'].xmlText(),
],
'事件控制':[
MotaActionBlocks['if_1_s'].xmlText(),
MotaActionBlocks['if_s'].xmlText(),
MotaActionFunctions.actionParser.parseList({"type": "switch", "condition": "判别值", "caseList": [
{"action": [{"type": "comment", "text": "当判别值是值的场合执行此事件"}]},
{"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['exit_s'].xmlText(),
MotaActionBlocks['trigger_s'].xmlText(),
MotaActionBlocks['insert_1_s'].xmlText(),
MotaActionBlocks['insert_2_s'].xmlText(),
],
'特效/声音':[
MotaActionBlocks['sleep_s'].xmlText(),
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(),
MotaActionBlocks['vibrate_s'].xmlText(),
MotaActionBlocks['animate_s'].xmlText(),
MotaActionBlocks['setViewport_s'].xmlText(),
MotaActionBlocks['moveViewport_s'].xmlText(),
MotaActionBlocks['showStatusBar_s'].xmlText(),
MotaActionBlocks['hideStatusBar_s'].xmlText(),
MotaActionBlocks['showHero_s'].xmlText(),
MotaActionBlocks['hideHero_s'].xmlText(),
MotaActionBlocks['setCurtain_0_s'].xmlText(),
MotaActionBlocks['setCurtain_1_s'].xmlText(),
MotaActionBlocks['screenFlash_s'].xmlText(),
MotaActionBlocks['setWeather_s'].xmlText(),
MotaActionBlocks['playBgm_s'].xmlText(),
MotaActionBlocks['pauseBgm_s'].xmlText(),
MotaActionBlocks['resumeBgm_s'].xmlText(),
MotaActionBlocks['loadBgm_s'].xmlText(),
MotaActionBlocks['freeBgm_s'].xmlText(),
MotaActionBlocks['playSound_s'].xmlText(),
MotaActionBlocks['stopSound_s'].xmlText(),
MotaActionBlocks['setVolume_s'].xmlText(),
MotaActionBlocks['callBook_s'].xmlText(),
MotaActionBlocks['callSave_s'].xmlText(),
MotaActionBlocks['autoSave_s'].xmlText(),
MotaActionBlocks['callLoad_s'].xmlText(),
],
'UI绘制':[
MotaActionBlocks['previewUI_s'].xmlText(),
MotaActionBlocks['clearMap_s'].xmlText(),
MotaActionBlocks['clearMap_1_s'].xmlText(),
MotaActionBlocks['setAttribute_s'].xmlText(),
MotaActionBlocks['fillText_s'].xmlText(),
MotaActionBlocks['fillBoldText_s'].xmlText(),
MotaActionBlocks['drawTextContent_s'].xmlText(),
MotaActionBlocks['fillRect_s'].xmlText(),
MotaActionBlocks['strokeRect_s'].xmlText(),
MotaActionBlocks['drawLine_s'].xmlText(),
MotaActionBlocks['drawArrow_s'].xmlText(),
MotaActionBlocks['fillPolygon_s'].xmlText(),
MotaActionBlocks['strokePolygon_s'].xmlText(),
MotaActionBlocks['fillEllipse_s'].xmlText(),
MotaActionBlocks['strokeEllipse_s'].xmlText(),
MotaActionBlocks['fillArc_s'].xmlText(),
MotaActionBlocks['strokeArc_s'].xmlText(),
MotaActionBlocks['drawImage_s'].xmlText(),
MotaActionBlocks['drawImage_1_s'].xmlText(),
MotaActionBlocks['drawIcon_s'].xmlText(),
MotaActionBlocks['drawBackground_s'].xmlText(),
MotaActionBlocks['drawSelector_s'].xmlText(),
MotaActionBlocks['drawSelector_1_s'].xmlText(),
],
'原生脚本':[
MotaActionBlocks['function_s'].xmlText(),
MotaActionBlocks['unknown_s'].xmlText(),
],
'值块':[
MotaActionBlocks['setValue_s'].xmlText([
MotaActionBlocks['idIdList_e'].xmlText(['status','生命']), '=', '', false
]),
MotaActionBlocks['expression_arithmetic_0'].xmlText(),
MotaActionBlocks['idFlag_e'].xmlText(),
MotaActionBlocks['idTemp_e'].xmlText(),
MotaActionBlocks['negate_e'].xmlText(),
MotaActionBlocks['bool_e'].xmlText(),
MotaActionBlocks['idString_e'].xmlText(),
MotaActionBlocks['idIdList_e'].xmlText(),
MotaActionBlocks['idFixedList_e'].xmlText(),
MotaActionBlocks['enemyattr_e'].xmlText(),
MotaActionBlocks['blockId_e'].xmlText(),
MotaActionBlocks['blockCls_e'].xmlText(),
MotaActionBlocks['equip_e'].xmlText(),
MotaActionBlocks['evalString_e'].xmlText(),
],
'常见事件模板':[
'<label text="检测音乐如果没有开启则系统提示开启"></label>',
MotaActionFunctions.actionParser.parseList({"type": "if", "condition": "!core.musicStatus.bgmStatus",
"true": [
"\\t[系统提示]你当前音乐处于关闭状态,本塔开音乐游戏效果更佳"
],
"false": []
}),
'<label text="商店购买属性/钥匙"></label>',
MotaActionFunctions.actionParser.parse([
{"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",
"displayDamage": true,
"data": [
' ... 战前剧情',
{"type": "battle", "id": "greenSlime"},
' ... 战后剧情;请注意上面的强制战斗不会使怪物消失',
'需要下一句来调用{"type": "hide"}来隐藏事件',
{"type": "hide"},
]
},'event'),
'<label text="打怪掉落道具"></label>',
MotaActionFunctions.actionParser.parse([
'怪物变成了黄钥匙(黄钥匙idnum是21)',
'打怪变成可对话的NPC: https://ckcz123.github.io/mota-js/#/event?id=%e6%89%93%e6%80%aa%e5%8f%98%e6%88%90%e5%8f%af%e5%af%b9%e8%af%9d%e7%9a%84npc%ef%bc%88%e6%80%aa%e7%89%a9-gtnpc%ef%bc%89',
{"type": "setBlock", "number": 21}
],'afterBattle'),
'<label text="打怪开门"></label>',
MotaActionFunctions.actionParser.parse([
{"type": "setValue", "name": "flag:__door__", "operator": "+=", "value": "1"},
{"type": "if", "condition": "flag:__door__==2",
"true": [
{"type": "openDoor", "loc": [10,5]}
],
"false": []
},
],'afterBattle'),
'<label text="杀死魔龙后隐藏其余图块"></label>',
MotaActionFunctions.actionParser.parse([
{"type": "function", "function": "function(){var x=core.status.event.data.x,y=core.status.event.data.y;if(core.isset(x)&&core.isset(y)){core.insertAction([{type:'hide',loc:[[x-1,y-2],[x,y-2],[x+1,y-2],[x-1,y-1],[x,y-1],[x+1,y-1],[x-1,y],[x+1,y]]}]);}}"},
],'afterBattle'),
'<label text="获得圣水后变成墙"></label>',
MotaActionFunctions.actionParser.parse({
"trigger": "action",
"noPass": true,
"data": [
{"type": "if", "condition": "flag:hasSuperPotion",
"true": [],
"false": [
{"type":"setValue", "name":"status:hp", "operator": "*=", "value": "2"},
{"type":"setBlock", "number": 1},
{"type":"setValue", "name":"flag:hasSuperPotion", "value": "true"}
]
}
]
},'event'),
],
'最近使用事件':[
'<label text="此处只是占位符,实际定义在editor_blockly.searchBlockCategoryCallback中"></label>',
]
}
var toolboxgap = '<sep gap="5"></sep>'
//xml_text = MotaActionFunctions.actionParser.parse(obj,type||'event')
//MotaActionBlocks['idString_e'].xmlText()
for (var name in toolboxObj){
var custom = null;
if(name=='最近使用事件')custom='searchBlockCategory';
getCategory(name,custom).innerHTML = toolboxObj[name].join(toolboxgap);
}
var blocklyArea = document.getElementById('blocklyArea');
var blocklyDiv = document.getElementById('blocklyDiv');
var workspace = Blockly.inject(blocklyDiv,{
media: '_server/blockly/media/',
toolbox: document.getElementById('toolbox'),
zoom:{
controls: true,
wheel: false,//滚轮改为上下(shift:左右)翻滚
startScale: 1.0,
maxScale: 3,
minScale: 0.3,
scaleSpeed: 1.08
},
trashcan: false,
});
editor_blockly.searchBlockCategoryCallback = function(workspace) {
var xmlList = [];
var labels = editor_blockly.searchBlock();
for (var i = 0; i < labels.length; i++) {
var blockText = '<xml>' +
MotaActionBlocks[labels[i]].xmlText() +
'</xml>';
var block = Blockly.Xml.textToDom(blockText).firstChild;
block.setAttribute("gap", 5);
xmlList.push(block);
}
return xmlList;
};
workspace.registerToolboxCategoryCallback(
'searchBlockCategory', editor_blockly.searchBlockCategoryCallback);
var onresize = function(e) {
blocklyDiv.style.width = blocklyArea.offsetWidth + 'px';
blocklyDiv.style.height = blocklyArea.offsetHeight + 'px';
Blockly.svgResize(workspace);
};
if(typeof editor !== "undefined" && !editor.isMobile)window.addEventListener('resize', onresize, false);
onresize();
//Blockly.svgResize(workspace);
//Blockly.bindEventWithChecks_(workspace.svgGroup_,"wheel",workspace,function(e){});
document.getElementById('blocklyDiv').onmousewheel = function(e){
//console.log(e);
e.preventDefault();
var hvScroll = e.shiftKey?'hScroll':'vScroll';
var mousewheelOffsetValue=20/380*workspace.scrollbar[hvScroll].handleLength_*3;
workspace.scrollbar[hvScroll].handlePosition_+=( ((e.deltaY||0)+(e.detail||0)) >0?mousewheelOffsetValue:-mousewheelOffsetValue);
workspace.scrollbar[hvScroll].onScroll_();
workspace.setScale(workspace.scale);
}
var doubleClickCheck=[[0,'abc']];
function omitedcheckUpdateFunction(event) {
if(event.type==='create'){
editor_blockly.addIntoLastUsedType(event.blockId);
}
if(event.type==='ui'){
var newClick = [new Date().getTime(),event.blockId];
var lastClick = doubleClickCheck.shift();
doubleClickCheck.push(newClick);
if(newClick[0]-lastClick[0]<500){
if(newClick[1]===lastClick[1]){
editor_blockly.doubleClickBlock(newClick[1]);
}
}
}
if(editor_blockly.workspace.topBlocks_.length>=2){
editor_blockly.setValue('入口方块只能有一个');
return;
}
var eventType = document.getElementById('entryType').value;
if(editor_blockly.workspace.topBlocks_.length==1){
var blockType = editor_blockly.workspace.topBlocks_[0].type;
if(blockType!==eventType+'_m'){
editor_blockly.setValue('入口方块类型错误');
return;
}
}
try {
var code = Blockly.JavaScript.workspaceToCode(workspace).replace(/\\\\(i|c|d|e|z)/g, '\\\\\\\\$1');
editor_blockly.setValue(code);
} catch (error) {
editor_blockly.setValue(String(error));
if (error instanceof OmitedError){
var blockName = error.blockName;
var varName = error.varName;
var block = error.block;
}
// console.log(error);
}
}
workspace.addChangeListener(omitedcheckUpdateFunction);
workspace.addChangeListener(Blockly.Events.disableOrphans);
editor_blockly.workspace = workspace;
MotaActionFunctions.workspace = function(){
return editor_blockly.workspace;
}
// 因为在editor_blockly.parse里已经HTML转义过一次了,所以这里要覆盖掉以避免在注释中出现&lt;等
MotaActionFunctions.xmlText = function (ruleName,inputs,isShadow,comment) {
var rule = MotaActionBlocks[ruleName];
var blocktext = isShadow?'shadow':'block';
var xmlText = [];
xmlText.push('<'+blocktext+' type="'+ruleName+'">');
if(!inputs)inputs=[];
for (var ii=0,inputType;inputType=rule.argsType[ii];ii++) {
var input = inputs[ii];
var _input = '';
var noinput = (input===null || input===undefined);
if(noinput && inputType==='field') continue;
if(noinput) input = '';
if(inputType!=='field') {
var subList = false;
var subrulename = rule.args[ii];
subrulename=subrulename.split('_').slice(0,-1).join('_');
var subrule = MotaActionBlocks[subrulename];
if (subrule instanceof Array) {
subrulename=subrule[subrule.length-1];
subrule = MotaActionBlocks[subrulename];
subList = true;
}
_input = subrule.xmlText([],true);
if(noinput && !subList && !isShadow) {
//无输入的默认行为是: 如果语句块的备选方块只有一个,直接代入方块
input = subrule.xmlText();
}
}
xmlText.push('<'+inputType+' name="'+rule.args[ii]+'">');
xmlText.push(_input+input);
xmlText.push('</'+inputType+'>');
}
if(comment){
xmlText.push('<comment>');
xmlText.push(comment);
xmlText.push('</comment>');
}
var next = inputs[rule.args.length];
if (next) {//next
xmlText.push('<next>');
xmlText.push(next);
xmlText.push('</next>');
}
xmlText.push('</'+blocktext+'>');
return xmlText.join('');
}
})();
`;
/////////////////initscript end /////////////////////////////
var editor_blockly = {entryType:'event'};
editor.uivalues.disableBlocklyReplace = editor.config.get("disableBlocklyReplace", false);
var replaceCheckbox = document.getElementById('blocklyReplace');
@ -497,6 +13,16 @@ function omitedcheckUpdateFunction(event) {
alert("已" + (replaceCheckbox.checked ? "开启" : "关闭") + "中文变量名替换!\n关闭并重开事件编辑器以生效。");
}
editor.uivalues.disableBlocklyExpandCompare = editor.config.get("disableBlocklyExpandCompare", false);
var expandCompareCheckbox = document.getElementById('blocklyExpandCompare');
expandCompareCheckbox.checked = !editor.uivalues.disableBlocklyExpandCompare;
editor_blockly.triggerExpandCompare = function () {
editor.uivalues.disableBlocklyExpandCompare = !expandCompareCheckbox.checked;
editor.config.set("disableBlocklyExpandCompare", !expandCompareCheckbox.checked);
if (MotaActionFunctions) MotaActionFunctions.disableExpandCompare = !expandCompareCheckbox.checked;
}
var input_ = '';
editor_blockly.runOne = function () {
//var printf = console.log;
@ -513,8 +39,7 @@ function omitedcheckUpdateFunction(event) {
var script = document.createElement('script');
//var initscript = document.getElementById('initscript').innerText;
script.innerHTML = converter.mainFile[5] + initscript;
script.innerHTML = converter.mainFile[5] + editor_blocklyconfig;
document.body.appendChild(script);
}
var xhr = new XMLHttpRequest();
@ -527,6 +52,7 @@ function omitedcheckUpdateFunction(event) {
input_ = xhr.responseText;
editor_blockly.runOne();
MotaActionFunctions.disableReplace = editor.uivalues.disableBlocklyReplace;
MotaActionFunctions.disableExpandCompare = editor.uivalues.disableBlocklyExpandCompare;
}
xhr.open('GET', '_server/MotaAction.g4', true);
xhr.send(null);
@ -579,7 +105,7 @@ function omitedcheckUpdateFunction(event) {
eval('obj=' + codeAreaHL.getValue().replace(/[<>&]/g, function (c) {
return {'<': '&lt;', '>': '&gt;', '&': '&amp;'}[c];
}).replace(/\\(r|f|i|c|d|e|z)/g,'\\\\$1')),
document.getElementById('entryType').value
editor_blockly.entryType
);
}
@ -594,7 +120,7 @@ function omitedcheckUpdateFunction(event) {
if (!type) return false;
editor_blockly.id = id_;
editor_blockly.setValue(input.value);
document.getElementById('entryType').value = type;
editor_blockly.entryType = type;
editor_blockly.parse();
editor_blockly.show();
return true;
@ -642,7 +168,7 @@ function omitedcheckUpdateFunction(event) {
editor_blockly.setValue('入口方块只能有一个');
return;
}
var eventType = document.getElementById('entryType').value;
var eventType = editor_blockly.entryType;
if(editor_blockly.workspace.topBlocks_.length==1){
var blockType = editor_blockly.workspace.topBlocks_[0].type;
if(blockType!==eventType+'_m'){
@ -705,14 +231,8 @@ function omitedcheckUpdateFunction(event) {
}
var previewBlock = function (b) {
var types = [
"previewUI_s", "clearMap_s", "clearMap_1_s", "setAttribute_s", "fillText_s",
"fillBoldText_s", "fillRect_s", "strokeRect_s", "drawLine_s",
"drawArrow_s", "fillPolygon_s", "strokePolygon_s", "fillEllipse_s", "strokeEllipse_s", "fillArc_s", "strokeArc_s",
"drawImage_s", "drawImage_1_s", "drawIcon_s", "drawBackground_s", "drawSelector_s", "drawSelector_1_s",
"waitContext_2"
];
if (b && types.indexOf(b.type)>=0) {
if (b && MotaActionBlocks[b.type].previewBlock) {
try {
var code = "[" + Blockly.JavaScript.blockToCode(b).replace(/\\(i|c|d|e|z)/g, '\\\\$1') + "]";
eval("var obj="+code);
@ -738,30 +258,17 @@ function omitedcheckUpdateFunction(event) {
if (previewBlock(b)) return;
if (b && b.type in selectPointBlocks) { // selectPoint
if (b && MotaActionBlocks[b.type].selectPoint) { // selectPoint
this.selectPoint();
return;
}
var textStringDict = {
'text_0_s': 'EvalString_0',
'text_1_s': 'EvalString_2',
'autoText_s': 'EvalString_2',
'scrollText_s': 'EvalString_0',
'comment_s': 'EvalString_0',
'choices_s': 'EvalString_0',
'showTextImage_s': 'EvalString_0',
'function_s': 'RawEvalString_0',
'shopsub': 'EvalString_1',
'confirm_s': 'EvalString_0',
'drawTextContent_s': 'EvalString_0',
}
var f = b ? textStringDict[b.type] : null;
var f = b ? MotaActionBlocks[b.type].doubleclicktext : null;
if (f) {
var value = b.getFieldValue(f);
//多行编辑
editor_multi.multiLineEdit(value, b, f, {'lint': f === 'RawEvalString_0'}, function (newvalue, b, f) {
if (textStringDict[b.type] !== 'RawEvalString_0') {
if (MotaActionBlocks[b.type].doubleclicktext !== 'RawEvalString_0') {
}
b.setFieldValue(newvalue.split('\n').join('\\n'), f);
});
@ -848,37 +355,11 @@ function omitedcheckUpdateFunction(event) {
// ------ select point ------
// id: [x, y, floorId, forceFloor]
var selectPointBlocks = {
"changeFloor_m": ["PosString_0", "PosString_1", "IdString_0", true],
"jumpHero_s": ["PosString_0", "PosString_1"],
"changeFloor_s": ["PosString_0", "PosString_1", "IdString_0", true],
"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"],
"show_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"hide_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"setBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
"turnBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
"move_s": ["PosString_0", "PosString_1"],
"jump_s": ["PosString_2", "PosString_3"], // 跳跃暂时只考虑终点
"showBgFgMap_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"hideBgFgMap_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"setBgFgBlock_s": ["EvalString_1", "EvalString_2", "IdString_0"],
"showFloorImg_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"hideFloorImg_s": ["EvalString_0", "EvalString_1", "IdString_0"],
"trigger_s": ["PosString_0", "PosString_1"],
"insert_2_s": ["PosString_0", "PosString_1", "IdString_0"],
"animate_s": ["EvalString_0", "EvalString_0"],
"setViewport_s": ["PosString_0", "PosString_1"]
}
editor_blockly.selectPoint = function () {
var block = Blockly.selected, arr = null;
var floorId = editor.currentFloorId, pos = editor.pos, x = pos.x, y = pos.y;
if (block != null && block.type in selectPointBlocks) {
arr = selectPointBlocks[block.type];
if (block != null && MotaActionBlocks[block.type].selectPoint) {
arr = eval(MotaActionBlocks[block.type].selectPoint);
var xv = parseInt(block.getFieldValue(arr[0])), yv = parseInt(block.getFieldValue(arr[1]));
if (block.type == 'animate_s') {
var v = block.getFieldValue(arr[0]).split(",");
@ -946,7 +427,13 @@ function omitedcheckUpdateFunction(event) {
return one != token && one.startsWith(token);
}).sort();
} else if (before.endsWith("怪物") || (ch == ':' && before.endsWith("enemy"))) {
return Object.keys(core.material.enemys).filter(function (one) {
var list = Object.keys(core.material.enemys);
if (before.endsWith("怪物") && MotaActionFunctions) {
list = MotaActionFunctions.pattern.replaceEnemyList.map(function (v) {
return v[1];
}).concat(list);
}
return list.filter(function (one) {
return one != token && one.startsWith(token);
})
} else {
@ -957,7 +444,7 @@ function omitedcheckUpdateFunction(event) {
if (before.endsWith("怪物") || (ch == ':' && ch2 == ':' && before.endsWith("enemy"))) {
var list = ["name", "hp", "atk", "def", "money", "exp", "point", "special"];
if (before.endsWith("怪物") && MotaActionFunctions) {
list = MotaActionFunctions.pattern.replaceEnemyList.map(function (v) {
list = MotaActionFunctions.pattern.replaceEnemyValueList.map(function (v) {
return v[1];
}).concat(list);
}
@ -1004,19 +491,32 @@ function omitedcheckUpdateFunction(event) {
}).sort();
}
var allIds = core.getAllIconIds();
var allIconIds = allIds.concat(Object.keys(core.statusBar.icons).filter(function (x) {
var namesObj={};
namesObj.allIds = ["this"].concat(core.getAllIconIds());
namesObj.allIconIds = namesObj.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 allFloorIds = core.floorIds;
var allColors = ["aqua青色", "black黑色", "blue蓝色", "fuchsia品红色", "gray灰色", "green深绿色", "lime绿色",
namesObj.allImages = Object.keys(core.material.images.images);
namesObj.allEnemys = Object.keys(core.material.enemys);
if (MotaActionFunctions && !MotaActionFunctions.disableReplace) {
namesObj.allEnemys = namesObj.allEnemys.concat(MotaActionFunctions.pattern.replaceEnemyList.map(function (x) {
return x[1];
}))
}
namesObj.allItems = Object.keys(core.material.items);
if (MotaActionFunctions && !MotaActionFunctions.disableReplace) {
namesObj.allItems = namesObj.allItems.concat(MotaActionFunctions.pattern.replaceItemList.map(function (x) {
return x[1];
}))
}
namesObj.allAnimates = Object.keys(core.material.animates);
namesObj.allBgms = Object.keys(core.material.bgms);
namesObj.allSounds = Object.keys(core.material.sounds);
namesObj.allShops = Object.keys(core.status.shops);
namesObj.allFloorIds = core.floorIds;
namesObj.allColors = ["aqua青色", "black黑色", "blue蓝色", "fuchsia品红色", "gray灰色", "green深绿色", "lime绿色",
"maroon深红色", "navy深蓝色", "gold金色", "olive黄褐色", "orange橙色", "purple品红色",
"red红色", "silver淡灰色", "teal深青色", "white白色", "yellow黄色"];
var filter = function (list, content) {
@ -1026,56 +526,18 @@ function omitedcheckUpdateFunction(event) {
}
// 对任意图块提供补全
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 == 'enemyattr_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);
}
// 对楼层名进行补全
if ((type == 'setFloor_s' || type == 'show_s' || type == 'hide_s' || type == 'insert_2_s'
|| type == 'setBlock_s' || type == 'turnBlock_s' || type == 'showFloorImg_s' || type == 'hideFloorImg_s'
|| type == 'showBgFgMap_s' || type == 'hideBgFgMap_s' || type == 'setBgFgBlock_s'
|| type == 'openDoor_s' || type == 'changeFloor_m') && name == "IdString_0") {
return filter(allFloorIds, content);
for(var ii=0,names;names=['allIds','allEnemys','allItems','allImages','allAnimates','allBgms','allSounds','allShops','allFloorIds'][ii];ii++){
if (MotaActionBlocks[type][names] && eval(MotaActionBlocks[type][names]).indexOf(name)!==-1) {
return filter(namesObj[names], content);
}
}
// 对\f进行自动补全
@ -1084,7 +546,7 @@ function omitedcheckUpdateFunction(event) {
if (content.charAt(index) == '\\') index++;
var after = content.substring(index + 2);
if (after.indexOf(",") < 0 && after.indexOf("]") < 0) {
return filter(allImages, after);
return filter(namesObj.allImages, after);
}
}
@ -1093,7 +555,7 @@ function omitedcheckUpdateFunction(event) {
if (index >= 0) {
var after = content.substring(index + 3);
if (after.indexOf("]") < 0) {
return filter(allIconIds, after);
return filter(namesObj.allIconIds, after);
}
}
@ -1103,7 +565,7 @@ function omitedcheckUpdateFunction(event) {
if (content.charAt(index) == '\\') index++;
var after = content.substring(index + 2);
if (after.indexOf("]") < 0) {
return filter(allColors, after);
return filter(namesObj.allColors, after);
}
}
@ -1133,7 +595,7 @@ Blockly.FieldColour.prototype.createWidget_ = function() {
var getValue=function(){
// return self.getValue() // css颜色
var f = pb.getFieldValue(targetf);
if (/^(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d),(25[0-5]|2[0-4]\d|1\d\d|[1-9]\d|\d)(,0(\.\d+)?|,1)?$/.test(f)) {
if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(f)) {
return f;
}
return "";
@ -1150,9 +612,8 @@ Blockly.FieldColour.prototype.createWidget_ = function() {
setTimeout(function () {
document.getElementById("colorPicker").value = getValue();
window.jsColorPicker.confirm = setValue;
// 设置位置
triggerColorPicker(Blockly.WidgetDiv.DIV.style.left, Blockly.WidgetDiv.DIV.style.top);
openColorPicker(Blockly.WidgetDiv.DIV.style.left, Blockly.WidgetDiv.DIV.style.top, setValue);
});
return document.createElement('table');
@ -1195,7 +656,7 @@ Blockly.FieldTextInput.prototype.showInlineEditor_ = function(quietInput) {
// 给inputDom绑事件
inputDom.oninput=function(){
var value=inputDom.value
if(/[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?/.test(value)){
if(/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(value)){
setValue('rgba('+value+')')
}
}

View File

@ -0,0 +1,520 @@
editor_blocklyconfig=(function(){
// start mark sfergsvae
(function(){
var getCategory = function(name,custom){
for(var node of document.getElementById('toolbox').children) {
if(node.getAttribute('name')==name) return node;
}
var node = document.createElement('category');
node.setAttribute('name',name);
if(custom)node.setAttribute('custom',custom);
document.getElementById('toolbox').appendChild(node);
return node;
}
var toolboxObj = {
'入口方块':[
'<label text="入口方块会根据当前类型在此数组中筛选,具体控制在editor_blockly.entranceCategoryCallback中"></label>',
MotaActionFunctions.actionParser.parse([
"欢迎使用事件编辑器",
"本事件触发一次后会消失",
{"type": "hide", "time": 500},
],'event'),
MotaActionFunctions.actionParser.parse({
"condition": "flag:__door__==2",
"currentFloor": true,
"priority": 0,
"delayExecute": false,
"multiExecute": false,
"data": [
{"type": "openDoor", "loc": [10,5]}
],
},'autoEvent'),
MotaActionBlocks['changeFloor_m'].xmlText(),
MotaActionFunctions.actionParser.parse([{
"id": "shop1",
"text": "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
"textInList": "1F金币商店",
"choices": [
{"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",
"item": true,
"textInList": "道具商店",
"choices": [
{"id": "yellowKey", "number": 10, "money": 10}
]
},{
"id": "keyShop1",
"textInList": "回收钥匙商店",
"commonEvent": "回收钥匙商店",
"args": ""
}],'shop'),
MotaActionBlocks['afterBattle_m'].xmlText(),
MotaActionBlocks['afterGetItem_m'].xmlText(),
MotaActionBlocks['afterOpenDoor_m'].xmlText(),
MotaActionBlocks['firstArrive_m'].xmlText(),
MotaActionBlocks['eachArrive_m'].xmlText(),
MotaActionBlocks['level_m'].xmlText(),
MotaActionBlocks['commonEvent_m'].xmlText(),
MotaActionBlocks['item_m'].xmlText(),
MotaActionFunctions.actionParser.parse([
{"title":"简单", "name": "Easy", "hard": 1, "action": [
{"type": "comment", "text": "在这里写该难度需执行的事件"}
]}
], 'levelChoose'),
MotaActionFunctions.actionParser.parse({
"type": 0, "value": {"atk": 10}, "percentage": {"speed": 10},
}, 'equip'),
MotaActionFunctions.actionParser.parse([{
"name": "bg.jpg", "x": 0, "y": 0, "canvas": "bg"
}], 'floorImage'),
MotaActionFunctions.actionParser.parse({
"time": 160, "openSound": "door.mp3", "closeSound": "door.mp3", "keys": {"yellowKey": 1, "orangeKey": 1}
}, 'doorInfo'),
MotaActionBlocks['faceIds_m'].xmlText(),
MotaActionBlocks['mainStyle_m'].xmlText(),
],
'显示文字':[
MotaActionBlocks['text_0_s'].xmlText(),
MotaActionBlocks['text_1_s'].xmlText(),
MotaActionBlocks['comment_s'].xmlText(),
MotaActionBlocks['autoText_s'].xmlText(),
MotaActionBlocks['scrollText_s'].xmlText(),
MotaActionBlocks['setText_s'].xmlText(),
MotaActionBlocks['showImage_s'].xmlText(),
MotaActionBlocks['showImage_1_s'].xmlText(),
MotaActionBlocks['hideImage_s'].xmlText(),
MotaActionBlocks['showTextImage_s'].xmlText(),
MotaActionBlocks['moveImage_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',0,MotaActionBlocks['choicesContext'].xmlText([
'剑','','',null,'',MotaActionFunctions.actionParser.parseList([{"type": "openDoor", "loc": [3,3]}]),
])
]),
],
'数据相关':[
MotaActionBlocks['setValue_s'].xmlText([
MotaActionBlocks['idIdList_e'].xmlText(['status','生命']), '=', '', false
]),
MotaActionBlocks['setEnemy_s'].xmlText(),
MotaActionBlocks['setFloor_s'].xmlText(),
MotaActionBlocks['setGlobalAttribute_s'].xmlText(),
MotaActionBlocks['setGlobalValue_s'].xmlText(),
MotaActionBlocks['setGlobalFlag_s'].xmlText(),
MotaActionBlocks['input_s'].xmlText(),
MotaActionBlocks['input2_s'].xmlText(),
MotaActionBlocks['update_s'].xmlText(),
MotaActionBlocks['moveAction_s'].xmlText(),
MotaActionBlocks['moveHero_s'].xmlText(),
MotaActionBlocks['jumpHero_s'].xmlText(),
MotaActionBlocks['changeFloor_s'].xmlText(),
MotaActionBlocks['changePos_s'].xmlText(),
MotaActionBlocks['battle_s'].xmlText(),
MotaActionBlocks['useItem_s'].xmlText(),
MotaActionBlocks['loadEquip_s'].xmlText(),
MotaActionBlocks['unloadEquip_s'].xmlText(),
MotaActionBlocks['openShop_s'].xmlText(),
MotaActionBlocks['disableShop_s'].xmlText(),
MotaActionBlocks['setHeroIcon_s'].xmlText(),
MotaActionBlocks['follow_s'].xmlText(),
MotaActionBlocks['unfollow_s'].xmlText(),
],
'地图处理':[
MotaActionBlocks['battle_1_s'].xmlText(),
MotaActionBlocks['openDoor_s'].xmlText(),
MotaActionBlocks['closeDoor_s'].xmlText(),
MotaActionBlocks['show_s'].xmlText(),
MotaActionBlocks['hide_s'].xmlText(),
MotaActionBlocks['setBlock_s'].xmlText(),
MotaActionBlocks['turnBlock_s'].xmlText(),
MotaActionBlocks['move_s'].xmlText(),
MotaActionBlocks['jump_s'].xmlText(),
MotaActionBlocks['showBgFgMap_s'].xmlText(),
MotaActionBlocks['hideBgFgMap_s'].xmlText(),
MotaActionBlocks['setBgFgBlock_s'].xmlText(),
MotaActionBlocks['showFloorImg_s'].xmlText(),
MotaActionBlocks['hideFloorImg_s'].xmlText(),
],
'事件控制':[
MotaActionBlocks['if_1_s'].xmlText(),
MotaActionBlocks['if_s'].xmlText(),
MotaActionFunctions.actionParser.parseList({"type": "switch", "condition": "判别值", "caseList": [
{"action": [{"type": "comment", "text": "当判别值是值的场合执行此事件"}]},
{"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['exit_s'].xmlText(),
MotaActionBlocks['trigger_s'].xmlText(),
MotaActionBlocks['insert_1_s'].xmlText(),
MotaActionBlocks['insert_2_s'].xmlText(),
],
'特效/声音':[
MotaActionBlocks['sleep_s'].xmlText(),
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(),
MotaActionBlocks['vibrate_s'].xmlText(),
MotaActionBlocks['animate_s'].xmlText(),
MotaActionBlocks['setViewport_s'].xmlText(),
MotaActionBlocks['moveViewport_s'].xmlText(),
MotaActionBlocks['showStatusBar_s'].xmlText(),
MotaActionBlocks['hideStatusBar_s'].xmlText(),
MotaActionBlocks['showHero_s'].xmlText(),
MotaActionBlocks['hideHero_s'].xmlText(),
MotaActionBlocks['setCurtain_0_s'].xmlText(),
MotaActionBlocks['setCurtain_1_s'].xmlText(),
MotaActionBlocks['screenFlash_s'].xmlText(),
MotaActionBlocks['setWeather_s'].xmlText(),
MotaActionBlocks['playBgm_s'].xmlText(),
MotaActionBlocks['pauseBgm_s'].xmlText(),
MotaActionBlocks['resumeBgm_s'].xmlText(),
MotaActionBlocks['loadBgm_s'].xmlText(),
MotaActionBlocks['freeBgm_s'].xmlText(),
MotaActionBlocks['playSound_s'].xmlText(),
MotaActionBlocks['stopSound_s'].xmlText(),
MotaActionBlocks['setVolume_s'].xmlText(),
MotaActionBlocks['callBook_s'].xmlText(),
MotaActionBlocks['callSave_s'].xmlText(),
MotaActionBlocks['autoSave_s'].xmlText(),
MotaActionBlocks['callLoad_s'].xmlText(),
],
'UI绘制':[
MotaActionBlocks['previewUI_s'].xmlText(),
MotaActionBlocks['clearMap_s'].xmlText(),
MotaActionBlocks['clearMap_1_s'].xmlText(),
MotaActionBlocks['setAttribute_s'].xmlText(),
MotaActionBlocks['fillText_s'].xmlText(),
MotaActionBlocks['fillBoldText_s'].xmlText(),
MotaActionBlocks['drawTextContent_s'].xmlText(),
MotaActionBlocks['fillRect_s'].xmlText(),
MotaActionBlocks['strokeRect_s'].xmlText(),
MotaActionBlocks['drawLine_s'].xmlText(),
MotaActionBlocks['drawArrow_s'].xmlText(),
MotaActionBlocks['fillPolygon_s'].xmlText(),
MotaActionBlocks['strokePolygon_s'].xmlText(),
MotaActionBlocks['fillEllipse_s'].xmlText(),
MotaActionBlocks['strokeEllipse_s'].xmlText(),
MotaActionBlocks['fillArc_s'].xmlText(),
MotaActionBlocks['strokeArc_s'].xmlText(),
MotaActionBlocks['drawImage_s'].xmlText(),
MotaActionBlocks['drawImage_1_s'].xmlText(),
MotaActionBlocks['drawIcon_s'].xmlText(),
MotaActionBlocks['drawBackground_s'].xmlText(),
MotaActionBlocks['drawSelector_s'].xmlText(),
MotaActionBlocks['drawSelector_1_s'].xmlText(),
],
'原生脚本':[
MotaActionBlocks['function_s'].xmlText(),
MotaActionBlocks['unknown_s'].xmlText(),
],
'值块':[
MotaActionBlocks['setValue_s'].xmlText([
MotaActionBlocks['idIdList_e'].xmlText(['status','生命']), '=', '', false
]),
MotaActionBlocks['expression_arithmetic_0'].xmlText(),
MotaActionBlocks['idFlag_e'].xmlText(),
MotaActionBlocks['idTemp_e'].xmlText(),
MotaActionBlocks['negate_e'].xmlText(),
MotaActionBlocks['bool_e'].xmlText(),
MotaActionBlocks['idString_e'].xmlText(),
MotaActionBlocks['idIdList_e'].xmlText(),
MotaActionBlocks['idFixedList_e'].xmlText(),
MotaActionBlocks['enemyattr_e'].xmlText(),
MotaActionBlocks['blockId_e'].xmlText(),
MotaActionBlocks['blockCls_e'].xmlText(),
MotaActionBlocks['equip_e'].xmlText(),
MotaActionBlocks['evalString_e'].xmlText(),
],
'常见事件模板':[
'<label text="检测音乐如果没有开启则系统提示开启"></label>',
MotaActionFunctions.actionParser.parseList({"type": "if", "condition": "!core.musicStatus.bgmStatus",
"true": [
"\t[系统提示]你当前音乐处于关闭状态,本塔开音乐游戏效果更佳"
],
"false": []
}),
'<label text="商店购买属性/钥匙"></label>',
MotaActionFunctions.actionParser.parse([
{"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",
"displayDamage": true,
"data": [
' ... 战前剧情',
{"type": "battle", "id": "greenSlime"},
' ... 战后剧情;请注意上面的强制战斗不会使怪物消失',
'需要下一句来调用{"type": "hide"}来隐藏事件',
{"type": "hide"},
]
},'event'),
'<label text="打怪掉落道具"></label>',
MotaActionFunctions.actionParser.parse([
'怪物变成了黄钥匙(黄钥匙idnum是21)',
'打怪变成可对话的NPC: https://ckcz123.github.io/mota-js/#/event?id=%e6%89%93%e6%80%aa%e5%8f%98%e6%88%90%e5%8f%af%e5%af%b9%e8%af%9d%e7%9a%84npc%ef%bc%88%e6%80%aa%e7%89%a9-gtnpc%ef%bc%89',
{"type": "setBlock", "number": 21}
],'afterBattle'),
'<label text="打怪开门"></label>',
MotaActionFunctions.actionParser.parse([
{"type": "setValue", "name": "flag:__door__", "operator": "+=", "value": "1"},
{"type": "if", "condition": "flag:__door__==2",
"true": [
{"type": "openDoor", "loc": [10,5]}
],
"false": []
},
],'afterBattle'),
'<label text="杀死魔龙后隐藏其余图块"></label>',
MotaActionFunctions.actionParser.parse([
{"type": "function", "function": "function(){var x=core.status.event.data.x,y=core.status.event.data.y;if(core.isset(x)&&core.isset(y)){core.insertAction([{type:'hide',loc:[[x-1,y-2],[x,y-2],[x+1,y-2],[x-1,y-1],[x,y-1],[x+1,y-1],[x-1,y],[x+1,y]]}]);}}"},
],'afterBattle'),
'<label text="获得圣水后变成墙"></label>',
MotaActionFunctions.actionParser.parse({
"trigger": "action",
"noPass": true,
"data": [
{"type": "if", "condition": "flag:hasSuperPotion",
"true": [],
"false": [
{"type":"setValue", "name":"status:hp", "operator": "*=", "value": "2"},
{"type":"setBlock", "number": 1},
{"type":"setValue", "name":"flag:hasSuperPotion", "value": "true"}
]
}
]
},'event'),
],
'最近使用事件':[
'<label text="此处只是占位符,实际定义在editor_blockly.searchBlockCategoryCallback中"></label>',
]
}
var toolboxgap = '<sep gap="5"></sep>'
//xml_text = MotaActionFunctions.actionParser.parse(obj,type||'event')
//MotaActionBlocks['idString_e'].xmlText()
for (var name in toolboxObj){
var custom = null;
if(name=='最近使用事件')custom='searchBlockCategory';
if(name=='入口方块')custom='entranceCategory';
getCategory(name,custom).innerHTML = toolboxObj[name].join(toolboxgap);
}
var blocklyArea = document.getElementById('blocklyArea');
var blocklyDiv = document.getElementById('blocklyDiv');
var workspace = Blockly.inject(blocklyDiv,{
media: '_server/blockly/media/',
toolbox: document.getElementById('toolbox'),
zoom:{
controls: true,
wheel: false,//滚轮改为上下(shift:左右)翻滚
startScale: 1.0,
maxScale: 3,
minScale: 0.3,
scaleSpeed: 1.08
},
trashcan: false,
});
editor_blockly.entranceCategoryCallback = function(workspace) {
var list=toolboxObj['入口方块']
var xmlList = [];
var eventType = editor_blockly.entryType+'_m';
for(var ii=0,blockText;blockText=list[ii];ii++){
if(new RegExp('<block type="'+eventType+'">').exec(blockText)){
var block = Blockly.Xml.textToDom('<xml>'+blockText+'</xml>').firstChild;
block.setAttribute("gap", 5);
xmlList.push(block);
}
}
return xmlList;
}
workspace.registerToolboxCategoryCallback(
'entranceCategory', editor_blockly.entranceCategoryCallback);
editor_blockly.searchBlockCategoryCallback = function(workspace) {
var xmlList = [];
var labels = editor_blockly.searchBlock();
for (var i = 0; i < labels.length; i++) {
var blockText = '<xml>' +
MotaActionBlocks[labels[i]].xmlText() +
'</xml>';
var block = Blockly.Xml.textToDom(blockText).firstChild;
block.setAttribute("gap", 5);
xmlList.push(block);
}
return xmlList;
};
workspace.registerToolboxCategoryCallback(
'searchBlockCategory', editor_blockly.searchBlockCategoryCallback);
var onresize = function(e) {
blocklyDiv.style.width = blocklyArea.offsetWidth + 'px';
blocklyDiv.style.height = blocklyArea.offsetHeight + 'px';
Blockly.svgResize(workspace);
};
if(typeof editor !== "undefined" && !editor.isMobile)window.addEventListener('resize', onresize, false);
onresize();
//Blockly.svgResize(workspace);
//Blockly.bindEventWithChecks_(workspace.svgGroup_,"wheel",workspace,function(e){});
document.getElementById('blocklyDiv').onmousewheel = function(e){
//console.log(e);
e.preventDefault();
var hvScroll = e.shiftKey?'hScroll':'vScroll';
var mousewheelOffsetValue=20/380*workspace.scrollbar[hvScroll].handleLength_*3;
workspace.scrollbar[hvScroll].handlePosition_+=( ((e.deltaY||0)+(e.detail||0)) >0?mousewheelOffsetValue:-mousewheelOffsetValue);
workspace.scrollbar[hvScroll].onScroll_();
workspace.setScale(workspace.scale);
}
var doubleClickCheck=[[0,'abc']];
function omitedcheckUpdateFunction(event) {
if(event.type==='create'){
editor_blockly.addIntoLastUsedType(event.blockId);
}
if(event.type==='ui'){
var newClick = [new Date().getTime(),event.blockId];
var lastClick = doubleClickCheck.shift();
doubleClickCheck.push(newClick);
if(newClick[0]-lastClick[0]<500){
if(newClick[1]===lastClick[1]){
editor_blockly.doubleClickBlock(newClick[1]);
}
}
}
if(editor_blockly.workspace.topBlocks_.length>=2){
editor_blockly.setValue('入口方块只能有一个');
return;
}
var eventType = editor_blockly.entryType;
if(editor_blockly.workspace.topBlocks_.length==1){
var blockType = editor_blockly.workspace.topBlocks_[0].type;
if(blockType!==eventType+'_m'){
editor_blockly.setValue('入口方块类型错误');
return;
}
}
try {
var code = Blockly.JavaScript.workspaceToCode(workspace).replace(/\\(i|c|d|e|z)/g, '\\\\$1');
editor_blockly.setValue(code);
} catch (error) {
editor_blockly.setValue(String(error));
if (error instanceof OmitedError){
var blockName = error.blockName;
var varName = error.varName;
var block = error.block;
}
// console.log(error);
}
}
workspace.addChangeListener(omitedcheckUpdateFunction);
workspace.addChangeListener(Blockly.Events.disableOrphans);
editor_blockly.workspace = workspace;
MotaActionFunctions.workspace = function(){
return editor_blockly.workspace;
}
// 因为在editor_blockly.parse里已经HTML转义过一次了,所以这里要覆盖掉以避免在注释中出现&lt;等
MotaActionFunctions.xmlText = function (ruleName,inputs,isShadow,comment) {
var rule = MotaActionBlocks[ruleName];
var blocktext = isShadow?'shadow':'block';
var xmlText = [];
xmlText.push('<'+blocktext+' type="'+ruleName+'">');
if(!inputs)inputs=[];
for (var ii=0,inputType;inputType=rule.argsType[ii];ii++) {
var input = inputs[ii];
var _input = '';
var noinput = (input===null || input===undefined);
if(noinput && inputType==='field') continue;
if(noinput) input = '';
if(inputType!=='field') {
var subList = false;
var subrulename = rule.argsGrammarName[ii];
var subrule = MotaActionBlocks[subrulename];
if (subrule instanceof Array) {
subrulename=subrule[subrule.length-1];
subrule = MotaActionBlocks[subrulename];
subList = true;
}
_input = subrule.xmlText([],true);
if(noinput && !subList && !isShadow) {
//无输入的默认行为是: 如果语句块的备选方块只有一个,直接代入方块
input = subrule.xmlText();
}
}
xmlText.push('<'+inputType+' name="'+rule.args[ii]+'">');
xmlText.push(_input+input);
xmlText.push('</'+inputType+'>');
}
if(comment){
xmlText.push('<comment>');
xmlText.push(comment);
xmlText.push('</comment>');
}
var next = inputs[rule.args.length];
if (next) {//next
xmlText.push('<next>');
xmlText.push(next);
xmlText.push('</next>');
}
xmlText.push('</'+blocktext+'>');
return xmlText.join('');
}
})();
// end mark sfergsvae
}).toString().split('// start mark sfergsvae')[1].split('// end mark sfergsvae')[0]

View File

@ -388,6 +388,10 @@ editor_datapanel_wrapper = function (editor) {
printe('不合法的id请使用字母、数字或下划线且不能以数字开头')
return;
}
if (id == 'hero' || id == 'this' || id == 'none' || id == 'airwall') {
printe('不得使用保留关键字作为id');
return;
}
editor.file.changeIdAndIdnum(id, null, editor_mode.info, function (err) {
if (err) {
printe(err);

View File

@ -212,7 +212,7 @@ editor_file = function (editor, callback) {
canUseQuickShop: currData.canUseQuickShop,
cannotViewMap: currData.cannotViewMap,
cannotMoveDirectly: currData.cannotMoveDirectly,
item_ratio: currData.item_ratio,
ratio: currData.ratio,
defaultGround: currData.defaultGround,
bgm: currData.bgm,
color: currData.color,
@ -260,7 +260,7 @@ editor_file = function (editor, callback) {
canUseQuickShop: currData.canUseQuickShop,
cannotViewMap: currData.cannotViewMap,
cannotMoveDirectly: currData.cannotMoveDirectly,
item_ratio: currData.item_ratio,
ratio: currData.ratio,
defaultGround: currData.defaultGround,
bgm: currData.bgm,
color: currData.color,
@ -499,7 +499,7 @@ editor_file = function (editor, callback) {
/*actionList:[
["change","['items']['name']","红宝石的新名字"],
["add","['items']['新的和name同级的属性']",123],
["change","['itemEffectTip']","',攻击力+'+editor.core.values.redJewel"],
["change","['itemEffectTip']","',攻击力+'+editor.core.values.redGem"],
]
[]时只查询不修改
*/
@ -574,7 +574,7 @@ editor_file = function (editor, callback) {
editor.file.editMapBlocksInfo = function (idnum, actionList, callback) {
/*actionList:[
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。"]],
["change","['events']",["\t[老人,wizard]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。"]],
["change","['afterBattle']",null],
]
[]时只查询不修改
@ -618,7 +618,7 @@ editor_file = function (editor, callback) {
editor.file.editLoc = function (x, y, actionList, callback) {
/*actionList:[
["change","['events']",["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。"]],
["change","['events']",["\t[老人,wizard]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。"]],
["change","['afterBattle']",null],
]
[]时只查询不修改

View File

@ -135,7 +135,7 @@ editor_game_wrapper = function (editor, main, core) {
// 获取当前地图
editor_game.prototype.fetchMapFromCore = function () {
var mapArray = core.maps.saveMap(core.status.floorId);
var mapArray = core.getMapArray(core.status.floorId, true);
editor.map = mapArray.map(function (v) {
return v.map(function (v) {
var x = parseInt(v), y = editor.indexs[x];

View File

@ -24,13 +24,15 @@ editor_listen_wrapper = function (editor) {
editor.dom.iconExpandBtn.onclick = editor.uifunctions.fold_material_click
editor.dom.iconLib.onmousedown = editor.uifunctions.material_ondown
editor.dom.iconLib.onmousemove = editor.uifunctions.material_onmove
editor.dom.iconLib.onmouseup = editor.uifunctions.material_onup
editor.dom.iconLib.oncontextmenu = function (e) { e.preventDefault() }
editor.dom.extraEvent.onmousedown = editor.uifunctions.extraEvent_click
editor.dom.chooseThis.onmousedown = editor.uifunctions.chooseThis_click
editor.dom.chooseInRight.onmousedown = editor.uifunctions.chooseInRight_click
editor.dom.copyLoc.onmousedown = editor.uifunctions.copyLoc_click
editor.dom.moveLoc.onmousedown = editor.uifunctions.moveLoc_click
editor.dom.pasteLoc.onmousedown = editor.uifunctions.pasteLoc_click
editor.dom.clearEvent.onmousedown = editor.uifunctions.clearEvent_click
editor.dom.clearLoc.onmousedown = editor.uifunctions.clearLoc_click
@ -128,10 +130,18 @@ editor_listen_wrapper = function (editor) {
editor.dom.chooseInRight.onmousedown = null
editor.dom.copyLoc.ontouchstart = editor.dom.copyLoc.onmousedown
editor.dom.copyLoc.onmousedown = null
editor.dom.moveLoc.ontouchstart = editor.dom.moveLoc.onmousedown
editor.dom.moveLoc.onmousedown = null
editor.dom.pasteLoc.ontouchstart = editor.dom.pasteLoc.onmousedown
editor.dom.pasteLoc.onmousedown = null
editor.dom.clearLoc.ontouchstart = editor.dom.clearLoc.onmousedown
editor.dom.clearLoc.onmousedown = null
// 不使用以下6语句, 会使得素材区手机无法拖动, 手机的框选素材只能放弃, 要通过弹框实现框选
// editor.dom.iconLib.ontouchstart = editor.dom.iconLib.onmousedown
// editor.dom.iconLib.onmousedown = null
// editor.dom.iconLib.ontouchmove = editor.dom.iconLib.onmousemove
// editor.dom.iconLib.onmousemove = null
// editor.dom.iconLib.ontouchend = editor.dom.iconLib.onmouseup
// editor.dom.iconLib.onmouseup = null
}
editor.constructor.prototype.mode_listen = function (callback) {

View File

@ -75,6 +75,8 @@ editor_mappanel_wrapper = function (editor) {
* + 绘图时画个矩形在那个位置
*/
editor.uifunctions.map_ondown = function (e) {
editor.uivalues.selectedArea = null;
editor.uivalues.lastMoveE=e;
var loc = editor.uifunctions.eToLoc(e);
var pos = editor.uifunctions.locToPos(loc, true);
if (editor.uivalues.bindSpecialDoor.loc != null) {
@ -89,10 +91,10 @@ editor_mappanel_wrapper = function (editor) {
}
return false;
}
if (e.button == 2) {
editor.uifunctions.showMidMenu(e.clientX, e.clientY);
return false;
}
// if (e.buttons == 2) { // 挪到onup
// editor.uifunctions.showMidMenu(e.clientX, e.clientY);
// return false;
// }
if (!selectBox.isSelected()) {
editor_mode.onmode('nextChange');
editor_mode.onmode('loc');
@ -122,6 +124,7 @@ editor_mappanel_wrapper = function (editor) {
* + 绘图模式时找到与队列尾相邻的鼠标方向的点画个矩形
*/
editor.uifunctions.map_onmove = function (e) {
editor.uivalues.lastMoveE=e;
if (!selectBox.isSelected()) {
if (editor.uivalues.startPos == null) return;
//tip.whichShow(1);
@ -136,9 +139,25 @@ editor_mappanel_wrapper = function (editor) {
editor.uivalues.endPos = pos;
if (editor.uivalues.startPos != null) {
if (editor.uivalues.startPos.x != editor.uivalues.endPos.x || editor.uivalues.startPos.y != editor.uivalues.endPos.y) {
core.drawArrow('eui',
32 * editor.uivalues.startPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.startPos.y + 16 - core.bigmap.offsetY,
32 * editor.uivalues.endPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.endPos.y + 16 - core.bigmap.offsetY);
if (e.buttons == 2) {
// 右键拖拽: 画选的区域
var x0 = editor.uivalues.startPos.x;
var y0 = editor.uivalues.startPos.y;
var x1 = editor.uivalues.endPos.x;
var y1 = editor.uivalues.endPos.y;
if (x0 > x1) { x0 ^= x1; x1 ^= x0; x0 ^= x1; }//swap
if (y0 > y1) { y0 ^= y1; y1 ^= y0; y0 ^= y1; }//swap
// draw rect
editor.dom.euiCtx.clearRect(0, 0, editor.dom.euiCtx.canvas.width, editor.dom.euiCtx.canvas.height);
editor.dom.euiCtx.fillStyle = 'rgba(0, 127, 255, 0.4)';
editor.dom.euiCtx.fillRect(32 * x0 - core.bigmap.offsetX, 32 * y0 - core.bigmap.offsetY,
32 * (x1 - x0) + 32, 32 * (y1 - y0) + 32);
}else{
// 左键拖拽: 画箭头
core.drawArrow('eui',
32 * editor.uivalues.startPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.startPos.y + 16 - core.bigmap.offsetY,
32 * editor.uivalues.endPos.x + 16 - core.bigmap.offsetX, 32 * editor.uivalues.endPos.y + 16 - core.bigmap.offsetY);
}
}
}
// editor_mode.onmode('nextChange');
@ -192,16 +211,35 @@ editor_mappanel_wrapper = function (editor) {
* + 非绘图模式时, 交换首末点的内容
* + 绘图模式时, 根据画线/画矩形/画tileset 做对应的绘制
*/
editor.uifunctions.map_onup = function (e) {
editor.uifunctions.map_onup = function (ee) {
editor.uivalues.selectedArea = null;
ee.preventDefault();
ee.stopPropagation();
var e=editor.uivalues.lastMoveE;
if (!selectBox.isSelected()) {
//tip.whichShow(1);
// editor.movePos(editor.uivalues.startPos, editor.uivalues.endPos);
if (editor.layerMod == 'map')
editor.exchangePos(editor.uivalues.startPos, editor.uivalues.endPos);
else
editor.exchangeBgFg(editor.uivalues.startPos, editor.uivalues.endPos, editor.layerMod);
if (e.buttons == 2) {
if (editor.uivalues.endPos==null || (editor.uivalues.startPos.x == editor.uivalues.endPos.x && editor.uivalues.startPos.y == editor.uivalues.endPos.y)) {
// 右键点击: 弹菜单
editor.uifunctions.showMidMenu(e.clientX, e.clientY);
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
} else {
// 右键拖拽: 选中区域
printf('已经选中该区域')
editor.uivalues.selectedArea = Object.assign({}, editor.uivalues.startPos, {x1: editor.uivalues.endPos.x, y1: editor.uivalues.endPos.y});
// 后续的处理
}
} else {
// 左键拖拽: 交换
//tip.whichShow(1);
// editor.movePos(editor.uivalues.startPos, editor.uivalues.endPos);
if (editor.layerMod == 'map')
editor.exchangePos(editor.uivalues.startPos, editor.uivalues.endPos);
else
editor.exchangeBgFg(editor.uivalues.startPos, editor.uivalues.endPos, editor.layerMod);
editor.uifunctions.unhighlightSaveFloorButton();
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
}
editor.uivalues.startPos = editor.uivalues.endPos = null;
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
return false;
}
editor.uivalues.holdingPath = 0;
@ -239,12 +277,11 @@ editor_mappanel_wrapper = function (editor) {
var x0 = editor.uivalues.stepPostfix[0].x;
var y0 = editor.uivalues.stepPostfix[0].y;
var idnum = editor.info.idnum;
var pmod=function(a,b){return (a%b+b)%b;}
for (var ii = 0; ii < editor.uivalues.stepPostfix.length; ii++) {
if (editor.uivalues.stepPostfix[ii].y != y0) {
y0++;
idnum += imgWidth;
}
editor[editor.layerMod][editor.uivalues.stepPostfix[ii].y][editor.uivalues.stepPostfix[ii].x] = editor.ids[editor.indexs[idnum + editor.uivalues.stepPostfix[ii].x - x0]];
var dx=pmod(editor.uivalues.stepPostfix[ii].x-x0,editor.uivalues.tileSize[0]);
var dy=pmod(editor.uivalues.stepPostfix[ii].y-y0,editor.uivalues.tileSize[1]);
editor[editor.layerMod][editor.uivalues.stepPostfix[ii].y][editor.uivalues.stepPostfix[ii].x] = editor.ids[editor.indexs[idnum + dx+dy*imgWidth]];
}
} else {
// 检测是否是填充模式
@ -274,6 +311,7 @@ editor_mappanel_wrapper = function (editor) {
editor.uivalues.holdingPath = 0;
editor.uivalues.stepPostfix = [];
editor.dom.euiCtx.clearRect(0, 0, core.__PIXELS__, core.__PIXELS__);
editor.uifunctions.highlightSaveFloorButton();
}
return false;
}
@ -341,12 +379,7 @@ editor_mappanel_wrapper = function (editor) {
* 显示右键菜单
*/
editor.uifunctions.showMidMenu = function (x, y) {
editor.uivalues.lastRightButtonPos = JSON.parse(JSON.stringify(
[editor.pos, editor.uivalues.lastRightButtonPos[0]]
));
// --- copy
editor.uivalues.lastCopyedInfo = [editor.copyFromPos(), editor.uivalues.lastCopyedInfo[0]];
var locStr = '(' + editor.uivalues.lastRightButtonPos[1].x + ',' + editor.uivalues.lastRightButtonPos[1].y + ')';
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
@ -385,8 +418,8 @@ editor_mappanel_wrapper = function (editor) {
else editor.dom.extraEvent.style.display = 'none';
editor.dom.chooseThis.children[0].innerHTML = '选中此点' + '(' + editor.pos.x + ',' + editor.pos.y + ')'
editor.dom.copyLoc.children[0].innerHTML = '复制事件' + locStr + '到此处';
editor.dom.moveLoc.children[0].innerHTML = '交换事件' + locStr + '与此事件的位置';
editor.dom.copyLoc.children[0].innerHTML = '复制事件';
editor.dom.pasteLoc.children[0].innerHTML = '粘贴到此事件';
editor.dom.midMenu.style = 'top:' + (y + scrollTop) + 'px;left:' + (x + scrollLeft) + 'px;';
}
@ -465,6 +498,7 @@ editor_mappanel_wrapper = function (editor) {
editor.drawEventBlock();
editor_mode.showMode('loc');
printf('添加楼梯事件成功');
editor.uifunctions.unhighlightSaveFloorButton();
});
return true;
}
@ -525,6 +559,7 @@ editor_mappanel_wrapper = function (editor) {
editor.drawPosSelection();
editor_mode.showMode('loc');
printf('绑定机关门事件成功');
editor.uifunctions.unhighlightSaveFloorButton();
});
bindSpecialDoor.loc = null;
bindSpecialDoor.enemys = [];
@ -565,32 +600,39 @@ editor_mappanel_wrapper = function (editor) {
editor.uifunctions.copyLoc_click = function (e) {
editor.uifunctions.hideMidMenu();
e.stopPropagation();
e.preventDefault();
editor_mode.onmode('');
editor.uivalues.copyedInfo = editor.copyFromPos();
printf('该点事件已复制');
return;
}
/**
* editor.dom.pasteLoc.onmousedown
* 菜单 移动此事件
*/
editor.uifunctions.pasteLoc_click = function (e) {
editor.uifunctions.hideMidMenu();
e.stopPropagation();
e.preventDefault();
if (!editor.uivalues.copyedInfo) {
printe("没有复制的事件");
return;
}
editor.savePreMap();
editor_mode.onmode('');
var now = editor.pos, last = editor.uivalues.lastRightButtonPos[1];
if (now.x == last.x && now.y == last.y) return;
editor.pasteToPos(editor.uivalues.lastCopyedInfo[1]);
editor.pasteToPos(editor.uivalues.copyedInfo);
editor.updateMap();
editor.file.saveFloorFile(function (err) {
if (err) {
printe(err);
throw (err)
}
; printf('复制事件成功');
; printf('粘贴到事件成功');
editor.uifunctions.unhighlightSaveFloorButton();
editor.drawPosSelection();
});
}
/**
* editor.dom.moveLoc.onmousedown
* 菜单 移动此事件
*/
editor.uifunctions.moveLoc_click = function (e) {
editor.uifunctions.hideMidMenu();
e.stopPropagation();
editor.savePreMap();
editor_mode.onmode('');
editor.exchangePos(editor.pos, editor.uivalues.lastRightButtonPos[1]);
return;
}
/**
@ -600,6 +642,7 @@ editor_mappanel_wrapper = function (editor) {
editor.uifunctions.clearEvent_click = function (e) {
e.stopPropagation();
editor.clearPos(false);
editor.uifunctions.unhighlightSaveFloorButton();
}
/**
@ -609,6 +652,7 @@ editor_mappanel_wrapper = function (editor) {
editor.uifunctions.clearLoc_click = function (e) {
e.stopPropagation();
editor.clearPos(true);
editor.uifunctions.unhighlightSaveFloorButton();
}
/**
@ -647,13 +691,13 @@ editor_mappanel_wrapper = function (editor) {
* 切换画笔模式
*/
editor.uifunctions.brushMod3_onchange = function () {
if (!editor.config.get('alertTileMode') &&
!confirm("从V2.6.6开始tileset贴图模式已被废弃。\n请右键额外素材并输入所需要绘制的宽高然后单击地图以绘制一个区域。\n\n点取消将不再显示此提示。")) {
editor.config.set('alertTileMode', true);
if (!editor.config.get('alertTileModeV2.7') &&
!confirm("从V2.7开始请直接素材区拖框进行绘制区域。\n\n点取消将不再显示此提示。")) {
editor.config.set('alertTileModeV2.7', true);
}
// tip.showHelp(5)
tip.isSelectedBlock(false)
tip.msgs[11] = String('tileset贴图模式下可以按选中tileset素材并在地图上拖动来一次绘制一个区域');
tip.msgs[11] = String('tileset平铺模式下可以按选中tileset素材并在地图上拖动来一次绘制一个区域');
tip.whichShow(12);
editor.brushMod = editor.dom.brushMod3.value;
}
@ -765,6 +809,15 @@ editor_mappanel_wrapper = function (editor) {
});
}
editor.uifunctions.highlightSaveFloorButton=function(){
var saveFloor = document.getElementById('saveFloor');
saveFloor.style.background='#FFCCAA';
}
editor.uifunctions.unhighlightSaveFloorButton=function(){
var saveFloor = document.getElementById('saveFloor');
saveFloor.style.background='';
}
editor.uifunctions.saveFloor_func = function () {
var saveFloor = document.getElementById('saveFloor');
@ -776,6 +829,7 @@ editor_mappanel_wrapper = function (editor) {
throw (err)
}
; printf('保存成功');
editor.uifunctions.unhighlightSaveFloorButton()
});
}
saveFloor.onclick = editor_mode.saveFloor;
@ -827,30 +881,51 @@ editor_mappanel_wrapper = function (editor) {
editor.constructor.prototype.copyFromPos = function (pos) {
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
pos = pos || editor.pos;
var map = core.clone(editor.map[pos.y][pos.x]);
var events = {};
fields.forEach(function(v){
events[v] = core.clone(editor.currentFloorData[v][pos.x+','+pos.y]);
})
return {map: map, events: events};
var x0 = pos.x, y0 = pos.y, x1 = pos.x1, y1 = pos.y1;
if (x1 == null) x1 = x0;
if (y1 == null) y1 = y0;
if (x0 > x1) { x0 ^= x1; x1 ^= x0; x0 ^= x1; }//swap
if (y0 > y1) { y0 ^= y1; y1 ^= y0; y0 ^= y1; }//swap
var result = {w: x1 - x0 + 1, h: y1 - y0 + 1, layer: editor.layerMod, data: []};
for (var i = x0; i <= x1; ++i) {
for (var j = y0; j<= y1; ++j) {
var map = core.clone(editor[editor.layerMod][j][i]);
var events = {};
fields.forEach(function(v){
events[v] = core.clone(editor.currentFloorData[v][i+','+j]);
})
result.data.push({map: map, events: events});
}
}
return result;
}
editor.constructor.prototype.pasteToPos = function (info, pos) {
if (info == null) return;
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
pos = pos || editor.pos;
editor.map[pos.y][pos.x] = core.clone(info.map);
fields.forEach(function(v){
if (info.events[v] == null) delete editor.currentFloorData[v][pos.x+","+pos.y];
else editor.currentFloorData[v][pos.x+","+pos.y] = core.clone(info.events[v]);
});
var w = info.w || 1, h = info.h || 1, layer = info.layer || 'map';
var data = core.clone(info.data || []);
for (var i = pos.x; i < pos.x+w; ++i) {
for (var j = pos.y; j < pos.y+h; ++j) {
var one = data.shift();
if (j >= editor[editor.layerMod].length || i >= editor[editor.layerMod][0].length) continue;
editor[editor.layerMod][j][i] = core.clone(one.map);
if (layer == 'map' && editor.layerMod == 'map') {
fields.forEach(function(v){
if (one.events[v] == null) delete editor.currentFloorData[v][i+","+j];
else editor.currentFloorData[v][i+","+j] = core.clone(one.events[v]);
});
}
}
}
}
editor.constructor.prototype.movePos = function (startPos, endPos, callback) {
if (!startPos || !endPos) return;
if (startPos.x == endPos.x && startPos.y == endPos.y) return;
var copyed = editor.copyFromPos(startPos);
editor.pasteToPos({map:0, events: {}}, startPos);
editor.pasteToPos({w: 1, h: 1, layer: 'map', data: [{map:0, events: {}}]}, startPos);
editor.pasteToPos(copyed, endPos);
editor.updateMap();
editor.file.saveFloorFile(function (err) {
@ -937,16 +1012,28 @@ editor_mappanel_wrapper = function (editor) {
editor.constructor.prototype.clearPos = function (clearPos, pos, callback) {
var fields = Object.keys(editor.file.comment._data.floors._data.loc._data);
pos = pos || editor.pos;
var x0 = pos.x, y0 = pos.y, x1 = pos.x1, y1 = pos.y1;
if (x1 == null) x1 = x0;
if (y1 == null) y1 = y0;
if (x0 > x1) { x0 ^= x1; x1 ^= x0; x0 ^= x1; }//swap
if (y0 > y1) { y0 ^= y1; y1 ^= y0; y0 ^= y1; }//swap
editor.uifunctions.hideMidMenu();
editor.savePreMap();
editor.info = 0;
editor_mode.onmode('');
if (clearPos)
editor.map[pos.y][pos.x]=editor.info;
for (var i = x0; i <= x1; ++i) {
for (var j = y0; j <= y1; ++j) {
if (j >= editor[editor.layerMod].length || i >= editor[editor.layerMod][0].length) continue;
if (clearPos)
editor[editor.layerMod][j][i] = 0;
if (editor.layerMod == 'map') {
fields.forEach(function(v){
delete editor.currentFloorData[v][i+","+j];
});
}
}
}
editor.updateMap();
fields.forEach(function(v){
delete editor.currentFloorData[v][pos.x+','+pos.y];
})
editor.file.saveFloorFile(function (err) {
if (err) {
printe(err);

View File

@ -64,11 +64,51 @@ editor_materialpanel_wrapper = function (editor) {
/**
* editor.dom.iconLib.onmousedown
* 素材区的单击事件
* 素材区的单击/拖拽事件
*/
editor.uifunctions.material_ondown = function (e) {
e.stopPropagation();
e.preventDefault();
editor.uivalues.lastMoveMaterE=e;
if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return;
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
editor.uivalues.startLoc={
'x': scrollLeft + e.clientX + editor.dom.iconLib.scrollLeft - right.offsetLeft - editor.dom.iconLib.offsetLeft,
'y': scrollTop + e.clientY + editor.dom.iconLib.scrollTop - right.offsetTop - editor.dom.iconLib.offsetTop,
'px': e.clientX,
'py': e.clientY,
'size': 32
};
}
/**
* editor.dom.iconLib.onmousemove
* 素材区的单击/拖拽事件
*/
editor.uifunctions.material_onmove = function (e) {
e.stopPropagation();
e.preventDefault();
editor.uivalues.lastMoveMaterE=e;
if (!editor.uivalues.startLoc) return;
var pos0 = editor.uifunctions.locToPos(editor.uivalues.startLoc);
editor.dom.dataSelection.style.left = 32 * pos0.x + 'px';
editor.dom.dataSelection.style.top = 32 * pos0.y + 'px';
editor.dom.dataSelection.style.width = e.clientX - editor.uivalues.startLoc.px + 'px';
editor.dom.dataSelection.style.height = e.clientY - editor.uivalues.startLoc.py + 'px';
editor.dom.dataSelection.style.display = 'block';
}
/**
* editor.dom.iconLib.onmouseup
* 素材区的单击/拖拽事件
*/
editor.uifunctions.material_onup = function (ee) {
var startLoc = editor.uivalues.startLoc;
editor.uivalues.startLoc = null;
var e=editor.uivalues.lastMoveMaterE;
if (!editor.isMobile && e.clientY >= editor.dom.iconLib.offsetHeight - editor.uivalues.scrollBarHeight) return;
var scrollLeft = document.documentElement.scrollLeft || document.body.scrollLeft;
var scrollTop = document.documentElement.scrollTop || document.body.scrollTop;
@ -79,6 +119,7 @@ editor_materialpanel_wrapper = function (editor) {
};
editor.loc = loc;
editor.uivalues.tileSize = [1,1];
var pos0 = editor.uifunctions.locToPos(startLoc);
var pos = editor.uifunctions.locToPos(loc);
for (var spriter in editor.widthsX) {
if (pos.x >= editor.widthsX[spriter][1] && pos.x < editor.widthsX[spriter][2]) {
@ -115,6 +156,7 @@ editor_materialpanel_wrapper = function (editor) {
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';
editor.dom.dataSelection.style.width = 32 - 6 + 'px';
if (pos.x == 0 && pos.y == 0) {
// editor.info={idnum:0, id:'empty','images':'清除块', 'y':0};
@ -133,21 +175,24 @@ editor_materialpanel_wrapper = function (editor) {
editor.info = { 'images': pos.images, 'y': y }
}
for (var ii = 0; ii < editor.ids.length; ii++) {
if ((core.tilesets.indexOf(pos.images) != -1 && editor.info.images == editor.ids[ii].images
&& editor.info.y == editor.ids[ii].y && editor.info.x == editor.ids[ii].x)
|| (Object.prototype.hasOwnProperty.call(autotiles, pos.images) && editor.info.images == editor.ids[ii].id
&& editor.info.y == editor.ids[ii].y)
|| (core.tilesets.indexOf(pos.images) == -1 && editor.info.images == editor.ids[ii].images
&& editor.info.y == editor.ids[ii].y)
for (var idindex = 0; idindex < editor.ids.length; idindex++) {
if ((core.tilesets.indexOf(pos.images) != -1 && editor.info.images == editor.ids[idindex].images
&& editor.info.y == editor.ids[idindex].y && editor.info.x == editor.ids[idindex].x)
|| (Object.prototype.hasOwnProperty.call(autotiles, pos.images) && editor.info.images == editor.ids[idindex].id
&& editor.info.y == editor.ids[idindex].y)
|| (core.tilesets.indexOf(pos.images) == -1 && editor.info.images == editor.ids[idindex].images
&& editor.info.y == editor.ids[idindex].y)
) {
editor.info = editor.ids[ii];
editor.info = editor.ids[idindex];
break;
}
}
if (editor.info.isTile && e.button == 2) {
if (editor.info.isTile && e.button == 2) { //这段改一改之类的应该能给手机用,就不删了
// 废弃好了
alert('V2.7后右键已被废弃,请直接素材区拖框选中区域。');
/*
var v = prompt("请输入该额外素材区域绑定宽高,以逗号分隔", "1,1");
if (v != null && /^\d+,\d+$/.test(v)) {
v = v.split(",");
@ -157,8 +202,31 @@ editor_materialpanel_wrapper = function (editor) {
alert("不合法的输入范围,已经越界");
} else {
editor.uivalues.tileSize = [x, y];
editor.dom.dataSelection.style.left = pos.x * 32 + 'px';
editor.dom.dataSelection.style.top = pos.y * ysize + 'px';
editor.dom.dataSelection.style.height = ysize*y - 6 + 'px';
editor.dom.dataSelection.style.width = 32*x - 6 + 'px';
}
}
*/
}
if (editor.info.isTile && e.button != 2) { //左键拖拽框选
var x = pos.x-pos0.x+1, y = pos.y-pos0.y+1;
var widthX = editor.widthsX[editor.info.images];
// 懒得仔细处理了, 只允许左上往右下拉
if (x <= 0 || y <= 0 || pos0.x < widthX[1]){
} else {
editor.info = editor.ids[idindex-(x-1)-(y-1)*(widthX[2]-widthX[1])];
editor.uifunctions.locToPos(startLoc); //重置editor.pos
editor.uivalues.tileSize = [x, y];
editor.dom.dataSelection.style.left = pos0.x * 32 + 'px';
editor.dom.dataSelection.style.top = pos0.y * ysize + 'px';
editor.dom.dataSelection.style.height = ysize*y - 6 + 'px';
editor.dom.dataSelection.style.width = 32*x - 6 + 'px';
}
}
}

View File

@ -99,7 +99,6 @@ editor_multi = function () {
editor_multi.isString = false;
editor_multi.lintAutocomplete = false;
if (args.lint === true) editor_multi.lintAutocomplete = true;
if (field.indexOf('Effect') !== -1) editor_multi.lintAutocomplete = true;
if ((!input.value || input.value == 'null') && editor_mode.mode == 'plugins')
input.value = '"function () {\\n\\t// 在此增加新插件\\n\\t\\n}"';
if (input.value.slice(0, 1) === '"' || args.string) {

View File

@ -8,14 +8,14 @@ editor_table_wrapper = function (editor) {
// HTML模板
editor_table.prototype.select = function (value, values) {
var content = editor.table.option(value) +
values.map(function (v) {
return editor.table.option(v)
if (values.indexOf(value) < 0) values = [value].concat(values);
var content = values.map(function (v) {
return editor.table.option(v, v == value)
}).join('')
return /* html */`<select>\n${content}</select>\n`
}
editor_table.prototype.option = function (value) {
return /* html */`<option value='${JSON.stringify(value)}'>${JSON.stringify(value)}</option>\n`
editor_table.prototype.option = function (value, selected) {
return /* html */`<option value='${JSON.stringify(value)}' ${selected ? 'selected' : ''}>${JSON.stringify(value)}</option>\n`
}
editor_table.prototype.text = function (value) {
return /* html */`<input type='text' spellcheck='false' value='${JSON.stringify(value)}'/>\n`
@ -23,8 +23,8 @@ editor_table_wrapper = function (editor) {
editor_table.prototype.checkbox = function (value) {
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.textarea = function (value, indent, disable) {
return /* html */`<textarea spellcheck='false' ${disable ? 'disabled readonly' : ''}>${JSON.stringify(value, null, indent || 0)}</textarea>\n`
}
editor_table.prototype.checkboxSet = function (value, keys, prefixStrings) {
if (value == null) value = [];
@ -76,7 +76,7 @@ editor_table_wrapper = function (editor) {
<td title="${field}">${shortField}</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>
<td>${editor.table.editGrid(shortComment, type != 'select' && type != 'checkbox' && type != 'checkboxSet' && type != 'disable')}</td>
</tr>\n`
}
@ -283,7 +283,7 @@ editor_table_wrapper = function (editor) {
case 'checkboxSet':
return editor.table.checkboxSet(thiseval, cobj._checkboxSet.key, cobj._checkboxSet.prefix);
default:
return editor.table.textarea(thiseval, cobj.indent || 0);
return editor.table.textarea(thiseval, cobj.indent || 0, cobj._type == 'disable');
}
}
@ -412,6 +412,7 @@ editor_table_wrapper = function (editor) {
if (cobj._type === 'event') editor_blockly.import(guid, { type: cobj._event });
if (cobj._type === 'textarea') editor_multi.import(guid, { lint: cobj._lint, string: cobj._string });
if (cobj._type === 'material') editor.table.selectMaterial(input, cobj);
if (cobj._type === 'color') editor.table.selectColor(input);
}
/**
@ -426,6 +427,7 @@ editor_table_wrapper = function (editor) {
if (cobj._type === 'event') editor_blockly.import(guid, { type: cobj._event });
if (cobj._type === 'textarea') editor_multi.import(guid, { lint: cobj._lint, string: cobj._string });
if (cobj._type === 'material') editor.table.selectMaterial(input, cobj);
if (cobj._type === 'color') editor.table.selectColor(input);
} else if (editor_mode.doubleClickMode === 'add') {
editor_mode.doubleClickMode = 'change';
editor.table.addfunc(guid, obj, commentObj, thisTr, input, field, cobj, modeNode)
@ -446,6 +448,21 @@ editor_table_wrapper = function (editor) {
})
}
editor_table.prototype.selectColor = function (input) {
if (input.value != null) {
var str = input.value.toString().replace(/[^\d.,]/g, '');
if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(str)) {
document.getElementById('colorPicker').value = str;
}
}
var boundingBox = input.getBoundingClientRect();
openColorPicker(boundingBox.x, boundingBox.y + boundingBox.height, function (value) {
value = value.replace(/[^\d.,]/g, '');
input.value = '[' + value +']';
input.onchange();
})
}
/**
* 删除表格项
*/

View File

@ -30,7 +30,7 @@ editor_ui_wrapper = function (editor) {
'双击事件编辑器的图块可以进行长文本编辑/脚本编辑/地图选点/UI绘制预览等操作',
'ESC或点击空白处可以自动保存当前修改',
'H键可以打开操作帮助哦',
'tileset贴图模式可以在地图上拖动来一次绘制一个区域;右键额外素材也可以绑定宽高',
'tileset平铺模式可以在地图上拖动来平铺框选的图形',
'可以拖动地图上的图块和事件或按Ctrl+C, Ctrl+X和Ctrl+V进行复制剪切和粘贴Delete删除',
'Alt+数字键保存图块,数字键读取保存的图块',
];
@ -236,6 +236,7 @@ editor_ui_wrapper = function (editor) {
throw (err)
}
; printf('地图保存成功');
editor.uifunctions.unhighlightSaveFloorButton();
});
}
selectBox.isSelected(false);
@ -318,6 +319,7 @@ editor_ui_wrapper = function (editor) {
editor.bgmap = JSON.parse(JSON.stringify(data.bgmap));
editor.updateMap();
editor.uivalues.postMapData.push(data);
editor.uifunctions.highlightSaveFloorButton();
printf("已撤销此操作,你可能需要重新保存地图。");
}
return;
@ -332,6 +334,7 @@ editor_ui_wrapper = function (editor) {
editor.bgmap = JSON.parse(JSON.stringify(data.bgmap));
editor.updateMap();
editor.uivalues.preMapData.push(data);
editor.uifunctions.highlightSaveFloorButton();
printf("已重做此操作,你可能需要重新保存地图。");
}
return;
@ -340,15 +343,16 @@ editor_ui_wrapper = function (editor) {
// Ctrl+C, Ctrl+X, Ctrl+V
if (e.ctrlKey && e.keyCode == 67 && !selectBox.isSelected()) {
e.preventDefault();
editor.uivalues.copyedInfo = editor.copyFromPos();
printf('该点事件已复制');
editor.uivalues.copyedInfo = editor.copyFromPos(editor.uivalues.selectedArea);
printf('该点事件已复制;请注意右键地图拉框可以复制一个区域;若有时复制失灵请多点几下空白处');
return;
}
if (e.ctrlKey && e.keyCode == 88 && !selectBox.isSelected()) {
e.preventDefault();
editor.uivalues.copyedInfo = editor.copyFromPos();
editor.clearPos(true, null, function () {
printf('该点事件已剪切');
editor.uivalues.copyedInfo = editor.copyFromPos(editor.uivalues.selectedArea);
editor.clearPos(true, editor.uivalues.selectedArea, function () {
printf('该点事件已剪切;请注意右键地图拉框可以剪切一个区域;若有时剪切失灵请多点几下空白处');
editor.uifunctions.unhighlightSaveFloorButton();
})
return;
}
@ -365,14 +369,18 @@ editor_ui_wrapper = function (editor) {
printe(err);
throw (err)
}
; printf('粘贴事件成功');
; printf('粘贴事件成功;若有时粘贴失灵请多点几下空白处');
editor.uifunctions.unhighlightSaveFloorButton();
editor.drawPosSelection();
});
return;
}
// DELETE
if (e.keyCode == 46 && !selectBox.isSelected()) {
editor.clearPos(true);
editor.clearPos(true, editor.uivalues.selectedArea, function () {
printf('该点事件已删除;请注意右键地图拉框可以删除一个区域;;若有时删除失灵请多点几下空白处');
editor.uifunctions.unhighlightSaveFloorButton();
})
return;
}
// ESC

View File

@ -26,7 +26,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
]
},
"_docs": "道具类别",
"_data": "只能取items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
"_data": "items(宝石、血瓶) constants(永久物品) tools(消耗道具) equips(装备)"
},
"name": {
"_leaf": true,
@ -44,20 +44,19 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"hideInToolbox": {
"_leaf": true,
"_type": "checkbox",
"_docs": "道具栏中隐藏",
"_data": "是否不显示在道具栏中"
"_docs": "不显示在道具栏",
},
"equip": {
"_leaf": true,
"_type": "textarea",
"_docs": "道具的装备属性",
"_data": "装备属性设置仅对cls为equips有效。\n如果此项不为null需要是一个对象里面可含\"type\"\"atk\"\"def\"\"mdef\"\"animate\"五项,分别对应装备部位、攻防护盾和动画。\n具体详见文档元件说明-装备)和已有的几个装备的写法。"
"_type": "event",
"_event": "equip",
"_docs": "道具的装备属性"
},
"hideInReplay": {
"_leaf": true,
"_type": "checkbox",
"_docs": "回放不绘制道具栏",
"_data": "是否回放时不绘制道具栏。\n如果此项为true则在回放录像时使用本道具将不会绘制道具栏页面而是直接使用。\n此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)"
"_data": "此项建议在会频繁连续多次使用的道具开启(如开启技能,或者《镜子》那样的镜像切换等等)"
}
}
},
@ -73,7 +72,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_string": true,
"_lint": true,
"_docs": "即捡即用提示",
"_data": "即捡即用类物品在获得时提示的文字仅对cls为items有效。"
},
@ -82,7 +80,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "event",
"_event": "item",
"_docs": "碰触或使用事件",
"_data": "碰触或使用本道具所执行的事件"
"_data": "碰触或使用本道具所执行的事件对所有cls有效"
},
"useItemEffect": {
"_leaf": true,
@ -97,7 +95,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_lint": true,
"_docs": "能否使用条件",
"_docs": "能否使用",
"_data": "当前能否使用该道具仅对cls为tools或constants有效。"
},
"equipCondition": {
@ -105,12 +103,12 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_lint": true,
"_docs": "能否装备条件",
"_docs": "能否装备",
"_data": "能装备某个装备的条件仅对cls为equips有效。\n与canUseItemEffect不同这里null代表可以装备。"
}
}
},
"items_template": { 'cls': 'items', 'name': '新物品', 'canPass': true },
"items_template": { 'cls': 'items', 'name': '新物品' },
// --------------------------- 【怪物】相关的表格配置 --------------------------- //
@ -128,7 +126,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "textarea",
"_string": true,
"_docs": "手册映射ID",
"_data": "在怪物手册中映射到的怪物ID。如果此项不为null则在怪物手册中将用目标ID来替换该怪物原本的ID。\n此项应被运用在同一个怪物的多朝向上。\n例如如果想定义同一个怪物的向下和向左的行走图则需要建立两个属性完全相同的怪物。\n但是这样会导致在怪物手册中同时存在向下和向左的两种怪物的显示。\n可以将朝向左的怪物的displayIdInBook项指定为朝向下的怪物ID这样在怪物手册中则会归一化只显示一个。"
"_data": "在怪物手册中映射到的怪物ID。如果此项不为null则在怪物手册中将用目标ID来替换该怪物原本的ID。常被运用在同一个怪物的多朝向上。"
},
"hp": {
"_leaf": true,
@ -182,7 +180,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"value": {
"_leaf": true,
"_type": "textarea",
"_docs": "特殊属性值",
"_docs": "特殊属性值",
"_data": "特殊属性的数值\n如领域/阻激/激光怪的伤害值;吸血怪的吸血比例;光环怪增加生命的比例"
},
"zoneSquare": {
@ -201,7 +199,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"notBomb": {
"_leaf": true,
"_type": "checkbox",
"_docs": "是否不可炸",
"_docs": "不可炸",
"_data": "该怪物不可被炸"
},
"n": {
@ -214,21 +212,21 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"add": {
"_leaf": true,
"_type": "checkbox",
"_docs": "吸血加自身",
"_docs": "吸血加自身",
"_data": "吸血后是否加到自身;光环是否叠加"
},
"atkValue": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==~~thiseval||thiseval==null",
"_docs": "退化扣攻击",
"_docs": "退化扣攻击",
"_data": "退化时勇士下降的攻击力点数;光环怪增加攻击的比例"
},
"defValue": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==~~thiseval||thiseval==null",
"_docs": "退化扣防御",
"_docs": "退化扣防御",
"_data": "退化时勇士下降的防御力点数;光环怪增加防御的比例"
},
"damage": {
@ -249,20 +247,20 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_data": {
"id": {
"_leaf": true,
"_type": "textarea",
"_type": "disable",
"_range": "false",
"_docs": "图块ID",
"_data": "图块唯一ID可在页面底部修改"
},
"idnum": {
"_leaf": true,
"_type": "textarea",
"_type": "disable",
"_range": "false",
"_data": "图块数字"
},
"cls": {
"_leaf": true,
"_type": "textarea",
"_type": "disable",
"_range": "false",
"_data": "图块类别"
},
@ -291,7 +289,6 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "checkbox",
"_docs": "可通行性",
"_data": "该图块是否可以通行true代表可以通行false代表不可通行"
},
"script": {
"_leaf": true,
@ -309,7 +306,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"key":["up","down","left","right"]
},
"_docs": "不可出方向",
"_data": "该图块的不可出方向\n可以在这里定义在该图块时不能前往哪个方向,可以达到悬崖之类的效果\n例如 [\"up\", \"left\"] 代表在该图块时不能往上和左走\n此值对背景层、事件层、前景层上的图块均有效"
"_data": "该图块的不可出方向\n对背景层、事件层、前景层上的图块均有效"
},
"cannotIn": {
"_leaf": true,
@ -319,7 +316,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"key":["up","down","left","right"]
},
"_docs": "不可入方向",
"_data": "该图块的不可入方向\n可以在这里定义不能朝哪个方向进入该图块,可以达到悬崖之类的效果\n例如 [\"down\"] 代表不能从该图块的上方点朝向下进入此图块\n此值对背景层、事件层、前景层上的图块均有效"
"_data": "该图块的不可入方向\n对背景层、事件层、前景层上的图块均有效"
},
"canBreak": {
"_leaf": true,
@ -329,22 +326,26 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
},
"animate": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==~~thiseval||thiseval==null",
"_type": "select",
"_select": {
"values": [1,2,3,4],
},
"_docs": "动画帧数",
"_data": "该图块的全局动画帧数。\n如果此项为null则对于除了npc48外使用素材默认帧数npc48默认是1帧即静止。"
"_data": "null代表素材默认帧数"
},
"doorInfo": {
"_leaf": true,
"_type": "textarea",
"_type": "event",
"_event": "doorInfo",
"_docs": "门信息",
"_data": "该图块的门信息,是一个三元数组。\n第一项为所需要的钥匙信息第二项为开此门时的音效第三项为关此门时的音效。仅对animates生效。"
"_data": "该图块的门信息,仅对animates和npc48生效。"
},
"faceIds": {
"_leaf": true,
"_type": "textarea",
"_type": "event",
"_event": "faceIds",
"_docs": "行走图朝向",
"_data": "行走图朝向,仅对NPC有效。可以在这里定义同一个NPC的多个朝向行走图。\n比如 {\"up\":\"N333\",\"down\":\"N334\",\"left\":\"N335\",\"right\":\"N336\"} 就将该素材的上下左右朝向分别绑定到N333,N334,N335和N336四个图块。\n在勇士撞上NPC时或NPC在移动时会自动选择最合适的朝向图块如果存在定义来进行绘制。"
"_data": "行走图朝向,仅对npc48有效。在勇士撞上NPC时或NPC在移动时会自动选择最合适的朝向图块如果存在定义来进行绘制。"
}
}
},
@ -359,15 +360,15 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_data": {
"floorId": {
"_leaf": true,
"_type": "textarea",
"_type": "disable",
"_range": "false",
"_docs": "楼层ID",
"_data": "文件名和floorId需要保持完全一致可在页面底部修改 \n楼层唯一标识符仅能由字母、数字、下划线组成且不能由数字开头 \n推荐用法第20层就用MT20第38层就用MT38地下6层就用MT_6用下划线代替负号隐藏3层用MT3hh表示隐藏等等"
"_data": "文件名和floorId需要保持完全一致可在页面底部修改"
},
"title": {
"_leaf": true,
"_type": "textarea",
"_docs": "楼层中文名",
"_docs": "楼层名",
"_data": "楼层中文名,将在切换楼层和浏览地图时显示"
},
"name": {
@ -378,22 +379,22 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
},
"width": {
"_leaf": true,
"_type": "textarea",
"_type": "disable",
"_range": "false",
"_docs": "宽度",
"_data": "地图x方向大小,请在表格最下方修改,null视为13"
"_data": "地图x方向大小,请在表格最下方修改"
},
"height": {
"_leaf": true,
"_type": "textarea",
"_type": "disable",
"_range": "false",
"_docs": "高度",
"_data": "地图y方向大小,请在表格最下方修改,null视为13"
"_data": "地图y方向大小,请在表格最下方修改"
},
"canFlyTo": {
"_leaf": true,
"_type": "checkbox",
"_docs": "可",
"_docs": "可楼传",
"_data": "该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器)"
},
"canUseQuickShop": {
@ -458,13 +459,13 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
},
"images": {
"_leaf": true,
"_type": "textarea",
"_docs": "楼层贴图",
"_data": "背景/前景图;你可以选择若干张图片来作为背景/前景素材。详细用法请参见文档“自定义素材”中的说明。"
"_type": "event",
"_event": "floorImage",
"_docs": "楼层贴图"
},
"color": {
"_leaf": true,
"_type": "textarea",
"_type": "color",
"_docs": "色调",
"_data": "该层的默认画面色调。本项可不写代表无色调如果写需要是一个RGBA数组如[255,0,0,0.3]"
},
@ -481,9 +482,9 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"values": [null].concat(Object.keys(editor.core.material.bgms))
},
"_docs": "背景音乐",
"_data": "到达该层后默认播放的BGM。本项可忽略,或者为一个定义过的背景音乐如\"bgm.mp3\"。"
"_data": "到达该层后默认播放的BGM"
},
"item_ratio": {
"ratio": {
"_leaf": true,
"_type": "textarea",
"_range": "(thiseval==~~thiseval && thiseval>=0)||thiseval==null",
@ -580,7 +581,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"cannotViewMap": false,
"cannotMoveDirectly": false,
"images": [],
"item_ratio": 1,
"ratio": 1,
"defaultGround": "ground",
"bgm": null,
"upFloor": null,

View File

@ -27,7 +27,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
return one;
return null;
}).toString(),
"_docs": "本塔使用图片",
"_docs": "使用图片",
"_data": "在此存放所有可能使用的图片tilesets除外 \n图片可以被作为背景图的一部分也可以直接用自定义事件进行显示。 \n 图片名不能使用中文,不能带空格或特殊字符;可以直接改名拼音就好 \n 建议对于较大的图片,在网上使用在线的“图片压缩工具(http://compresspng.com/zh/)”来进行压缩,以节省流量 \n 依次向后添加",
},
"tilesets": {
@ -50,7 +50,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
return j >= 0 ? 1 : -1;
});
}).toString(),
"_docs": "本塔额外素材",
"_docs": "额外素材",
"_data": "在此存放额外素材的图片名, \n可以自定导入任意张素材图片无需PS无需注册即可直接在游戏中使用 \n 形式如[\"1.png\", \"2.png\"] ,将需要的素材图片放在images目录下 \n 素材的宽高必须都是32的倍数且图片上的总图块数不超过1000即最多有1000个32*32的图块在该图片上"
},
"animates": {
@ -62,7 +62,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
if (one.endsWith(".animate")) return one.substring(0, one.lastIndexOf('.'));
return null;
}).toString(),
"_docs": "本塔使用动画",
"_docs": "使用动画",
"_data": "在此存放所有可能使用的动画必须是animate格式在这里不写后缀名 \n动画必须放在animates目录下文件名不能使用中文不能带空格或特殊字符 \n \"jianji\", \"thunder\" 根据需求自行添加"
},
"bgms": {
@ -75,7 +75,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
return one;
return null;
}).toString(),
"_docs": "本塔使用音乐",
"_docs": "使用音乐",
"_data": "在此存放所有的bgm和文件名一致。 \n音频名不能使用中文不能带空格或特殊字符可以直接改名拼音就好"
},
"sounds": {
@ -88,7 +88,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
return one;
return null;
}).toString(),
"_docs": "本塔使用音效",
"_docs": "使用音效",
"_data": "在此存放所有的SE和文件名一致 \n音频名不能使用中文不能带空格或特殊字符可以直接改名拼音就好"
},
"fonts": {
@ -100,42 +100,21 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
if (one.endsWith(".ttf")) return one.substring(0, one.lastIndexOf('.'));
return null;
}).toString(),
"_docs": "本塔使用字体",
"_docs": "使用字体",
"_data": "在此存放所有可能使用的字体 \n 字体名不能使用中文,不能带空格或特殊字符"
},
"nameMap": {
"_leaf": true,
"_type": "textarea",
"_docs": "文件映射",
"_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",
"_type": "event",
"_event": "levelChoose",
"_docs": "难度分歧",
"_data": "难度选择每个数组的第一个是其在标题界面显示的难度第二个是在游戏内部传输的字符串会显示在状态栏修改此处后需要在project/functions中作相应更改。\n如果需直接开始游戏将下面的startDirectly开关打开即可。"
"_data": "难度分歧定义和对应的事件;此处留空数组表示将直接开始游戏"
},
"equipName": {
"_leaf": true,
@ -153,68 +132,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_docs": "标题音乐",
"_data": "在标题界面应该播放的bgm内容"
},
"statusLeftBackground": {
"styles": {
"_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,
"_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"
"_type": "event",
"_event": "mainStyle",
"_docs": "主样式",
"_data": "主要样式设置,包括标题、按钮、状态栏等的背景色等"
}
}
},
@ -264,7 +187,13 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
return name.endsWith('.png');
}))
},
"_data": "勇士行走图"
"_data": "行走图"
},
"animate": {
"_leaf": true,
"_type": "checkbox",
"_docs": "帧动画",
"_data": "是否开启停止状态和对话框的帧动画"
},
"name": {
"_leaf": true,
@ -351,7 +280,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Object && !(thiseval instanceof Array)",
"_docs": "初始装备个数",
"_docs": "初始拥有装备个数",
"_data": "初始装备个数,例如初始送铁剑可以写 {\"sword1\": 1}"
}
}
@ -392,13 +321,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
},
"followers": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval instanceof Array",
"_data": "跟随者列表"
"_type": "disable",
"_data": "跟随者"
},
"steps": {
"_leaf": true,
"_type": "textarea",
"_type": "disable",
"_data": "行走步数"
}
}
@ -408,7 +336,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_type": "event",
"_event": "firstArrive",
"_range": "thiseval==null || thiseval instanceof Array",
"_docs": "标题事件",
"_docs": "标题事件",
"_data": "标题界面事件化,可以使用事件流的形式来绘制开始界面等。\n需要开启startUsingCanvas这个开关。\n详见文档-个性化-标题界面事件化。"
},
"startText": {
@ -456,46 +384,46 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_docs": "衰弱效果",
"_data": "衰弱状态下攻防减少的数值\n如果此项不小于1则作为实际下降的数值比如10就是攻防各下降10\n如果在0到1之间则为下降的比例比如0.3就是下降30%的攻防)"
},
"redJewel": {
"redGem": {
"_leaf": true,
"_type": "textarea",
"_docs": "红宝石效果",
"_docs": "红宝石",
"_data": "红宝石加攻击的数值"
},
"blueJewel": {
"blueGem": {
"_leaf": true,
"_type": "textarea",
"_docs": "蓝宝石效果",
"_docs": "蓝宝石",
"_data": "蓝宝石加防御的数值"
},
"greenJewel": {
"greenGem": {
"_leaf": true,
"_type": "textarea",
"_docs": "绿宝石效果",
"_docs": "绿宝石",
"_data": "绿宝石加护盾的数值"
},
"redPotion": {
"_leaf": true,
"_type": "textarea",
"_docs": "红血瓶效果",
"_docs": "红血瓶",
"_data": "红血瓶加血数值"
},
"bluePotion": {
"_leaf": true,
"_type": "textarea",
"_docs": "蓝血瓶效果",
"_docs": "蓝血瓶",
"_data": "蓝血瓶加血数值"
},
"yellowPotion": {
"_leaf": true,
"_type": "textarea",
"_docs": "黄血瓶效果",
"_docs": "黄血瓶",
"_data": "黄血瓶加血数值"
},
"greenPotion": {
"_leaf": true,
"_type": "textarea",
"_docs": "绿血瓶效果",
"_docs": "绿血瓶",
"_data": "绿血瓶加血数值"
},
"breakArmor": {
@ -525,14 +453,16 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"animateSpeed": {
"_leaf": true,
"_type": "textarea",
"_docs": "全局动画时间",
"_data": "全局动画时间即怪物振动频率一般300比较合适"
"_docs": "全局动画时间",
"_data": "全局动画时间即怪物振动频率一般300比较合适"
},
"statusCanvasRowsOnMobile": {
"_leaf": true,
"_type": "textarea",
"_range": "thiseval==null || (thiseval>0 && thiseval<=4)",
"_docs": "竖屏自绘行数",
"_type": "select",
"_select": {
"values": [1,2,3,4]
},
"_docs": "竖状态栏自绘行数",
"_data": "竖屏模式下顶端状态栏canvas化后的行数。\n此项将决定竖屏的状态栏高度如果设置则不小于1且不大于4。\n仅在statusCanvas开启时才有效"
},
}
@ -585,36 +515,36 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"enableSkill"
]
},
"_data": "状态栏显示"
"_data": "状态栏显示"
},
"flyNearStair": {
"_leaf": true,
"_type": "checkbox",
"_docs": "楼传楼梯边",
"_docs": "楼传需在楼梯边",
"_data": "传送器是否需要在楼梯边使用如果flyRecordPosition开启则此项对箭头也有效。"
},
"flyRecordPosition": {
"_leaf": true,
"_type": "checkbox",
"_docs": "楼传平面模式",
"_docs": "楼传平面模式",
"_data": "传送器平面塔模式;此模式下楼层传送器将飞到上次离开该楼层的位置。"
},
"steelDoorWithoutKey": {
"_leaf": true,
"_type": "checkbox",
"_docs": "铁门不消耗",
"_docs": "铁门不消耗钥匙",
"_data": "铁门是否不需要钥匙开启。如果此项为true则无需钥匙也可以开铁门。"
},
"itemFirstText": {
"_leaf": true,
"_type": "checkbox",
"_docs": "首次道具提示",
"_docs": "首次道具进行提示",
"_data": "首次获得道具是否提示"
},
"equipboxButton": {
"_leaf": true,
"_type": "checkbox",
"_docs": "状态栏装备",
"_docs": "状态栏装备按钮",
"_data": "状态栏的装备按钮。若此项为true则将状态栏中的楼层转换器按钮换为装备栏按钮"
},
"enableAddPoint": {
@ -632,7 +562,7 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"betweenAttackMax": {
"_leaf": true,
"_type": "checkbox",
"_docs": "夹击不超伤害",
"_docs": "夹击不超伤害",
"_data": "夹击伤害是否不超过怪物伤害值。"
},
"useLoop": {
@ -644,19 +574,13 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"startUsingCanvas": {
"_leaf": true,
"_type": "checkbox",
"_docs": "标题事件化",
"_docs": "标题开启事件化",
"_data": "是否开始菜单canvas化如果此项为true则将使用canvas来绘制开始菜单"
},
"startDirectly": {
"_leaf": true,
"_type": "checkbox",
"_docs": "不选择难度",
"_data": "点击“开始游戏”后是否立刻开始游戏而不显示难度选择界面"
},
"statusCanvas": {
"_leaf": true,
"_type": "checkbox",
"_docs": "自绘状态栏",
"_docs": "开启自绘状态栏",
"_data": "是否状态栏canvas化即手动自定义绘制状态栏。\n如果此项开启则可在脚本编辑的drawStatusBar中自定义绘制菜单栏。"
},
"displayEnemyDamage": {

View File

@ -26,6 +26,12 @@ var plugins_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
"_range": "typeof(thiseval)=='string' || thiseval==null",
"_data": "灯光效果"
},
"removeMap": {
"_leaf": true,
"_type": "textarea",
"_range": "typeof(thiseval)=='string' || thiseval==null",
"_data": "砍层插件"
},
"itemShop": {
"_leaf": true,
"_type": "textarea",

View File

@ -121,7 +121,7 @@
colorPickers.current = colorPickers[index];
}
},
createListener = function(e) {
createListener = function() {
elm = document.getElementById("colorPicker");
var input = elm,
position = window.ColorPicker.getOrigin(input),
@ -268,9 +268,19 @@ jsColorPicker('input.color', {
size: 1,
});
function openColorFromButton() {
delete window.jsColorPicker.confirm;
triggerColorPicker('414px', '53px');
function openColorPicker(px, py, callback) {
window.jsColorPicker.confirm = callback;
var colorPanel = document.getElementById('colorPanel');
if (colorPanel.style.display=='none' && px != null && py != null) {
colorPanel.style.display = "inline-block";
colorPanel.style.left = px + 'px';
colorPanel.style.top = py + 'px';
window.jsColorPicker.create();
}
else {
colorPanel.style.display = 'none';
delete window.jsColorPicker.confirm;
}
}
function confirmColor() {
@ -287,22 +297,8 @@ function confirmColor() {
colorPicker.select();
document.execCommand("Copy");
}
triggerColorPicker();
}
function triggerColorPicker(left, top) {
var colorPanel = document.getElementById('colorPanel');
if (colorPanel.style.display=='none' && left && top) {
colorPanel.style.display = "inline-block";
colorPanel.style.left = left;
colorPanel.style.top = top;
window.jsColorPicker.create();
}
else {
colorPanel.style.display = 'none';
delete window.jsColorPicker.confirm;
}
colorPanel.style.display = 'none';
delete window.jsColorPicker.confirm;
}
// ------ AutoCompletion ------

View File

@ -204,20 +204,6 @@
<button onclick="editor_blockly.showXML()">Show XML</button>
<button onclick="editor_blockly.runCode()">console.log(obj=code)</button>
-->
<select id="entryType" disabled="disabled" style="display: none">
<option value="event">event</option>
<option value="autoEvent">autoEvent</option>
<option value="changeFloor">changeFloor</option>
<option value="level">level</option>
<option value="shop">shop</option>
<option value="afterBattle">afterBattle</option>
<option value="afterGetItem">afterGetItem</option>
<option value="afterOpenDoor">afterOpenDoor</option>
<option value="firstArrive">firstArrive</option>
<option value="eachArrive">eachArrive</option>
<option value="commonEvent">commonEvent</option>
<option value="item">item</option>
</select>
<button onclick="editor_blockly.confirm()">确认</button>
<button id='blocklyParse' onclick="editor_blockly.parse()">解析</button>
<button onclick="editor_blockly.cancel()">取消</button>
@ -226,14 +212,12 @@
<div class="searchLogo"></div>
<input type="text" id="searchBlock" placeholder="搜索图块"/>
</div>
<div id="colorPanel" class="cpPanel" style="display: none">
<input class="color" id="colorPicker" value="255,215,0,1"/>
<button onclick="confirmColor()">确定</button>
</div>
<button class="cpPanel" onclick="editor_blockly.selectPoint()">地图选点</button>
<button class="cpPanel" onclick="editor.uievent.searchUsedFlags()" style="margin-left:5px">变量出现位置搜索</button>
<input type="checkbox" class="cpPanel" id="blocklyReplace" onchange="editor_blockly.triggerReplace()" style="margin-left: 10px" />
<span class="cpPanel" style="margin-left: -4px; font-size: 13px">开启中文名替换</span>
<input type="checkbox" class="cpPanel" id="blocklyExpandCompare" onchange="editor_blockly.triggerExpandCompare()" style="margin-left: 10px" />
<span class="cpPanel" style="margin-left: -4px; font-size: 13px">展开值块逻辑运算</span>
<xml id="toolbox" style="display:none">
</xml>
</h3>
@ -245,6 +229,10 @@
</div>
</div>
</div>
<div id="colorPanel" class="cpPanel" style="display: none">
<input class="color" id="colorPicker" value="255,215,0,1"/>
<button onclick="confirmColor()">确定</button>
</div>
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
<button onclick="editor_multi.confirm()">确认</button>
<button onclick="editor_multi.cancel()">取消</button>
@ -363,7 +351,7 @@
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
<div id='pasteLoc' class="menuitem"><div class="menuitem-content">粘贴到此事件</div></div>
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
</div>
@ -383,7 +371,7 @@
<select id="brushMod" style="clear:right">
<option value="line">画线</option>
<option value="rectangle">画矩形</option>
<option value="tileset">tileset贴图</option>
<option value="tileset">tileset平铺</option>
<option value="fill">填充模式</option>
</select>
<select id="layerMod" style="float:left;margin-right:3px">
@ -626,6 +614,8 @@
<script src="_server/blockly/blocks_compressed.js"></script>
<script src="_server/blockly/javascript_compressed.js"></script>
<script src="_server/blockly/zh-hans.js"></script>
<script src='_server/MotaActionParser.js'></script>
<script src='_server/editor_blocklyconfig.js'></script>
<script src='_server/editor_blockly.js'></script>
<!-- codemirror -->
<script src="_server/CodeMirror/codeMirror.bundle.min.js"></script>

View File

@ -200,20 +200,6 @@
<button onclick="editor_blockly.showXML()">Show XML</button>
<button onclick="editor_blockly.runCode()">console.log(obj=code)</button>
-->
<select id="entryType" disabled="disabled" style="display: none">
<option value="event">event</option>
<option value="autoEvent">autoEvent</option>
<option value="changeFloor">changeFloor</option>
<option value="level">level</option>
<option value="shop">shop</option>
<option value="afterBattle">afterBattle</option>
<option value="afterGetItem">afterGetItem</option>
<option value="afterOpenDoor">afterOpenDoor</option>
<option value="firstArrive">firstArrive</option>
<option value="eachArrive">eachArrive</option>
<option value="commonEvent">commonEvent</option>
<option value="item">item</option>
</select>
<button onclick="editor_blockly.confirm()">确认</button>
<button id='blocklyParse' onclick="editor_blockly.parse()">解析</button>
<button onclick="editor_blockly.cancel()">取消</button>
@ -221,14 +207,12 @@
<div class="searchLogo"></div>
<input type="text" id="searchBlock" placeholder="搜索图块"/>
</div>
<div id="colorPanel" class="cpPanel" style="display: none">
<input class="color" id="colorPicker" value="255,215,0,1"/>
<button onclick="confirmColor()">确定</button>
</div>
<button class="cpPanel" onclick="editor_blockly.selectPoint()" style="margin-left:5px">地图选点</button>
<button class="cpPanel" onclick="editor.uievent.searchUsedFlags()" style="margin-left:5px">变量出现位置搜索</button>
<input type="checkbox" class="cpPanel" id="blocklyReplace" onchange="editor_blockly.triggerReplace()" style="margin-left: 10px" />
<span class="cpPanel" style="margin-left: -4px; font-size: 13px">开启中文名替换</span>
<input type="checkbox" class="cpPanel" id="blocklyExpandCompare" onchange="editor_blockly.triggerExpandCompare()" style="margin-left: 10px" />
<span class="cpPanel" style="margin-left: -4px; font-size: 13px">展开值块逻辑运算</span>
<xml id="toolbox" style="display:none">
</xml>
</h3>
@ -240,6 +224,10 @@
</div>
</div>
</div>
<div id="colorPanel" class="cpPanel" style="display: none">
<input class="color" id="colorPicker" value="255,215,0,1"/>
<button onclick="confirmColor()">确定</button>
</div>
<div id="left7" style="z-index:-1;opacity: 0;"><!-- 多行文本编辑器 -->
<button onclick="editor_multi.confirm()">确认</button>
<button onclick="editor_multi.cancel()">取消</button>
@ -343,7 +331,7 @@
<span style="font-size: 12px;">
<input type="radio" id="brushMod" name="brushMod" value="line" checked="checked" />线
<input type="radio" id="brushMod2" name="brushMod" value="rectangle" />矩形
<input type="radio" id="brushMod3" name="brushMod" value="tileset" />tileset贴图
<input type="radio" id="brushMod3" name="brushMod" value="tileset" />tileset平铺
<input type="radio" id="brushMod4" name="brushMod" value="fill" />填充
</span>
@ -386,7 +374,7 @@
<div id='chooseThis' class="menuitem"><div class="menuitem-content">选中此点</div></div>
<div id='chooseInRight' class="menuitem"><div class="menuitem-content">在素材区选中此图块</div></div>
<div id='copyLoc' class="menuitem"><div class="menuitem-content">复制此事件</div></div>
<div id='moveLoc' class="menuitem"><div class="menuitem-content">移动此事件</div></div>
<div id='pasteLoc' class="menuitem"><div class="menuitem-content">粘贴到此事件</div></div>
<div id='clearEvent' class="menuitem"><div class="menuitem-content">仅清空此点事件</div></div>
<div id='clearLoc' class="menuitem"><div class="menuitem-content">清空此点及事件</div></div>
</div>
@ -610,6 +598,8 @@
<script src="_server/blockly/blocks_compressed.js"></script>
<script src="_server/blockly/javascript_compressed.js"></script>
<script src="_server/blockly/zh-hans.js"></script>
<script src='_server/MotaActionParser.js'></script>
<script src='_server/editor_blocklyconfig.js'></script>
<script src='_server/editor_blockly.js'></script>
<!-- codemirror -->
<script src="_server/CodeMirror/codeMirror.bundle.min.js"></script>

View File

@ -8,7 +8,7 @@ function dynamicMapEditor() {
// 所有显示的ID
this.displayIds = [
'none', 'yellowWall', 'blueWall', 'whiteWall', 'yellowDoor', 'blueDoor', 'redDoor', 'star', 'lava', 'lavaNet',
'yellowKey', 'blueKey', 'redKey', 'redJewel', 'blueJewel', 'greenJewel', 'yellowJewel',
'yellowKey', 'blueKey', 'redKey', 'redGem', 'blueGem', 'greenGem', 'yellowGem',
'redPotion', 'bluePotion', 'yellowPotion', 'greenPotion', 'pickaxe', 'bomb', 'centerFly',
'cls:autotile', 'cls:enemys', 'cls:enemy48'
];

View File

@ -1919,7 +1919,7 @@ 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 && selection != 4) return;
if (selection != 1 && selection != 2 && selection != 3 && selection != 4) return;
}
var width = choices[selection].width;
var leftPos = (core.__PIXELS__ - width) / 2, rightPos = (core.__PIXELS__ + width) / 2;
@ -1928,32 +1928,32 @@ actions.prototype._clickSwitchs = function (x, y) {
core.status.event.selection = selection;
switch (selection) {
case 0:
return this._clickSwitchs_bgm();
return this._clickSwitchs_bgmSound();
case 1:
return this._clickSwitchs_sound();
case 2:
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:
case 2:
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:
case 3:
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_floorChangeTime(-100);
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_floorChangeTime(100);
return;
case 4:
if (x == leftGrid || x == leftGrid + 1) return this._clickSwitchs_setSize(-1);
if (x == rightGrid || x == rightGrid + 1) return this._clickSwitchs_setSize(1);
return;
case 5:
return this._clickSwitchs_displayEnemyDamage();
case 6:
return this._clickSwitchs_displayCritical();
return this._clickSwitchs_displayCriticalExtra();
case 7:
return this._clickSwitchs_displayExtraDamage();
case 8:
return this._clickSwitchs_potionNoRouting();
case 9:
case 8:
return this._clickSwitchs_clickMove();
case 10:
case 9:
core.status.event.selection = 0;
core.ui.drawSettings();
break;
@ -1961,13 +1961,23 @@ actions.prototype._clickSwitchs = function (x, y) {
}
}
actions.prototype._clickSwitchs_bgm = function () {
core.triggerBgm();
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_sound = function () {
core.musicStatus.soundStatus = !core.musicStatus.soundStatus;
actions.prototype._clickSwitchs_bgmSound = function () {
var bgm = core.musicStatus.bgmStatus;
var sound = core.musicStatus.soundStatus;
if (bgm && sound) {
sound = false;
} else if (bgm && !sound) {
bgm = false;
sound = true;
} else if (!bgm && sound) {
sound = false;
} else {
bgm = true;
sound = true;
}
if (bgm != core.musicStatus.bgmStatus)
core.triggerBgm();
core.musicStatus.soundStatus = sound;
core.setLocalStorage('soundStatus', core.musicStatus.soundStatus);
core.ui.drawSwitchs();
}
@ -1995,6 +2005,17 @@ actions.prototype._clickSwitchs_floorChangeTime = function (delta) {
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_setSize = function (delta) {
var index = core.domStyle.availableScale.indexOf(core.domStyle.scale);
if (index < 0) return;
index += delta;
if (index < 0 || index >= core.domStyle.availableScale.length);
core.domStyle.scale = core.domStyle.availableScale[index];
core.setLocalStorage('scale', core.domStyle.scale);
core.resize();
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_displayEnemyDamage = function () {
core.flags.displayEnemyDamage = !core.flags.displayEnemyDamage;
core.updateDamage();
@ -2002,16 +2023,26 @@ actions.prototype._clickSwitchs_displayEnemyDamage = function () {
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_displayCritical = function () {
core.flags.displayCritical = !core.flags.displayCritical;
actions.prototype._clickSwitchs_displayCriticalExtra = function () {
var critical = core.flags.displayCritical;
var extra = core.flags.displayExtraDamage;
if (critical && extra) {
extra = false;
} else if (critical && !extra) {
critical = false;
extra = true;
} else if (!critical && extra) {
critical = false;
extra = false;
} else {
critical = true;
extra = true;
}
core.flags.displayCritical = critical;
core.flags.displayExtraDamage = extra;
core.updateDamage();
core.setLocalStorage('critical', core.flags.displayCritical);
core.ui.drawSwitchs();
}
actions.prototype._clickSwitchs_displayExtraDamage = function () {
core.flags.displayExtraDamage = !core.flags.displayExtraDamage;
core.updateDamage();
core.setLocalStorage('extraDamage', core.flags.displayExtraDamage);
core.ui.drawSwitchs();
}
@ -2037,15 +2068,17 @@ actions.prototype._keyUpSwitchs = function (keycode) {
}
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);
case 1: return this._clickSwitchs_userVolume(-1);
case 2: return this._clickSwitchs_moveSpeed(-10);
case 3: return this._clickSwitchs_floorChangeTime(-100);
case 4: return this._clickSwitchs_setSize(-1);
}
} 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);
case 1: return this._clickSwitchs_userVolume(1);
case 2: return this._clickSwitchs_moveSpeed(10);
case 3: return this._clickSwitchs_floorChangeTime(100);
case 4: return this._clickSwitchs_setSize(1);
}
}
this._selectChoices(core.status.event.ui.choices.length, keycode, this._clickSwitchs);

View File

@ -146,6 +146,11 @@ control.prototype._animationFrame_globalAnimate = function (timestamp) {
core.status.autotileAnimateObjs.blocks.forEach(function (block) {
core.maps._drawAutotileAnimate(block, core.status.globalAnimateStatus);
});
// Global hero animate
if ((core.status.hero || {}).animate && core.status.heroMoving == 0) {
core.drawHero('stop', null, core.status.globalAnimateStatus);
}
}
// Box animate
core.drawBoxAnimate();
@ -260,7 +265,7 @@ control.prototype._animationFrame_weather_fog = function () {
var w = core.__PIXELS__, h = core.__PIXELS__;
core.setAlpha('weather', 0.5);
core.animateFrame.weather.nodes.forEach(function (p) {
ctx.drawImage(core.animateFrame.weather.fog, p.x - ox, p.y - oy, w, h);
core.drawImage(ctx, core.animateFrame.weather.fog, p.x - ox, p.y - oy, w, h);
p.x += p.xs;
p.y += p.ys;
if (p.x > core.bigmap.width*32 - w/2) {
@ -768,7 +773,7 @@ control.prototype.tryMoveDirectly = function (destX, destY) {
}
////// 绘制勇士 //////
control.prototype.drawHero = function (status, offset) {
control.prototype.drawHero = function (status, offset, frame) {
if (!core.isPlaying() || !core.status.floorId || core.status.gameOver) return;
var x = core.getHeroLoc('x'), y = core.getHeroLoc('y'), direction = core.getHeroLoc('direction');
status = status || 'stop';
@ -783,17 +788,65 @@ control.prototype.drawHero = function (status, offset) {
core.status.heroCenter.py = 32 * y + offsetY + 32 - core.material.icons.hero.height / 2;
if (!core.hasFlag('hideHero')) {
this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
core.drawImage('hero', block.img, block.heroIcon[block.status]*block.width,
block.heroIcon.loc * block.height, block.width, block.height,
block.posx+(32-block.width)/2, block.posy+32-block.height, block.width, block.height);
});
this._drawHero_draw(direction, x, y, status, offset, frame);
}
this._drawHero_updateViewport();
}
control.prototype._drawHero_updateViewport = function () {
core.control.updateViewport();
core.setGameCanvasTranslate('hero', 0, 0);
}
control.prototype._drawHero_draw = function (direction, x, y, status, offset, frame) {
this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
core.drawImage('hero', block.img, (block.heroIcon[block.status] + (frame || 0))%4*block.width,
block.heroIcon.loc * block.height, block.width, block.height,
block.posx+(32-block.width)/2, block.posy+32-block.height, block.width, block.height);
});
}
control.prototype.triggerHero = function (type, time, callback) {
if (type == null) {
type = core.hasFlag('hideHero') ? 'show' : 'hide';
}
if ((core.hasFlag('hideHero') && type != 'show') || (!core.hasFlag('hideHero') && type != 'hide')) {
if (callback) callback();
return;
}
if (type == 'show') core.removeFlag('hideHero');
else core.setFlag('hideHero', true);
time = time || 0;
if (time == 0) {
core.drawHero();
if (callback) callback();
return;
}
time /= Math.max(core.status.replay.speed, 1)
this._triggerHero_animate(type, 10 / time, callback);
}
control.prototype._triggerHero_animate = function (type, delta, callback) {
var opacity = type != 'show' ? 1 : 0;
var animate = setInterval(function () {
opacity += type != 'show' ? -delta : delta;
core.clearMap('hero');
core.setAlpha('hero', opacity);
core.control._drawHero_draw(core.getHeroLoc('direction'), core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop', 0);
core.setAlpha('hero', 1);
if (opacity >= 1 || opacity <= 0) {
delete core.animateFrame.asyncId[animate];
clearInterval(animate);
core.drawHero();
if (callback) callback();
}
}, 10);
core.animateFrame.asyncId[animate] = true;
}
control.prototype._drawHero_getDrawObjs = function (direction, x, y, status, offset) {
var heroIconArr = core.material.icons.hero, drawObjs = [], index = 0;
drawObjs.push({
@ -984,7 +1037,7 @@ control.prototype.checkBlock = function () {
core.updateStatusBar();
}
}
this._checkBlock_snipe(core.status.checkBlock.snipe[loc]);
this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
this._checkBlock_ambush(core.status.checkBlock.ambush[loc]);
}
@ -998,10 +1051,10 @@ control.prototype._checkBlock_disableQuickShop = function () {
}
////// 阻击 //////
control.prototype._checkBlock_snipe = function (snipe) {
if (!snipe || snipe.length == 0) return;
control.prototype._checkBlock_repulse = function (repulse) {
if (!repulse || repulse.length == 0) return;
var actions = [];
snipe.forEach(function (t) {
repulse.forEach(function (t) {
actions.push({"type": "move", "loc": [t[0],t[1]], "steps": [t[3]], "time": 250, "keep": true, "async": true});
});
actions.push({"type": "waitAsync"});
@ -1047,6 +1100,7 @@ control.prototype.updateDamage = function (floorId, ctx) {
control.prototype._updateDamage_damage = function (floorId, ctx) {
core.setTextAlign(ctx, 'left');
core.extractBlocks(floorId);
core.status.maps[floorId].blocks.forEach(function (block) {
var x = block.x, y = block.y;
if (!block.disable && block.event.cls.indexOf('enemy') == 0 && block.event.displayDamage !== false) {
@ -1526,10 +1580,12 @@ control.prototype._replayAction_getNext = function (action) {
control.prototype._replayAction_moveDirectly = function (action) {
if (action.indexOf("move:")!=0) return false;
// 忽略连续的瞬移事件
while (core.status.replay.toReplay.length>0 &&
core.status.replay.toReplay[0].indexOf('move:')==0) {
core.status.route.push(action);
action = core.status.replay.toReplay.shift();
if (!core.hasFlag('poison')) {
while (core.status.replay.toReplay.length>0 &&
core.status.replay.toReplay[0].indexOf('move:')==0) {
core.status.route.push(action);
action = core.status.replay.toReplay.shift();
}
}
var pos=action.substring(5).split(":");
@ -2008,12 +2064,17 @@ control.prototype.getRealStatusOrDefault = function (status, name) {
////// 设置某个属性的增幅值 //////
control.prototype.setBuff = function (name, value) {
// 仅保留三位有效buff值
value = parseFloat(value.toFixed(3));
this.setFlag('__'+name+'_buff__', value);
}
////// 加减某个属性的增幅值 //////
control.prototype.addBuff = function (name, value) {
this.setFlag('__'+name+'_buff__', this.getBuff(name) + value);
var buff = this.getBuff(name) + value;
// 仅保留三位有效buff值
buff = parseFloat(buff.toFixed(3));
this.setFlag('__'+name+'_buff__', buff);
}
////// 获得某个属性的增幅值 //////
@ -2467,72 +2528,14 @@ control.prototype.updateHeroIcon = function (name) {
var ratio = Math.min(w / h, 1), width = 32 * ratio, left = 16 - width/2;
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");
var ctx = canvas.getContext("2d");
canvas.width = 32;
canvas.height = 32;
context.drawImage(image, 0, 0, w, h, left, 0, width, 32);
core.drawImage(ctx, image, 0, 0, w, h, left, 0, width, 32);
core.statusBar.image.name.src = canvas.toDataURL("image/png");
}
control.prototype.updateGlobalAttribute = function (name) {
if (name == null) name = Object.keys(core.status.globalAttribute);
if (name instanceof Array) {
name.forEach(function (t) {
core.control.updateGlobalAttribute(t);
});
return;
}
var attribute = core.status.globalAttribute || core.initStatus.globalAttribute;
if (attribute == null) return;
switch (name) {
case 'statusLeftBackground':
if (!core.domStyle.isVertical) {
core.dom.statusBar.style.background = attribute[name];
}
break;
case 'statusTopBackground':
if (core.domStyle.isVertical) {
core.dom.statusBar.style.background = attribute[name];
}
break;
case 'toolsBackground':
if (core.domStyle.isVertical) {
core.dom.toolBar.style.background = attribute[name];
}
break;
case 'borderColor':
{
var border = '3px ' + attribute[name] + ' solid';
core.dom.statusBar.style.borderTop = border;
core.dom.statusBar.style.borderLeft = border;
core.dom.statusBar.style.borderRight = core.domStyle.isVertical?border:'';
core.dom.statusBar.style.borderBottom = core.domStyle.isVertical?'':border;
core.dom.gameDraw.style.border = border;
core.dom.toolBar.style.borderLeft = border;
core.dom.toolBar.style.borderRight = core.domStyle.isVertical?border:'';
core.dom.toolBar.style.borderBottom = core.domStyle.isVertical?border:'';
break;
}
case 'statusBarColor':
{
var texts = core.dom.statusTexts;
for (var i=0;i<texts.length;i++)
texts[i].style.color = attribute[name];
break;
}
case 'hardLabelColor':
core.dom.hard.style.color = attribute[name];
break;
case 'floorChangingBackground':
core.dom.floorMsgGroup.style.background = attribute[name];
break;
case 'floorChangingTextColor':
core.dom.floorMsgGroup.style.color = attribute[name];
break;
}
}
////// 改变工具栏为按钮1-8 //////
control.prototype.setToolbarButton = function (useButton) {
if (!core.domStyle.showStatusBar) {
@ -2638,17 +2641,28 @@ control.prototype._doResize = function (obj) {
control.prototype.resize = function() {
if (main.mode=='editor')return;
var clientWidth = main.dom.body.clientWidth, clientHeight = main.dom.body.clientHeight;
var CANVAS_WIDTH = core.__PIXELS__ + 6, BAR_WIDTH = Math.round(core.__PIXELS__ * 0.31) + 3;
var CANVAS_WIDTH = core.__PIXELS__, BAR_WIDTH = Math.round(core.__PIXELS__ * 0.31);
var BORDER = 3;
if (clientWidth >= CANVAS_WIDTH + BAR_WIDTH || (clientWidth > clientHeight && clientHeight < CANVAS_WIDTH)) {
if (clientWidth - 3 * BORDER >= CANVAS_WIDTH + BAR_WIDTH || (clientWidth > clientHeight && clientHeight - 2 * BORDER < CANVAS_WIDTH)) {
// 横屏
core.domStyle.isVertical = false;
core.domStyle.scale = Math.min(1, clientHeight / CANVAS_WIDTH);
core.domStyle.availableScale = [];
[1, 1.25, 1.5, 1.75, 2].forEach(function (v) {
if (clientWidth - 3 * BORDER >= v*(CANVAS_WIDTH + BAR_WIDTH) && clientHeight - 2 * BORDER >= v * CANVAS_WIDTH) {
core.domStyle.availableScale.push(v); // 64x64
}
});
if (core.domStyle.availableScale.indexOf(core.domStyle.scale) < 0) {
core.domStyle.scale = Math.min(1, (clientHeight - 2 * BORDER) / CANVAS_WIDTH);
}
}
else {
// 竖屏
core.domStyle.isVertical = true;
core.domStyle.scale = Math.min(1, clientWidth / CANVAS_WIDTH);
core.domStyle.scale = Math.min(1, (clientWidth - 2 * BORDER) / CANVAS_WIDTH);
core.domStyle.availableScale = [];
}
var statusDisplayArr = this._shouldDisplayStatus(), count = statusDisplayArr.length;
@ -2664,15 +2678,16 @@ control.prototype.resize = function() {
clientWidth: clientWidth,
clientHeight: clientHeight,
CANVAS_WIDTH: CANVAS_WIDTH,
BORDER: BORDER,
BAR_WIDTH: BAR_WIDTH,
outerSize: CANVAS_WIDTH * core.domStyle.scale,
outerSize: CANVAS_WIDTH * core.domStyle.scale + 2 * BORDER,
globalAttribute: globalAttribute,
border: '3px ' + globalAttribute.borderColor + ' solid',
border: '3px ' + core.arrayToRGBA(globalAttribute.borderColor) + ' solid',
statusDisplayArr: statusDisplayArr,
count: count,
col: col,
statusBarHeightInVertical: core.domStyle.isVertical ? (32 * col + 6) * core.domStyle.scale + 6 : 0,
toolbarHeightInVertical: core.domStyle.isVertical ? 44 * core.domStyle.scale + 6 : 0,
statusBarHeightInVertical: core.domStyle.isVertical ? (32 * col + 6) * core.domStyle.scale + 2 * BORDER : 0,
toolbarHeightInVertical: core.domStyle.isVertical ? 44 * core.domStyle.scale + 2 * BORDER : 0,
is15x15: core.__SIZE__ == 15
};
@ -2689,7 +2704,7 @@ control.prototype._resize_gameGroup = function (obj) {
totalHeight = obj.outerSize + obj.statusBarHeightInVertical + obj.toolbarHeightInVertical
}
else {
totalWidth = (obj.CANVAS_WIDTH + obj.BAR_WIDTH) * core.domStyle.scale;
totalWidth = obj.outerSize + obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER;
totalHeight = obj.outerSize;
}
gameGroup.style.width = totalWidth + "px";
@ -2698,10 +2713,9 @@ control.prototype._resize_gameGroup = function (obj) {
gameGroup.style.top = (obj.clientHeight - totalHeight) / 2 + "px";
// floorMsgGroup
var floorMsgGroup = core.dom.floorMsgGroup;
floorMsgGroup.style.width = obj.outerSize - 6 + "px";
floorMsgGroup.style.height = totalHeight - 6 + "px";
floorMsgGroup.style.background = obj.globalAttribute.floorChangingBackground;
floorMsgGroup.style.color = obj.globalAttribute.floorChangingTextColor;
floorMsgGroup.style = obj.globalAttribute.floorChangingStyle;
floorMsgGroup.style.width = obj.outerSize - 2 * obj.BORDER + "px";
floorMsgGroup.style.height = totalHeight - 2 * obj.BORDER + "px";
// musicBtn
if (core.domStyle.isVertical || core.domStyle.scale < 1) {
core.dom.musicBtn.style.right = core.dom.musicBtn.style.bottom = "3px";
@ -2713,7 +2727,7 @@ control.prototype._resize_gameGroup = function (obj) {
}
control.prototype._resize_canvas = function (obj) {
var innerSize = (obj.outerSize - 6) + "px";
var innerSize = (obj.CANVAS_WIDTH * core.domStyle.scale) + "px";
for (var i = 0; i < core.dom.gameCanvas.length; ++i)
core.dom.gameCanvas[i].style.width = core.dom.gameCanvas[i].style.height = innerSize;
core.dom.gif.style.width = core.dom.gif.style.height = innerSize;
@ -2738,8 +2752,6 @@ control.prototype._resize_canvas = function (obj) {
// resize next
main.dom.next.style.width = main.dom.next.style.height = 5 * core.domStyle.scale + "px";
main.dom.next.style.borderBottomWidth = main.dom.next.style.borderRightWidth = 4 * core.domStyle.scale + "px";
}
control.prototype._resize_statusBar = function (obj) {
@ -2752,7 +2764,7 @@ control.prototype._resize_statusBar = function (obj) {
statusBar.style.fontSize = 16 * core.domStyle.scale + "px";
}
else {
statusBar.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
statusBar.style.width = (obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER) + "px";
statusBar.style.height = obj.outerSize + "px";
statusBar.style.background = obj.globalAttribute.statusLeftBackground;
// --- 计算文字大小
@ -2764,22 +2776,22 @@ control.prototype._resize_statusBar = function (obj) {
statusBar.style.borderBottom = core.domStyle.isVertical ? '' : obj.border;
// 自绘状态栏
if (core.domStyle.isVertical) {
core.dom.statusCanvas.style.width = obj.outerSize - 6 + "px";
core.dom.statusCanvas.width = core.__PIXELS__;
core.dom.statusCanvas.style.width = obj.CANVAS_WIDTH + "px";
core.dom.statusCanvas.width = obj.CANVAS_WIDTH;
core.dom.statusCanvas.style.height = obj.statusBarHeightInVertical - 3 + "px";
core.dom.statusCanvas.height = obj.col * 32 + 9;
}
else {
core.dom.statusCanvas.style.width = obj.BAR_WIDTH * core.domStyle.scale - 3 + "px";
core.dom.statusCanvas.width = obj.BAR_WIDTH - 3;
core.dom.statusCanvas.style.height = obj.outerSize - 6 + "px";
core.dom.statusCanvas.height = core.__PIXELS__;
core.dom.statusCanvas.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
core.dom.statusCanvas.width = obj.BAR_WIDTH;
core.dom.statusCanvas.style.height = obj.outerSize - 2 * obj.BORDER + "px";
core.dom.statusCanvas.height = obj.CANVAS_WIDTH;
}
core.dom.statusCanvas.style.display = core.flags.statusCanvas ? "block" : "none";
}
control.prototype._resize_status = function (obj) {
var statusHeight = (core.domStyle.isVertical ? 1 : (core.__HALF_SIZE__ + 3) / obj.count) * 32 * core.domStyle.scale * 0.8;
var statusHeight = (core.domStyle.isVertical ? 1 : (core.__HALF_SIZE__ + obj.BORDER) / obj.count) * 32 * core.domStyle.scale * 0.8;
// status
for (var i = 0; i < core.dom.status.length; ++i) {
var id = core.dom.status[i].id, style = core.dom.status[i].style;
@ -2787,7 +2799,7 @@ control.prototype._resize_status = function (obj) {
style.display = core.flags.statusCanvas || obj.statusDisplayArr.indexOf(id) < 0 ? 'none': 'block';
style.margin = 3 * core.domStyle.scale + "px";
style.height = statusHeight + "px";
style.maxWidth = obj.BAR_WIDTH * core.domStyle.scale * (core.domStyle.isVertical ? 0.95 : 1) + "px";
style.maxWidth = obj.BAR_WIDTH * core.domStyle.scale * (core.domStyle.isVertical ? 0.95 : 1) + obj.BORDER + "px";
if (obj.is15x15 && !core.domStyle.isVertical)
style.marginLeft = 11 * core.domStyle.scale + "px";
}
@ -2819,7 +2831,7 @@ control.prototype._resize_toolBar = function (obj) {
toolBar.style.background = obj.globalAttribute.toolsBackground;
}
else {
toolBar.style.width = obj.BAR_WIDTH * core.domStyle.scale + "px";
toolBar.style.width = obj.BAR_WIDTH * core.domStyle.scale + obj.BORDER + "px";
toolBar.style.top = 0.718 * obj.outerSize + "px";
toolBar.style.height = 0.281 * obj.outerSize + "px";
toolBar.style.background = 'transparent';
@ -2844,7 +2856,6 @@ control.prototype._resize_tools = function (obj) {
style.marginTop = 6 * core.domStyle.scale + "px"
}
core.dom.hard.style.lineHeight = toolsHeight + "px";
core.dom.hard.style.color = obj.globalAttribute.hardLabelColor;
if (core.domStyle.isVertical) {
core.dom.hard.style.width = obj.outerSize - 9 * toolsMarginLeft - 8.5 * toolsHeight - 12 + "px";
}

View File

@ -84,6 +84,7 @@ function core() {
// 样式
this.domStyle = {
scale: 1.0,
availableScale: [],
isVertical: false,
showStatusBar: true,
toolbarBtn: false,
@ -190,15 +191,13 @@ function core() {
},
"globalAttribute": {
'equipName': main.equipName || [],
"statusLeftBackground": main.statusLeftBackground || "url(project/materials/ground.png) repeat",
"statusTopBackground": main.statusTopBackground || "url(project/materials/ground.png) repeat",
"toolsBackground": main.toolsBackground || "url(project/materials/ground.png) repeat",
"borderColor": main.borderColor || "white",
"statusBarColor": main.statusBarColor || "white",
"hardLabelColor": main.hardLabelColor || "red",
"floorChangingBackground": main.floorChangingBackground || "black",
"floorChangingTextColor": main.floorChangingTextColor || "white",
"font": main.font || "Verdana"
"statusLeftBackground": main.styles.statusLeftBackground || "url(project/materials/ground.png) repeat",
"statusTopBackground": main.styles.statusTopBackground || "url(project/materials/ground.png) repeat",
"toolsBackground": main.styles.toolsBackground || "url(project/materials/ground.png) repeat",
"borderColor": main.styles.borderColor || [204,204,204,1],
"statusBarColor": main.styles.statusBarColor || [255,255,255,1],
"floorChangingStyle": main.styles.floorChangingStyle || "background-color: black; color: white",
"font": main.styles.font || "Verdana"
},
'curtainColor': null,
'openingDoor': null,
@ -292,6 +291,12 @@ core.prototype._init_sys_flags = function () {
// 行走速度
core.values.moveSpeed = core.getLocalStorage('moveSpeed', 100);
core.values.floorChangeTime = core.getLocalStorage('floorChangeTime', 500);
if (main.mode != 'editor') {
core.domStyle.scale = core.getLocalStorage('scale', 1);
if (core.domStyle.scale != 1) {
core.resize();
}
}
}
core.prototype._init_platform = function () {

View File

@ -299,6 +299,7 @@ enemys.prototype._getDamage = function (enemy, hero, x, y, floorId) {
enemys.prototype.getCurrentEnemys = function (floorId) {
floorId = floorId || core.status.floorId;
var enemys = [], used = {};
core.extractBlocks(floorId);
var mapBlocks = core.status.maps[floorId].blocks;
for (var b = 0; b < mapBlocks.length; b++) {
if (!mapBlocks[b].disable && mapBlocks[b].event.cls.indexOf('enemy') == 0) {
@ -364,6 +365,7 @@ enemys.prototype.hasEnemyLeft = function (enemyId, floorId) {
else if (enemyId) enemyMap[enemyId] = true;
else enemyMap = null;
for (var i = 0; i < floorId.length; i++) {
core.extractBlocks(floorId[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) {

View File

@ -61,6 +61,7 @@ events.prototype._startGame_start = function (hard, seed, route, callback) {
core.dom.musicBtn.style.display = 'block';
core.push(todo, core.firstData.startCanvas);
}
core.push(todo, {"type": "function", "function": "function() { core.events._startGame_setHard(); }"})
core.push(todo, core.firstData.startText);
this.insertAction(todo, null, null, function () {
core.events._startGame_afterStart(nowLoc, callback);
@ -69,6 +70,22 @@ events.prototype._startGame_start = function (hard, seed, route, callback) {
if (route != null) core.startReplay(route);
}
events.prototype._startGame_setHard = function () {
// 根据难度设置flag:hard
// 这一段应当在startCanvas之后startText之前做
var hardValue = 0;
var hardColor = 'red';
main.levelChoose.forEach(function (one) {
if (one.name == core.status.hard) {
hardValue = one.hard;
hardColor = core.arrayToRGBA(one.color || [255,0,0,1]);
core.insertAction(one.action);
}
});
core.setFlag('hard', 0);
core.setFlag('__hardColor__', hardColor);
}
events.prototype._startGame_afterStart = function (nowLoc, callback) {
core.ui.closePanel();
this._startGame_statusBar();
@ -441,7 +458,7 @@ events.prototype._openDoor_check = function (id, x, y, needKey) {
}
// 是否存在门或暗墙
if (core.material.icons.animates[id] == null) {
if (core.material.icons.animates[id] == null && core.material.icons.npc48[id] == null) {
return clearAndReturn();
}
@ -452,13 +469,14 @@ events.prototype._openDoor_check = function (id, x, y, needKey) {
return clearAndReturn();
doorInfo = doorInfo.doorInfo;
// Check all keys
var keyInfo = doorInfo[0];
var keyInfo = doorInfo.keys || {};
if (needKey) {
if (keyInfo == null) {
core.drawTip("无法开启此门");
return clearAndReturn();
}
for (var keyName in keyInfo) {
// --- 如果是一个不存在的道具,则直接认为无法开启
if (!core.material.items[keyName]) {
core.drawTip("无法开启此门");
return clearAndReturn();
}
var keyValue = keyInfo[keyName];
if (core.itemCount(keyName) < keyValue) {
core.drawTip("你没有" + ((core.material.items[keyName] || {}).name || "钥匙"), null, true);
@ -470,22 +488,28 @@ events.prototype._openDoor_check = function (id, x, y, needKey) {
core.removeItem(keyName, keyInfo[keyName]);
}
}
core.playSound(doorInfo[1] || 'door.mp3');
core.playSound(doorInfo.openSound);
return true;
}
events.prototype._openDoor_animate = function (id, x, y, callback) {
var door = core.material.icons.animates[id];
var speed = 40;
var blockInfo = core.getBlockInfo(id);
var image = blockInfo.image, posY = blockInfo.posY, height = blockInfo.height;
var speed = (core.getBlockById(id).event.doorInfo.time || 160) / 4;
var locked = core.status.lockControl;
core.lockControl();
core.status.replay.animate = true;
core.removeBlock(x, y);
core.drawImage('event', core.material.images.animates, 0, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
core.drawImage('event', image, 0, posY * height + height - 32, 32, 32, x * 32, y * 32, 32, 32);
if (height > 32)
core.drawImage('event2', image, 0, posY * height, 32, height - 32, x * 32, y * 32 + 32 - height, 32, height - 32);
var state = 0;
var animate = window.setInterval(function () {
core.clearMap('event', 32 * x, 32 * y, 32, 32);
if (height > 32)
core.clearMap('event2', x * 32, y * 32 + 32 - height, 32, height - 32)
state++;
if (state == 4) {
clearInterval(animate);
@ -496,7 +520,9 @@ events.prototype._openDoor_animate = function (id, x, y, callback) {
if (callback) callback();
return;
}
core.drawImage('event', core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
core.drawImage('event', image, 32 * state, posY * height + height - 32, 32, 32, x * 32, y * 32, 32, 32);
if (height > 32)
core.drawImage('event2', image, 32 * state, posY * height, 32, height - 32, x * 32, y * 32 + 32 - height, 32, height - 32);
}, core.status.replay.speed == 24 ? 1 : speed / Math.max(core.status.replay.speed, 1));
core.animateFrame.asyncId[animate] = true;
}
@ -661,6 +687,7 @@ events.prototype._changeFloor_getHeroLoc = function (floorId, stair, heroLoc) {
heroLoc.y = core.status.maps[floorId][stair][1];
}
else {
core.extractBlocks(floorId);
var blocks = core.status.maps[floorId].blocks;
for (var i in blocks) {
if (!blocks[i].disable && blocks[i].event.id === stair) {
@ -903,6 +930,8 @@ events.prototype.doAction = function (keepUI) {
}
events.prototype._doAction_finishEvents = function () {
if (core.status.gameOver) return true;
// 事件处理完毕
if (core.status.event.data.list.length == 0) {
// 检测并执行延迟自动事件
@ -960,7 +989,7 @@ events.prototype.insertCommonEvent = function (name, x, y, callback, addToLast)
if (callback) callback();
return;
}
this.insertAction(commonEvent, x, y, callback, addToLast);
this.insertAction({"type": "dowhile", "condition": "false", "data": commonEvent}, x, y, callback, addToLast);
}
////// 获得一个公共事件 //////
@ -1281,10 +1310,16 @@ events.prototype._action_hide = function (data, x, y, prefix) {
events.prototype._action_setBlock = function (data, x, y, prefix) {
data.loc = this.__action_getLoc2D(data.loc, x, y, prefix);
data.loc.forEach(function (t) {
core.setBlock(data.number, t[0], t[1], data.floorId);
});
core.doAction();
data.time = data.time || 0;
data.floorId = data.floorId || core.status.floorId;
if (data.time > 0 && data.floorId == core.status.floorId) {
this.__action_doAsyncFunc(data.async, core.animateSetBlocks, data.number, data.loc, data.floorId, data.time);
} else {
data.loc.forEach(function (loc) {
core.setBlock(data.number, loc[0], loc[1], data.floorId);
});
core.doAction();
}
}
events.prototype._action_turnBlock = function (data, x, y, prefix) {
@ -1424,7 +1459,7 @@ events.prototype._action_changePos = function (data, x, y, prefix) {
events.prototype._action_showImage = function (data, x, y, prefix) {
if (core.isReplaying()) data.time = 0;
this.__action_doAsyncFunc(data.async || data.time == 0, core.showImage,
data.code, data.image, data.sloc, data.loc, data.opacity, data.time);
data.code, data.image + (data.reverse || ''), data.sloc, data.loc, data.opacity, data.time);
}
events.prototype._precompile_showImage = function (data) {
@ -1980,15 +2015,25 @@ events.prototype._action_hideStatusBar = function (data, x, y, prefix) {
}
events.prototype._action_showHero = function (data, x, y, prefix) {
core.removeFlag('hideHero');
core.drawHero();
core.doAction();
data.time = data.time || 0;
if (data.time > 0) {
this.__action_doAsyncFunc(data.async, core.triggerHero, 'show', data.time);
} else {
core.removeFlag('hideHero');
core.drawHero();
core.doAction();
}
}
events.prototype._action_hideHero = function (data, x, y, prefix) {
core.setFlag('hideHero', true);
core.drawHero();
core.doAction();
data.time = data.time || 0;
if (data.time > 0) {
this.__action_doAsyncFunc(data.async, core.triggerHero, 'hide', data.time);
} else {
core.setFlag('hideHero', true);
core.drawHero();
core.doAction();
}
}
events.prototype._action_vibrate = function (data, x, y, prefix) {
@ -2026,7 +2071,7 @@ events.prototype._action_wait = function (data, x, y, prefix) {
} else if (data.timeout) {
core.status.event.interval = setTimeout(function() {
core.status.route.push("input:none");
core.removeFlag("type");
core.setFlag("type", -1);
core.doAction();
}, data.timeout);
}
@ -2535,7 +2580,7 @@ events.prototype.setEnemy = function (id, name, value, prefix) {
////// 设置楼层属性 //////
events.prototype.setFloorInfo = function (name, value, floorId, prefix) {
floorId = floorId || core.status.floorId;
core.status.maps[floorId][name] = core.calValue(value, prefix);
core.status.maps[floorId][name] = value;
core.updateStatusBar();
}
@ -2548,10 +2593,14 @@ events.prototype.setGlobalAttribute = function (name, value) {
// --- 检查 []
if (value.charAt(0) == '[' && value.charAt(value.length - 1) == ']')
value = eval(value);
// --- 检查颜色
if (/^[0-9 ]+,[0-9 ]+,[0-9 ]+(,[0-9. ]+)?$/.test(value)) {
value = 'rgba(' + value + ')';
}
}
core.status.globalAttribute[name] = value;
core.updateGlobalAttribute(name);
core.setFlag('globalAttribute', core.status.globalAttribute);
core.resize();
}
////// 设置全局开关 //////
@ -2574,7 +2623,8 @@ events.prototype.setGlobalFlag = function (name, value) {
events.prototype.closeDoor = function (x, y, id, callback) {
id = id || "";
if (core.material.icons.animates[id] == null || core.getBlock(x, y) != null) {
if ((core.material.icons.animates[id] == null && core.material.icons.npc48[id] == null)
|| core.getBlock(x, y) != null) {
if (callback) callback();
return;
}
@ -2585,27 +2635,36 @@ events.prototype.closeDoor = function (x, y, id, callback) {
}
// 关门动画
core.playSound(doorInfo[2] || 'door.mp3');
var door = core.material.icons.animates[id];
var speed = 40, state = 0;
core.playSound(doorInfo.closeDoor);
var blockInfo = core.getBlockInfo(id);
var image = blockInfo.image, posY = blockInfo.posY, height = blockInfo.height;
var speed = (doorInfo.time || 160) / 4, state = 0;
var animate = window.setInterval(function () {
state++;
if (state == 4) {
clearInterval(animate);
delete core.animateFrame.asyncId[animate];
core.setBlock(core.getNumberById(id), x, y);
core.setBlock(id, x, y);
if (callback) callback();
return;
}
core.clearMap('event', 32 * x, 32 * y, 32, 32);
core.drawImage('event', core.material.images.animates, 32 * (4-state), 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
core.drawImage('event', image, 32 * (4-state), posY * height + height - 32, 32, 32, x * 32, y * 32, 32, 32);
if (height > 32)
core.drawImage('event2', image, 32 * (4-state), posY * height, 32, height - 32, x * 32, y * 32 + 32 - height, 32, height - 32);
}, core.status.replay.speed == 24 ? 1 : speed / Math.max(core.status.replay.speed, 1));
core.animateFrame.asyncId[animate] = true;
}
////// 显示图片 //////
events.prototype.showImage = function (code, image, sloc, loc, opacityVal, time, callback) {
var imageName = null;
if (typeof image == 'string') {
imageName = image;
if (image.endsWith(':x') || image.endsWith(':y') || image.endsWith(':o')) {
image = image.substring(0, image.length - 2);
}
image = core.getMappedName(image);
image = core.material.images.images[image];
}
@ -2627,7 +2686,7 @@ events.prototype.showImage = function (code, image, sloc, loc, opacityVal, time,
time = time || 0;
var name = "image" + zIndex;
var ctx = core.createCanvas(name, x, y, w, h, zIndex);
ctx.drawImage(image, sx, sy, sw, sh, 0, 0, w, h);
core.drawImage(ctx, imageName == null ? image : imageName, sx, sy, sw, sh, 0, 0, w, h);
if (time == 0) {
core.setOpacity(name, opacityVal);
if (callback) callback();

View File

@ -36,16 +36,13 @@ icons.prototype.getAllIconIds = function () {
return this.allIconIds;
}
icons.prototype._getAnimateFrames = function (cls, useOriginValue) {
icons.prototype._getAnimateFrames = function (cls) {
if (cls == 'enemys' || cls == 'npcs') {
return 2;
}
if (cls == 'animates' || cls == 'enemy48') {
if (cls == 'animates' || cls == 'enemy48' || cls == 'npc48') {
return 4;
}
if (cls == 'npc48') {
return useOriginValue ? 4 : 1;
}
return 1;
}
@ -53,6 +50,7 @@ icons.prototype._getAnimateFrames = function (cls, useOriginValue) {
icons.prototype.getTilesetOffset = function (id) {
if (typeof id == 'string') {
id = core.getIdOfThis(id);
// Tileset的ID必须是 X+数字 的形式
if (!/^X\d+$/.test(id)) return null;
id = parseInt(id.substring(1));
@ -74,4 +72,4 @@ icons.prototype.getTilesetOffset = function (id) {
startOffset += this.tilesetStartOffset;
}
return null;
}
}

View File

@ -31,7 +31,6 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
var itemCls = core.material.items[itemId].cls;
// 消耗品
if (itemCls === 'items') {
var ratio = parseInt(core.status.thisMap.item_ratio) || 1;
var curr_hp = core.status.hero.hp;
if (itemId in this.itemEffect) {
try {
@ -64,10 +63,9 @@ items.prototype.getItemEffectTip = function (itemId) {
var itemCls = core.material.items[itemId].cls;
// 消耗品
if (itemCls === 'items') {
var ratio = parseInt(core.status.thisMap.item_ratio) || 1;
if (itemId in this.itemEffectTip) {
try {
return eval(this.itemEffectTip[itemId]) || "";
return core.replaceText(this.itemEffectTip[itemId]) || "";
} catch (e) {
main.log(e);
return "";
@ -95,7 +93,6 @@ items.prototype.useItem = function (itemId, noRoute, callback) {
items.prototype._useItemEffect = function (itemId) {
if (itemId in this.useItemEffect) {
try {
var ratio = parseInt(core.status.thisMap.item_ratio) || 1;
eval(this.useItemEffect[itemId]);
}
catch (e) {
@ -292,53 +289,41 @@ items.prototype.unloadEquip = function (equipType, callback) {
}
items.prototype.compareEquipment = function (compareEquipId, beComparedEquipId) {
var result = {};
var result = {"value": {}, "percentage": {}};
var first = core.material.items[compareEquipId], second = core.material.items[beComparedEquipId];
for (var name in core.status.hero) {
if (typeof core.status.hero[name] == 'number') {
var ans = 0;
if (first) ans += (first.equip || {})[name] || 0;
if (second) ans -= (second.equip || {})[name] || 0;
if (ans != 0) result[name] = ans;
for (var one in result) {
for (var name in core.status.hero) {
if (typeof core.status.hero[name] == 'number') {
var ans = 0;
if (first) ans += ((first.equip || {})[one] || {})[name] || 0;
if (second) ans -= ((second.equip || {})[one] || {})[name] || 0;
if (ans != 0) result[one][name] = ans;
}
}
}
return result;
}
////// 实际换装的效果 //////
items.prototype._loadEquipEffect = function (equipId, unloadEquipId, isPercentage) {
items.prototype._loadEquipEffect = function (equipId, unloadEquipId) {
// 比较能力值
var result = core.compareEquipment(equipId, unloadEquipId);
if (isPercentage) {
for (var name in result)
core.addBuff(name, result[name] / 100);
}
else {
for (var name in result)
core.status.hero[name] += result[name];
}
for (var name in result.percentage)
core.addBuff(name, result.percentage[name] / 100);
for (var name in result.value)
core.status.hero[name] += result.value[name];
}
items.prototype._realLoadEquip = function (type, loadId, unloadId, callback) {
var loadEquip = core.material.items[loadId] || {}, unloadEquip = core.material.items[unloadId] || {};
loadEquip.equip = loadEquip.equip || {};
unloadEquip.equip = unloadEquip.equip || {}
var loadPercentage = loadEquip.equip.percentage, unloadPercentage = unloadEquip.equip.percentage;
if (loadId && unloadId && (loadPercentage || false) != (unloadPercentage || false)) {
this.unloadEquip(type);
this.loadEquip(loadId);
if (callback) callback();
return;
}
// --- 音效
this._realLoadEquip_playSound();
// --- 实际换装
this._loadEquipEffect(loadId, unloadId, loadPercentage == null ? unloadPercentage : loadPercentage);
this._loadEquipEffect(loadId, unloadId);
// --- 加减
if (loadId) core.removeItem(loadId);

View File

@ -22,6 +22,17 @@ maps.prototype._setFloorSize = function (floorId) {
core.floors[floorId].height = core.floors[floorId].height || core.__SIZE__;
}
maps.prototype._resetFloorImages = function () {
for (var floorId in core.status.maps) {
(core.status.maps[floorId].images || []).forEach(function (one) {
var flag = "__floorImg__" + floorId + "_" + one.x + "_" + one.y;
if (core.getFlag(flag) == null) {
if (one.disabled) core.setFlag(flag, true);
}
})
}
}
// ------ 加载地图与地图的存档读档(压缩与解压缩) ------ //
////// 加载某个楼层(从剧本或存档中) //////
@ -42,12 +53,27 @@ maps.prototype.loadFloor = function (floorId, map) {
if (notCopy.indexOf(name) == -1 && map[name] != null)
content[name] = core.clone(map[name]);
}
map = this.decompressMap(map.map, floorId);
// 事件处理
content['blocks'] = this._mapIntoBlocks(map, floor, floorId);
content.map = map.map;
if (main.mode == 'editor') {
this.extractBlocks(content);
}
return content;
}
/// 根据需求解析出blocks
maps.prototype.extractBlocks = function (map) {
map = map || core.status.floorId;
if (typeof map == 'string') map = (core.status.maps||{})[map];
if (!map) return;
if (map.blocks) return;
if (map.deleted) {
map.blocks = [];
return;
}
var floorId = map.floorId;
map.blocks = this._mapIntoBlocks(this.decompressMap(map.map, floorId), core.floors[floorId], floorId);
}
maps.prototype._mapIntoBlocks = function (map, floor, floorId) {
var blocks = [];
var mw = core.floors[floorId].width;
@ -64,6 +90,7 @@ maps.prototype._mapIntoBlocks = function (map, floor, floorId) {
////// 从ID获得数字 //////
maps.prototype.getNumberById = function (id) {
id = this.getIdOfThis(id);
core.status.id2number = core.status.id2number || {};
if (core.status.id2number[id] != null) return core.status.id2number[id];
return core.status.id2number[id] = this._getNumberById(id);
@ -94,6 +121,13 @@ maps.prototype.getBlockById = function (id) {
return this.getBlockByNumber(this.getNumberById(id));
}
maps.prototype.getIdOfThis = function (id) {
if (id != 'this') return id;
if (core.status.event.id != 'action') return id;
if (!core.status.event.data || core.status.event.data.x == null || core.status.event.data.y == null) return id;
return core.getBlockId(core.status.event.data.x, core.status.event.data.y) || id;
}
////// 数字和ID的对应关系 //////
maps.prototype.initBlock = function (x, y, id, addInfo, eventFloor) {
var disable = null;
@ -137,7 +171,7 @@ maps.prototype._addInfo = function (block) {
block.event.trigger = 'getItem';
}
if (block.event.animate == null) {
block.event.animate = core.icons._getAnimateFrames(block.event.cls, false);
block.event.animate = core.icons._getAnimateFrames(block.event.cls);
}
block.event.height = 32;
if (block.event.cls == 'enemy48' || block.event.cls == 'npc48')
@ -266,17 +300,16 @@ maps.prototype.saveMap = function (floorId) {
return map;
}
// 砍层状态:直接返回
if (main.mode == 'play' && (flags.__removed__ || []).indexOf(floorId) >= 0) {
return { canFlyTo: false, cannotViewMap: true };
if ((flags.__removed__ || []).indexOf(floorId) >= 0) {
return { deleted: true, canFlyTo: false, cannotViewMap: true };
}
var map = maps[floorId], floor = core.floors[floorId];
var blocks = this._getMapArrayFromBlocks(map.blocks, floor.width, floor.height, true);
if (main.mode == 'editor') return blocks;
var thisFloor = this._compressFloorData(map, floor);
var mapArr = this.compressMap(blocks, floorId);
if (mapArr != null) thisFloor.map = mapArr;
var map = maps[floorId];
var thisFloor = this._compressFloorData(map, core.floors[floorId]);
if (map.blocks) {
var mapArr = this.compressMap(map.blocks, map.width, map.height, floorId);
if (mapArr != null) thisFloor.map = mapArr;
}
return thisFloor;
}
@ -305,23 +338,6 @@ maps.prototype.loadMap = function (data, floorId) {
return this.loadFloor(floorId, data[floorId]);
}
////// 删除地图,不计入存档 //////
maps.prototype.removeMaps = function (fromId, toId) {
if (!core.isPlaying()) return;
toId = toId || fromId;
var fromIndex = core.floorIds.indexOf(fromId),
toIndex = core.floorIds.indexOf(toId);
if (toIndex < 0) toIndex = core.floorIds.length - 1;
flags.__removed__ = flags.__removed__ || [];
for (var i = fromIndex; i <= toIndex; ++i) {
var floorId = core.floorIds[i];
delete flags.__visited__[floorId];
flags.__removed__.push(floorId);
core.status.maps[floorId].canFlyTo = false;
core.status.maps[floorId].cannotViewMap = true;
}
}
////// 更改地图画布的尺寸
maps.prototype.resizeMap = function (floorId) {
floorId = floorId || core.status.floorId;
@ -345,18 +361,12 @@ maps.prototype.resizeMap = function (floorId) {
////// 将当前地图重新变成二维数组形式 //////
maps.prototype.getMapArray = function (floorId, showDisable) {
floorId = floorId || core.status.floorId;
return this._getMapArrayFromBlocks(core.status.maps[floorId].blocks,
core.floors[floorId].width, core.floors[floorId].height, showDisable);
var map = core.status.maps[floorId];
if (!map.blocks) return map.map;
return this._getMapArrayFromBlocks(map.blocks, map.width, map.height, showDisable);
}
maps.prototype._getMapArrayFromBlocks = function (blockArray, width, height, showDisable) {
if (typeof blockArray == 'string') {
var floorId = blockArray;
blockArray = core.status.maps[floorId].blocks;
width = core.floors[floorId].width;
height = core.floors[floorId].height;
}
var blocks = [];
var allzero = [];
for (var y = 0; y < width; y++) allzero.push(0);
@ -380,6 +390,7 @@ maps.prototype._getMapArrayFromBlocks = function (blockArray, width, height, sho
maps.prototype.getMapBlocksObj = function (floorId, showDisable) {
floorId = floorId || core.status.floorId;
var obj = {};
core.extractBlocks(floorId);
core.status.maps[floorId].blocks.forEach(function (block) {
if (!block.disable || showDisable)
obj[block.x + "," + block.y] = block;
@ -564,8 +575,6 @@ maps.prototype._canMoveDirectly_checkGlobal = function () {
if (core.status.thisMap.cannotMoveDirectly) return false;
// flag:cannotMoveDirectly为true不能
if (core.hasFlag('cannotMoveDirectly')) return false;
// 中毒状态:不能
if (core.hasFlag('poison')) return false;
return true;
}
@ -688,7 +697,7 @@ maps.prototype._automaticRoute_deepAdd = function (x, y) {
// 绕过路障
if (id.endsWith("Net")) deepAdd += 100;
// 绕过血瓶和绿宝石
if (core.hasFlag('__potionNoRouting__') && (id.endsWith("Potion") || id == 'greenJewel')) deepAdd += 100;
if (core.hasFlag('__potionNoRouting__') && (id.endsWith("Potion") || id == 'greenGem')) deepAdd += 100;
// 绕过传送点
// if (block.block.event.trigger == 'changeFloor') deepAdd+=10;
}
@ -771,6 +780,7 @@ maps.prototype.drawMap = function (floorId, callback) {
core.clearMap('all');
this.generateGroundPattern(floorId);
core.status.floorId = floorId;
core.extractBlocks(floorId);
core.status.thisMap = core.status.maps[floorId];
this._drawMap_drawAll();
@ -828,7 +838,7 @@ maps.prototype._drawBg_drawBackground = function (floorId, ctx) {
if (groundInfo != null) {
for (var i = 0; i < width; i++) {
for (var j = 0; j < height; j++) {
ctx.drawImage(groundInfo.image, 32 * groundInfo.posX, groundInfo.height * groundInfo.posY, 32, 32, i * 32, j * 32, 32, 32);
core.drawImage(ctx, groundInfo.image, 32 * groundInfo.posX, groundInfo.height * groundInfo.posY, 32, 32, i * 32, j * 32, 32, 32);
}
}
}
@ -837,6 +847,7 @@ maps.prototype._drawBg_drawBackground = function (floorId, ctx) {
////// 绘制事件层 //////
maps.prototype.drawEvents = function (floorId, blocks, ctx) {
floorId = floorId || core.status.floorId;
core.extractBlocks(floorId);
if (!blocks) blocks = core.status.maps[floorId].blocks;
var arr = this._getMapArrayFromBlocks(blocks, core.floors[floorId].width, core.floors[floorId].height);
var onMap = ctx == null;
@ -909,36 +920,25 @@ maps.prototype._drawFloorImages = function (floorId, ctx, name, images, currStat
floorId = floorId || core.status.floorId;
if (!images) images = this._getFloorImages(floorId);
var redraw = currStatus != null;
images.forEach(function (t) {
if (typeof t == 'string') t = [0, 0, t];
var dx = parseInt(t[0]), dy = parseInt(t[1]), imageName = t[2], frame = core.clamp(parseInt(t[4]), 1, 8);
imageName = core.getMappedName(imageName);
var image = core.material.images.images[imageName];
images.forEach(function (one) {
var image = core.material.images.images[core.getMappedName(one.name)];
var frame = one.frame || 1;
if (!image) return;
var flag = "__floorImg__" + floorId + "_" + one.x + "_" + one.y;
if (core.hasFlag(flag)) return;
if (redraw && frame == 1) return; // 不重绘
if (core.isset(dx) && core.isset(dy) && image &&
!core.hasFlag("__floorImg__" + floorId + "_" + dx + "_" + dy)) {
var width = parseInt(image.width / frame), offsetX = (currStatus || 0) % frame * width;
if (/.*\.gif/i.test(imageName) && main.mode == 'play') {
if (redraw) return; // 忽略gif
this._drawFloorImages_gif(image, dx, dy);
return;
}
core.maps._drawFloorImage(ctx, name, t[3], image, offsetX, width, dx, dy, redraw);
if (/.*\.gif/i.test(one.name)) {
if (redraw) return;
this._drawFloorImages_gif(image, one.x, one.y);
return;
}
});
this._drawFloorImage(ctx, name, one, image, currStatus);
}, this);
}
maps.prototype._getFloorImages = function (floorId) {
floorId = floorId || core.status.floorId;
var images = [];
if ((core.status.maps || core.floors)[floorId].images) {
images = (core.status.maps || core.floors)[floorId].images;
if (typeof images == 'string') {
images = [[0, 0, images]];
}
}
return images;
return ((core.status.maps || core.floors)[floorId || core.status.floorId] || {}).images || [];
}
maps.prototype._drawFloorImages_gif = function (image, dx, dy) {
@ -954,30 +954,26 @@ maps.prototype._drawFloorImages_gif = function (image, dx, dy) {
return;
}
maps.prototype._drawFloorImage = function (ctx, name, type, image, offsetX, width, dx, dy, redraw) {
maps.prototype._drawFloorImage = function (ctx, name, one, image, currStatus) {
var height = image.height;
var _draw = function () {
if (redraw) core.clearMap(ctx, dx, dy, width, height);
core.drawImage(ctx, image, offsetX, 0, width, height, dx, dy, width, height);
}
if (!type) {
if (name != 'bg') return;
return _draw();
}
if (type == 1) {
if (name != 'fg') return;
return _draw();
}
if (type == 2) {
var imageName = one.name + (one.reverse||'');
var width = parseInt((one.w == null ? image.width : one.w) / (one.frame || 1));
var height = one.h == null ? image.height : one.h;
var sx = (one.sx || 0) + (currStatus || 0) % (one.frame || 1) * width;
var sy = one.sy || 0;
if (one.canvas != 'auto' && one.canvas != name) return;
if (one.canvas != 'auto') {
if (currStatus != null) core.clearMap(ctx, one.x, one.y, width, height);
core.drawImage(ctx, imageName, sx, sy, width, height, one.x, one.y, width, height);
} else {
if (name == 'bg') {
if (redraw) core.clearMap(ctx, dx, dy + height - 32, width, 32);
core.drawImage('bg', image, offsetX, height - 32, width, 32, dx, dy + height - 32, width, 32);
if (currStatus != null) core.clearMap(ctx, one.x, one.y + height - 32, width, 32);
core.drawImage(ctx, imageName, sx, sy + height - 32, width, 32, one.x, one.y+height - 32, width, 32);
} else if (name == 'fg') {
if (currStatus != null) core.clearMap(ctx, one.x, one.y, width, height - 32);
core.drawImage(ctx, imageName, sx, sy, width, height - 32, one.x, one.y, width, height - 32);
}
else if (name == 'fg') {
if (redraw) core.clearMap(ctx, dx, dy, width, height - 32);
core.drawImage('fg', image, offsetX, 0, width, height - 32, dx, dy, width, height - 32);
}
return;
}
}
@ -1048,7 +1044,7 @@ maps.prototype._drawAutotile_render = function(canvas, x, y, size, autotile, sta
];
var data = indexData[index];
if(index>=16){ // 拐角直接绘制
canvas.drawImage(autotile, data[0][0], data[0][1], data[0][2], data[0][3], data[0][4], data[0][5], size/2, size/2);
core.drawImage(canvas, autotile, data[0][0], data[0][1], data[0][2], data[0][3], data[0][4], data[0][5], size/2, size/2);
}else{ // 非拐角要根据是否已经绘制进行切分后绘制
this._drawAutotile_renderCut(canvas, autotile, x, y, size, data, done);
}
@ -1089,7 +1085,7 @@ maps.prototype._drawAutotile_renderCut = function(canvas, autotile, x, y, size,
}
for(var i = 0; i<4; i++){
var dt = drawData[i];if(!dt)continue;
canvas.drawImage(autotile, dt[0], dt[1], 16, 16, x + (i % 2) * size / 2, y + parseInt(i / 2) * size / 2, size/2, size/2);
core.drawImage(canvas, autotile, dt[0], dt[1], 16, 16, x + (i % 2) * size / 2, y + parseInt(i / 2) * size / 2, size/2, size/2);
};
}
@ -1099,7 +1095,7 @@ maps.prototype._drawAutotile_drawBlockByIndex = function (ctx, dx, dy, autotileI
var sx = 16 * ((index - 1) % 6), sy = 16 * (~~((index - 1) / 6));
status = status || 0;
status %= parseInt(autotileImg.width / 96);
ctx.drawImage(autotileImg, sx + 96 * status, sy, 16, 16, dx, dy, size / 2, size / 2);
core.drawImage(ctx, autotileImg, sx + 96 * status, sy, 16, 16, dx, dy, size / 2, size / 2);
}
maps.prototype._drawAutotile_getAutotileAroundId = function (currId, x, y, mapArr) {
@ -1170,16 +1166,16 @@ maps.prototype._makeAutotileEdges = function () {
var n = core.maps.getNumberById(t);
core.material.autotileEdges[n] = [n];
ctx.clearRect(0, 0, 32, 32);
ctx.drawImage(core.material.images.autotile[t], 0, 0, 32, 32, 0, 0, 32, 32);
core.clearMap(ctx, 0, 0, 32, 32);
core.drawImage(ctx, core.material.images.autotile[t], 0, 0, 32, 32, 0, 0, 32, 32);
var data = canvas.toDataURL("image/png");
autotileIds.forEach(function (t2) {
if (t == t2) return;
var n2 = core.maps.getNumberById(t2);
ctx.clearRect(0, 0, 32, 32);
ctx.drawImage(core.material.images.autotile[t2], 32, 0, 32, 32, 0, 0, 32, 32);
core.clearMap(ctx, 0, 0, 32, 32);
core.drawImage(ctx, core.material.images.autotile[t2], 32, 0, 32, 32, 0, 0, 32, 32);
if (data == canvas.toDataURL("image/png")) {
core.material.autotileEdges[n].push(n2);
}
@ -1204,6 +1200,7 @@ maps.prototype.drawThumbnail = function (floorId, blocks, options, toDraw) {
}
maps.prototype._drawThumbnail_drawTempCanvas = function (floorId, blocks, options) {
core.extractBlocks(floorId);
blocks = blocks || core.status.maps[floorId].blocks;
options = options || {}
@ -1238,11 +1235,11 @@ maps.prototype._drawThumbnail_realDrawTempCanvas = function (floorId, blocks, op
this.drawEvents(floorId, blocks, tempCanvas);
// 缩略图:勇士
if (options.heroLoc) {
options.heroIcon = options.heroIcon || core.status.hero.image;
options.heroIcon = options.heroIcon || core.status.hero.image || 'hero.png';
options.heroIcon = core.getMappedName(options.heroIcon);
var icon = core.material.icons.hero[options.heroLoc.direction];
var height = core.material.images.images[options.heroIcon].height / 4;
tempCanvas.drawImage(core.material.images.images[options.heroIcon], icon.stop * 32, icon.loc * height, 32, height,
core.drawImage(tempCanvas, core.material.images.images[options.heroIcon], icon.stop * 32, icon.loc * height, 32, height,
32 * options.heroLoc.x, 32 * options.heroLoc.y + 32 - height, 32, height);
}
// 缩略图:前景
@ -1272,21 +1269,21 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, toDraw) {
var side = (size - realWidth) / 2;
core.fillRect(ctx, x, y, side, realHeight, '#000000');
core.fillRect(ctx, x + size - side, y, side, realHeight);
ctx.drawImage(tempCanvas.canvas, 0, 0, tempWidth, tempHeight, x + side, y, realWidth, realHeight);
core.drawImage(ctx, tempCanvas.canvas, 0, 0, tempWidth, tempHeight, x + side, y, realWidth, realHeight);
}
else {
var realWidth = size, realHeight = realWidth * tempHeight / tempWidth;
var side = (size - realHeight) / 2;
core.fillRect(ctx, x, y, realWidth, side, '#000000');
core.fillRect(ctx, x, y + size - side, realWidth, side);
ctx.drawImage(tempCanvas.canvas, 0, 0, tempWidth, tempHeight, x, y + side, realWidth, realHeight);
core.drawImage(ctx, tempCanvas.canvas, 0, 0, tempWidth, tempHeight, x, y + side, realWidth, realHeight);
}
}
else {
// 只绘制可见窗口
var offsetX = core.clamp(centerX - core.__HALF_SIZE__, 0, width - core.__SIZE__),
offsetY = core.clamp(centerY - core.__HALF_SIZE__, 0, height - core.__SIZE__);
ctx.drawImage(tempCanvas.canvas, offsetX * 32, offsetY * 32, core.__PIXELS__, core.__PIXELS__, x, y, size, size);
core.drawImage(ctx, tempCanvas.canvas, offsetX * 32, offsetY * 32, core.__PIXELS__, core.__PIXELS__, x, y, size, size);
}
}
@ -1340,6 +1337,7 @@ maps.prototype.enemyExists = function (x, y, id, floorId) {
maps.prototype.getBlock = function (x, y, floorId, showDisable) {
floorId = floorId || core.status.floorId;
if (!floorId) return null;
core.extractBlocks(floorId);
var blocks = core.status.maps[floorId].blocks;
for (var n = 0; n < blocks.length; n++) {
if (blocks[n].x == x && blocks[n].y == y) {
@ -1417,6 +1415,7 @@ maps.prototype.searchBlock = function (id, floorId, showDisable) {
});
return result;
}
core.extractBlocks(floorId);
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) || core.matchRegex(id, block.event.id))) {
@ -1472,7 +1471,7 @@ maps.prototype.hideBlock = function (x, y, floorId) {
maps.prototype.hideBlockByIndex = function (index, floorId) {
floorId = floorId || core.status.floorId;
if (!floorId) return;
core.extractBlocks(floorId);
var blocks = core.status.maps[floorId].blocks, block = blocks[index];
block.disable = true;
}
@ -1512,7 +1511,7 @@ maps.prototype.removeBlock = function (x, y, floorId) {
maps.prototype.removeBlockByIndex = function (index, floorId) {
floorId = floorId || core.status.floorId;
if (!floorId) return;
core.extractBlocks(floorId);
var blocks = core.status.maps[floorId].blocks, block = blocks[index];
blocks.splice(index, 1);
}
@ -1638,6 +1637,103 @@ maps.prototype.setBlock = function (number, x, y, floorId) {
}
}
maps.prototype.animateSetBlock = function (number, x, y, floorId, time, callback) {
floorId = floorId || core.status.floorId;
time = time || 0;
if (floorId != core.status.floorId || time == 0) {
// 不在当前楼层,直接忽略
this.setBlock(number, x, y, floorId);
if (callback) callback();
return;
}
if (typeof number == 'string') {
if (/^\d+$/.test(number)) number = parseInt(number);
else number = core.getNumberById(number);
}
var originBlock = core.getBlock(x, y, floorId, true);
var block = this.initBlock(x, y, number, true, core.floors[floorId]);
// 如果原本是启用的
if (originBlock != null && !originBlock.block.disable) {
return this._animateSetBlock_originEnabled(block, number, x, y, floorId, time, callback);
}
// 如果原本不存在
if (originBlock == null) {
return this._animateSetBlock_originNotExists(block, number, x, y, floorId, time, callback);
}
// 如果原本存在且禁用;应当直接设置,没有动画
if (originBlock != null && originBlock.block.disable) {
return this._animateSetBlock_originDisabled(number, x, y, floorId, callback);
}
if (callback) callback();
}
maps.prototype._animateSetBlock_originEnabled = function (block, number, x, y, floorId, time, callback) {
// 情况1设置到0
if (block.id == 0) {
// 如果该点红点没有事件 - 直接删除
if (!block.event.trigger) {
return this.animateBlock([x, y], 'remove', time, callback);
} else {
// 如果该点红点有事件则设置到0但是需启用
return this.animateBlock([x, y], 'hide', time, function () {
core.setBlock(0, x, y, floorId);
core.showBlock(x, y, floorId);
if (callback) callback();
});
}
}
// 情况2设置到非0
else {
return this.animateBlock([x, y], 'hide', time / 2, function () {
core.setBlock(number, x, y, floorId);
core.animateBlock([x, y], 'show', time / 2, callback);
})
}
}
maps.prototype._animateSetBlock_originNotExists = function (block, number, x, y, floorId, time, callback) {
// 情况1设置到0没有动画效果
if (block.id == 0) {
core.setBlock(number, x, y, floorId);
if (callback) callback();
}
else {
// 情况2设置到非0有淡入动画
core.setBlock(number, x, y, floorId);
core.hideBlock(x, y, floorId);
core.animateBlock([x, y], 'show', time, callback);
return;
}
}
maps.prototype._animateSetBlock_originDisabled = function (number, x, y, floorId, callback) {
core.setBlock(number, x, y, floorId);
if (callback) callback();
}
maps.prototype.animateSetBlocks = function (number, locs, floorId, time, callback) {
if (!(locs instanceof Array)) {
if (callback) callback();
return;
}
if (typeof locs[0] == 'number' && typeof locs[1] == 'number')
locs = [locs];
var count = locs.length;
var _afterSet = function () {
count--;
if (count == 0) {
if (callback) callback();
}
}
locs.forEach(function (loc) {
core.animateSetBlock(number, loc[0], loc[1], floorId, time, _afterSet);
});
}
////// 事件转向 //////
maps.prototype.turnBlock = function (direction, x, y, floorId) {
var id = core.getBlockId(x, y, floorId, true);
@ -1668,6 +1764,7 @@ maps.prototype.replaceBlock = function (fromNumber, toNumber, floorId) {
return;
}
var toBlock = this.getBlockByNumber(toNumber, true);
core.extractBlocks(floorId);
core.status.maps[floorId].blocks.forEach(function (block) {
if (block.id == fromNumber) {
block.id = toNumber;
@ -1817,7 +1914,7 @@ maps.prototype.moveBlock = function (x, y, steps, time, keep, callback) {
}
maps.prototype._moveBlock_doMove = function (blockInfo, canvases, moveInfo, callback) {
var animateTotal = core.icons._getAnimateFrames(blockInfo.cls, true), animateTime = 0;
var animateTotal = core.icons._getAnimateFrames(blockInfo.cls), animateTime = 0;
var animate = window.setInterval(function () {
if (blockInfo.cls != 'tileset') {
animateTime += moveInfo.per_time;

View File

@ -228,35 +228,6 @@ localforage
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
mid
============
Copyright (c) 2010, Matt Westcott & Ben Firshman
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
* The names of its contributors may not be used to endorse or promote products
derived from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
zip
============

701
libs/thirdparty/mid.js vendored
View File

@ -1,701 +0,0 @@
var sampleRate = 44100; /* hard-coded in Flash player */
function AudioPlayer(context, generator, loop) {
// Uses Webkit Web Audio API if available
sampleRate = context.sampleRate;
var channelCount = 2;
var bufferSize = 4096*4; // Higher for less gitches, lower for less latency
var node = context.createScriptProcessor(bufferSize, 0, channelCount);
node.onaudioprocess = function(e) { process(e) };
function process(e) {
if (generator.finished) {
if (loop) {
generator.reset();
generator.finished = false;
}
else {
node.disconnect();
return;
}
}
var dataLeft = e.outputBuffer.getChannelData(0);
var dataRight = e.outputBuffer.getChannelData(1);
var generate = generator.generate(bufferSize);
for (var i = 0; i < bufferSize; ++i) {
dataLeft[i] = generate[i*2];
dataRight[i] = generate[i*2+1];
}
}
// start
// node.connect(context.destination);
return {
'play': function () {
node.connect(context.destination);
},
'pause': function() {
node.disconnect();
}
}
}
/*
class to parse the .mid file format
(depends on stream.js)
*/
function MidiFile(data) {
function readChunk(stream) {
var id = stream.read(4);
var length = stream.readInt32();
return {
'id': id,
'length': length,
'data': stream.read(length)
};
}
var lastEventTypeByte;
function readEvent(stream) {
var event = {};
event.deltaTime = stream.readVarInt();
var eventTypeByte = stream.readInt8();
if ((eventTypeByte & 0xf0) == 0xf0) {
/* system / meta event */
if (eventTypeByte == 0xff) {
/* meta event */
event.type = 'meta';
var subtypeByte = stream.readInt8();
var length = stream.readVarInt();
switch(subtypeByte) {
case 0x00:
event.subtype = 'sequenceNumber';
if (length != 2) throw "Expected length for sequenceNumber event is 2, got " + length;
event.number = stream.readInt16();
return event;
case 0x01:
event.subtype = 'text';
event.text = stream.read(length);
return event;
case 0x02:
event.subtype = 'copyrightNotice';
event.text = stream.read(length);
return event;
case 0x03:
event.subtype = 'trackName';
event.text = stream.read(length);
return event;
case 0x04:
event.subtype = 'instrumentName';
event.text = stream.read(length);
return event;
case 0x05:
event.subtype = 'lyrics';
event.text = stream.read(length);
return event;
case 0x06:
event.subtype = 'marker';
event.text = stream.read(length);
return event;
case 0x07:
event.subtype = 'cuePoint';
event.text = stream.read(length);
return event;
case 0x20:
event.subtype = 'midiChannelPrefix';
if (length != 1) throw "Expected length for midiChannelPrefix event is 1, got " + length;
event.channel = stream.readInt8();
return event;
case 0x2f:
event.subtype = 'endOfTrack';
if (length != 0) throw "Expected length for endOfTrack event is 0, got " + length;
return event;
case 0x51:
event.subtype = 'setTempo';
if (length != 3) throw "Expected length for setTempo event is 3, got " + length;
event.microsecondsPerBeat = (
(stream.readInt8() << 16)
+ (stream.readInt8() << 8)
+ stream.readInt8()
)
return event;
case 0x54:
event.subtype = 'smpteOffset';
if (length != 5) throw "Expected length for smpteOffset event is 5, got " + length;
var hourByte = stream.readInt8();
event.frameRate = {
0x00: 24, 0x20: 25, 0x40: 29, 0x60: 30
}[hourByte & 0x60];
event.hour = hourByte & 0x1f;
event.min = stream.readInt8();
event.sec = stream.readInt8();
event.frame = stream.readInt8();
event.subframe = stream.readInt8();
return event;
case 0x58:
event.subtype = 'timeSignature';
if (length != 4) throw "Expected length for timeSignature event is 4, got " + length;
event.numerator = stream.readInt8();
event.denominator = Math.pow(2, stream.readInt8());
event.metronome = stream.readInt8();
event.thirtyseconds = stream.readInt8();
return event;
case 0x59:
event.subtype = 'keySignature';
if (length != 2) throw "Expected length for keySignature event is 2, got " + length;
event.key = stream.readInt8(true);
event.scale = stream.readInt8();
return event;
case 0x7f:
event.subtype = 'sequencerSpecific';
event.data = stream.read(length);
return event;
default:
// console.log("Unrecognised meta event subtype: " + subtypeByte);
event.subtype = 'unknown'
event.data = stream.read(length);
return event;
}
event.data = stream.read(length);
return event;
} else if (eventTypeByte == 0xf0) {
event.type = 'sysEx';
var length = stream.readVarInt();
event.data = stream.read(length);
return event;
} else if (eventTypeByte == 0xf7) {
event.type = 'dividedSysEx';
var length = stream.readVarInt();
event.data = stream.read(length);
return event;
} else {
throw "Unrecognised MIDI event type byte: " + eventTypeByte;
}
} else {
/* channel event */
var param1;
if ((eventTypeByte & 0x80) == 0) {
/* running status - reuse lastEventTypeByte as the event type.
eventTypeByte is actually the first parameter
*/
param1 = eventTypeByte;
eventTypeByte = lastEventTypeByte;
} else {
param1 = stream.readInt8();
lastEventTypeByte = eventTypeByte;
}
var eventType = eventTypeByte >> 4;
event.channel = eventTypeByte & 0x0f;
event.type = 'channel';
switch (eventType) {
case 0x08:
event.subtype = 'noteOff';
event.noteNumber = param1;
event.velocity = stream.readInt8();
return event;
case 0x09:
event.noteNumber = param1;
event.velocity = stream.readInt8();
if (event.velocity == 0) {
event.subtype = 'noteOff';
} else {
event.subtype = 'noteOn';
}
return event;
case 0x0a:
event.subtype = 'noteAftertouch';
event.noteNumber = param1;
event.amount = stream.readInt8();
return event;
case 0x0b:
event.subtype = 'controller';
event.controllerType = param1;
event.value = stream.readInt8();
return event;
case 0x0c:
event.subtype = 'programChange';
event.programNumber = param1;
return event;
case 0x0d:
event.subtype = 'channelAftertouch';
event.amount = param1;
return event;
case 0x0e:
event.subtype = 'pitchBend';
event.value = param1 + (stream.readInt8() << 7);
return event;
default:
throw "Unrecognised MIDI event type: " + eventType
}
}
}
stream = Stream(data);
var headerChunk = readChunk(stream);
if (headerChunk.id != 'MThd' || headerChunk.length != 6) {
throw "Bad .mid file - header not found";
}
var headerStream = Stream(headerChunk.data);
var formatType = headerStream.readInt16();
var trackCount = headerStream.readInt16();
var timeDivision = headerStream.readInt16();
if (timeDivision & 0x8000) {
throw "Expressing time division in SMTPE frames is not supported yet"
} else {
ticksPerBeat = timeDivision;
}
var header = {
'formatType': formatType,
'trackCount': trackCount,
'ticksPerBeat': ticksPerBeat
}
var tracks = [];
for (var i = 0; i < header.trackCount; i++) {
tracks[i] = [];
var trackChunk = readChunk(stream);
if (trackChunk.id != 'MTrk') {
throw "Unexpected chunk - expected MTrk, got "+ trackChunk.id;
}
var trackStream = Stream(trackChunk.data);
while (!trackStream.eof()) {
var event = readEvent(trackStream);
tracks[i].push(event);
//console.log(event);
}
}
return {
'header': header,
'tracks': tracks
}
}
function Replayer(midiFile, synth) {
var trackStates = [];
var beatsPerMinute = 120;
var ticksPerBeat = midiFile.header.ticksPerBeat;
var channelCount = 16;
var channels = [];
var nextEventInfo;
var samplesToNextEvent;
function Channel() {
var generatorsByNote = {};
var currentProgram = PianoProgram;
function noteOn(note, velocity) {
if (generatorsByNote[note] && !generatorsByNote[note].released) {
/* playing same note before releasing the last one. BOO */
generatorsByNote[note].noteOff(); /* TODO: check whether we ought to be passing a velocity in */
}
generator = currentProgram.createNote(note, velocity);
synth.addGenerator(generator);
generatorsByNote[note] = generator;
}
function noteOff(note, velocity) {
if (generatorsByNote[note] && !generatorsByNote[note].released) {
generatorsByNote[note].noteOff(velocity);
}
}
function setProgram(programNumber) {
currentProgram = PROGRAMS[programNumber] || PianoProgram;
}
return {
'noteOn': noteOn,
'noteOff': noteOff,
'setProgram': setProgram
}
}
function getNextEvent() {
var ticksToNextEvent = null;
var nextEventTrack = null;
var nextEventIndex = null;
for (var i = 0; i < trackStates.length; i++) {
if (
trackStates[i].ticksToNextEvent != null
&& (ticksToNextEvent == null || trackStates[i].ticksToNextEvent < ticksToNextEvent)
) {
ticksToNextEvent = trackStates[i].ticksToNextEvent;
nextEventTrack = i;
nextEventIndex = trackStates[i].nextEventIndex;
}
}
if (nextEventTrack != null) {
/* consume event from that track */
var nextEvent = midiFile.tracks[nextEventTrack][nextEventIndex];
if (midiFile.tracks[nextEventTrack][nextEventIndex + 1]) {
trackStates[nextEventTrack].ticksToNextEvent += midiFile.tracks[nextEventTrack][nextEventIndex + 1].deltaTime;
} else {
trackStates[nextEventTrack].ticksToNextEvent = null;
}
trackStates[nextEventTrack].nextEventIndex += 1;
/* advance timings on all tracks by ticksToNextEvent */
for (var i = 0; i < trackStates.length; i++) {
if (trackStates[i].ticksToNextEvent != null) {
trackStates[i].ticksToNextEvent -= ticksToNextEvent
}
}
nextEventInfo = {
'ticksToEvent': ticksToNextEvent,
'event': nextEvent,
'track': nextEventTrack
}
var beatsToNextEvent = ticksToNextEvent / ticksPerBeat;
var secondsToNextEvent = beatsToNextEvent / (beatsPerMinute / 60);
samplesToNextEvent += secondsToNextEvent * synth.sampleRate;
} else {
nextEventInfo = null;
samplesToNextEvent = null;
self.finished = true;
}
}
function generate(samples) {
var data = new Array(samples*2);
var samplesRemaining = samples;
var dataOffset = 0;
while (true) {
if (samplesToNextEvent != null && samplesToNextEvent <= samplesRemaining) {
/* generate samplesToNextEvent samples, process event and repeat */
var samplesToGenerate = Math.ceil(samplesToNextEvent);
if (samplesToGenerate > 0) {
synth.generateIntoBuffer(samplesToGenerate, data, dataOffset);
dataOffset += samplesToGenerate * 2;
samplesRemaining -= samplesToGenerate;
samplesToNextEvent -= samplesToGenerate;
}
handleEvent();
getNextEvent();
} else {
/* generate samples to end of buffer */
if (samplesRemaining > 0) {
synth.generateIntoBuffer(samplesRemaining, data, dataOffset);
samplesToNextEvent -= samplesRemaining;
}
break;
}
}
return data;
}
function handleEvent() {
var event = nextEventInfo.event;
switch (event.type) {
case 'meta':
switch (event.subtype) {
case 'setTempo':
beatsPerMinute = 60000000 / event.microsecondsPerBeat
}
break;
case 'channel':
switch (event.subtype) {
case 'noteOn':
channels[event.channel].noteOn(event.noteNumber, event.velocity);
break;
case 'noteOff':
channels[event.channel].noteOff(event.noteNumber, event.velocity);
break;
case 'programChange':
//console.log('program change to ' + event.programNumber);
channels[event.channel].setProgram(event.programNumber);
break;
}
break;
}
}
function reset() {
for (var i = 0; i < midiFile.tracks.length; i++) {
trackStates[i] = {
'nextEventIndex': 0,
'ticksToNextEvent': (
midiFile.tracks[i].length ?
midiFile.tracks[i][0].deltaTime :
null
)
};
}
for (var i = 0; i < channelCount; i++) {
channels[i] = Channel();
}
samplesToNextEvent = 0;
getNextEvent();
}
reset();
var self = {
'reset': reset,
'generate': generate,
'finished': false
}
return self;
}
/* Wrapper for accessing strings through sequential reads */
function Stream(str) {
var position = 0;
function read(length) {
var result = str.substr(position, length);
position += length;
return result;
}
/* read a big-endian 32-bit integer */
function readInt32() {
var result = (
(str.charCodeAt(position) << 24)
+ (str.charCodeAt(position + 1) << 16)
+ (str.charCodeAt(position + 2) << 8)
+ str.charCodeAt(position + 3));
position += 4;
return result;
}
/* read a big-endian 16-bit integer */
function readInt16() {
var result = (
(str.charCodeAt(position) << 8)
+ str.charCodeAt(position + 1));
position += 2;
return result;
}
/* read an 8-bit integer */
function readInt8(signed) {
var result = str.charCodeAt(position);
if (signed && result > 127) result -= 256;
position += 1;
return result;
}
function eof() {
return position >= str.length;
}
/* read a MIDI-style variable-length integer
(big-endian value in groups of 7 bits,
with top bit set to signify that another byte follows)
*/
function readVarInt() {
var result = 0;
while (true) {
var b = readInt8();
if (b & 0x80) {
result += (b & 0x7f);
result <<= 7;
} else {
/* b is the last byte */
return result + b;
}
}
}
return {
'eof': eof,
'read': read,
'readInt32': readInt32,
'readInt16': readInt16,
'readInt8': readInt8,
'readVarInt': readVarInt
}
}
function SineGenerator(freq) {
var self = {'alive': true};
var period = sampleRate / freq;
var t = 0;
self.generate = function(buf, offset, count) {
for (; count; count--) {
var phase = t / period;
var result = Math.sin(phase * 2 * Math.PI);
buf[offset++] += result;
buf[offset++] += result;
t++;
}
}
return self;
}
function SquareGenerator(freq, phase) {
var self = {'alive': true};
var period = sampleRate / freq;
var t = 0;
self.generate = function(buf, offset, count) {
for (; count; count--) {
var result = ( (t / period) % 1 > phase ? 1 : -1);
buf[offset++] += result;
buf[offset++] += result;
t++;
}
}
return self;
}
function ADSRGenerator(child, attackAmplitude, sustainAmplitude, attackTimeS, decayTimeS, releaseTimeS) {
var self = {'alive': true}
var attackTime = sampleRate * attackTimeS;
var decayTime = sampleRate * (attackTimeS + decayTimeS);
var decayRate = (attackAmplitude - sustainAmplitude) / (decayTime - attackTime);
var releaseTime = null; /* not known yet */
var endTime = null; /* not known yet */
var releaseRate = sustainAmplitude / (sampleRate * releaseTimeS);
var t = 0;
self.noteOff = function() {
if (self.released) return;
releaseTime = t;
self.released = true;
endTime = releaseTime + sampleRate * releaseTimeS;
}
self.generate = function(buf, offset, count) {
if (!self.alive) return;
var input = new Array(count * 2);
for (var i = 0; i < count*2; i++) {
input[i] = 0;
}
child.generate(input, 0, count);
childOffset = 0;
while(count) {
if (releaseTime != null) {
if (t < endTime) {
/* release */
while(count && t < endTime) {
var ampl = sustainAmplitude - releaseRate * (t - releaseTime);
buf[offset++] += input[childOffset++] * ampl;
buf[offset++] += input[childOffset++] * ampl;
t++;
count--;
}
} else {
/* dead */
self.alive = false;
return;
}
} else if (t < attackTime) {
/* attack */
while(count && t < attackTime) {
var ampl = attackAmplitude * t / attackTime;
buf[offset++] += input[childOffset++] * ampl;
buf[offset++] += input[childOffset++] * ampl;
t++;
count--;
}
} else if (t < decayTime) {
/* decay */
while(count && t < decayTime) {
var ampl = attackAmplitude - decayRate * (t - attackTime);
buf[offset++] += input[childOffset++] * ampl;
buf[offset++] += input[childOffset++] * ampl;
t++;
count--;
}
} else {
/* sustain */
while(count) {
buf[offset++] += input[childOffset++] * sustainAmplitude;
buf[offset++] += input[childOffset++] * sustainAmplitude;
t++;
count--;
}
}
}
}
return self;
}
function midiToFrequency(note) {
return 440 * Math.pow(2, (note-69)/12);
}
PianoProgram = {
'attackAmplitude': 0.2,
'sustainAmplitude': 0.1,
'attackTime': 0.02,
'decayTime': 0.3,
'releaseTime': 0.02,
'createNote': function(note, velocity) {
var frequency = midiToFrequency(note);
return ADSRGenerator(
SineGenerator(frequency),
this.attackAmplitude * (velocity / 128), this.sustainAmplitude * (velocity / 128),
this.attackTime, this.decayTime, this.releaseTime
);
}
}
StringProgram = {
'createNote': function(note, velocity) {
var frequency = midiToFrequency(note);
return ADSRGenerator(
SineGenerator(frequency),
0.5 * (velocity / 128), 0.2 * (velocity / 128),
0.4, 0.8, 0.4
);
}
}
PROGRAMS = {
41: StringProgram,
42: StringProgram,
43: StringProgram,
44: StringProgram,
45: StringProgram,
46: StringProgram,
47: StringProgram,
49: StringProgram,
50: StringProgram
};
function Synth(sampleRate) {
var generators = [];
function addGenerator(generator) {
generators.push(generator);
}
function generate(samples) {
var data = new Array(samples*2);
generateIntoBuffer(samples, data, 0);
return data;
}
function generateIntoBuffer(samplesToGenerate, buffer, offset) {
for (var i = offset; i < offset + samplesToGenerate * 2; i++) {
buffer[i] = 0;
}
for (var i = generators.length - 1; i >= 0; i--) {
generators[i].generate(buffer, offset, samplesToGenerate);
if (!generators[i].alive) generators.splice(i, 1);
}
}
return {
'sampleRate': sampleRate,
'addGenerator': addGenerator,
'generate': generate,
'generateIntoBuffer': generateIntoBuffer
}
}

File diff suppressed because one or more lines are too long

View File

@ -108,9 +108,9 @@ ui.prototype.fillBoldText = function (name, text, x, y, style, strokeStyle, font
if (!ctx) return;
if (font) ctx.font = font;
if (!style) style = ctx.fillStyle;
if (style instanceof Array) style = core.arrayToRGBA(style);
style = core.arrayToRGBA(style);
if (!strokeStyle) strokeStyle = '#000000';
if (strokeStyle instanceof Array) strokeStyle = core.arrayToRGBA(strokeStyle);
strokeStyle = core.arrayToRGBA(strokeStyle);
ctx.fillStyle = strokeStyle;
ctx.fillText(text, x-1, y-1);
ctx.fillText(text, x-1, y+1);
@ -392,15 +392,13 @@ ui.prototype.setOpacity = function (name, opacity) {
////// 设置某个canvas的绘制属性如颜色等 //////
ui.prototype.setFillStyle = function (name, style) {
var ctx = this.getContextByName(name);
if (style instanceof Array) style = core.arrayToRGBA(style);
if (ctx) ctx.fillStyle = style;
if (ctx) ctx.fillStyle = core.arrayToRGBA(style);
}
////// 设置某个canvas边框属性 //////
ui.prototype.setStrokeStyle = function (name, style) {
var ctx = this.getContextByName(name);
if (style instanceof Array) style = core.arrayToRGBA(style);
if (ctx) ctx.strokeStyle = style;
if (ctx) ctx.strokeStyle = core.arrayToRGBA(style);
}
////// 设置某个canvas的对齐 //////
@ -507,32 +505,61 @@ ui.prototype.splitLines = function (name, text, maxWidth, font) {
////// 绘制一张图片 //////
ui.prototype.drawImage = function (name, image, x, y, w, h, x1, y1, w1, h1) {
// 检测文件名以 :x, :y, :o 结尾,表示左右翻转,上下翻转和中心翻转
var ctx = this.getContextByName(name);
if (!ctx) return;
var reverse = null;
if (typeof image == 'string') {
if (image.endsWith(':x') || image.endsWith(':y') || image.endsWith(':o')) {
reverse = image.charAt(image.length - 1);
image = image.substring(0, image.length - 2);
}
image = core.getMappedName(image);
image = core.material.images.images[image];
if (!image) return;
if (!image || !(image instanceof Image)) return;
}
var scale = {
'x': [-1, 1],
'y': [1, -1],
'o': [-1, -1]
};
// 只能接受2, 4, 8个参数
if (x != null && y != null) {
if (w != null && h != null) {
if (x1 != null && y1 != null && w1 != null && h1 != null) {
if (w == null || h == null) {
// 两个参数变成四个参数
w = image.width;
h = image.height;
}
if (x1 != null && y1 != null && w1 != null && h1 != null) {
if (reverse == null) {
ctx.drawImage(image, x, y, w, h, x1, y1, w1, h1);
return;
} else {
ctx.save();
ctx.translate(x1 + w1 / 2, y1 + h1 / 2);
ctx.scale(scale[reverse][0], scale[reverse][1]);
ctx.drawImage(image, x, y, w, h, -w1 / 2, -h1 / 2, w1, h1);
ctx.restore();
}
ctx.drawImage(image, x, y, w, h);
return;
}
ctx.drawImage(image, x, y);
if (reverse == null) {
ctx.drawImage(image, x, y, w, h);
} else {
ctx.save();
ctx.translate(x + w / 2, y + h / 2);
ctx.scale(scale[reverse][0], scale[reverse][1]);
ctx.drawImage(image, -w / 2, -h / 2, w, h);
ctx.restore();
}
return;
}
}
ui.prototype._uievent_drawImage = function (data) {
this._createUIEvent();
this.drawImage('uievent', data.image, core.calValue(data.x), core.calValue(data.y), core.calValue(data.w), core.calValue(data.h),
this.drawImage('uievent', data.image + (data.reverse || ''), core.calValue(data.x), core.calValue(data.y), core.calValue(data.w), core.calValue(data.h),
core.calValue(data.x1), core.calValue(data.y1), core.calValue(data.w1), core.calValue(data.h1));
}
@ -547,7 +574,7 @@ ui.prototype.drawIcon = function (name, id, x, y, w, h, frame) {
info = {image: core.statusBar.icons[id], posX: 0, posY: 0, height: 32};
else return;
}
ctx.drawImage(info.image, 32 * (info.posX + frame), info.height * info.posY, 32, info.height, x, y, w || 32, h || info.height);
core.drawImage(ctx, 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) {
@ -567,7 +594,7 @@ 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@")) {
if (name.startsWith("@temp@") || /^arg\d+$/.test(name)) {
delete core.status.hero.flags[name];
}
});
@ -723,7 +750,7 @@ ui.prototype._getPosition = function (content) {
py = core.status.event.data.y;
}
content = content.replace("\b", "\\b")
.replace(/\\b\[(up|center|down|hero|null)(,(hero|null|\d+,\d+|\d+))?]/g, function (s0, s1, s2, s3) {
.replace(/\\b\[(up|center|down|hero|this)(,(hero|null|\d+,\d+|\d+))?]/g, function (s0, s1, s2, s3) {
pos = s1;
if (s3 == 'hero' || s1=='hero' && !s3) {
px = core.status.hero.loc.x;
@ -747,7 +774,7 @@ ui.prototype._getPosition = function (content) {
noPeak = core.getBlockId(px, py) == null;
}
}
if(pos=='hero' || pos=='null'){
if(pos=='hero' || pos=='this'){
pos = py==null?'center':(py>=core.__HALF_SIZE__? 'up':'down');
}
return "";
@ -792,64 +819,53 @@ ui.prototype._clearUIEventSelector = function (codes) {
ui.prototype._drawSelector = function (ctx, background, w, h, left, top) {
left = left || 0;
top = top || 0;
ctx = this.getContextByName(ctx);
if (!ctx) return;
if (typeof background == 'string')
background = core.material.images.images[background];
if (!(background instanceof Image)) return;
// back
ctx.drawImage(background, 130, 66, 28, 28, left+2, top+2, w-4, h-4);
core.drawImage(ctx, background, 130, 66, 28, 28, left+2, top+2, w-4, h-4);
// corner
ctx.drawImage(background, 128, 64, 2, 2, left, top, 2, 2);
ctx.drawImage(background, 158, 64, 2, 2, left+w-2, top, 2, 2);
ctx.drawImage(background, 128, 94, 2, 2, left, top+h-2, 2, 2);
ctx.drawImage(background, 158, 94, 2, 2, left+w-2, top+h-2, 2, 2);
core.drawImage(ctx, background, 128, 64, 2, 2, left, top, 2, 2);
core.drawImage(ctx, background, 158, 64, 2, 2, left+w-2, top, 2, 2);
core.drawImage(ctx, background, 128, 94, 2, 2, left, top+h-2, 2, 2);
core.drawImage(ctx, background, 158, 94, 2, 2, left+w-2, top+h-2, 2, 2);
// border
ctx.drawImage(background, 130, 64, 28, 2, left+2, top, w-4, 2);
ctx.drawImage(background, 130, 94, 28, 2, left+2, top+h-2, w-4, 2);
ctx.drawImage(background, 128, 66, 2, 28, left, top+2, 2,h-4);
ctx.drawImage(background, 158, 66, 2, 28, left+w-2, top+2, 2,h-4);
core.drawImage(ctx, background, 130, 64, 28, 2, left+2, top, w-4, 2);
core.drawImage(ctx, background, 130, 94, 28, 2, left+2, top+h-2, w-4, 2);
core.drawImage(ctx, background, 128, 66, 2, 28, left, top+2, 2,h-4);
core.drawImage(ctx, background, 158, 66, 2, 28, left+w-2, top+2, 2,h-4);
}
////// 绘制 WindowSkin
ui.prototype.drawWindowSkin = function(background, ctx, x, y, w, h, direction, px, py) {
background = background || core.status.textAttribute.background;
if (typeof background == 'string') {
background = core.getMappedName(background);
background = core.material.images.images[background];
}
// 仿RM窗口皮肤 ↓
var dstImage = core.getContextByName(ctx);
if (!dstImage) return;
// 绘制背景
dstImage.drawImage(background, 0, 0, 128, 128, x+2, y+2, w-4, h-4);
core.drawImage(ctx, background, 0, 0, 128, 128, x+2, y+2, w-4, h-4);
// 绘制边框
// 上方
dstImage.drawImage(background, 128, 0, 16, 16, x, y, 16, 16);
core.drawImage(ctx, background, 128, 0, 16, 16, x, y, 16, 16);
for (var dx = 0; dx < w - 64; dx += 32) {
dstImage.drawImage(background, 144, 0, 32, 16,x+dx+16, y, 32, 16);
dstImage.drawImage(background, 144,48, 32, 16,x+dx+16, y+h-16, 32, 16);
core.drawImage(ctx, background, 144, 0, 32, 16,x+dx+16, y, 32, 16);
core.drawImage(ctx, background, 144,48, 32, 16,x+dx+16, y+h-16, 32, 16);
}
dstImage.drawImage(background, 144, 0,w-dx-32, 16,x+dx+16, y,w-dx-32, 16);
dstImage.drawImage(background, 144,48,w-dx-32, 16,x+dx+16, y+h-16,w-dx-32, 16);
dstImage.drawImage(background, 176, 0, 16, 16, x+w-16, y, 16, 16);
core.drawImage(ctx, background, 144, 0,w-dx-32, 16,x+dx+16, y,w-dx-32, 16);
core.drawImage(ctx, background, 144,48,w-dx-32, 16,x+dx+16, y+h-16,w-dx-32, 16);
core.drawImage(ctx, background, 176, 0, 16, 16, x+w-16, y, 16, 16);
// 左右
for (var dy = 0; dy < h - 64; dy += 32) {
dstImage.drawImage(background, 128,16, 16, 32, x,y+dy+16, 16, 32);
dstImage.drawImage(background, 176,16, 16, 32, x+w-16,y+dy+16, 16, 32);
core.drawImage(ctx, background, 128,16, 16, 32, x,y+dy+16, 16, 32);
core.drawImage(ctx, background, 176,16, 16, 32, x+w-16,y+dy+16, 16, 32);
}
dstImage.drawImage(background, 128,16, 16,h-dy-32, x,y+dy+16, 16,h-dy-32);
dstImage.drawImage(background, 176,16, 16,h-dy-32, x+w-16,y+dy+16, 16,h-dy-32);
core.drawImage(ctx, background, 128,16, 16,h-dy-32, x,y+dy+16, 16,h-dy-32);
core.drawImage(ctx, background, 176,16, 16,h-dy-32, x+w-16,y+dy+16, 16,h-dy-32);
// 下方
dstImage.drawImage(background, 128,48, 16, 16, x, y+h-16, 16, 16);
dstImage.drawImage(background, 176,48, 16, 16, x+w-16, y+h-16, 16, 16);
core.drawImage(ctx, background, 128,48, 16, 16, x, y+h-16, 16, 16);
core.drawImage(ctx, background, 176,48, 16, 16, x+w-16, y+h-16, 16, 16);
// arrow
if(px != null && py != null){
if(direction == 'up'){
dstImage.drawImage(background,128,96,32,32,px,y+h-3,32,32);
core.drawImage(ctx, background,128,96,32,32,px,y+h-3,32,32);
}else if(direction == 'down') {
dstImage.drawImage(background,160,96,32,32,px,y-29,32,32);
core.drawImage(ctx, background,160,96,32,32,px,y-29,32,32);
}
}
// 仿RM窗口皮肤 ↑
@ -903,7 +919,7 @@ ui.prototype._drawBackground_drawWindowSkin = function (background, left, top, r
ui.prototype._drawBackground_drawColor = function (background, left, top, right, bottom, position, px, py, xoffset, yoffset) {
var alpha = background[3];
core.setAlpha('ui', alpha);
core.setStrokeStyle('ui', core.status.globalAttribute.borderColor);
core.setStrokeStyle('ui', core.arrayToRGBA(core.status.globalAttribute.borderColor));
core.setFillStyle('ui', core.arrayToRGB(background));
core.setLineWidth('ui', 2);
// 绘制
@ -956,6 +972,7 @@ ui.prototype._getDrawableIconInfo = function (id) {
if (id && id.indexOf('flag:') === 0) {
id = core.getFlag(id.substring(5), id);
}
id = core.getIdOfThis(id);
var image = null, icon = null;
["terrains","animates","items","npcs","enemys"].forEach(function (v) {
if (core.material.icons[v][id] != null) {
@ -991,8 +1008,7 @@ ui.prototype.drawTextContent = function (ctx, content, config) {
config.left = config.left || 0;
config.right = config.left + (config.maxWidth == null ? (ctx != null ? ctx.canvas.width : core.__PIXELS__) : config.maxWidth)
config.top = config.top || 0;
config.color = config.color || textAttribute.text;
if (config.color instanceof Array) config.color = core.arrayToRGBA(config.color);
config.color = core.arrayToRGBA(config.color || textAttribute.text);
if (config.bold == null) config.bold = textAttribute.bold;
config.italic = false;
config.align = config.align || textAttribute.align || "left";
@ -1045,7 +1061,7 @@ ui.prototype._drawTextContent_draw = function (ctx, tempCtx, content, config) {
if (config.index >= config.blocks.length) return false;
var block = config.blocks[config.index++];
if (block != null) {
ctx.drawImage(tempCtx.canvas, block.left, block.top, block.width, block.height,
core.drawImage(ctx, 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);
}
@ -1283,18 +1299,14 @@ ui.prototype.drawTextBox = function(content, showAll) {
ui.prototype._drawTextBox_drawImages = function (content) {
return content.replace(/(\f|\\f)\[(.*?)]/g, function (text, sympol, str) {
var ss = str.split(",");
if (ss.length!=3 && ss.length!=5 && ss.length!=9) return "";
ss[0] = core.getMappedName(ss[0]);
var img = core.material.images.images[ss[0]];
if (!img) return "";
// 绘制
if (ss.length==3)
core.drawImage('ui', img, parseFloat(ss[1]), parseFloat(ss[2]));
core.drawImage('ui', ss[0], parseFloat(ss[1]), parseFloat(ss[2]));
else if (ss.length==5)
core.drawImage('ui', img, 0, 0, img.width, img.height, parseFloat(ss[1]), parseFloat(ss[2]), parseFloat(ss[3]), parseFloat(ss[4]));
core.drawImage('ui', ss[0], parseFloat(ss[1]), parseFloat(ss[2]), parseFloat(ss[3]), parseFloat(ss[4]));
else if (ss.length==9 || ss.length==10) {
if (ss.length==10) core.setAlpha('ui', parseFloat(ss[9]));
core.drawImage('ui', img, parseFloat(ss[1]), parseFloat(ss[2]), parseFloat(ss[3]), parseFloat(ss[4]), parseFloat(ss[5]), parseFloat(ss[6]), parseFloat(ss[7]), parseFloat(ss[8]));
core.drawImage('ui', ss[0], parseFloat(ss[1]), parseFloat(ss[2]), parseFloat(ss[3]), parseFloat(ss[4]), parseFloat(ss[5]), parseFloat(ss[6]), parseFloat(ss[7]), parseFloat(ss[8]));
core.setAlpha('ui', 1);
}
return "";
@ -1386,10 +1398,20 @@ ui.prototype._drawTextBox_drawTitleAndIcon = function (titleInfo, hPos, vPos, al
core.status.boxAnimateObjs = [];
// --- 勇士
if (titleInfo.image == core.material.images.hero) {
core.clearMap('ui', hPos.left + 15, image_top, 32, titleInfo.height);
core.fillRect('ui', hPos.left + 15, image_top, 32, titleInfo.height, core.material.groundPattern);
core.drawImage('ui', titleInfo.image, 0, 0, core.material.icons.hero.width || 32, core.material.icons.hero.height,
hPos.left + 15, image_top, 32, titleInfo.height);
if (core.status.hero.animate) {
var direction = core.getHeroLoc('direction');
if (direction == 'up') direction = 'down';
core.status.boxAnimateObjs.push({
'bgx': hPos.left + 15, 'bgy': image_top, 'bgWidth': 32, 'bgHeight': titleInfo.height,
'x': hPos.left + 15, 'y': image_top, 'height': titleInfo.height, 'animate': 4,
'image': titleInfo.image, 'pos': core.material.icons.hero[direction].loc * titleInfo.height
})
} else {
core.clearMap('ui', hPos.left + 15, image_top, 32, titleInfo.height);
core.fillRect('ui', hPos.left + 15, image_top, 32, titleInfo.height, core.material.groundPattern);
core.drawImage('ui', titleInfo.image, 0, 0, core.material.icons.hero.width || 32, core.material.icons.hero.height,
hPos.left + 15, image_top, 32, titleInfo.height);
}
}
else {
core.status.boxAnimateObjs.push({
@ -1560,8 +1582,7 @@ ui.prototype._drawChoices_drawChoices = function (choices, isWindowSkin, hPos, v
core.setTextAlign('ui', 'center');
core.setFont('ui', this._buildFont(17, true));
for (var i = 0; i < choices.length; i++) {
var color = choices[i].color || core.status.textAttribute.text;
if (color instanceof Array) color = core.arrayToRGBA(color);
var color = core.arrayToRGBA(choices[i].color || core.status.textAttribute.text);
core.setFillStyle('ui', color);
var offset = this.HPIXEL;
if (choices[i].icon) {
@ -1655,16 +1676,15 @@ ui.prototype.drawWaiting = function(text) {
ui.prototype.drawSwitchs = function() {
core.status.event.id = 'switchs';
var choices = [
"背景音乐: "+(core.musicStatus.bgmStatus ? "[ON]" : "[OFF]"),
"背景音效: "+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
"音乐/音效: "+(core.musicStatus.bgmStatus ? "[ON]" : "[OFF]") + " "+(core.musicStatus.soundStatus ? "[ON]" : "[OFF]"),
//显示为 0~10 十挡
" < 音量:" + Math.round(Math.sqrt(100 * core.musicStatus.userVolume)) + " > ",
//数值越大耗时越长
" < 步时:" + core.values.moveSpeed + " > ",
" < 转场:" + core.values.floorChangeTime + " > ",
" < 放缩:" + Math.max(core.domStyle.scale, 1) + "x > ",
"怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
"临界/领域: "+(core.flags.displayCritical ? "[ON]" : "[OFF]")+" "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
"血瓶绕路: "+(core.hasFlag('__potionNoRouting__') ? "[ON]":"[OFF]"),
"单击瞬移: "+(!core.hasFlag("__noClickMove__") ? "[ON]":"[OFF]"),
"返回主菜单"
@ -1970,7 +1990,7 @@ ui.prototype.drawBookDetail = function (index) {
core.fillRect('data', left, top, width, height, '#000000');
core.setAlpha('data', 1);
core.strokeRect('data', left - 1, top - 1, width + 1, height + 1,
core.status.globalAttribute.borderColor, 2);
core.arrayToRGBA(core.status.globalAttribute.borderColor), 2);
this._drawBookDetail_drawContent(enemy, content, {top: top, content_left: content_left, bottom: bottom, validWidth: validWidth});
}
@ -2460,23 +2480,17 @@ ui.prototype._drawEquipbox_description = function (info, max_height) {
}
ui.prototype._drawEquipbox_getStatusChanged = function (info, equip, equipType, y) {
var compare, differentMode = null;
if (info.index < this.LAST) compare = core.compareEquipment(null, info.selectId);
else {
if (equipType<0) differentMode = '<当前没有该装备的空位,请先卸下装备>';
else {
var last = core.material.items[info.equipEquipment[equipType]]||{};
if (last.equip && (last.equip.percentage || false) != (equip.equip.percentage || false))
differentMode = '<数值和比例模式之间的切换不显示属性变化>';
else
compare = core.compareEquipment(info.selectId, info.equipEquipment[equipType]);
}
if (info.index < this.LAST) {
// 光标在装备栏上:查询卸下装备属性
return core.compareEquipment(null, info.selectId);
}
if (differentMode != null) {
core.fillText('ui', differentMode, 10, y, '#CCCCCC', this._buildFont(14, false));
return;
if (equipType < 0) {
// 没有空位
core.fillText('ui', '<当前没有该装备的空位,请先卸下装备>', 10, y, '#CCCCCC', this._buildFont(14, false));
return null;
}
return compare;
// 光标在装备上:查询装上后的属性变化
return core.compareEquipment(info.selectId, info.equipEquipment[equipType]);
}
ui.prototype._drawEquipbox_drawStatusChanged = function (info, y, equip, equipType) {
@ -2486,19 +2500,19 @@ ui.prototype._drawEquipbox_drawStatusChanged = function (info, y, equip, equipTy
// --- 变化值...
core.setFont('ui', this._buildFont(14, true));
for (var name in compare) {
for (var name in core.status.hero) {
if (typeof core.status.hero[name] != 'number') continue;
var nowValue = core.getRealStatus(name);
// 查询新值
var newValue = (core.getStatus(name) + (compare.value[name] || 0))
* (core.getBuff(name) + (compare.percentage[name] || 0) / 100);
if (nowValue == newValue) continue;
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;
nowValue = Math.floor(nowBuff * core.getStatus(name));
newValue = Math.floor(newBuff * core.getStatus(name));
}
nowValue = core.formatBigNumber(nowValue);
newValue = core.formatBigNumber(newValue);
this._drawEquipbox_drawStatusChanged_draw(nowValue+"->", '#CCCCCC', obj);
this._drawEquipbox_drawStatusChanged_draw(newValue, compare[name]>0?'#00FF00':'#FF0000', obj);
this._drawEquipbox_drawStatusChanged_draw(newValue, newValue>nowValue?'#00FF00':'#FF0000', obj);
obj.drawOffset += 8;
}
}
@ -2629,14 +2643,16 @@ ui.prototype._drawSLPanel_drawRecord = function(title, data, x, y, size, cho, hi
core.fillText('ui', title, x, y, highLight?'#FFD700':'#FFFFFF', this._buildFont(17, true));
core.strokeRect('ui', x-size/2, y+15, size, size, cho?strokeColor:'#FFFFFF', cho?6:2);
if (data && data.floorId) {
core.drawThumbnail(data.floorId, core.maps.loadMap(data.maps, data.floorId).blocks, {
var map = core.maps.loadMap(data.maps, data.floorId);
core.extractBlocks(map);
core.drawThumbnail(data.floorId, map.blocks, {
heroLoc: data.hero.loc, heroIcon: data.hero.image, flags: data.hero.flags
}, {
ctx: 'ui', x: x-size/2, y: y+15, size: size, centerX: data.hero.loc.x, centerY: data.hero.loc.y
});
if (core.isPlaying() && core.getFlag("hard") != data.hero.flags.hard) {
core.fillRect('ui', x-size/2, y+15, size, size, [0, 0, 0, 0.4], 2);
core.fillText('ui', data.hard, x, parseInt(y+22+size/2), core.dom.hard.style.color, this._buildFont(30,true));
core.fillText('ui', data.hard, x, parseInt(y+22+size/2), data.hero.flags.__hardColor__ || 'red', this._buildFont(30,true));
}
var v = core.formatBigNumber(data.hero.hp,true)+"/"+core.formatBigNumber(data.hero.atk,true)+"/"+core.formatBigNumber(data.hero.def,true);
var v2 = "/"+core.formatBigNumber(data.hero.mdef,true);
@ -2799,6 +2815,7 @@ ui.prototype._drawStatistics_add = function (floorId, obj, x1, x2, value) {
}
ui.prototype._drawStatistics_floorId = function (floorId, obj) {
core.extractBlocks(floorId);
var floor = core.status.maps[floorId], blocks = floor.blocks;
// 隐藏层不给看
if (floor.cannotViewMap && floorId!=core.status.floorId) return;
@ -2829,7 +2846,6 @@ ui.prototype._drawStatistics_items = function (floorId, floor, id, obj) {
if (obj.cls[id]=='items' && id!='superPotion') {
var temp = core.clone(core.status.hero);
core.setFlag("__statistics__", true);
var ratio = floor.item_ratio||1;
try { eval(core.items.itemEffect[id]); }
catch (e) {}
hp = core.status.hero.hp - temp.hp;

View File

@ -352,13 +352,13 @@ utils.prototype.splitImage = function (image, width, height) {
width = width || 32;
height = height || width;
var canvas = document.createElement("canvas");
var context = canvas.getContext("2d");
var ctx = canvas.getContext("2d");
var ans = [];
for (var j = 0; j < image.height; j += height) {
for (var i = 0; i < image.width; i += width) {
var w = Math.min(width, image.width - i), h = Math.min(height, image.height - j);
canvas.width = w; canvas.height = h;
context.drawImage(image, i, j, w, h, 0, 0, w, h);
core.drawImage(ctx, image, i, j, w, h, 0, 0, w, h);
var img = new Image();
img.src = canvas.toDataURL("image/png");
ans.push(img);
@ -401,6 +401,7 @@ utils.prototype.formatSize = function (size) {
utils.prototype.formatBigNumber = function (x, onMap) {
x = Math.floor(parseFloat(x));
if (!core.isset(x)) return '???';
if (x > 1e24 || x < -1e24) return x;
var c = x < 0 ? "-" : "";
x = Math.abs(x);
@ -436,12 +437,14 @@ utils.prototype.formatBigNumber = function (x, onMap) {
////// 数组转RGB //////
utils.prototype.arrayToRGB = function (color) {
if (!(color instanceof Array)) return color;
var nowR = this.clamp(parseInt(color[0]), 0, 255), nowG = this.clamp(parseInt(color[1]), 0, 255),
nowB = this.clamp(parseInt(color[2]), 0, 255);
return "#" + ((1 << 24) + (nowR << 16) + (nowG << 8) + nowB).toString(16).slice(1);
}
utils.prototype.arrayToRGBA = function (color) {
if (!(color instanceof Array)) return color;
if (color[3] == null) color[3] = 1;
var nowR = this.clamp(parseInt(color[0]), 0, 255), nowG = this.clamp(parseInt(color[1]), 0, 255),
nowB = this.clamp(parseInt(color[2]), 0, 255), nowA = this.clamp(parseFloat(color[3]), 0, 1);
@ -1125,51 +1128,6 @@ utils.prototype.same = function (a, b) {
return false;
}
utils.prototype._export = function (floorIds) {
if (!floorIds) floorIds = [core.status.floorId];
else if (floorIds == 'all') floorIds = core.clone(core.floorIds);
else if (typeof floorIds == 'string') floorIds = [floorIds];
var monsterMap = {};
// map
var content = floorIds.length + "\n" + core.__SIZE__ + " " + core.__SIZE__ + "\n\n";
floorIds.forEach(function (floorId) {
var arr = core.maps._getMapArrayFromBlocks(core.status.maps[floorId].blocks, core.__SIZE__, core.__SIZE__);
content += arr.map(function (x) {
// check monster
x.forEach(function (t) {
var block = core.maps.getBlockByNumber(t);
if (block.event.cls.indexOf("enemy") == 0) {
monsterMap[t] = block.event.id;
}
})
return x.join("\t");
}).join("\n") + "\n\n";
})
// values
content += ["redJewel", "blueJewel", "greenJewel", "redPotion", "bluePotion",
"yellowPotion", "greenPotion", "sword1", "shield1"].map(function (x) {
return core.values[x] || 0;
}).join(" ") + "\n\n";
// monster
content += Object.keys(monsterMap).length + "\n";
for (var t in monsterMap) {
var id = monsterMap[t], monster = core.material.enemys[id];
content += t + " " + monster.hp + " " + monster.atk + " " +
monster.def + " " + monster.money + " " + monster.special + "\n";
}
content += "\n0 0 0 0 0 0\n\n";
content += core.status.hero.hp + " " + core.status.hero.atk + " "
+ core.status.hero.def + " " + core.status.hero.mdef + " " + core.status.hero.money + " "
+ core.itemCount('yellowKey') + " " + core.itemCount("blueKey") + " " + core.itemCount("redKey") + " 0 "
+ core.status.hero.loc.x + " " + core.status.hero.loc.y + "\n";
console.log(content);
}
utils.prototype.unzip = function (blobOrUrl, success, error, convertToText, onprogress) {
var _error = function (msg) {
main.log(msg);

18
main.js
View File

@ -200,18 +200,19 @@ main.prototype.init = function (mode, callback) {
var mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;
for(var ii in mainData)main[ii]=mainData[ii];
main.dom.startBackground.src = main.startBackground;
main.dom.startLogo.style=main.startLogoStyle;
main.dom.startButtonGroup.style = main.startButtonsStyle;
main.levelChoose.forEach(function(value){
main.dom.startBackground.src = main.styles.startBackground;
main.dom.startLogo.style=main.styles.startLogoStyle;
main.dom.startButtonGroup.style = main.styles.startButtonsStyle;
main.levelChoose = main.levelChoose || [];
main.levelChoose.forEach(function (value) {
var span = document.createElement('span');
span.setAttribute('class','startButton');
span.innerText=value[0];
span.innerText=value.title || '';
(function(span,str_){
span.onclick = function () {
core.events.startGame(str_);
}
})(span,value[1]);
})(span,value.name||'');
main.dom.levelChooseButtons.appendChild(span);
});
main.createOnChoiceAnimation();
@ -724,10 +725,9 @@ main.dom.playGame.onclick = function () {
main.dom.startButtons.style.display='none';
main.core.control.checkBgm();
if (main.core.isset(main.core.flags.startDirectly) && main.core.flags.startDirectly) {
if (main.levelChoose.length == 0) {
core.events.startGame("");
}
else {
} else {
main.dom.levelChooseButtons.style.display='block';
main.selectedButton = null;
main.selectButton(0);

View File

@ -41,41 +41,48 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"背景图.jpg": "bg.jpg",
"背景音乐.mp3": "bgm.mp3"
},
"startBackground": "project/images/bg.jpg",
"startLogoStyle": "color: black",
"levelChoose": [
[
"简单",
"Easy"
],
[
"普通",
"Normal"
],
[
"困难",
"Hard"
],
[
"噩梦",
"Hell"
]
{
"title": "简单",
"name": "Easy",
"hard": 1,
"action": [
{
"type": "comment",
"text": "在这里写该难度需执行的事件"
}
]
},
{
"title": "普通",
"name": "Normal",
"hard": 2,
"color": [
0,
255,
0,
1
],
"action": []
}
],
"equipName": [
"武器",
"盾牌"
],
"startBgm": null,
"statusLeftBackground": "url(project/materials/ground.png) repeat",
"statusTopBackground": "url(project/materials/ground.png) repeat",
"toolsBackground": "url(project/materials/ground.png) repeat",
"borderColor": "#CCCCCC",
"statusBarColor": "white",
"hardLabelColor": "red",
"floorChangingBackground": "black",
"floorChangingTextColor": "white",
"font": "Verdana",
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;"
"styles": {
"startBackground": "project/images/bg.jpg",
"startLogoStyle": "color: black",
"startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;",
"statusLeftBackground": "url(project/materials/ground.png) repeat",
"statusTopBackground": "url(project/materials/ground.png) repeat",
"toolsBackground": "url(project/materials/ground.png) repeat",
"borderColor": [204,204,204,1],
"statusBarColor": [255,255,255,1],
"floorChangingStyle": "background-color: black; color: white",
"font": "Verdana"
}
},
"firstData": {
"title": "魔塔样板",
@ -84,6 +91,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"floorId": "sample0",
"hero": {
"image": "hero.png",
"animate": false,
"name": "阳光",
"lv": 1,
"hpmax": 9999,
@ -158,7 +166,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
},
{
"type": "if",
"condition": "core.flags.startDirectly",
"condition": "main.levelChoose.length == 0",
"true": [
{
"type": "comment",
@ -172,7 +180,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
},
{
"type": "function",
"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}"
"function": "function(){\nvar choices = [];\nmain.levelChoose.forEach(function (one) {\n\tchoices.push({\n\t\t\"text\": one.title || '',\n\t\t\"action\": [\n\t\t\t{ \"type\": \"function\", \"function\": \"function() { core.status.hard = '\" + (one.name || '') + \"'; }\" }\n\t\t]\n\t});\n})\ncore.insertAction({ \"type\": \"choices\", \"choices\": choices });\n}"
}
]
},
@ -219,7 +227,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
},
{
"type": "if",
"condition": "!core.isReplaying()",
"condition": "(!core.isReplaying())",
"true": [
{
"type": "function",
@ -239,60 +247,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
}
],
"startText": [
{
"type": "comment",
"text": "根据难度分歧设置<flag:hard>并给其他初始值"
},
{
"type": "switch",
"condition": "core.status.hard",
"caseList": [
{
"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"
}
]
}
]
},
{
"type": "comment",
"text": "初始剧情"
@ -303,7 +257,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"shops": [
{
"id": "shop1",
"text": "\t[贪婪之神,blueShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
"text": "\t[贪婪之神,moneyShop]勇敢的武士啊, 给我${20+2*flag:shop1}金币就可以:",
"textInList": "1F金币商店",
"mustEnable": false,
"disablePreview": false,
@ -368,7 +322,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
},
{
"id": "shop2",
"text": "\t[贪婪之神,pinkShop]勇敢的武士啊, 给我一定经验就可以:",
"text": "\t[贪婪之神,expShop]勇敢的武士啊, 给我一定经验就可以:",
"textInList": "1F经验商店",
"mustEnable": false,
"disablePreview": true,
@ -465,9 +419,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"lavaDamage": 100,
"poisonDamage": 10,
"weakValue": 20,
"redJewel": 3,
"blueJewel": 3,
"greenJewel": 5,
"redGem": 3,
"blueGem": 3,
"greenGem": 5,
"redPotion": 100,
"bluePotion": 250,
"yellowPotion": 500,
@ -499,7 +453,6 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"betweenAttackMax": false,
"useLoop": false,
"startUsingCanvas": false,
"startDirectly": false,
"statusCanvas": false,
"displayEnemyDamage": true,
"displayCritical": true,

View File

@ -1,88 +1,84 @@
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},
"skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"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},
"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},
"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},
"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},
"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},
"evilHero": {"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},
"silverSlime": {"name":"银头怪","hp":100,"atk":120,"def":0,"money":15,"experience":0,"point":0,"special":14},
"whiteHornSlime": {"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},
"poisonZombie": {"name":"绿兽人","hp":100,"atk":120,"def":0,"money":13,"experience":0,"point":0,"special":12},
"octopus": {"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]},
"frozenSkeleton": {"name":"冻死骨","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"silverSlimelord": {"name":"银怪王","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"goldSlimelord": {"name":"金怪王","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"skeletonWarrior": {"name":"骷髅士兵","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"ghostWarrior": {"name":"冥队长","hp":100,"atk":120,"def":0,"money":8,"experience":0,"point":0,"special":7},
"whiteSlimeman": {"name":"水银战士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"slimeman": {"name":"影子战士","hp":100,"atk":0,"def":0,"money":11,"experience":0,"point":0,"special":[10,21],"atkValue":2,"defValue":3},
"yellowGT": {"name":"初级卫兵","hp":100,"atk":120,"def":0,"money":10,"experience":0,"point":0,"special":0},
"blueGT": {"name":"中级卫兵","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"redGT": {"name":"高级卫兵","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"blackMS": {"name":"黑衣魔王","hp":1000,"atk":500,"def":0,"money":1000,"experience":1000,"point":0,"special":0,"notBomb":true},
"yellowMS": {"name":"黄衣魔王","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"greenMS": {"name":"青衣武士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"magicMaster": {"name":"黑暗大法师","hp":100,"atk":120,"def":0,"money":12,"experience":0,"point":0,"special":11,"value":0.3333333333333333,"add":true,"notBomb":true},
"blueMS": {"name":"白衣武士","hp":100,"atk":120,"def":0,"money":17,"experience":0,"point":0,"special":16},
"redMS": {"name":"红衣魔王","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"devilWarrior": {"name":"魔神武士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"fairyEnemy": {"name":"仙子","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"dragon": {"name":"魔龙","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"skeletonKnight": {"name":"骷髅武士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"skeletonPresbyter": {"name":"骷髅巫师","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"ironRock": {"name":"铁面人","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"grayRock": {"name":"灰色石头人","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"yellowPriest": {"name":"中级法师","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"evilPrincess": {"name":"痛苦魔女","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"blademaster": {"name":"剑圣","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"evilFairy": {"name":"黑暗仙子","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"blueRock": {"name":"鬼邪石","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"skeletonLite": {"name":"骷髅精英","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"blueSkeleton": {"name":"蓝骷髅","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"bowman": {"name":"弓兵","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"liteBowman": {"name":"精锐弓兵","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"crismonZombie": {"name":"红兽人","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"watcherSlime": {"name":"邪眼怪","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"mutantSlimeman": {"name":"变异战士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"devilKnight": {"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},
"greenGT": {"name":"卫兵队长","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"ghostSoldier": {"name":"冥队长","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"goldBat": {"name":"金蝙蝠","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"pinkSoldier": {"name":"红战士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"pinkGhostSoldier": {"name":"红队长","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"greenSoldier": {"name":"青战士","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0},
"greenGhostSoldier": {"name":"青队长","hp":0,"atk":0,"def":0,"money":0,"experience":0,"point":0,"special":0}
"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":0},
"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":0},
"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":0},
"skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"rock": {"name":"石头人","hp":100,"atk":120,"def":0,"money":4,"exp":0,"point":0,"special":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":0},
"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},
"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":0},
"yellowKnight": {"name":"金骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"redKnight": {"name":"红骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"darkKnight": {"name":"黑骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"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":0},
"poisonSkeleton": {"name":"紫骷髅","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"poisonBat": {"name":"紫蝙蝠","hp":100,"atk":120,"def":0,"money":14,"exp":0,"point":0,"special":13},
"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":0},
"evilHero": {"name":"迷失勇者","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"demonPriest": {"name":"魔神法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"goldHornSlime": {"name":"金角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"silverSlime": {"name":"银头怪","hp":100,"atk":120,"def":0,"money":15,"exp":0,"point":0,"special":14},
"whiteHornSlime": {"name":"尖角怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"redSwordsman": {"name":"剑王","hp":100,"atk":120,"def":0,"money":7,"exp":0,"point":0,"special":6,"n":8},
"poisonZombie": {"name":"绿兽人","hp":100,"atk":120,"def":0,"money":13,"exp":0,"point":0,"special":12},
"octopus": {"name":"血影","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"princessEnemy": {"name":"假公主","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"angel": {"name":"天使","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"elemental": {"name":"元素生物","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"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]},
"frozenSkeleton": {"name":"冻死骨","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"silverSlimelord": {"name":"银怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"goldSlimelord": {"name":"金怪王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"skeletonWarrior": {"name":"骷髅士兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"ghostWarrior": {"name":"冥队长","hp":100,"atk":120,"def":0,"money":8,"exp":0,"point":0,"special":7},
"whiteSlimeman": {"name":"水银战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"slimeman": {"name":"影子战士","hp":100,"atk":0,"def":0,"money":11,"exp":0,"point":0,"special":[10,21],"atkValue":2,"defValue":3},
"yellowGT": {"name":"初级卫兵","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":0},
"blueGT": {"name":"中级卫兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"redGT": {"name":"高级卫兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"blackMS": {"name":"黑衣魔王","hp":1000,"atk":500,"def":0,"money":1000,"exp":1000,"point":0,"special":0,"notBomb":true},
"yellowMS": {"name":"黄衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"greenMS": {"name":"青衣武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"magicMaster": {"name":"黑暗大法师","hp":100,"atk":120,"def":0,"money":12,"exp":0,"point":0,"special":11,"value":0.3333333333333333,"add":true,"notBomb":true},
"blueMS": {"name":"白衣武士","hp":100,"atk":120,"def":0,"money":17,"exp":0,"point":0,"special":16},
"redMS": {"name":"红衣魔王","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"devilWarrior": {"name":"魔神武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"fairyEnemy": {"name":"仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"dragon": {"name":"魔龙","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"skeletonKnight": {"name":"骷髅武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"skeletonPresbyter": {"name":"骷髅巫师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"ironRock": {"name":"铁面人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"grayRock": {"name":"灰色石头人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"yellowPriest": {"name":"中级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"evilPrincess": {"name":"痛苦魔女","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"blademaster": {"name":"剑圣","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"evilFairy": {"name":"黑暗仙子","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"blueRock": {"name":"鬼邪石","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"skeletonLite": {"name":"骷髅精英","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"greenKnight": {"name":"强盾骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"bowman": {"name":"弓兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"liteBowman": {"name":"精锐弓兵","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"crismonZombie": {"name":"红兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"watcherSlime": {"name":"邪眼怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"mutantSlimeman": {"name":"变异战士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"devilKnight": {"name":"恶灵骑士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"grayPriest": {"name":"混沌法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"greenGT": {"name":"卫兵队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"ghostSoldier": {"name":"冥队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0},
"frostBat": {"name":"寒蝙蝠","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}
}

View File

@ -175,7 +175,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
"data": [
{
"type": "choices",
"text": "\t[商人,woman]你有多余的钥匙想要出售吗?",
"text": "\t[商人,trader]你有多余的钥匙想要出售吗?",
"choices": [
{
"text": "黄钥匙10金币",
@ -204,7 +204,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
}
],
"false": [
"\t[商人,woman]你没有黄钥匙!"
"\t[商人,trader]你没有黄钥匙!"
]
}
]
@ -236,7 +236,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
}
],
"false": [
"\t[商人,woman]你没有蓝钥匙!"
"\t[商人,trader]你没有蓝钥匙!"
]
}
]

View File

@ -8,7 +8,7 @@ main.floors.MT0=
"cannotViewMap": false,
"defaultGround": "ground",
"images": [],
"item_ratio": 1,
"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],

View File

@ -8,7 +8,7 @@ main.floors.sample0=
"defaultGround": "ground",
"images": [],
"bgm": "bgm.mp3",
"item_ratio": 1,
"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],
@ -46,8 +46,8 @@ main.floors.sample0=
}
],
"10,11": [
"\t[老人,woman]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。",
"\t[老人,woman]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
"\t[老人,trader]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。",
"\t[老人,trader]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
{
"type": "hide",
"time": 500
@ -63,24 +63,24 @@ main.floors.sample0=
}
],
"2,8": [
"\t[老人,magician]这些都是各种各样的怪物所有怪物的数据都在enemys.js中设置。",
"\t[老人,magician]这批怪物分别为普通、先攻、魔攻、坚固、2连击、3连击、4连击、破甲、反击、净化。",
"\t[老人,magician]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
"\t[老人,wizard]这些都是各种各样的怪物所有怪物的数据都在enemys.js中设置。",
"\t[老人,wizard]这批怪物分别为普通、先攻、魔攻、坚固、2连击、3连击、4连击、破甲、反击、净化。",
"\t[老人,wizard]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的说明。",
{
"type": "hide",
"time": 500
}
],
"2,5": [
"\t[老人,magician]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值可参见样板中黑暗大法师的写法。",
"\t[老人,wizard]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值可参见样板中黑暗大法师的写法。",
{
"type": "hide",
"time": 500
}
],
"2,3": [
"\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。",
"\t[老人,magician]夹击和领域同时发生时先计算领域,再夹击。\n自动寻路同样会尽量绕过你设置的这些点。",
"\t[老人,wizard]领域、夹击。\n请注意领域怪需要设置value为伤害数值可参见样板中初级巫师的写法。",
"\t[老人,wizard]夹击和领域同时发生时先计算领域,再夹击。\n自动寻路同样会尽量绕过你设置的这些点。",
{
"type": "hide",
"time": 500

View File

@ -7,18 +7,20 @@ main.floors.sample1=
"canUseQuickShop": true,
"defaultGround": "grass",
"images": [
[
0,
0,
"bg.jpg",
0
]
{
"name": "bg.jpg",
"canvas": "bg",
"x": 0,
"y": 0,
"w": 416,
"h": 416
}
],
"weather": [
"snow",
6
],
"item_ratio": 1,
"ratio": 1,
"map": [
[ 7,131, 8,152, 9,130, 10,152,166,165,132,165,166],
[ 0, 0, 0, 0, 0, 0, 0,152,165,164, 0,162,165],
@ -263,13 +265,13 @@ main.floors.sample1=
}
],
"10,4": [
"\t[blackKing]你终于还是来了。",
"\t[blackMS]你终于还是来了。",
"\t[hero]放开我们的公主!",
"\t[blackKing]如果我不愿意呢?",
"\t[blackMS]如果我不愿意呢?",
"\t[hero]无需多说,拔剑吧!",
{
"type": "battle",
"id": "blackKing"
"id": "blackMS"
},
{
"type": "hide",
@ -285,7 +287,7 @@ main.floors.sample1=
7
]
},
"\t[blackKing]没想到你已经变得这么强大了... 算你厉害。\n公主就交给你了请好好对她。",
"\t[blackMS]没想到你已经变得这么强大了... 算你厉害。\n公主就交给你了请好好对她。",
{
"type": "hide"
}
@ -419,23 +421,23 @@ main.floors.sample1=
{
"case": "0",
"action": [
"\t[老人,woman]这是个很复杂的例子它将教会你如何使用if 语句进行条件判断,以及 choices 提供选项来供用户进行选择。",
"\t[老人,woman]第一次访问我将显示这段文字;从第二次开始将会向你出售钥匙。\n钥匙价格将随着访问次数递增。\n当合计出售了七把钥匙后将送你一把大黄门钥匙并消失不再出现。",
"\t[老人,woman]这部分的逻辑比较长,请细心看样板的写法,是很容易看懂并理解的。"
"\t[老人,trader]这是个很复杂的例子它将教会你如何使用if 语句进行条件判断,以及 choices 提供选项来供用户进行选择。",
"\t[老人,trader]第一次访问我将显示这段文字;从第二次开始将会向你出售钥匙。\n钥匙价格将随着访问次数递增。\n当合计出售了七把钥匙后将送你一把大黄门钥匙并消失不再出现。",
"\t[老人,trader]这部分的逻辑比较长,请细心看样板的写法,是很容易看懂并理解的。"
]
},
{
"case": "8",
"action": [
"\t[老人,woman]你购买的钥匙已经够多了,再继续卖给你的话我会有危险的。",
"\t[老人,woman]看在你贡献给我这么多钱的份上,送你一把大黄门钥匙吧,希望你能好好用它。",
"\t[老人,trader]你购买的钥匙已经够多了,再继续卖给你的话我会有危险的。",
"\t[老人,trader]看在你贡献给我这么多钱的份上,送你一把大黄门钥匙吧,希望你能好好用它。",
{
"type": "setValue",
"name": "item:bigKey",
"operator": "+=",
"value": "1"
},
"\t[老人,woman]我先走了,拜拜~",
"\t[老人,trader]我先走了,拜拜~",
{
"type": "hide",
"time": 500
@ -450,7 +452,7 @@ main.floors.sample1=
"action": [
{
"type": "choices",
"text": "\t[老人,woman]少年,你需要钥匙吗?\n我这里有大把的",
"text": "\t[老人,trader]少年,你需要钥匙吗?\n我这里有大把的",
"choices": [
{
"text": "黄钥匙(${9+flag:woman_times}金币)",
@ -473,7 +475,7 @@ main.floors.sample1=
}
],
"false": [
"\t[老人,woman]你的金钱不足!"
"\t[老人,trader]你的金钱不足!"
]
}
]
@ -502,7 +504,7 @@ main.floors.sample1=
}
],
"false": [
"\t[老人,woman]你的金钱不足!"
"\t[老人,trader]你的金钱不足!"
]
}
]
@ -528,7 +530,7 @@ main.floors.sample1=
}
],
"false": [
"\t[老人,woman]你的金钱不足!",
"\t[老人,trader]你的金钱不足!",
{
"type": "continue"
}
@ -560,8 +562,8 @@ main.floors.sample1=
}
],
"12,11": [
"\t[老人,womanMagician]使用 {\"type\":\"function\"} 可以写自定义的JS脚本。\n本塔支持的所有主要API会在doc文档内给出。",
"\t[老人,womanMagician]例如这个例子:即将弹出一个输入窗口,然后会将你的输入结果直接加到你的攻击力上。",
"\t[老人,recluse]使用 {\"type\":\"function\"} 可以写自定义的JS脚本。\n本塔支持的所有主要API会在doc文档内给出。",
"\t[老人,recluse]例如这个例子:即将弹出一个输入窗口,然后会将你的输入结果直接加到你的攻击力上。",
{
"type": "input",
"text": "请输入你要加攻击力的数值:"
@ -584,7 +586,7 @@ main.floors.sample1=
],
"false": []
},
"\t[老人,womanMagician]具体可参见样板中本事件的写法。"
"\t[老人,recluse]具体可参见样板中本事件的写法。"
]
},
"changeFloor": {

View File

@ -8,7 +8,7 @@ main.floors.sample2=
"cannotViewMap": false,
"defaultGround": "ground",
"images": [],
"item_ratio": 1,
"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],

View File

@ -18,7 +18,7 @@ main.floors.sample3=
10
],
"bgm": "bgm.mp3",
"item_ratio": 1,
"ratio": 1,
"map": [
[ 5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5],
[ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5],
@ -871,7 +871,7 @@ main.floors.sample3=
"\t[hero]好温暖……",
{
"type": "setValue",
"name": "item:yellowJewel",
"name": "item:yellowGem",
"value": "1"
},
{

View File

@ -26,6 +26,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 初始化地图
core.status.floorId = floorId;
core.status.maps = maps;
core.maps._resetFloorImages();
// 初始化怪物和道具
core.material.enemys = core.enemys.getEnemys();
core.material.items = core.items.getItems();
@ -40,7 +41,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core._init_sys_flags();
// 初始化界面,状态栏等
core.resize();
core.updateGlobalAttribute();
// 状态栏是否显示
if (core.hasFlag('hideStatusBar'))
core.hideStatusBar(core.hasFlag('showToolbox'));
@ -115,6 +115,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.status.hero.loc = heroLoc;
// 检查重生怪并重置
if (!fromLoad) {
core.extractBlocks(floorId);
core.status.maps[floorId].blocks.forEach(function (block) {
if (block.disable && core.enemys.hasSpecial(block.event.id, 23)) {
block.disable = false;
@ -358,7 +359,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
// 如果该点存在事件 -- V2.5.4 以后阻击怪也可以有战后事件了
core.push(todo, core.floors[core.status.floorId].afterBattle[x + "," + y]);
if (core.status.floorId != null) {
core.push(todo, core.floors[core.status.floorId].afterBattle[x + "," + y]);
}
// 在这里增加其他的自定义事件需求
/*
@ -385,6 +388,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var todo = [];
// 检查该点的获得开门后事件。
if (core.status.floorId == null) return;
var event = core.floors[core.status.floorId].afterOpenDoor[x + "," + y];
if (event) core.unshift(todo, event);
@ -403,6 +407,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var todo = [];
// 检查该点的获得道具后事件。
if (core.status.floorId == null) return;
var event = core.floors[core.status.floorId].afterGetItem[x + "," + y];
if (event && (event instanceof Array || !isGentleClick || !event.disableOnGentleClick)) {
core.unshift(todo, event);
@ -432,7 +437,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
return [
[1, "先攻", "怪物首先攻击"],
[2, "魔攻", "怪物无视勇士的防御"],
[3, "坚固", "勇士每回合最多只能对怪物造成1点伤害"],
[3, "坚固", "怪物防御不小于勇士攻击-1"],
[4, "2连击", "怪物每回合攻击2次"],
[5, "3连击", "怪物每回合攻击3次"],
[6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }],
@ -516,6 +521,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var cache = core.status.checkBlock.cache[index];
if (!cache) {
// 没有该点的缓存,则遍历每个图块
core.extractBlocks(floorId);
core.status.maps[floorId].blocks.forEach(function (block) {
if (!block.disable) {
// 获得该图块的ID
@ -833,7 +839,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
break;
case 52: // 快捷键4破冰/冰冻/地震/上下楼器/... 其他道具依次判断
{
var list = ["icePickaxe", "snow", "earthquake", "upFly", "downFly", "jumpShoes", "lifeWand", "poisonWine", "weakWine", "curseWine", "superWine"];
var list = ["icePickaxe", "freezeBadge", "earthquake", "upFly", "downFly", "jumpShoes", "lifeWand", "poisonWine", "weakWine", "curseWine", "superWine"];
for (var i = 0; i < list.length; i++) {
var itemId = list[i];
if (core.canUseItem(itemId)) {
@ -934,7 +940,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var toAttribute = core.getFlag('globalAttribute', core.status.globalAttribute);
if (!core.same(toAttribute, core.status.globalAttribute)) {
core.status.globalAttribute = toAttribute;
core.updateGlobalAttribute();
core.resize();
}
// 重置音量
core.events.setVolume(core.getFlag("__volume__", 1), 0);
@ -1032,6 +1038,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 难度
core.statusBar.hard.innerText = core.status.hard;
core.statusBar.hard.style.color = core.getFlag('__hardColor__', 'red');
// 自定义状态栏绘制
core.drawStatusBar();
@ -1051,7 +1058,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var damage = {}, // 每个点的伤害值
type = {}, // 每个点的伤害类型
snipe = {}, // 每个点的阻击怪信息
repulse = {}, // 每个点的阻击怪信息
ambush = {}; // 每个点的捕捉信息
// 计算血网和领域、阻击、激光的伤害,计算捕捉信息
@ -1065,7 +1072,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
type[loc] = type[loc] || {};
// 血网
if (id == 'lavaNet' && !core.hasItem('shoes')) {
if (id == 'lavaNet' && !core.hasItem('amulet')) {
damage[loc] = (damage[loc] || 0) + core.values.lavaDamage;
type[loc]["血网伤害"] = true;
}
@ -1096,8 +1103,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}
// 阻击
// 如果要防止阻击伤害,可以直接简单的将 flag:no_snipe 设为true
if (enemy && core.hasSpecial(enemy.special, 18) && !core.hasFlag('no_snipe')) {
// 如果要防止阻击伤害,可以直接简单的将 flag:no_repulse 设为true
if (enemy && core.hasSpecial(enemy.special, 18) && !core.hasFlag('no_repulse')) {
for (var dir in core.utils.scan) {
var nx = x + core.utils.scan[dir].x,
ny = y + core.utils.scan[dir].y,
@ -1112,7 +1119,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
var rnx = x + core.utils.scan[rdir].x,
rny = y + core.utils.scan[rdir].y;
if (rnx >= 0 && rnx < width && rny >= 0 && rny < height && core.getBlock(rnx, rny, floorId) == null) {
snipe[currloc] = (snipe[currloc] || []).concat([
repulse[currloc] = (repulse[currloc] || []).concat([
[x, y, id, rdir]
]);
}
@ -1207,7 +1214,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.status.checkBlock = {
damage: damage,
type: type,
snipe: snipe,
repulse: repulse,
ambush: ambush,
cache: {} // clear cache
};
@ -1281,6 +1288,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 判定能否瞬移到该点
if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y);
if (ignoreSteps >= 0) {
// 中毒也允许瞬移
if (core.hasFlag('poison')) {
var damage = ignoreSteps * core.values.poisonDamage;
if (damage >= core.status.hero.hp) return false;
core.status.hero.statistics.poisonDamage += damage;
core.status.hero.hp -= damage;
}
core.clearMap('hero');
// 获得勇士最后的朝向
var lastDirection = core.status.route[core.status.route.length - 1];
@ -1295,6 +1310,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 统计信息
core.status.hero.statistics.moveDirectly++;
core.status.hero.statistics.ignoreSteps += ignoreSteps;
if (core.hasFlag('poison')) {
core.updateStatusBar();
}
return true;
}
return false;
@ -1355,7 +1373,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 绘制下一个数据
var name = toDraw[index];
// 图片大小25x25
ctx.drawImage(core.statusBar.icons[name], leftOffset, topOffset, 25, 25);
core.drawImage(ctx, core.statusBar.icons[name], leftOffset, topOffset, 25, 25);
// 文字内容
var text = (core.statusBar[name] || {}).innerText || " ";
// 斜体判定:如果不是纯数字和字母,斜体会非常难看,需要取消
@ -1391,9 +1409,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
return [
'yellowDoor', 'blueDoor', 'redDoor', 'greenDoor', 'steelDoor',
'yellowKey', 'blueKey', 'redKey', 'greenKey', 'steelKey',
'redJewel', 'blueJewel', 'greenJewel', 'yellowJewel',
'redGem', 'blueGem', 'greenGem', 'yellowGem',
'redPotion', 'bluePotion', 'greenPotion', 'yellowPotion', 'superPotion',
'pickaxe', 'bomb', 'centerFly', 'icePickaxe', 'snow',
'pickaxe', 'bomb', 'centerFly', 'icePickaxe', 'freezeBadge',
'earthquake', 'upFly', 'downFly', 'jumpShoes', 'lifeWand',
'poisonWine', 'weakWine', 'curseWine', 'superWine',
'sword1', 'sword2', 'sword3', 'sword4', 'sword5',

View File

@ -97,23 +97,26 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"steelDoor2": 27,
"steelDoor3": 28,
"iceDoor": 29,
"iceDoor2": 30
"iceDoor2": 30,
"magentaWall": 31
},
"npcs": {
"man": 0,
"woman": 1,
"trader": 1,
"thief": 2,
"fairy": 3,
"magician": 4,
"womanMagician": 5,
"oldMan": 6,
"child": 7,
"wood": 8,
"pinkShop": 9,
"blueShop": 10,
"wizard": 4,
"recluse": 5,
"king": 6,
"youngMan": 7,
"sign": 8,
"expShop": 9,
"moneyShop": 10,
"princess": 11,
"man2": 28,
"woman2": 29,
"greenMan": 28,
"blueTrader": 29,
"redMSNpc": 30,
"blackTrader": 31,
"octopusLeftTop": 12,
"octopusTop": 13,
"octopusRightTop": 14,
@ -173,7 +176,7 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"redSwordsman": 53,
"poisonZombie": 55,
"octopus": 57,
"greenKnight": 59,
"princessEnemy": 59,
"skeletonWarrior": 9,
"frozenSkeleton": 69,
"silverSlimelord": 60,
@ -202,20 +205,16 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"evilFairy": 51,
"blueRock": 63,
"skeletonLite": 64,
"blueSkeleton": 65,
"greenKnight": 65,
"bowman": 66,
"liteBowman": 67,
"crismonZombie": 68,
"watcherSlime": 70,
"mutantSlimeman": 71,
"goldBat": 72,
"frostBat": 72,
"devilKnight": 73,
"grayPriest": 74,
"greenGT": 75,
"pinkGhostSoldier": 77,
"greenSoldier": 78,
"greenGhostSoldier": 79,
"pinkSoldier": 76,
"ghostSoldier": 11,
"evilHero": 40
},
@ -232,10 +231,10 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"greenKey": 3,
"steelKey": 4,
"bigKey": 6,
"redJewel": 16,
"blueJewel": 17,
"greenJewel": 18,
"yellowJewel": 19,
"redGem": 16,
"blueGem": 17,
"greenGem": 18,
"yellowGem": 19,
"redPotion": 20,
"bluePotion": 21,
"greenPotion": 22,
@ -262,7 +261,7 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"upFly": 15,
"downFly": 14,
"coin": 11,
"snow": 41,
"freezeBadge": 41,
"cross": 40,
"superPotion": 29,
"earthquake": 8,
@ -270,9 +269,9 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"weakWine": 25,
"curseWine": 27,
"superWine": 28,
"knife": 42,
"moneyPocket": 46,
"shoes": 47,
"dagger": 42,
"silverCoin": 46,
"amulet": 47,
"hammer": 48,
"jumpShoes": 49,
"skill1": 30,

View File

@ -19,22 +19,22 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "可以打开一扇红门",
"hideInToolbox": true
},
"redJewel": {
"redGem": {
"cls": "items",
"name": "红宝石",
"text": "',攻击+${core.values.redJewel}'"
"text": "攻击+${core.values.redGem}"
},
"blueJewel": {
"blueGem": {
"cls": "items",
"name": "蓝宝石",
"text": "',防御+${core.values.blueJewel}'"
"text": ",防御+${core.values.blueGem}"
},
"greenJewel": {
"greenGem": {
"cls": "items",
"name": "绿宝石",
"text": "',护盾+${core.values.greenJewel}'"
"text": ",护盾+${core.values.greenGem}"
},
"yellowJewel": {
"yellowGem": {
"cls": "items",
"name": "黄宝石",
"text": "可以进行加点"
@ -42,22 +42,22 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"redPotion": {
"cls": "items",
"name": "红血瓶",
"text": "',生命+${core.values.redPotion}'"
"text": ",生命+${core.values.redPotion}"
},
"bluePotion": {
"cls": "items",
"name": "蓝血瓶",
"text": "',生命+${core.values.bluePotion}'"
"text": ",生命+${core.values.bluePotion}"
},
"yellowPotion": {
"cls": "items",
"name": "黄血瓶",
"text": "',生命+${core.values.yellowPotion'}"
"text": ",生命+${core.values.yellowPotion}"
},
"greenPotion": {
"cls": "items",
"name": "绿血瓶",
"text": "',生命+${core.values.greenPotion}'"
"text": ",生命+${core.values.greenPotion}"
},
"sword0": {
"cls": "items",
@ -65,8 +65,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一把已经生锈的剑",
"equip": {
"type": 0,
"atk": 0,
"animate": "sword"
"animate": "sword",
"value": {
"atk": 0
}
}
},
"sword1": {
@ -75,8 +77,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一把很普通的铁剑",
"equip": {
"type": 0,
"atk": 10,
"animate": "sword"
"animate": "sword",
"value": {
"atk": 10
}
}
},
"sword2": {
@ -85,8 +89,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一把很普通的银剑",
"equip": {
"type": 0,
"atk": 20,
"animate": "sword"
"animate": "sword",
"value": {
"atk": 20
}
}
},
"sword3": {
@ -95,8 +101,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一把很普通的骑士剑",
"equip": {
"type": 0,
"atk": 40,
"animate": "sword"
"animate": "sword",
"value": {
"atk": 40
}
}
},
"sword4": {
@ -105,8 +113,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一把很普通的圣剑",
"equip": {
"type": 0,
"atk": 80,
"animate": "sword"
"animate": "sword",
"value": {
"atk": 80
}
}
},
"sword5": {
@ -115,8 +125,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一把很普通的神圣剑",
"equip": {
"type": 0,
"atk": 100,
"animate": "sword"
"animate": "sword",
"value": {
"atk": 160
}
}
},
"shield0": {
@ -125,7 +137,9 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一个很破旧的铁盾",
"equip": {
"type": 1,
"def": 0
"value": {
"def": 0
}
}
},
"shield1": {
@ -134,7 +148,9 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一个很普通的铁盾",
"equip": {
"type": 1,
"def": 10
"value": {
"def": 10
}
}
},
"shield2": {
@ -143,7 +159,9 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一个很普通的银盾",
"equip": {
"type": 1,
"def": 20
"value": {
"def": 20
}
}
},
"shield3": {
@ -152,7 +170,9 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一个很普通的骑士盾",
"equip": {
"type": 1,
"def": 40
"value": {
"def": 40
}
}
},
"shield4": {
@ -161,7 +181,9 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一个很普通的圣盾",
"equip": {
"type": 1,
"def": 80
"value": {
"def": 80
}
}
},
"shield5": {
@ -170,17 +192,19 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"text": "一个很普通的神圣盾",
"equip": {
"type": 1,
"def": 100,
"mdef": 100
"value": {
"def": 100,
"mdef": 100
}
}
},
"superPotion": {
"cls": "items",
"name": "圣水"
},
"moneyPocket": {
"silverCoin": {
"cls": "items",
"name": "金钱袋"
"name": "银币"
},
"book": {
"cls": "constants",
@ -200,7 +224,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"name": "幸运金币",
"text": "持有时打败怪物可得双倍金币"
},
"snow": {
"freezeBadge": {
"cls": "constants",
"name": "冰冻徽章",
"text": "可以将面前的熔岩变成平地"
@ -210,14 +234,14 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"name": "十字架",
"text": "持有后无视怪物的无敌属性"
},
"knife": {
"dagger": {
"cls": "constants",
"name": "屠龙匕首",
"text": "该道具尚未被定义"
},
"shoes": {
"amulet": {
"cls": "constants",
"name": "绿鞋",
"name": "护符",
"text": "持有时无视负面地形"
},
"bigKey": {
@ -317,14 +341,14 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
}
},
"itemEffect": {
"redJewel": "core.status.hero.atk += core.values.redJewel * ratio",
"blueJewel": "core.status.hero.def += core.values.blueJewel * ratio",
"greenJewel": "core.status.hero.mdef += core.values.greenJewel * ratio",
"yellowJewel": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
"redPotion": "core.status.hero.hp += core.values.redPotion * ratio",
"bluePotion": "core.status.hero.hp += core.values.bluePotion * ratio",
"yellowPotion": "core.status.hero.hp += core.values.yellowPotion * ratio",
"greenPotion": "core.status.hero.hp += core.values.greenPotion * ratio",
"redGem": "core.status.hero.atk += core.values.redGem * core.status.thisMap.ratio",
"blueGem": "core.status.hero.def += core.values.blueGem * core.status.thisMap.ratio",
"greenGem": "core.status.hero.mdef += core.values.greenGem * core.status.thisMap.ratio",
"yellowGem": "core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10;",
"redPotion": "core.status.hero.hp += core.values.redPotion * core.status.thisMap.ratio",
"bluePotion": "core.status.hero.hp += core.values.bluePotion * core.status.thisMap.ratio",
"yellowPotion": "core.status.hero.hp += core.values.yellowPotion * core.status.thisMap.ratio",
"greenPotion": "core.status.hero.hp += core.values.greenPotion * core.status.thisMap.ratio",
"sword0": "core.status.hero.atk += 0",
"sword1": "core.status.hero.atk += 10",
"sword2": "core.status.hero.atk += 20",
@ -339,32 +363,32 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"shield5": "core.status.hero.def += 100;core.status.hero.mdef += 100",
"bigKey": "core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++;",
"superPotion": "core.status.hero.hp *= 2",
"moneyPocket": "core.status.hero.money += 500"
"silverCoin": "core.status.hero.money += 500"
},
"itemEffectTip": {
"redJewel": "',攻击+'+core.values.redJewel * ratio",
"blueJewel": "',防御+'+core.values.blueJewel * ratio",
"greenJewel": "',护盾+'+core.values.greenJewel * ratio",
"yellowJewel": "',全属性提升'",
"redPotion": "',生命+'+core.values.redPotion * ratio",
"bluePotion": "',生命+'+core.values.bluePotion * ratio",
"yellowPotion": "',生命+'+core.values.yellowPotion * ratio",
"greenPotion": "',生命+'+core.values.greenPotion * ratio",
"sword0": "',攻击+0'",
"sword1": "',攻击+10'",
"sword2": "',攻击+20'",
"sword3": "',攻击+40'",
"sword4": "',攻击+80'",
"sword5": "',攻击+100'",
"shield0": "',防御+0'",
"shield1": "',防御+10'",
"shield2": "',防御+20'",
"shield3": "',防御+40'",
"shield4": "',防御+80'",
"shield5": "',防御+100护盾+100'",
"bigKey": "',全钥匙+1'",
"superPotion": "',生命值翻倍'",
"moneyPocket": "',金币+500'"
"redGem": ",攻击+${core.values.redGem * core.status.thisMap.ratio}",
"blueGem": ",防御+${core.values.blueGem * core.status.thisMap.ratio}",
"greenGem": ",护盾+${core.values.greenGem * core.status.thisMap.ratio}",
"yellowGem": ",全属性提升",
"redPotion": ",生命+${core.values.redPotion * core.status.thisMap.ratio}",
"bluePotion": ",生命+${core.values.bluePotion * core.status.thisMap.ratio}",
"yellowPotion": ",生命+${core.values.yellowPotion * core.status.thisMap.ratio}",
"greenPotion": ",生命+${core.values.greenPotion * core.status.thisMap.ratio}",
"sword0": ",攻击+0",
"sword1": ",攻击+10",
"sword2": ",攻击+20",
"sword3": ",攻击+40",
"sword4": ",攻击+80",
"sword5": ",攻击+100",
"shield0": ",防御+0",
"shield1": ",防御+10",
"shield2": ",防御+20",
"shield3": ",防御+40",
"shield4": ",防御+80",
"shield5": ",防御+100护盾+100",
"bigKey": ",全钥匙+1",
"superPotion": ",生命值翻倍",
"silverCoin": ",金币+500"
},
"useItemEffect": {
"book": "core.ui.drawBook(0);",
@ -372,7 +396,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"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})();",
"freezeBadge": "(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 + '使用成功');",
@ -388,10 +412,10 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"bluePotion": "core.status.hero.hp += core.values.bluePotion",
"greenPotion": "core.status.hero.hp += core.values.greenPotion",
"yellowPotion": "core.status.hero.hp += core.values.yellowPotion",
"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": null,
"redGem": "core.status.hero.atk += core.values.redGem",
"blueGem": "core.status.hero.def += core.values.blueGem",
"greenGem": "core.status.hero.mdef += core.values.greenGem",
"yellowGem": 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": {
@ -404,7 +428,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"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",
"freezeBadge": "true",
"bigKey": "(function () {\n\treturn core.searchBlock('yellowDoor').length > 0;\n})();",
"poisonWine": "core.hasFlag('poison');",
"weakWine": "core.hasFlag('weak');",
@ -416,15 +440,15 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"bluePotion": "true",
"greenPotion": "true",
"yellowPotion": "true",
"redJewel": "true",
"blueJewel": "true",
"greenJewel": "true",
"yellowJewel": "true",
"redGem": "true",
"blueGem": "true",
"greenGem": "true",
"yellowGem": "true",
"skill1": "true"
},
"equipCondition": {},
"useItemEvent": {
"yellowJewel": [
"yellowGem": [
{
"type": "choices",
"choices": [

View File

@ -1,8 +1,8 @@
var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
{
"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"]},
"1": {"cls":"animates","id":"yellowWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
"2": {"cls":"animates","id":"whiteWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
"3": {"cls":"animates","id":"blueWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
"4": {"cls":"animates","id":"star","name":"星空"},
"5": {"cls":"animates","id":"lava","name":"岩浆"},
"6": {"cls":"terrains","id":"ice"},
@ -11,9 +11,9 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"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":"咒网"},
"12": {"cls":"animates","id":"poisonNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行毒处理\n\tif (!core.hasItem('amulet')) {\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('amulet')) {\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('amulet')) {\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"},
@ -23,10 +23,10 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"24": {"cls":"items","id":"greenKey"},
"25": {"cls":"items","id":"steelKey"},
"26": {"cls":"items","id":"bigKey"},
"27": {"cls":"items","id":"redJewel"},
"28": {"cls":"items","id":"blueJewel"},
"29": {"cls":"items","id":"greenJewel"},
"30": {"cls":"items","id":"yellowJewel"},
"27": {"cls":"items","id":"redGem"},
"28": {"cls":"items","id":"blueGem"},
"29": {"cls":"items","id":"greenGem"},
"30": {"cls":"items","id":"yellowGem"},
"31": {"cls":"items","id":"redPotion"},
"32": {"cls":"items","id":"bluePotion"},
"33": {"cls":"items","id":"greenPotion"},
@ -50,7 +50,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"51": {"cls":"items","id":"upFly"},
"52": {"cls":"items","id":"downFly"},
"53": {"cls":"items","id":"coin"},
"54": {"cls":"items","id":"snow"},
"54": {"cls":"items","id":"freezeBadge"},
"55": {"cls":"items","id":"cross"},
"56": {"cls":"items","id":"superPotion"},
"57": {"cls":"items","id":"earthquake"},
@ -58,9 +58,9 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"59": {"cls":"items","id":"weakWine"},
"60": {"cls":"items","id":"curseWine"},
"61": {"cls":"items","id":"superWine"},
"62": {"cls":"items","id":"knife"},
"63": {"cls":"items","id":"moneyPocket"},
"64": {"cls":"items","id":"shoes"},
"62": {"cls":"items","id":"dagger"},
"63": {"cls":"items","id":"silverCoin"},
"64": {"cls":"items","id":"amulet"},
"65": {"cls":"items","id":"hammer"},
"68": {"cls":"items","id":"lifeWand"},
"69": {"cls":"items","id":"jumpShoes"},
@ -68,12 +68,12 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"71": {"cls":"items","id":"shield0"},
"72": {"cls":"items","id":"skill1"},
"73": {"cls":"items","id":"wand"},
"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":"铁门"},
"81": {"cls":"animates","id":"yellowDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"yellowKey":1}},"name":"黄门"},
"82": {"cls":"animates","id":"blueDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"blueKey":1}},"name":"蓝门"},
"83": {"cls":"animates","id":"redDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"redKey":1}},"name":"红门"},
"84": {"cls":"animates","id":"greenDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"greenKey":1}},"name":"绿门"},
"85": {"cls":"animates","id":"specialDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"specialKey":1}},"name":"机关门"},
"86": {"cls":"animates","id":"steelDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"steelKey":1}},"name":"铁门"},
"87": {"cls":"terrains","id":"upFloor","canPass":true},
"88": {"cls":"terrains","id":"downFloor","canPass":true},
"89": {"cls":"animates","id":"portal","canPass":true},
@ -86,26 +86,31 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"102": {"cls":"animates","id":"crystalBottom"},
"103": {"cls":"animates","id":"fire"},
"104": {"cls":"animates","id":"switch"},
"105": {"cls":"animates","id":"steelDoor2","doorInfo":[{},"door.mp3","door.mp3"],"animate":1,"trigger":"openDoor"},
"106": {"cls":"animates","id":"steelDoor3","doorInfo":[{},"door.mp3","door.mp3"],"animate":1,"trigger":"openDoor"},
"107": {"cls":"animates","id":"iceDoor","doorInfo":[{},"door.mp3","door.mp3"],"animate":1,"trigger":"openDoor"},
"108": {"cls":"animates","id":"iceDoor2","doorInfo":[{},"door.mp3","door.mp3"],"animate":1,"trigger":"openDoor"},
"105": {"cls":"animates","id":"steelDoor2","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
"106": {"cls":"animates","id":"steelDoor3","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
"107": {"cls":"animates","id":"iceDoor","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
"108": {"cls":"animates","id":"iceDoor2","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
"109": {"cls":"animates","id":"magentaWall","canBreak":true,"animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}}},
"121": {"cls":"npcs","id":"man"},
"122": {"cls":"npcs","id":"woman"},
"122": {"cls":"npcs","id":"trader"},
"123": {"cls":"npcs","id":"thief"},
"124": {"cls":"npcs","id":"fairy"},
"125": {"cls":"npcs","id":"magician"},
"126": {"cls":"npcs","id":"womanMagician"},
"127": {"cls":"npcs","id":"oldMan"},
"128": {"cls":"npcs","id":"child"},
"129": {"cls":"npcs","id":"wood"},
"130": {"cls":"npcs","id":"pinkShop"},
"131": {"cls":"npcs","id":"blueShop"},
"125": {"cls":"npcs","id":"wizard"},
"126": {"cls":"npcs","id":"recluse"},
"127": {"cls":"npcs","id":"king"},
"128": {"cls":"npcs","id":"youngMan"},
"129": {"cls":"npcs","id":"sign"},
"130": {"cls":"npcs","id":"expShop"},
"131": {"cls":"npcs","id":"moneyShop"},
"132": {"cls":"npcs","id":"princess"},
"133": {"cls":"npc48","id":"npc0","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"}},
"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"}},
"133": {"cls":"npc48","id":"npc0","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1},
"134": {"cls":"npc48","id":"npc1","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1},
"135": {"cls":"npc48","id":"npc2","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1},
"136": {"cls":"npc48","id":"npc3","faceIds":{"down":"npc0","left":"npc1","right":"npc2","up":"npc3"},"animate":1},
"137": {"cls":"npcs","id":"greenMan"},
"138": {"cls":"npcs","id":"blueTrader"},
"139": {"cls":"npcs","id":"redMSNpc"},
"140": {"cls":"npcs","id":"blackTrader"},
"151": {"cls":"autotile","id":"autotile1"},
"152": {"cls":"autotile","id":"autotile2"},
"153": {"cls":"autotile","id":"autotile3"},
@ -135,8 +140,6 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"194": {"cls":"npcs","id":"dragonRight"},
"195": {"cls":"npcs","id":"dragonLeftBottom"},
"196": {"cls":"npcs","id":"dragonRightBottom"},
"197": {"cls":"npcs","id":"man2"},
"198": {"cls":"npcs","id":"woman2"},
"201": {"cls":"enemys","id":"greenSlime"},
"202": {"cls":"enemys","id":"redSlime"},
"203": {"cls":"enemys","id":"blackSlime"},
@ -196,7 +199,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"257": {"cls":"enemys","id":"dragon"},
"258": {"cls":"enemys","id":"octopus"},
"259": {"cls":"enemys","id":"fairyEnemy"},
"260": {"cls":"enemys","id":"greenKnight"},
"260": {"cls":"enemys","id":"princessEnemy"},
"261": {"cls":"enemy48","id":"angel"},
"262": {"cls":"enemy48","id":"elemental"},
"263": {"cls":"enemy48","id":"steelGuard"},
@ -206,21 +209,17 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"267": {"cls":"enemys","id":"grayRock"},
"268": {"cls":"enemys","id":"blueRock"},
"269": {"cls":"enemys","id":"skeletonLite"},
"270": {"cls":"enemys","id":"blueSkeleton"},
"270": {"cls":"enemys","id":"greenKnight"},
"271": {"cls":"enemys","id":"bowman"},
"272": {"cls":"enemys","id":"liteBowman"},
"273": {"cls":"enemys","id":"crismonZombie"},
"274": {"cls":"enemys","id":"frozenSkeleton"},
"275": {"cls":"enemys","id":"watcherSlime"},
"276": {"cls":"enemys","id":"mutantSlimeman"},
"277": {"cls":"enemys","id":"goldBat"},
"277": {"cls":"enemys","id":"frostBat"},
"278": {"cls":"enemys","id":"devilKnight"},
"279": {"cls":"enemys","id":"grayPriest"},
"280": {"cls":"enemys","id":"greenGT"},
"281": {"cls":"enemys","id":"pinkSoldier"},
"282": {"cls":"enemys","id":"pinkGhostSoldier"},
"283": {"cls":"enemys","id":"greenSoldier"},
"284": {"cls":"enemys","id":"greenGhostSoldier"},
"300": {"cls":"terrains","id":"ground"},
"301": {"cls":"terrains","id":"grass"},
"302": {"cls":"terrains","id":"grass2"},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 34 KiB

After

Width:  |  Height:  |  Size: 35 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 72 KiB

After

Width:  |  Height:  |  Size: 69 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 600 B

After

Width:  |  Height:  |  Size: 817 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 8.4 KiB

After

Width:  |  Height:  |  Size: 8.6 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 23 KiB

After

Width:  |  Height:  |  Size: 18 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 26 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 17 KiB

After

Width:  |  Height:  |  Size: 20 KiB

View File

@ -220,6 +220,49 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return null;
}
},
"removeMap": function () {
// 高层塔砍层插件,删除后不会存入存档,不可浏览地图也不可飞到。
// 推荐用法:
// 对于超高层或分区域塔当在1区时将2区以后的地图删除1区结束时恢复2区进二区时删除1区地图以此类推
// 这样可以大幅减少存档空间,以及加快存读档速度
// 删除楼层
// core.removeMaps("MT1", "MT300") 删除MT1~MT300之间的全部层
// core.removeMaps("MT10") 只删除MT10层
this.removeMaps = function (fromId, toId) {
toId = toId || fromId;
var fromIndex = core.floorIds.indexOf(fromId),
toIndex = core.floorIds.indexOf(toId);
if (toIndex < 0) toIndex = core.floorIds.length - 1;
flags.__removed__ = flags.__removed__ || [];
for (var i = fromIndex; i <= toIndex; ++i) {
var floorId = core.floorIds[i];
delete flags.__visited__[floorId];
flags.__removed__.push(floorId);
core.status.maps[floorId].deleted = true;
core.status.maps[floorId].canFlyTo = false;
core.status.maps[floorId].cannotViewMap = true;
}
}
// 恢复楼层
// core.resumeMaps("MT1", "MT300") 恢复MT1~MT300之间的全部层
// core.resumeMaps("MT10") 只恢复MT10层
this.resumeMaps = function (fromId, toId) {
toId = toId || fromId;
var fromIndex = core.floorIds.indexOf(fromId),
toIndex = core.floorIds.indexOf(toId);
if (toIndex < 0) toIndex = core.floorIds.length - 1;
flags.__removed__ = flags.__removed__ || [];
for (var i = fromIndex; i <= toIndex; ++i) {
var floorId = core.floorIds[i];
flags.__removed__ = flags.__removed__.filter(function (f) { return f != floorId; });
if (core.status.maps[floorId].deleted) {
core.status.maps[floorId] = core.loadFloor(floorId);
}
}
}
},
"itemShop": function () {
// 道具商店相关的插件
@ -618,41 +661,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
};
};
// 其实只注释了最后一行,只能这样了
control.drawHero = function (status, offset) {
if (!core.isPlaying() || !core.status.floorId || core.status.gameOver) return;
var x = core.getHeroLoc('x'),
y = core.getHeroLoc('y'),
direction = core.getHeroLoc('direction');
status = status || 'stop';
offset = offset || 0;
var way = core.utils.scan[direction];
var dx = way.x,
dy = way.y,
offsetX = dx * offset,
offsetY = dy * offset;
core.bigmap.offsetX = core.clamp((x - core.__HALF_SIZE__) * 32 + offsetX, 0, 32 * core.bigmap.width - core.__PIXELS__);
core.bigmap.offsetY = core.clamp((y - core.__HALF_SIZE__) * 32 + offsetY, 0, 32 * core.bigmap.height - core.__PIXELS__);
core.clearAutomaticRouteNode(x + dx, y + dy);
core.clearMap('hero');
if (!core.hasFlag('hideHero')) {
this._drawHero_getDrawObjs(direction, x, y, status, offset).forEach(function (block) {
core.drawImage('hero', block.img, block.heroIcon[block.status] * block.width,
block.heroIcon.loc * block.height, block.width, block.height,
block.posx + (32 - block.width) / 2, block.posy + 32 - block.height, block.width, block.height);
});
}
core.control.updateViewport();
//core.setGameCanvasTranslate('hero', 0, 0);
};
// 复写转发
core.drawHero = function (status, offset) {
return core.control.drawHero(status, offset);
};
// 创建摄像机对象
this.camera = new this.Camera();
@ -661,13 +669,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.camera.update();
};
core.control._drawHero_updateViewport = function () {
core.control.updateViewport();
}
// 代理原本的镜头事件
control.updateViewport = function () {
core.control.updateViewport = function () {
core.plugin.camera.requestCameraUpdate();
};
// 更变楼层的行为追加,重置镜头
events.prototype.changingFloor = function (floorId, heroLoc) {
core.events.changingFloor = function (floorId, heroLoc) {
this.eventdata.changingFloor(floorId, heroLoc);
core.plugin.camera.resetCamera();
};

14
runtime.d.ts vendored
View File

@ -42,7 +42,7 @@ type Animate = {
type Floor = {
title: string,
item_ratio: number
ratio: number
}
type ResolvedMap = {
@ -221,9 +221,7 @@ type gameStatus = {
toolsBackground: string
borderColor: string
statusBarColor: string
hardLabelColor: string
floorChangingBackground: string
floorChangingTextColor: string
floorChangingStyle: string
font: string
}
curtainColor: null
@ -652,9 +650,9 @@ declare class events {
/**
*
* @example core.setFloorInfo('item_ratio', 2, 'MT0'); // 把主塔0层的血瓶和宝石变为双倍效果
* @param name 'title','name','canFlyTo','canUseQuickShop','cannotViewMap','cannotMoveDirectly','upFloor','downFloor','defaultGround','images','color','weather','bgm','item_ratio','underGround'
* @param values 'title''name''defaultGround''bgm''underGround''canXxx''xxxFloor''item_ratio'
* @example core.setFloorInfo('ratio', 2, 'MT0'); // 把主塔0层的血瓶和宝石变为双倍效果
* @param name 'title','name','canFlyTo','canUseQuickShop','cannotViewMap','cannotMoveDirectly','upFloor','downFloor','defaultGround','images','color','weather','bgm','ratio','underGround'
* @param values 'title''name''defaultGround''bgm''underGround''canXxx''xxxFloor''ratio'
* @param floorId id
* @param prefix
*/
@ -1542,7 +1540,7 @@ declare class utils {
/**
* 适用于global:xxx
* @example if (core.getGlobal('一周目已通关', false) === true) core.getItem('knife'); // 二周目游戏进行到此处时会获得一把屠龙匕首
* @example if (core.getGlobal('一周目已通关', false) === true) core.getItem('dagger'); // 二周目游戏进行到此处时会获得一把屠龙匕首
* @param key
* @param defaultValue nullundefined时
* @returns

View File

@ -74,7 +74,7 @@
color: #fff;
font-size: 0.6rem;
position: absolute;
top: 8%;
top: 10%;
left: 5%;
z-index: 15;
}
@ -295,27 +295,22 @@ 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 {

View File

@ -8,7 +8,7 @@
(已完成!) 7. 建议把core.playBgm(bgm, startTime)的startTime参数在事件中也提供出来以用于一些演出比如适当的剧情处直接从高潮开始。同理可以让“暂停背景音乐”记录下当前播放到了第几秒并在“恢复背景音乐”中自动从这个秒数恢复。作者还可以手动配合音量渐变效果
(已完成!) 8. 系统设置菜单中“音量”和“步时”的点击区并不是根据文本长度自动适配的,这导致作者修改文本(包括但不限于翻译)后玩家难以找到准确的点击区,建议优化
(已完成!) 9. 建议给“显示选择项”、“显示确认框”、“等待用户操作”这三个事件添加一个“若多少毫秒内不响应则触发的分支”用来实现一些如新新2的QTE录像中可以记录“choice: timeout”、“confirm: timeout”和“wait: timeout”来表示触发了超时分支
10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点
(已完成!) 10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点
(已完成!) 11. 建议修复勇士后退时跟随者的鬼畜行为并推出一套能够对跟随者位置和朝向进行读写的API甚至事件且允许这些信息被计入存档以实现一些演出效果甚至游戏要素如新新2用公主占位防冰块
(已完成!) 12. “设置怪物属性”事件的下拉框目前只支持一部分另一部分只能通过手敲json再解析来得到希望提供完整支持
(已完成!) 13. 建议给core.moveAction(callback)提供对应的事件,用于在事件中让勇士像事件外一样移动,从而正常触发跑毒和阻激夹域捕等
@ -28,7 +28,7 @@
(已完成!) 清除最近使用图块
(已完成!) cannotIn / cannotOut使用选项框
(已完成!) noPass->canPass改成选择框
初始化&读档优化:不一次读取全部楼层并创建
(已完成!) 初始化&读档优化:不一次读取全部楼层并创建
(已完成!) 绿钥匙进状态栏
(已完成!) 图块ID不可全数字
(已完成!) 怪物详细信息富文本化
@ -44,23 +44,34 @@
(已完成!) 重构全局商店!
(已完成!) 读档时色调数据丢失
(已完成!) 圆角边框
像素高分辨率问题
(不处理) 像素高分辨率问题
(已完成!) 道具效果优化,删除部分道具相关的开关
(已完成!) 素材列表选择
(已完成!) 油漆桶,动态更改地图大小
地图拉框选择复制剪切删除
(已完成!) 地图拉框选择复制剪切删除
(已完成!) 额外素材区拖动选择一个区域
(已完成!) 素材替换
大屏幕下放大游戏界面
(已完成!) 大屏幕下放大游戏界面
(已完成!) 最近使用/最常使用的图块
(已完成!) loader并行加载
合并items.js
(已完成!) 增加fonts目录全塔属性增加fonts引用
(已完成!) 右边框输入完后解析按钮高亮
32x48的门
(已完成!) 32x48的门
(已完成!) 难度分歧的图块颜色含SL界面
(已完成!) 装备同时加属性和比例
(已完成!) removeMap和resumeMap
(已完成!) 右键图块选择复制/粘贴事件
(已完成!) showImage, drawImage立绘等加上对称选项
(已完成!) 更多的图块blockly化
(已完成!) 勇士帧动画
(不处理;现在静止状态可以有帧动画了,所以不考虑行走过程动画) 行走动画
(已完成!) 合并main中一些设置内容
(已完成!) \t[this], 勇士朝下flag:arg清理瞬移扣血
-------------
(不处理) 0. 部分文案的修改,如“地图编辑器”(启动服务.exe中、“enemys”、“snipe”
(不处理) 0. 部分文案的修改,如“地图编辑器”(启动服务.exe中、“enemys”、“repulse”
(造塔工具相关都给鹿神) 1. 便捷PS工具希望加入自定义单位宽高功能希望把“白底转透明”增强为“纯色底转透明”弹窗由作者输入RGB或RGBA值
(已修复) 2. 请求修复如果还没修复新建单张空白地图无法自定义宽高的bug
(文档相关给秋橙) 3. 希望给M键“追加素材”功能写个更详细的说明在线文档中没有所以离线文档中也没写成
@ -90,7 +101,7 @@
(已完成!) 27. 勇士后退时跟随者很鬼畜,建议优化(每步聚集算是一种简陋的办法)
(不处理) 28. 勇士的移动帧只有2建议改为允许作者指定
(不处理) 29. 建议加一对“勇士开始抖动”和“勇士停止抖动”事件指令,来让勇士像图块一样原地抖动(即全局动画)。目前这个效果还只能通过隐藏勇士(或切换透明行走图)并转变图块/图层块来实现且只能用于事件处理中QAQ
30. 建议加一个“视角锁定”事件指令,从而允许用事件改变勇士位置、朝向或行走图时不会使视角重置到以其为中心,用于一些演出效果
(不处理) 30. 建议加一个“视角锁定”事件指令,从而允许用事件改变勇士位置、朝向或行走图时不会使视角重置到以其为中心,用于一些演出效果
(已完成!) 31. 楼层切换事件绿点一旦使用blockly编辑就会无视全塔属性的切换时间只能手动在表格中删除时间数据相关“楼层切换”事件指令也有这个问题有群友还希望这个默认时间能像步时和音量一样由玩家设定来节约拆塔时间。使用blockly编辑也无法做出“ignoretrue”的效果用来覆盖全塔属性的禁止穿透建议优化
(已完成!) 32. 关于CC的来回回档优化版据其称清空存档后会出现bug此外他使用了W键导致二倍斩失效了js的switch语句遇到duplicate cases居然不报错吗...
(已完成!) 33. 疑似已被CC修复楼传平面塔模式在记录离开位置时会错误地把读档也算作离开
@ -114,7 +125,7 @@
(已修复!) 49. 系统设置菜单中音量和步时的点击区并不是根据文本长度自动适配的,这导致作者修改文本(包括但不限于翻译)后玩家难以找到准确的点击区,建议优化
(不处理) 50. 建议给录像播放时的N键提供一个对应的移动端操作以方便移动端作者
(已完成!) 51. 希望给“显示选择项”、“显示确认框”、“等待用户操作”这三个事件添加一个“若多少毫秒内不响应则触发的分支”用来实现一些QTE录像中可以记录“choice: timeout”、“confirm: timeout”和“wait: timeout”来表示触发了超时分支
52. 希望给“转变图块”加一个淡入时间参数显隐和转变图层块也希望加个淡入淡出时间参数图层块也希望提供移动和跳跃事件专门用于原本是空地或空气墙的情况。目前要实现这样的效果必须使用红点然而红点有着“推箱子、阻击、捕捉、重生、炸锤和afterXxx事件”的系列问题且会导致core.removeBlock()隐藏事件退化为core.hideBlock()
(已完成!) 52. 希望给“转变图块”加一个淡入时间参数显隐和转变图层块也希望加个淡入淡出时间参数图层块也希望提供移动和跳跃事件专门用于原本是空地或空气墙的情况。目前要实现这样的效果必须使用红点然而红点有着“推箱子、阻击、捕捉、重生、炸锤和afterXxx事件”的系列问题且会导致core.removeBlock()隐藏事件退化为core.hideBlock()
(不处理) 53. 希望“移动事件”的移速和淡出速度拆开成两个参数,目前这样捆绑在一起不太自由
(已完成) 54. 建议把图块属性的noPass改为勾选框而不是下拉框因为null一定表示不可通行道具根本没有noPass
(不处理,可以转变图块) 55. “移动事件”和“跳跃事件”会导致本来勾选了不显伤的怪物突然有了显伤,非常难看,建议优化
@ -132,7 +143,7 @@
(不处理) 67. “画面震动”事件希望不要光左右晃至少做成QQ窗口抖动的效果吧w
(不处理) 68. “自动存档”事件希望加一个“读此档后打断当前事件”的勾选项,否则这种自动存档用于强制战斗之前就没什么意义了,读了档还是会强制战斗。录像兼容性方面,不知道如果这种自动存档只用于事件开头是不是就不会有问题
(已修复!) 69. “等待用户操作”虽然提供了场合块但还不支持将多个按键的场合合并比如空格、回车和C键一般会被作者予以合并执行内容如果只是大致相同也值得合并在块内再行分歧希望支持一下
70. “显隐勇士”事件指令希望加个淡入淡出时间参数
(已完成!) 70. “显隐勇士”事件指令希望加个淡入淡出时间参数
(不处理,请用等待事件) 1. 希望给core.drawTip()和core.playSound()出个同步版本,目前只有异步版本,后者如果要模拟同步就得绑在一个透明动画上
(已完成!) 72. “绘制描边文本”事件希望加一个“描边颜色”参数,目前只能描黑边
(已完成!) 73. 画弧既然有现成的API那建议也作为UI绘制事件提供。甚至希望提供画椭圆功能长短轴水平或铅直的那种参数为中心坐标和长短轴长度

View File

@ -41,7 +41,7 @@ V2.6.6 -> V2.7 接档说明:
5. 使用VSCode分别打开接档后的V2.7和纯净的V2.7的【project/items.js】并执行以下操作
- 将三色钥匙的cls从"keys"改成"tools",并新增 "hideInToolbox": true
- 如下道具的【useItemEffect】和【canUseItemEffect】有所改变请直接从纯净的V2.7覆盖到你要接档的V2.7
- earthquake, pickaxe, icePickaxe, snow, bigKey, bomb, upFly, downFly
- earthquake, pickaxe, icePickaxe, freezeBadge, bigKey, bomb, upFly, downFly
- 如果确认你的塔不会使用该道具,可忽略
- 黄宝石和生命魔杖增加了【useItemEvent】如需使用请进行复制
@ -49,7 +49,7 @@ V2.6.6 -> V2.7 接档说明:
- 找到【terrains】中的三色墙和六色门删除对应的这几行
- yellowWall, blueWall, whiteWall, yellowDoor, blueDoor, redDoor, greenDoor, specialDoor, steelDoor
- 在V2.7中terrains不再保留门的引用门效果仅由animates决定
- 将【terrains】中的 blueShop-left, blueShop-right, pinkShop-left, pinkShop-right 分别重命名为
- 将【terrains】中的 moneyShop-left, moneyShop-right, expShop-left, expShop-right 分别重命名为
blueShopLeft, blueShopRight, pinkShopLeft, pinkShopRight
7. 使用VSCode分别打开接档后的V2.7和纯净的V2.7的【project/maps.js】并执行以下操作
@ -87,5 +87,8 @@ V2.6.6 -> V2.7 接档说明:
- 「重启当前事件」已经被删除并且无法在游戏中使用。请替换成等价的循环处理或者插入事件
- 在V2.7中所有的experience全部改名exp请检查所有对经验值进行操作的地方
其他:
Jewel改名Gem
道具效果提示文字replaceText