This commit is contained in:
oc 2018-10-29 00:20:26 +08:00
parent 87e39fee52
commit e957966935
11 changed files with 99 additions and 67 deletions

View File

@ -1848,12 +1848,16 @@ actions.prototype.clickSwitchs = function (x,y) {
core.ui.drawSwitchs();
break;
case 7:
window.open(core.platform.isPC?"editor.html":"editor-mobile.html", "_blank");
core.setFlag('bigmapMoveDirectly', !core.getFlag('bigmapMoveDirectly', false));
core.ui.drawSwitchs();
break;
case 8:
window.open(core.firstData.name+".zip", "_blank");
window.open(core.platform.isPC?"editor.html":"editor-mobile.html", "_blank");
break;
case 9:
window.open(core.firstData.name+".zip", "_blank");
break;
case 10:
core.status.event.selection=0;
core.ui.drawSettings();
break;
@ -2367,6 +2371,9 @@ actions.prototype.clickReplay = function (x, y) {
break;
}
case 2:
core.chooseReplayFile();
break;
case 3:
if (core.hasFlag('debug')) {
core.drawText("\t[系统提示]调试模式下无法下载录像");
break;
@ -2379,7 +2386,7 @@ actions.prototype.clickReplay = function (x, y) {
}));
break;
break;
case 3:
case 4:
core.ui.closePanel();
break;
}

View File

@ -1658,25 +1658,37 @@ control.prototype.doEffect = function (effect) {
////// 开启debug模式 //////
control.prototype.debug = function() {
core.setFlag('debug', true);
core.insertAction(["\t[调试模式开启]此模式下按住Ctrl键或Ctrl+Shift键可以穿墙并忽略一切事件。\n同时录像将失效也无法上传成绩。"]);
/*
core.setStatus('hp', 999999);
core.setStatus('atk', 10000);
core.setStatus('def', 10000);
core.setStatus('mdef', 10000);
core.setStatus('money', 10000);
core.setStatus('experience', 10000);
core.setItem('yellowKey', 50);
core.setItem('blueKey', 50);
core.setItem('redKey', 50);
core.setItem('book', 1);
core.setItem('fly', 1);
for (var i in core.status.maps)
if (core.status.maps[i].canFlyTo && core.status.hero.flyRange.indexOf(i)<0)
core.status.hero.flyRange.push(i);
core.updateStatusBar();
core.drawTip("作弊成功");
*/
core.drawText("\t[调试模式开启]此模式下按住Ctrl键或Ctrl+Shift键可以穿墙并忽略一切事件。\n同时录像将失效也无法上传成绩。");
}
////// 选择录像文件 //////
control.prototype.chooseReplayFile = function () {
core.readFile(function (obj) {
if (obj.name!=core.firstData.name) {
alert("存档和游戏不一致!");
return;
}
if (core.isset(obj.version) && obj.version!=core.firstData.version) {
// alert("游戏版本不一致!");
if (!confirm("游戏版本不一致!\n你仍然想播放录像吗"))
return;
}
if (!core.isset(obj.route) || !core.isset(obj.hard)) {
alert("无效的录像!");
return;
}
core.dom.startPanel.style.display = 'none';
core.resetStatus(core.firstData.hero, obj.hard, core.firstData.floorId, null, core.initStatus.maps);
core.setFlag('seed', obj.seed);
core.setFlag('rand', obj.seed);
core.events.setInitData(obj.hard);
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
core.startReplay(core.decodeRoute(obj.route));
}, true);
}, function () {
})
}
////// 开始播放 //////

View File

