diff --git a/main.js b/main.js index eeead2e..8ffbb4b 100644 --- a/main.js +++ b/main.js @@ -560,10 +560,10 @@ main.prototype.listen = function () { (main.dom.startButtons.style.display == 'block' || main.dom.levelChooseButtons.style.display == 'block') ) { - if (e.keyCode == 38 || e.keyCode == 33) + if (e.keyCode == 38 || e.keyCode == 37 || e.keyCode == 33) // up/pgup main.selectButton((main.selectedButton || 0) - 1); - else if (e.keyCode == 40 || e.keyCode == 34) + else if (e.keyCode == 40 || e.keyCode == 39 || e.keyCode == 34) // down/pgdn main.selectButton((main.selectedButton || 0) + 1); else if (e.keyCode == 67 || e.keyCode == 13 || e.keyCode == 32) diff --git a/project/data.js b/project/data.js index 3363902..9d2ed54 100644 --- a/project/data.js +++ b/project/data.js @@ -40,6 +40,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "4.jpg", "5.jpg", "6.jpeg", + "641-e.jpg", + "641-h.jpg", "7.jpg", "8.jpg", "9.jpeg", @@ -172,7 +174,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "startBackground": "project/images/bg.jpg", "startVerticalBackground": "project/images/bg.jpg", "startLogoStyle": "color: white", - "startButtonsStyle": "background-color: #32369F; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 2px solid; caret-color: #FFD700;", + "startButtonsStyle": "background-color: #32369F00; opacity: 0.85; color: #FFFFFF; border: #FFFFFF 0px solid; caret-color: #FFD700;", "statusLeftBackground": "url(project/materials/ground.png) repeat", "statusTopBackground": "url(project/materials/ground.png) repeat", "toolsBackground": "black", @@ -903,9 +905,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "enableAddPoint": false, "enableNegativeDamage": false, "betweenAttackMax": false, - "useLoop": false, + "useLoop": true, "startUsingCanvas": false, - "statusCanvas": false, + "statusCanvas": true, "enableEnemyPoint": false, "enableGentleClick": false, "ignoreChangeFloor": true, diff --git a/project/floors/MT0.js b/project/floors/MT0.js index 3ec226a..f780c4a 100644 --- a/project/floors/MT0.js +++ b/project/floors/MT0.js @@ -72,6 +72,295 @@ main.floors.MT0= 2 ] } + ], + "5,6": [ + { + "type": "if", + "condition": "(flag:hard==3)", + "true": [ + { + "type": "choices", + "text": "\t[bdf,hero]各测塔员成绩", + "choices": [ + { + "text": "星宫白 - 1", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "1" + }, + { + "type": "setValue", + "name": "status:mdef", + "operator": "+=", + "value": "3" + } + ] + }, + { + "text": "鸣 - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "-1" + } + ] + }, + { + "text": "yztm889 - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "-2" + } + ] + }, + { + "text": "顾 - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "-3" + } + ] + }, + { + "text": "Farewell - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "-4" + } + ] + }, + { + "text": "(主角) bdf - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "-5" + } + ] + }, + { + "text": "α - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "-6" + } + ] + }, + { + "text": "(作者) 王州 - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "-7" + } + ] + }, + { + "text": "迷迭香 - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "-8" + } + ] + } + ] + } + ], + "false": [ + { + "type": "choices", + "text": "\t[bdf,hero]各测塔员成绩", + "choices": [ + { + "text": "星宫白 - 124", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "124" + } + ] + }, + { + "text": "鸣 - 114", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "114" + } + ] + }, + { + "text": "yztm889 - 112", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "112" + } + ] + }, + { + "text": "顾 - 110", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "110" + } + ] + }, + { + "text": "Farewell - 102", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "102" + } + ] + }, + { + "text": "(主角) bdf - 28", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "28" + } + ] + }, + { + "text": "α - 19", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "19" + } + ] + }, + { + "text": "(作者) 王州 - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "1" + } + ] + }, + { + "text": "迷迭香 - 过不去", + "action": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "-1" + } + ] + } + ] + } + ] + }, + { + "type": "if", + "condition": "(flag:lhjnb>0)", + "true": [ + { + "type": "setValue", + "name": "status:exp", + "operator": "+=", + "value": "67" + }, + { + "type": "setValue", + "name": "status:atk", + "operator": "+=", + "value": "30" + }, + { + "type": "setValue", + "name": "status:def", + "operator": "+=", + "value": "30" + }, + { + "type": "setValue", + "name": "status:mdef", + "operator": "+=", + "value": "81" + }, + { + "type": "sleep", + "time": 50 + }, + { + "type": "setValue", + "name": "status:hp", + "value": "1" + }, + { + "type": "setValue", + "name": "status:exp", + "operator": "+=", + "value": "1" + }, + { + "type": "sleep", + "time": 50 + }, + { + "type": "setValue", + "name": "status:hp", + "operator": "+=", + "value": "flag:lhjnb" + }, + { + "type": "setValue", + "name": "status:hp", + "operator": "-=", + "value": "1" + }, + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "4" + }, + { + "type": "changeFloor", + "floorId": "MT10", + "loc": [ + 6, + 2 + ] + } + ], + "false": [ + { + "type": "setValue", + "name": "flag:lhjnb", + "value": "0" + } + ] + } ] }, "changeFloor": {}, diff --git a/project/floors/MT1.js b/project/floors/MT1.js index d2d98a8..040ba08 100644 --- a/project/floors/MT1.js +++ b/project/floors/MT1.js @@ -29,7 +29,11 @@ main.floors.MT1= "type": "changePos", "direction": "down" }, - "从这层开始的三层,到了下一层都不能返回,铁门需要你击败所有的怪物。" + "从这层开始的三层,到了下一层都不能返回,铁门需要你击败所有的怪物。", + { + "type": "function", + "function": "function(){\ncore.plugin.displayChapter(\"第一篇\", \"婴儿\")\n}" + } ], "eachArrive": [], "parallelDo": "var lastTime = core.getFlag('lastTime', 0);\n\nif (timestamp - lastTime > 60) {\n\tvar image = core.material.images.images[\"8.jpg\"];\n\tvar width = 416,\n\t\theight = 416;\n\n\tcore.canvas.bg.translate(width / 2, height / 2);\n\tcore.canvas.bg.rotate(Math.PI / 180 / 6);\n\tcore.canvas.bg.translate(-width / 2, -height / 2);\n\tcore.canvas.bg.drawImage(image, -296, -88);\n\n\tcore.setFlag('lastTime', timestamp);\n\n\tvar rotateTime = core.getFlag('rotateTime', 0);\n\trotateTime += 1;\n\tif (rotateTime >= 6 * 180) {\n\t\trotateTime -= 6 * 180;\n\t}\n\tcore.setFlag('rotateTime', rotateTime);\n}", diff --git a/project/floors/ND1.js b/project/floors/ND1.js index a03ea53..59d294d 100644 --- a/project/floors/ND1.js +++ b/project/floors/ND1.js @@ -58,7 +58,7 @@ main.floors.ND1= }, { "type": "function", - "function": "function(){\ncore.status.hard = 'Easy';\n}" + "function": "function(){\ncore.status.hard = 'Easy';\nflags.__hardColor__ = 'green'\n//core.setGlobalAttribute(\"borderColor\", \"#8ee877\");\ncore.setGlobalAttribute(\"statusLeftBackground\", \"url(project/images/641-e.jpg)0% 0%/auto 100% repeat\");\ncore.setGlobalAttribute(\"statusTopBackground\", \"url(project/images/641-e.jpg)0% 0%/auto 100% repeat\");\n}" }, { "type": "break", @@ -90,7 +90,7 @@ main.floors.ND1= }, { "type": "function", - "function": "function(){\ncore.status.hard = 'Hard';\n}" + "function": "function(){\ncore.status.hard = 'Hard';\n//core.setGlobalAttribute(\"borderColor\", \"#ea7888\");\ncore.setGlobalAttribute(\"statusLeftBackground\", \"url(project/images/641-h.jpg)0% 0%/auto 100% repeat\");\ncore.setGlobalAttribute(\"statusTopBackground\", \"url(project/images/641-h.jpg)0% 0%/auto 100% repeat\");\n}" }, { "type": "break", diff --git a/project/functions.js b/project/functions.js index 299ae53..63885bc 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1,8 +1,7 @@ -/// -var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = +var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { - "events": { - "resetGame": function (hero, hard, floorId, maps, values) { + "events": { + "resetGame": function (hero, hard, floorId, maps, values) { // 重置整个游戏;此函数将在游戏开始时,或者每次读档时最先被调用 // hero:勇士信息;hard:难度;floorId:当前楼层ID;maps:地图信息;values:全局数值信息 @@ -52,7 +51,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 隐藏右下角的音乐按钮 core.dom.musicBtn.style.display = 'none'; }, - "win": function (reason, norank, noexit) { + "win": function (reason, norank, noexit) { // 游戏获胜事件 // 请注意,成绩统计时是按照hp进行上传并排名 // 可以先在这里对最终分数进行计算,比如将2倍攻击和5倍黄钥匙数量加到分数上 @@ -81,7 +80,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = }) }); }, - "lose": function (reason) { + "lose": function (reason) { // 游戏失败事件 core.ui.closePanel(); var replaying = core.isReplaying(); @@ -94,7 +93,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = }); }) }, - "changingFloor": function (floorId, heroLoc) { + "changingFloor": function (floorId, heroLoc) { // 正在切换楼层过程中执行的操作;此函数的执行时间是“屏幕完全变黑“的那一刻 // floorId为要切换到的楼层ID;heroLoc表示勇士切换到的位置 @@ -162,7 +161,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // ...可以新增一些其他内容,比如创建个画布在右上角显示什么内容等等 }, - "afterChangeFloor": function (floorId) { + "afterChangeFloor": function (floorId) { // 转换楼层结束的事件;此函数会在整个楼层切换完全结束后再执行 // floorId是切换到的楼层 @@ -181,7 +180,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } } }, - "flyTo": function (toId, callback) { + "flyTo": function (toId, callback) { // 楼层传送器的使用,从当前楼层飞往toId // 如果不能飞行请返回false @@ -224,7 +223,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = return true; }, - "beforeBattle": function (enemyId, x, y) { + "beforeBattle": function (enemyId, x, y) { // 战斗前触发的事件,可以加上一些战前特效(详见下面支援的例子) // 此函数在“检测能否战斗和自动存档”【之后】执行。如果需要更早的战前事件,请在插件中覆重写 core.events.doSystemEvent 函数。 // 返回true则将继续战斗,返回false将不再战斗。 @@ -255,7 +254,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = return true; }, - "afterBattle": function (enemyId, x, y) { + "afterBattle": function (enemyId, x, y) { // 战斗结束后触发的事件 var enemy = core.material.enemys[enemyId]; @@ -426,7 +425,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.clearContinueAutomaticRoute(); }, - "afterOpenDoor": function (doorId, x, y) { + "afterOpenDoor": function (doorId, x, y) { // 开一个门后触发的事件 var todo = []; @@ -447,7 +446,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = else core.clearContinueAutomaticRoute(); }, - "afterGetItem": function (itemId, x, y, isGentleClick) { + "afterGetItem": function (itemId, x, y, isGentleClick) { // 获得一个道具后触发的事件 // itemId:获得的道具ID;x和y是该道具所在的坐标 // isGentleClick:是否是轻按触发的 @@ -469,7 +468,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (todo.length > 0) core.insertAction(todo, x, y); }, - "afterPushBox": function () { + "afterPushBox": function () { // 推箱子后的事件 if (core.searchBlock('box').length == 0) { // 可以通过if语句来进行开门操作 @@ -482,9 +481,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = */ } } - }, - "enemys": { - "getSpecials": function () { + }, + "enemys": { + "getSpecials": function () { // 获得怪物的特殊属性,每一行定义一个特殊属性。 // 分为五项,第一项为该特殊属性的数字,第二项为特殊属性的名字,第三项为特殊属性的描述 // 第四项为该特殊属性的颜色,可以写十六进制 #RRGGBB 或者 [r,g,b,a] 四元数组 @@ -520,7 +519,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = [27, "捕捉", function (enemy) { return "当走到怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时会强制进行战斗。"; }, "#c0ddbb"] ]; }, - "getEnemyInfo": function (enemy, hero, x, y, floorId) { + "getEnemyInfo": function (enemy, hero, x, y, floorId) { // 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用 // 例如:坚固、模仿、仿攻等等 // @@ -643,7 +642,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = "guards": guards, // 返回支援情况 }; }, - "getDamageInfo": function (enemy, hero, x, y, floorId) { + "getDamageInfo": function (enemy, hero, x, y, floorId) { // 获得战斗伤害信息(实际伤害计算函数) // // 参数说明: @@ -801,9 +800,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = "damage": Math.floor(damage) }; } - }, - "actions": { - "onKeyUp": function (keyCode, altKey) { + }, + "actions": { + "onKeyUp": function (keyCode, altKey) { // 键盘按键处理,可以在这里自定义快捷键列表 // keyCode:当前按键的keyCode(每个键的keyCode自行百度) // altKey:Alt键是否被按下,为true代表同时按下了Alt键 @@ -954,7 +953,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } }, - "onStatusBarClick": function (px, py, vertical) { + "onStatusBarClick": function (px, py, vertical) { // 点击状态栏时触发的事件,仅在自绘状态栏开启时生效 // px和py为点击的像素坐标 // vertical为录像播放过程中的横竖屏信息 @@ -1022,9 +1021,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = */ } - }, - "control": { - "saveData": function () { + }, + "control": { + "saveData": function () { // 存档操作,此函数应该返回“具体要存档的内容” // 差异化存储values @@ -1049,7 +1048,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = return data; }, - "loadData": function (data, callback) { + "loadData": function (data, callback) { // 读档操作;从存储中读取了内容后的行为 // 重置游戏和路线 @@ -1088,7 +1087,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (callback) callback(); }); }, - "getStatusLabel": function (name) { + "getStatusLabel": function (name) { // 返回某个状态英文名的对应中文标签,如atk -> 攻击,def -> 防御等。 // 请注意此项仅影响 libs/ 下的内容(如绘制怪物手册、数据统计等) // 自行定义的(比如获得道具效果)中用到的“攻击+3”等需要自己去对应地方修改 @@ -1109,7 +1108,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = steps: "步数", }[name] || name; }, - "triggerDebuff": function (action, type) { + "triggerDebuff": function (action, type) { // 毒衰咒效果的获得与解除 // action:获得还是解除;'get'表示获得,'remove'表示解除 // type:一个数组表示获得了哪些毒衰咒效果;poison, weak,curse @@ -1166,7 +1165,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (success) core.playSound('回血'); } }, - "updateStatusBar": function () { + "updateStatusBar": function () { // 更新状态栏 // 检查等级 @@ -1249,7 +1248,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // updateDamage只能在此处执行!!更新全地图显伤 core.updateDamage(); }, - "updateCheckBlock": function (floorId) { + "updateCheckBlock": function (floorId) { // 领域、夹击、阻击等的伤害值计算 floorId = floorId || core.status.floorId; if (!floorId || !core.status.maps) return; @@ -1460,7 +1459,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = cache: {} // clear cache }; }, - "moveOneStep": function (callback) { + "moveOneStep": function (callback) { // 勇士每走一步后执行的操作。callback为行走完毕后的回调 // 这个函数执行在“刚走完”的时候,即还没有检查该点的事件和领域伤害等。 // 请注意:瞬间移动不会执行该函数。如果要控制能否瞬间移动有三种方法: @@ -1523,7 +1522,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 如需强行终止行走可以在这里条件判定: // core.stopAutomaticRoute(); }, - "moveDirectly": function (x, y, ignoreSteps) { + "moveDirectly": function (x, y, ignoreSteps) { // 瞬间移动;x,y为要瞬间移动的点;ignoreSteps为减少的步数,可能之前已经被计算过 // 返回true代表成功瞬移,false代表没有成功瞬移 @@ -1562,26 +1561,27 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } return false; }, - "parallelDo": function (timestamp) { - // 并行事件处理,可以在这里写任何需要并行处理的脚本或事件 - // 该函数将被系统反复执行,每次执行间隔视浏览器或设备性能而定,一般约为16.6ms一次 - // 参数timestamp为“从游戏资源加载完毕到当前函数执行时”的时间差,以毫秒为单位 + "parallelDo": function (timestamp) { + // 并行事件处理,可以在这里写任何需要并行处理的脚本或事件 + // 该函数将被系统反复执行,每次执行间隔视浏览器或设备性能而定,一般约为16.6ms一次 + // 参数timestamp为“从游戏资源加载完毕到当前函数执行时”的时间差,以毫秒为单位 - // 检查当前是否处于游戏开始状态 - if (!core.isPlaying()) return; + // 检查当前是否处于游戏开始状态 + if (!core.isPlaying()) return; - // 执行当前楼层的并行事件处理 - if (core.status.floorId) { - try { - eval(core.floors[core.status.floorId].parallelDo); - } catch (e) { - console.error(e); - } - } + // 执行当前楼层的并行事件处理 + if (core.status.floorId) { + try { + eval(core.floors[core.status.floorId].parallelDo); + } catch (e) { + console.error(e); } - }, - "ui": { - "getToolboxItems": function (cls) { + } + if (core.getFlag("dynHPneed")) core.updateStatusBar() +} + }, + "ui": { + "getToolboxItems": function (cls) { // 获得道具栏中当前某类型道具的显示项和显示顺序 // cls为道具类型,只可能是 tools, constants 和 equips // 返回一个数组,代表当前某类型道具的显示内容和顺序 @@ -1591,78 +1591,130 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = .filter(function (id) { return !core.material.items[id].hideInToolbox; }) .sort( /*function (id1, id2) { return core.material.items[id1].name <= core.material.items[id2].name ? -1 : 1 }*/); }, - "drawStatusBar": function () { - // 这真的是人能写出来的东西? - var ctx, fill = function (text, x, y, style) { - core.ui.setFont(ctx, (/\w+/.test(text) ? 'italic ' : '') + 'bold 18px Verdana'); - core.ui.fillBoldText(ctx, text, x, y, style); - }; - if (core.flags.statusCanvas) { // 系统开关「自绘状态栏」开启 - core.ui.clearMap(ctx = core.dom.statusCanvasCtx); // 清空状态栏 - core.ui.setFillStyle(ctx, core.status.globalAttribute.statusBarColor); - if (core.domStyle.isVertical) { // 竖屏 - core.drawImage(ctx, core.statusBar.icons.floor, 6, 6, 25, 25); - fill((core.status.thisMap || {}).name || "Loading", 42, 26); - core.drawImage(ctx, core.statusBar.icons.hp, 137, 6, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('hp')), 173, 26); - core.drawImage(ctx, core.statusBar.icons.atk, 268, 6, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('atk')), 304, 26); - core.drawImage(ctx, core.statusBar.icons.def, 6, 38, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('def')), 42, 58); - core.drawImage(ctx, core.statusBar.icons.mdef, 137, 38, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('mdef')), 173, 58); - core.drawImage(ctx, core.statusBar.icons.money, 268, 38, 25, 25); - fill(core.formatBigNumber(core.status.hero.money), 304, 58); - core.drawImage(ctx, core.statusBar.icons.exp, 6, 70, 25, 25); - fill(core.formatBigNumber(core.status.hero.exp), 42, 90); - } else if (!core.flags.hideLeftStatusBar) { // 横屏且未隐藏状态栏 - core.drawImage(ctx, core.statusBar.icons.floor, 6, 9, 25, 25); - fill((core.status.thisMap || {}).name || "Loading", 42, 29); - core.drawImage(ctx, core.statusBar.icons.hp, 6, 43, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('hp')), 42, 63); - core.drawImage(ctx, core.statusBar.icons.atk, 6, 77, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('atk')), 42, 97); - core.drawImage(ctx, core.statusBar.icons.def, 6, 111, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('def')), 42, 131); - core.drawImage(ctx, core.statusBar.icons.mdef, 6, 145, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('mdef')), 42, 165); - core.drawImage(ctx, core.statusBar.icons.money, 6, 179, 25, 25); - fill(core.formatBigNumber(core.status.hero.money), 42, 199); - core.drawImage(ctx, core.statusBar.icons.exp, 6, 213, 25, 25); - fill(core.formatBigNumber(core.status.hero.exp), 42, 233); - fill(core.setTwoDigits(core.itemCount('yellowKey')), 11, 267, '#FFCCAA'); - fill(core.setTwoDigits(core.itemCount('blueKey')), 46, 267, '#AAAADD'); - fill(core.setTwoDigits(core.itemCount('redKey')), 81, 267, '#FF8888'); - } - } else if (core.flags.hideLeftStatusBar && !core.domStyle.isVertical) { // 横屏且隐藏状态栏 - if (!core.dymCanvas['status']) - core.ui.createCanvas('status', 0, 0, core._PX_, core._PY_, 66); // 刚好盖过显伤层 - core.ui.clearMap(ctx = core.dymCanvas['status']); - core.ui.setFillStyle(ctx, core.status.globalAttribute.statusBarColor); - var offset = core.status.hero.loc.x - core.bigmap.offsetX / 32 >= core._HEIGHT_ ? 0 : core._PY_; - core.ui.setAlpha(ctx, 0.75); - core.ui.drawWindowSkin('winskin.png', ctx, offset, 0, core._PX_ - core._PY_, core._PY_); - core.ui.setAlpha(ctx, 1); - core.drawImage(ctx, core.statusBar.icons.floor, 6 + offset, 9, 25, 25); - fill((core.status.thisMap || {}).name || "Loading", 42 + offset, 29); - core.drawImage(ctx, core.statusBar.icons.hp, 6 + offset, 43, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('hp')), 42 + offset, 63); - core.drawImage(ctx, core.statusBar.icons.atk, 6 + offset, 77, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('atk')), 42 + offset, 97); - core.drawImage(ctx, core.statusBar.icons.def, 6 + offset, 111, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('def')), 42 + offset, 131); - core.drawImage(ctx, core.statusBar.icons.mdef, 6 + offset, 145, 25, 25); - fill(core.formatBigNumber(core.getRealStatus('mdef')), 42 + offset, 165); - core.drawImage(ctx, core.statusBar.icons.money, 6 + offset, 179, 25, 25); - fill(core.formatBigNumber(core.status.hero.money), 42 + offset, 199); - core.drawImage(ctx, core.statusBar.icons.exp, 6 + offset, 213, 25, 25); - fill(core.formatBigNumber(core.status.hero.exp), 42 + offset, 233); - fill(core.setTwoDigits(core.itemCount('yellowKey')), 11 + offset, 267, '#FFCCAA'); - fill(core.setTwoDigits(core.itemCount('blueKey')), 46 + offset, 267, '#AAAADD'); - fill(core.setTwoDigits(core.itemCount('redKey')), 81 + offset, 267, '#FF8888'); - } + "drawStatusBar": function () { + // 这真的是人能写出来的东西? + var ctx, fill = function (text, x, y, style) { + core.ui.setFont(ctx, (/\w+/.test(text) ? ' ' : '') + '20px 得意黑'); + core.ui.fillText(ctx, text, x, y, style); }, - "drawStatistics": function () { + fill1 = function (text, x, y, style) { + core.ui.setFont(ctx, (/\w+/.test(text) ? ' ' : '') + '12px 得意黑'); + core.ui.fillText(ctx, text, x, y, style); + }; + core.ui.clearMap(ctx = core.dom.statusCanvasCtx); + if (core.status.hero.flags.hideStatusBar) return; + if (core.flags.statusCanvas) { // 系统开关「自绘状态栏」开启 + core.ui.clearMap(ctx = core.dom.statusCanvasCtx); // 清空状态栏 + core.ui.setFillStyle(ctx, core.status.globalAttribute.statusBarColor); + if (core.domStyle.isVertical) { // 竖屏 + core.drawImage(ctx, core.statusBar.icons.floor, 6, 6, 25, 25); + fill((core.status.thisMap || {}).name || "Loading", 42, 26); + core.drawImage(ctx, core.statusBar.icons.hp, 137, 6, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('hp')), 173, 26); + core.drawImage(ctx, core.statusBar.icons.atk, 268, 6, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('atk')), 304, 26); + core.drawImage(ctx, core.statusBar.icons.def, 6, 38, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('def')), 42, 58); + core.drawImage(ctx, core.statusBar.icons.mdef, 137, 38, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('mdef')), 173, 58); + core.drawImage(ctx, core.statusBar.icons.money, 268, 38, 25, 25); + fill(core.formatBigNumber(core.status.hero.money), 304, 58); + core.drawImage(ctx, core.statusBar.icons.exp, 6, 70, 25, 25); + fill(core.formatBigNumber(core.status.hero.exp), 42, 90); + } else if (!core.flags.hideLeftStatusBar) { // 横屏且未隐藏状态栏 + core.drawIcon(ctx, 18, 6, 5, 25, 25); + core.drawIcon(ctx, 34, 6, 35, 25, 25); + core.drawIcon(ctx, 27, 6, 65, 25, 25); + core.drawIcon(ctx, 28, 6, 95, 25, 25); + core.drawIcon(ctx, 29, 6, 125, 25, 25); + + fill((core.status.thisMap || {}).name || "Loading", 42, 25); + //core.drawImage(ctx, core.statusBar.icons.hp, 6, 35, 25, 25); + fill(flags.dynHP || core.formatBigNumber(core.getRealStatus('hp')), 42, 55); + //core.drawImage(ctx, core.statusBar.icons.atk, 6, 65, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('atk')), 42, 85, '#FF5555'); + //core.drawImage(ctx, core.statusBar.icons.def, 6, 95, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('def')), 42, 115, '#45D1E0'); + //core.drawImage(ctx, core.statusBar.icons.mdef, 6, 125, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('mdef')), 42, 145, '#00AA00'); + //core.drawImage(ctx, core.statusBar.icons.money, 6, 155, 25, 25); + //fill(core.formatBigNumber(core.status.hero.money), 42, 175); + ctx.textAlign = 'center' //文字居中 + ctx.textBaseline = 'middle' + ctx.fillText(core.getLvName(), 40, 180) + fill1("Need: " + core.formatBigNumber(core.getNextLvUpNeed()), 40, 195) + if (core.getNextLvUpNeed()) { + var rat = (core.status.hero.exp) / (core.getNextLvUpNeed() + core.status.hero.exp) + /*ctx.moveTo(40, 185); + ctx.arc(40, 185, 30, -Math.PI / 2, -Math.PI / 2 + 2 * Math.PI * rat, false); + ctx.closePath(); + ctx.fillStyle = "#FFFF00" + ctx.fill();*/ + ctx.beginPath() //高亮环路径 + ctx.arc(40, 185, 30, -Math.PI / 2, -Math.PI / 2 + 2 * Math.PI * rat, false) + ctx.strokeStyle = 'rgb(255, 255, 0)' + ctx.lineWidth = 5 + ctx.lineCap = 'butt' + ctx.stroke() + var act = core.firstData.levelUp[core.status.hero.lv].action, + _ = { hp: 0, atk: 0, def: 0, mdef: 0 } + for (var i of act) { + if (i.name.substr(0, 6) == "status") _[i.name.substr(7)] += parseFloat(i.value); + } + fill1("Next Level", 100, 161, '#FFFFFF'); + fill1("Atk + " + core.formatBigNumber(_.atk), 100, 185, '#FF5555'); + fill1("Def + " + core.formatBigNumber(_.def), 100, 197, '#45D1E0'); + fill1("Mdef + " + core.formatBigNumber(_.mdef), 100, 209, '#00AA00'); + fill1("Hp + " + core.formatBigNumber(_.hp), 100, 173, '#FFFFFF'); + + + } + ctx.textAlign = 'left' + ctx.textBaseline = 'alphabetic' + //core.drawImage(ctx, core.statusBar.icons.exp, 6, 185, 25, 25); + //fill(core.formatBigNumber(core.status.hero.exp), 42, 205); + core.drawIcon(ctx, 21, 6, 220, 25, 25); + core.drawIcon(ctx, 22, 66, 220, 25, 25); + core.drawIcon(ctx, 23, 6, 250, 25, 25); + core.drawIcon(ctx, 47, 66, 250, 25, 25); + + fill(core.setTwoDigits(core.itemCount('yellowKey')), 32, 240, '#FFCCAA'); + fill(core.setTwoDigits(core.itemCount('blueKey')), 92, 240, '#AAAADD'); + fill(core.setTwoDigits(core.itemCount('redKey')), 32, 270, '#FF8888'); + fill(core.setTwoDigits(core.itemCount('pickaxe')), 92, 270, '#BC6E27'); + fill(core.setTwoDigits(core.itemCount('yellowKey') * 2 + core.itemCount('blueKey') * 5 + core.itemCount('redKey') * 15 + core.itemCount('pickaxe') * 30), 32, 300, '#FA1489'); + fill(core.setTwoDigits(core.getFlag('lhjnb', 0)), 92, 300, '#8D8600'); + + } + } else if (core.flags.hideLeftStatusBar && !core.domStyle.isVertical) { // 横屏且隐藏状态栏 + if (!core.dymCanvas['status']) + core.ui.createCanvas('status', 0, 0, core._PX_, core._PY_, 66); // 刚好盖过显伤层 + core.ui.clearMap(ctx = core.dymCanvas['status']); + core.ui.setFillStyle(ctx, core.status.globalAttribute.statusBarColor); + var offset = core.status.hero.loc.x - core.bigmap.offsetX / 32 >= core._HEIGHT_ ? 0 : core._PY_; + core.ui.setAlpha(ctx, 0.75); + core.ui.drawWindowSkin('winskin.png', ctx, offset, 0, core._PX_ - core._PY_, core._PY_); + core.ui.setAlpha(ctx, 1); + core.drawImage(ctx, core.statusBar.icons.floor, 6 + offset, 9, 25, 25); + fill((core.status.thisMap || {}).name || "Loading", 42 + offset, 29); + core.drawImage(ctx, core.statusBar.icons.hp, 6 + offset, 43, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('hp')), 42 + offset, 63); + core.drawImage(ctx, core.statusBar.icons.atk, 6 + offset, 77, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('atk')), 42 + offset, 97); + core.drawImage(ctx, core.statusBar.icons.def, 6 + offset, 111, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('def')), 42 + offset, 131); + core.drawImage(ctx, core.statusBar.icons.mdef, 6 + offset, 145, 25, 25); + fill(core.formatBigNumber(core.getRealStatus('mdef')), 42 + offset, 165); + core.drawImage(ctx, core.statusBar.icons.money, 6 + offset, 179, 25, 25); + fill(core.formatBigNumber(core.status.hero.money), 42 + offset, 199); + core.drawImage(ctx, core.statusBar.icons.exp, 6 + offset, 213, 25, 25); + fill(core.formatBigNumber(core.status.hero.exp), 42 + offset, 233); + fill(core.setTwoDigits(core.itemCount('yellowKey')), 11 + offset, 267, '#FFCCAA'); + fill(core.setTwoDigits(core.itemCount('blueKey')), 46 + offset, 267, '#AAAADD'); + fill(core.setTwoDigits(core.itemCount('redKey')), 81 + offset, 267, '#FF8888'); + } +}, + "drawStatistics": function () { // 浏览地图时参与的统计项目 return [ @@ -1678,7 +1730,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // 在这里可以增加新的ID来进行统计个数,只能增加道具ID ]; }, - "drawAbout": function () { + "drawAbout": function () { // 绘制“关于”界面 core.ui.closePanel(); core.lockControl(); @@ -1706,5 +1758,5 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // TODO: 写自己的“关于”页面,每次增加32像素即可 core.playSound('打开界面'); } - } + } } \ No newline at end of file diff --git a/project/icons.js b/project/icons.js index 86d08c1..1fe86ea 100644 --- a/project/icons.js +++ b/project/icons.js @@ -64,7 +64,8 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = "sWallTLR": 32, "sWallTBR": 33, "sWallTBL": 34, - "T362": 35 + "T362": 35, + "location": 36 }, "animates": { "star": 0, diff --git a/project/images/641-e.jpg b/project/images/641-e.jpg new file mode 100644 index 0000000..340da89 Binary files /dev/null and b/project/images/641-e.jpg differ diff --git a/project/images/641-h.jpg b/project/images/641-h.jpg new file mode 100644 index 0000000..8c4facd Binary files /dev/null and b/project/images/641-h.jpg differ diff --git a/project/maps.js b/project/maps.js index ed2eaa9..d8bbc2c 100644 --- a/project/maps.js +++ b/project/maps.js @@ -16,6 +16,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e = "14": {"cls":"animates","id":"curseNet","canPass":true,"trigger":"null","script":"(function () {\n\tif (!core.hasItem('amulet')) {\n\t\tcore.triggerDebuff('get', 'curse');\n\t\tcore.updateStatusBar();\n\t}\n\n\t// 如果要做一次性咒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()","name":"咒网"}, "15": {"cls":"animates","id":"blueLava"}, "16": {"cls":"animates","id":"water"}, + "18": {"cls":"terrains","id":"location"}, "20": {"cls":"autotile","id":"autotile"}, "21": {"cls":"items","id":"yellowKey"}, "22": {"cls":"items","id":"blueKey"}, @@ -68,9 +69,9 @@ 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":{"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":"红门"}, + "81": {"cls":"animates","id":"yellowDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"yellowKey":1},"afterOpenDoor":[{"type":"setValue","name":"flag:lhjnb","operator":"+=","value":"2"}]},"name":"黄门"}, + "82": {"cls":"animates","id":"blueDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"blueKey":1},"afterOpenDoor":[{"type":"setValue","name":"flag:lhjnb","operator":"+=","value":"5"}]},"name":"蓝门"}, + "83": {"cls":"animates","id":"redDoor","trigger":"openDoor","animate":1,"doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{"redKey":1},"afterOpenDoor":[{"type":"setValue","name":"flag:lhjnb","operator":"+=","value":"15"}]},"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":"铁门"}, diff --git a/project/materials/terrains.png b/project/materials/terrains.png index 9fc0f11..d2ea864 100644 Binary files a/project/materials/terrains.png and b/project/materials/terrains.png differ diff --git a/project/plugins.js b/project/plugins.js index d2961a5..fda87c9 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -1814,5 +1814,164 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }, 1000); } })(); + }, + "dynamicHP": function () { + + + //由于改成了自绘状态栏,又进行了一些魔改,从直接改写core.setStatusBarInnerHTML变成用Flag,,,,, + + // 此插件允许人物血量动态进行变化 + // 原作:Fux2(老黄鸡) + + //新增:所有属性都动态变化,变化时状态栏字体颜色不同,变化结束后颜色恢复,增加BUFF/DeBUFF的显示 + + // 是否开启本插件,默认禁用;将此改成 true 将启用本插件。 + var __enable = true; + if (!__enable) return; + + var speed = 0.05; // 动态血量变化速度,越大越快。 + + var hpcolor1 = null; + var hpcolor2 = null; + var Debuffhp = null; + var _currentHp = null; + var _lastStatus1 = null; + var _check1 = function () { + if (_lastStatus1 != core.status.hero) { + _lastStatus1 = core.status.hero; + _currentHp = core.status.hero.hp; + } + }; + + core.registerAnimationFrame('dynamicHp', true, function () { + _check1(); + if (core.status.hero.hp != _currentHp) { + var dis = (_currentHp - core.status.hero.hp) * speed; + if (dis > 0 && dis < 1) dis = 1; + else if (dis > -1 && dis < 0) dis = -1; + if (Math.abs(_currentHp - core.status.hero.hp) < 1) { + _currentHp = core.status.hero.hp; + } else { + _currentHp -= dis; + } + + } + + if (core.getRealStatus('hp') == _currentHp) { + core.setFlag("dynHP", core.formatBigNumber(_currentHp)); + core.setFlag("dynHPneed", false); + } else { + core.setFlag("dynHP", core.formatBigNumber(Math.ceil(_currentHp))); + core.setFlag("dynHPneed", true); + } + + }); + + + ////// 设置statusBar的innerHTML,会自动斜体和放缩,也可以增加自定义css ////// + /*utils.prototype.setStatusBarInnerHTML = function (name, value, css) { + if (!core.statusBar[name]) return; + var isNumber = false; + if (typeof value == 'number') { + value = this.formatBigNumber(value); + isNumber = true; + } + // 判定是否斜体 + var italic = /^[-a-zA-Z`~!@#$%^&*()_=+\[{\]}\\|;:'",<.>\/?]*$/.test(value); + var style = 'font-style: ' + (italic ? 'italic' : 'normal') + '; '; + style += 'text-shadow: #000 1px 0 0, #000 0 1px 0, #000 -1px 0 0, #000 0 -1px 0; '; + // 判定是否需要缩放 + var length = this.strlen(value) || 1; + style += 'font-size: ' + Math.min(1, 7 / length) + 'em; '; + if (css) style += css; + if (isNumber) { + core.statusBar[name].innerHTML = "" + value + ""; + } else { + core.statusBar[name].innerHTML = ""; + core.statusBar[name].children[0].innerText = value; + } + }*/ + + +}, + "chapter": function () { + // 章节显示 + var chapter = "", + description = ""; + // 核心动画运算 + this.displayChapter = function (chapter, description) { + // 先建画布 + if (core.isReplaying()) return; + core.createCanvas("chapter", 0, 0, 480, 480, 100); + var frame = 0, + speed = 0, + left = -480, + down = 240; + // 一秒50帧 + core.lockControl(); + var interval = setInterval(function () { + core.clearMap("chapter"); + speed = core.hyperbolicCosine((frame - 84) * 0.05); + left += speed / 2; + // 背景 + if (frame <= 110) { + core.fillRect("chapter", 0, -240 - left, 480, left + 480, "#000000"); + core.fillRect("chapter", 0, 240, 480, left + 480, "#000000"); + } else { + core.fillRect("chapter", 0, 0, 480, down, "#000000"); + core.fillRect("chapter", 0, 480 - down, 480, down, "#000000"); + down -= speed / 2; + } + // 中间矩形 + if (frame <= 100) { + core.fillRect("chapter", 0, 240 - frame / 5, 480, frame / 2.5, [255, 255, 255, 0.5 + frame / 200]); + } else { + core.fillRect("chapter", 0, 240 - (2100 / (205 - frame)), 480, 4200 / (205 - frame), [255, 255, 255, (175 - frame) / 75]); + } + // 上下方线 + core.fillRect("chapter", left, 210, 300, 10, "#FF4D00"); + core.fillRect("chapter", 180 - left, 260, 300, 10, "#2DFFFC"); + core.fillRect("chapter", left + 310, 210, 10, 10, "#FF4D00"); + core.fillRect("chapter", 160 - left, 260, 10, 10, "#2DFFFC"); + core.fillPolygon("chapter", [ + [left + 330, 210], + [left + 330, 220], + [left + 340, 220] + ], "#FF4D00"); + core.fillPolygon("chapter", [ + [150 - left, 260], + [140 - left, 260], + [150 - left, 270] + ], "#2DFFFC"); + // 闪光条 + for (var i = 5; i > 0; i--) { + if (frame <= 150) { + core.drawLine("chapter", 0, 220, left + 320, 220, [255, 255, 255, 0.4], i); + core.drawLine("chapter", 480, 260, 160 - left, 260, [255, 255, 255, 0.4], i); + } else { + core.drawLine("chapter", 0, 220, left + 320, 220, [255, 255, 255, 0.4 - (frame - 150) / 125], i); + core.drawLine("chapter", 480, 260, 160 - left, 260, [255, 255, 255, 0.4 - (frame - 150) / 125], i); + } + } + core.fillEllipse("chapter", left + 320, 220, 7, 3, 0, [255, 255, 255, 0.8]); + core.fillEllipse("chapter", left + 320, 220, 2, 10, 0, [255, 255, 255, 0.8]); + core.fillEllipse("chapter", 160 - left, 260, 7, 3, 0, [255, 255, 255, 0.8]); + core.fillEllipse("chapter", 160 - left, 260, 2, 10, 0, [255, 255, 255, 0.8]); + // 字 + core.setTextAlign("chapter", "center"); + core.fillBoldText("chapter", chapter + " " + description, left + 360, 250, "#ffffff", "#000000", "28px scroll"); + if (frame >= 200) { + clearInterval(interval); + core.deleteCanvas("chapter"); + core.unlockControl(); + } + if (frame == 80) core.playSound("chapter.mp3"); + frame++; + }, 20); + }; + // 返回双曲余弦值 + this.hyperbolicCosine = function (number) { + return 0.5 * (Math.pow(Math.E, number) + Math.pow(Math.E, -number)); } +} } \ No newline at end of file diff --git a/styles.css b/styles.css index 1d84860..33ac928 100644 --- a/styles.css +++ b/styles.css @@ -138,6 +138,7 @@ border: #FFFFFF 2px solid; caret-color: #FFD700; border-radius: 10px; + white-space: nowrap; } #startButtons { @@ -149,16 +150,20 @@ } .startButton { - width: 100%; - margin: 0; + width: 30%; + margin: 5px; font-weight: bold; - display: block; + display: inline-block; cursor: pointer; padding: 4px 0; border-color: transparent; - border-width: 2px; + border-width: 0px 0px 3px 0px; border-style: solid; border-radius: 6px; + font-family: 得意黑; +} +.startButton:hover { + transform: scale(1.2); } .onChoiceAnimate {