@ -1030,6 +1030,11 @@ core.prototype.resetMap = function(floorId) {
core.maps.resetMap(floorId);
}
////// 选择录像文件 //////
core.prototype.chooseReplayFile = function () {
core.control.chooseReplayFile();
}
////// 开始播放 //////
core.prototype.startReplay = function (list) {
core.control.startReplay(list);

View File

@ -316,10 +316,10 @@ maps.prototype.canMoveDirectly = function (destX,destY) {
if (fromX==destX&&fromY==destY) return 0;
// 大地图且会改变左上角坐标,不能
var sx = core.clamp(fromX-6,0,core.bigmap.width-13), sy = core.clamp(fromY-6,0,core.bigmap.width-13),
ex = core.clamp(destX-6,0,core.bigmap.height-13), ey = core.clamp(destY-6,0,core.bigmap.height-13);
var sx = core.clamp(fromX-6,0,core.bigmap.width-13), sy = core.clamp(fromY-6,0,core.bigmap.height-13),
ex = core.clamp(destX-6,0,core.bigmap.width-13), ey = core.clamp(destY-6,0,core.bigmap.height-13);
if (sx!=ex || sy!=ey) return -1;
if (!core.hasFlag('bigmapMoveDirectly') && (sx!=ex || sy!=ey)) return -1;
// 无视起点事件
var nowBlockId = core.getBlockId(fromX, fromY);

View File

@ -822,6 +822,7 @@ ui.prototype.drawSwitchs = function() {
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
"新版存档: "+(core.platform.useLocalForage ? "[ON]":"[OFF]"),
"大地图瞬移:"+(core.hasFlag('bigmapMoveDirectly') ? "[ON]":"[OFF]"),
"查看工程",
"下载离线版本",
"返回主菜单"
@ -1230,7 +1231,7 @@ ui.prototype.drawReplay = function () {
core.lockControl();
core.status.event.id = 'replay';
this.drawChoices(null, [
"从头回放录像", "从存档开始回放", "下载当前录像", "返回游戏"
"从头回放录像", "从存档开始回放", "选择录像文件", "下载当前录像", "返回游戏"
]);
}
@ -1768,6 +1769,11 @@ ui.prototype.drawToolbox = function(index) {
core.fillText('ui', item.name, 10, 32, '#FFD700', "bold 20px Verdana")
var text = item.text||"该道具暂无描述。";
try {
// 检查能否eval
text = eval(text);
} catch (e) {}
var lines = core.splitLines('ui', text, 406, '17px Verdana');
core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px Verdana');

27
main.js
View File

@ -531,32 +531,7 @@ main.dom.replayGame.onclick = function () {
}
}
core.readFile(function (obj) {
if (obj.name!=core.firstData.name) {
alert("存档和游戏不一致!");
return;
}
if (core.isset(obj.version) && obj.version!=core.firstData.version) {
// alert("游戏版本不一致!");
if (!confirm("游戏版本不一致!\n你仍然想播放录像吗"))
return;
}
if (!core.isset(obj.route) || !core.isset(obj.hard)) {
alert("无效的录像!");
return;
}
core.dom.startPanel.style.display = 'none';
core.resetStatus(core.firstData.hero, obj.hard, core.firstData.floorId, null, core.initStatus.maps);
core.setFlag('seed', obj.seed);
core.setFlag('rand', obj.seed);
core.events.setInitData(obj.hard);
core.changeFloor(core.status.floorId, null, core.firstData.hero.loc, null, function() {
core.startReplay(core.decodeRoute(obj.route));
}, true);
}, function () {
})
core.chooseReplayFile();
}

View File

@ -27,7 +27,10 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"item.mp3",
"equip.mp3",
"zone.mp3",
"jump.mp3"
"jump.mp3",
"pickaxe.mp3",
"bomb.mp3",
"centerFly.mp3"
],
"startBackground": "bg.jpg",
"startLogoStyle": "color: black",

View File

@ -15,35 +15,43 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
},
"redJewel": {
"cls": "items",
"name": "红宝石"
"name": "红宝石",
"text": "',攻击+'+core.values.redJewel"
},
"blueJewel": {
"cls": "items",
"name": "蓝宝石"
"name": "蓝宝石",
"text": "',防御+'+core.values.blueJewel"
},
"greenJewel": {
"cls": "items",
"name": "绿宝石"
"name": "绿宝石",
"text": "',魔防+'+core.values.greenJewel"
},
"yellowJewel": {
"cls": "items",
"name": "黄宝石"
"name": "黄宝石",
"text": "可以进行加点"
},
"redPotion": {
"cls": "items",
"name": "红血瓶"
"name": "红血瓶",
"text": "',生命+'+core.values.redPotion"
},
"bluePotion": {
"cls": "items",
"name": "蓝血瓶"
"name": "蓝血瓶",
"text": "',生命+'+core.values.bluePotion"
},
"yellowPotion": {
"cls": "items",
"name": "黄血瓶"
"name": "黄血瓶",
"text": "'生命+'+core.values.yellowPotion"
},
"greenPotion": {
"cls": "items",
"name": "绿血瓶"
"name": "绿血瓶",
"text": "',生命+'+core.values.greenPotion"
},
"sword0": {
"cls": "items",
@ -343,13 +351,13 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"book": "core.ui.drawBook(0);",
"fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));",
"earthquake": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"pickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"pickaxe": "core.playSound('pickaxe.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"icePickaxe": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"snow": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n});",
"bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"centerFly": "core.clearMap('hero');\ncore.setHeroLoc('x', (core.bigmap.width||13)-1-core.getHeroLoc('x'));\ncore.setHeroLoc('y', (core.bigmap.height||13)-1-core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
"bomb": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"hammer": "core.playSound('bomb.mp3');\ncore.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.events.afterUseBomb();\n});",
"centerFly": "core.playSound('centerFly.mp3');\ncore.clearMap('hero');\ncore.setHeroLoc('x', (core.bigmap.width||13)-1-core.getHeroLoc('x'));\ncore.setHeroLoc('y', (core.bigmap.height||13)-1-core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');",
"upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.replay();\n});",
"downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n\tcore.drawTip(core.material.items[itemId].name + '使用成功');\n\tcore.replay();\n});",
"poisonWine": "core.setFlag('poison', false);",
@ -357,7 +365,15 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"curseWine": "core.setFlag('curse', false);",
"superWine": "core.setFlag('poison', false);\nif (core.hasFlag('weak')) {\n\tcore.setFlag('weak', false);\n\tcore.status.hero.atk += core.getFlag('weakAtk', core.values.weakValue);\n\tcore.status.hero.def += core.getFlag('weakDef', core.values.weakValue);\n}\ncore.setFlag('curse', false);",
"lifeWand": "core.insertAction([\n\t{\"type\": \"input\", \"text\": \"请输入生命魔杖使用次数:(0-${item:lifeWand})\"},\n\t{\"type\": \"if\", \"condition\": \"flag:input<=item:lifeWand\",\n\t\t\"true\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"item:lifeWand\", \"value\": \"item:lifeWand-flag:input\"},\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+flag:input*100\"},\n\t\t\t\"成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。\"\n\t\t],\n\t\t\"false\": [\"输入不合法!\"]\n\t},\n]);\ncore.addItem('lifeWand', 1);",
"jumpShoes": "core.insertAction({\"type\":\"jumpHero\",\"loc\":[core.nextX(2),core.nextY(2)]});"
"jumpShoes": "core.insertAction({\"type\":\"jumpHero\",\"loc\":[core.nextX(2),core.nextY(2)]});",
"redPotion": "core.status.hero.hp += core.values.redPotion",
"bluePotion": "core.status.hero.hp += core.values.bluePotion",
"greenPotion": "core.status.hero.hp += core.values.greenPotion",
"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": "core.insertAction([\n\t{\"type\": \"choices\", \"choices\": [\n\t\t{\"text\": \"攻击+1\", \"action\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:atk\", \"value\": \"status:atk+1\"}\n\t\t]},\n\t\t{\"text\": \"防御+2\", \"action\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:def\", \"value\": \"status:def+2\"}\n\t\t]},\n\t\t{\"text\": \"生命+200\", \"action\": [\n\t\t\t{\"type\": \"setValue\", \"name\": \"status:hp\", \"value\": \"status:hp+200\"}\n\t\t]},\n\t]}\n]);"
},
"canUseItemEffect": {
"book": "true",
@ -377,6 +393,14 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"curseWine": "core.hasFlag('curse')",
"superWine": "core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse')",
"lifeWand": "true",
"jumpShoes": "var nx=core.nextX(2),ny=core.nextY(2);nx>=0&&nx<core.bigmap.width&&ny>=0&&ny<core.bigmap.height&&core.getBlock(nx,ny)==null"
"jumpShoes": "var nx=core.nextX(2),ny=core.nextY(2);nx>=0&&nx<core.bigmap.width&&ny>=0&&ny<core.bigmap.height&&core.getBlock(nx,ny)==null",
"redPotion": "true",
"bluePotion": "true",
"greenPotion": "true",
"yellowPotion": "true",
"redJewel": "true",
"blueJewel": "true",
"greenJewel": "true",
"yellowJewel": "true"
}
}

BIN
project/sounds/bomb.mp3 Normal file

Binary file not shown.

Binary file not shown.

BIN
project/sounds/pickaxe.mp3 Normal file

Binary file not shown.