Merge pull request #246 from ckcz123/v2.0

V2.0
This commit is contained in:
Zhang Chen 2018-10-29 02:22:31 +08:00 committed by GitHub
commit a910b08a9a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
23 changed files with 372 additions and 235 deletions

View File

@ -306,41 +306,45 @@ return code;
*/; */;
setText_s setText_s
: '设置剧情文本的属性' '位置' SetTextPosition_List BGNL? '标题颜色' EvalString? '正文颜色' EvalString? '背景色' EvalString? '粗体' B_1_List BGNL? '标题字体大小' EvalString? '正文字体大小' EvalString? '打字间隔' EvalString? Newline : '设置剧情文本的属性' '位置' SetTextPosition_List '偏移像素' EvalString? BGNL? '标题颜色' EvalString? '正文颜色' EvalString? '背景色' EvalString? '粗体' B_1_List BGNL? '标题字体大小' EvalString? '正文字体大小' EvalString? '打字间隔' EvalString? Newline
/* setText_s /* setText_s
tooltip : setText设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填 tooltip : setText设置剧情文本的属性,颜色为RGB三元组或RGBA四元组,打字间隔为剧情文字添加的时间间隔,为整数或不填
helpUrl : https://ckcz123.github.io/mota-js/#/event?id=settext%EF%BC%9A%E8%AE%BE%E7%BD%AE%E5%89%A7%E6%83%85%E6%96%87%E6%9C%AC%E7%9A%84%E5%B1%9E%E6%80%A7 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=settext%EF%BC%9A%E8%AE%BE%E7%BD%AE%E5%89%A7%E6%83%85%E6%96%87%E6%9C%AC%E7%9A%84%E5%B1%9E%E6%80%A7
default : [null,"","","",null,"","",''] default : [null,"","","","",null,"","",""]
SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"'; SetTextPosition_List_0 =SetTextPosition_List_0==='null'?'': ', "position": "'+SetTextPosition_List_0+'"';
var colorRe = /^(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)?$/; var colorRe = /^(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)?$/;
if (EvalString_0) { if (EvalString_0) {
if (!colorRe.test(EvalString_0))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1'); if (!/^\d+$/.test(EvalString_0))throw new Error('像素偏移量必须是整数或不填');
EvalString_0 = ', "title": ['+EvalString_0+']'; EvalString_0 = ', "offset": '+EvalString_0;
} }
if (EvalString_1) { if (EvalString_1) {
if (!colorRe.test(EvalString_1))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1'); if (!colorRe.test(EvalString_1))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
EvalString_1 = ', "text": ['+EvalString_1+']'; EvalString_1 = ', "title": ['+EvalString_1+']';
} }
if (EvalString_2) { if (EvalString_2) {
if (!colorRe.test(EvalString_2))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1'); if (!colorRe.test(EvalString_2))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
EvalString_2 = ', "background": ['+EvalString_2+']'; EvalString_2 = ', "text": ['+EvalString_2+']';
} }
if (EvalString_3) { if (EvalString_3) {
if (!/^\d+$/.test(EvalString_3))throw new Error('字体大小必须是整数或不填'); if (!colorRe.test(EvalString_3))throw new Error('颜色格式错误,形如:0~255,0~255,0~255,0~1');
EvalString_3 = ', "titlefont": '+EvalString_3; EvalString_3 = ', "background": ['+EvalString_3+']';
} }
if (EvalString_4) { if (EvalString_4) {
if (!/^\d+$/.test(EvalString_4))throw new Error('字体大小必须是整数或不填'); if (!/^\d+$/.test(EvalString_4))throw new Error('字体大小必须是整数或不填');
EvalString_4 = ', "textfont": '+EvalString_4; EvalString_4 = ', "titlefont": '+EvalString_4;
} }
if (EvalString_5) { if (EvalString_5) {
if (!/^\d+$/.test(EvalString_5))throw new Error('打字时间间隔必须是整数或不填'); if (!/^\d+$/.test(EvalString_5))throw new Error('字体大小必须是整数或不填');
EvalString_5 = ', "time": '+EvalString_5; EvalString_5 = ', "textfont": '+EvalString_5;
} }
B_1_List_0 = ', "bold": '+B_1_List_0; if (EvalString_6) {
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+EvalString_4+EvalString_5+'},\n'; if (!/^\d+$/.test(EvalString_6))throw new Error('打字时间间隔必须是整数或不填');
EvalString_6 = ', "time": '+EvalString_6;
}
B_1_List_0 = B_1_List_0==='null'?'':', "bold": '+B_1_List_0;
var code = '{"type": "setText"'+SetTextPosition_List_0+EvalString_0+EvalString_1+EvalString_2+B_1_List_0+EvalString_3+EvalString_4+EvalString_5+EvalString_6+'},\n';
return code; return code;
*/; */;
@ -1450,7 +1454,7 @@ Stair_List
/*Stair_List ['loc','upFloor','downFloor']*/; /*Stair_List ['loc','upFloor','downFloor']*/;
SetTextPosition_List SetTextPosition_List
: '不改变'|'上'|'中'|'下' : '不改变'|'距离顶部'|'居中'|'距离底部'
/*SetTextPosition_List ['null','up','center','down']*/; /*SetTextPosition_List ['null','up','center','down']*/;
ShopUse_List ShopUse_List
@ -1705,7 +1709,7 @@ ActionParser.prototype.parseAction = function() {
data.text=setTextfunc(data.text); data.text=setTextfunc(data.text);
data.background=setTextfunc(data.background); data.background=setTextfunc(data.background);
this.next = MotaActionBlocks['setText_s'].xmlText([ this.next = MotaActionBlocks['setText_s'].xmlText([
data.position,data.title,data.text,data.background,data.bold,data.titlefont,data.textfont,data.time,this.next]); data.position,data.offset,data.title,data.text,data.background,data.bold,data.titlefont,data.textfont,data.time,this.next]);
break; break;
case "tip": case "tip":
this.next = MotaActionBlocks['tip_s'].xmlText([ this.next = MotaActionBlocks['tip_s'].xmlText([

View File

@ -79,6 +79,26 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_leaf": true, "_leaf": true,
"_type": "textarea", "_type": "textarea",
"_data": "边框颜色,包括游戏边界的边框和对话框边框等。" "_data": "边框颜色,包括游戏边界的边框和对话框边框等。"
},
"statusBarColor": {
"_leaf": true,
"_type": "textarea",
"_data": "状态栏的文字颜色,默认是白色"
},
"hardLabelColor": {
"_leaf": true,
"_type": "textarea",
"_data": "难度显示的颜色,默认是红色"
},
"floorChangingBackground": {
"_leaf": true,
"_type": "textarea",
"_data": "楼层转换界面的背景样式可以使用纯色默认值black也可以使用图片参见状态栏的图片写法"
},
"floorChangingTextColor": {
"_leaf": true,
"_type": "textarea",
"_data": "楼层转换界面的文字颜色,默认是白色"
} }
} }
}, },
@ -551,12 +571,6 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_bool": "bool", "_bool": "bool",
"_data": "寻路算法是否经过血瓶如果该项为false则寻路算法会自动尽量绕过血瓶" "_data": "寻路算法是否经过血瓶如果该项为false则寻路算法会自动尽量绕过血瓶"
}, },
"enableViewMaps": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否支持在菜单栏中查看所有楼层的地图"
},
"portalWithoutTrigger": { "portalWithoutTrigger": {
"_leaf": true, "_leaf": true,
"_type": "checkbox", "_type": "checkbox",
@ -575,12 +589,6 @@ data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc =
"_bool": "bool", "_bool": "bool",
"_data": "是否允许瞬间移动" "_data": "是否允许瞬间移动"
}, },
"clickMoveDirectly": {
"_leaf": true,
"_type": "checkbox",
"_bool": "bool",
"_data": "是否默认开启单击瞬移,用户可在菜单栏手动开关"
}
} }
} }
} }

View File

@ -162,11 +162,13 @@ core.nextY(n)
core.openDoor(id, x, y, needKey, callback) [异步] core.openDoor(id, x, y, needKey, callback) [异步]
尝试开门操作。id为目标点的IDx和y为坐标needKey表示是否需要使用钥匙callback为开门完毕后的回调函数。 尝试开门操作。id为目标点的IDx和y为坐标needKey表示是否需要使用钥匙callback为开门完毕后的回调函数。
id可为null代表使用地图上的值。
例如core.openDoor('yellowDoor', 10, 3, false, function() {console.log("1")}) 例如core.openDoor('yellowDoor', 10, 3, false, function() {console.log("1")})
core.battle(id, x, y, force, callback) [异步] core.battle(id, x, y, force, callback) [异步]
执行战斗事件。id为怪物的idx和y为坐标force为bool值表示是否是强制战斗callback为战斗完毕后的回调函数。 执行战斗事件。id为怪物的idx和y为坐标force为bool值表示是否是强制战斗callback为战斗完毕后的回调函数。
id可为null代表使用地图上的值。
例如core.battle('greenSlime', null, null, true) 例如core.battle('greenSlime', null, null, true)

View File

@ -126,7 +126,7 @@ animate为该装备的攻击动画仅对type为0时有效。具体可参见[
``` text ``` text
yellowDoor, blueDoor, redDoor, greenDoor, specialDoor, steelDoor, yellowDoor, blueDoor, redDoor, greenDoor, specialDoor, steelDoor,
yellowWall, blueWall, whiteWall, lava, star yellowWall, blueWall, whiteWall
``` ```
## 怪物 ## 怪物

View File

@ -337,47 +337,47 @@
<div id='statusBar' class="clearfix"> <div id='statusBar' class="clearfix">
<div class="status" id="floorCol"> <div class="status" id="floorCol">
<img id="img-floor"> <img id="img-floor">
<p class='statusLabel' id='floor'></p> <p class='statusLabel statusText' id='floor'></p>
</div> </div>
<div class="status" id="nameCol"> <div class="status" id="nameCol">
<img id="img-name"> <img id="img-name">
<p class='statusLabel' id='name'></p> <p class='statusLabel statusText' id='name'></p>
</div> </div>
<div class="status" id="lvCol"> <div class="status" id="lvCol">
<img id="img-lv"> <img id="img-lv">
<p class='statusLabel' id='lv'></p> <p class='statusLabel statusText' id='lv'></p>
</div> </div>
<div class="status" id='hpmaxCol'> <div class="status" id='hpmaxCol'>
<img id="img-hpmax"> <img id="img-hpmax">
<p class='statusLabel' id='hpmax'></p> <p class='statusLabel statusText' id='hpmax'></p>
</div> </div>
<div class="status"> <div class="status">
<img id="img-hp"> <img id="img-hp">
<p class='statusLabel' id='hp'></p> <p class='statusLabel statusText' id='hp'></p>
</div> </div>
<div class="status"> <div class="status">
<img id="img-atk"> <img id="img-atk">
<p class='statusLabel' id='atk'></p> <p class='statusLabel statusText' id='atk'></p>
</div> </div>
<div class="status"> <div class="status">
<img id="img-def"> <img id="img-def">
<p class='statusLabel' id='def'></p> <p class='statusLabel statusText' id='def'></p>
</div> </div>
<div class="status" id="mdefCol"> <div class="status" id="mdefCol">
<img id="img-mdef"> <img id="img-mdef">
<p class='statusLabel' id='mdef'></p> <p class='statusLabel statusText' id='mdef'></p>
</div> </div>
<div class="status" id="moneyCol"> <div class="status" id="moneyCol">
<img id="img-money"> <img id="img-money">
<p class='statusLabel' id='money'></p> <p class='statusLabel statusText' id='money'></p>
</div> </div>
<div class="status" id="expCol"> <div class="status" id="expCol">
<img id="img-experience"> <img id="img-experience">
<p class='statusLabel' id='experience'></p> <p class='statusLabel statusText' id='experience'></p>
</div> </div>
<div class="status" id="upCol"> <div class="status" id="upCol">
<img id="img-up"> <img id="img-up">
<p class='statusLabel' id='up'></p> <p class='statusLabel statusText' id='up'></p>
</div> </div>
<div class="status" id='keyCol'> <div class="status" id='keyCol'>
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span> <span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>

View File

@ -323,47 +323,47 @@
<div id='statusBar' class="clearfix"> <div id='statusBar' class="clearfix">
<div class="status" id="floorCol"> <div class="status" id="floorCol">
<img id="img-floor"> <img id="img-floor">
<p class='statusLabel' id='floor'></p> <p class='statusLabel statusText' id='floor'></p>
</div> </div>
<div class="status" id="nameCol"> <div class="status" id="nameCol">
<img id="img-name"> <img id="img-name">
<p class='statusLabel' id='name'></p> <p class='statusLabel statusText' id='name'></p>
</div> </div>
<div class="status" id="lvCol"> <div class="status" id="lvCol">
<img id="img-lv"> <img id="img-lv">
<p class='statusLabel' id='lv'></p> <p class='statusLabel statusText' id='lv'></p>
</div> </div>
<div class="status" id='hpmaxCol'> <div class="status" id='hpmaxCol'>
<img id="img-hpmax"> <img id="img-hpmax">
<p class='statusLabel' id='hpmax'></p> <p class='statusLabel statusText' id='hpmax'></p>
</div> </div>
<div class="status"> <div class="status">
<img id="img-hp"> <img id="img-hp">
<p class='statusLabel' id='hp'></p> <p class='statusLabel statusText' id='hp'></p>
</div> </div>
<div class="status"> <div class="status">
<img id="img-atk"> <img id="img-atk">
<p class='statusLabel' id='atk'></p> <p class='statusLabel statusText' id='atk'></p>
</div> </div>
<div class="status"> <div class="status">
<img id="img-def"> <img id="img-def">
<p class='statusLabel' id='def'></p> <p class='statusLabel statusText' id='def'></p>
</div> </div>
<div class="status" id="mdefCol"> <div class="status" id="mdefCol">
<img id="img-mdef"> <img id="img-mdef">
<p class='statusLabel' id='mdef'></p> <p class='statusLabel statusText' id='mdef'></p>
</div> </div>
<div class="status" id="moneyCol"> <div class="status" id="moneyCol">
<img id="img-money"> <img id="img-money">
<p class='statusLabel' id='money'></p> <p class='statusLabel statusText' id='money'></p>
</div> </div>
<div class="status" id="expCol"> <div class="status" id="expCol">
<img id="img-experience"> <img id="img-experience">
<p class='statusLabel' id='experience'></p> <p class='statusLabel statusText' id='experience'></p>
</div> </div>
<div class="status" id="upCol"> <div class="status" id="upCol">
<img id="img-up"> <img id="img-up">
<p class='statusLabel' id='up'></p> <p class='statusLabel statusText' id='up'></p>
</div> </div>
<div class="status" id='keyCol'> <div class="status" id='keyCol'>
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span> <span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>

View File

@ -44,47 +44,47 @@
<div id='statusBar' class="clearfix"> <div id='statusBar' class="clearfix">
<div class="status" id="floorCol"> <div class="status" id="floorCol">
<img id="img-floor"> <img id="img-floor">
<p class='statusLabel' id='floor'></p> <p class='statusLabel statusText' id='floor'></p>
</div> </div>
<div class="status" id="nameCol"> <div class="status" id="nameCol">
<img id="img-name"> <img id="img-name">
<p class='statusLabel' id='name'></p> <p class='statusLabel statusText' id='name'></p>
</div> </div>
<div class="status" id="lvCol"> <div class="status" id="lvCol">
<img id="img-lv"> <img id="img-lv">
<p class='statusLabel' id='lv'></p> <p class='statusLabel statusText' id='lv'></p>
</div> </div>
<div class="status" id='hpmaxCol'> <div class="status" id='hpmaxCol'>
<img id="img-hpmax"> <img id="img-hpmax">
<p class='statusLabel' id='hpmax'></p> <p class='statusLabel statusText' id='hpmax'></p>
</div> </div>
<div class="status"> <div class="status">
<img id="img-hp"> <img id="img-hp">
<p class='statusLabel' id='hp'></p> <p class='statusLabel statusText' id='hp'></p>
</div> </div>
<div class="status"> <div class="status">
<img id="img-atk"> <img id="img-atk">
<p class='statusLabel' id='atk'></p> <p class='statusLabel statusText' id='atk'></p>
</div> </div>
<div class="status"> <div class="status">
<img id="img-def"> <img id="img-def">
<p class='statusLabel' id='def'></p> <p class='statusLabel statusText' id='def'></p>
</div> </div>
<div class="status" id="mdefCol"> <div class="status" id="mdefCol">
<img id="img-mdef"> <img id="img-mdef">
<p class='statusLabel' id='mdef'></p> <p class='statusLabel statusText' id='mdef'></p>
</div> </div>
<div class="status" id="moneyCol"> <div class="status" id="moneyCol">
<img id="img-money"> <img id="img-money">
<p class='statusLabel' id='money'></p> <p class='statusLabel statusText' id='money'></p>
</div> </div>
<div class="status" id="expCol"> <div class="status" id="expCol">
<img id="img-experience"> <img id="img-experience">
<p class='statusLabel' id='experience'></p> <p class='statusLabel statusText' id='experience'></p>
</div> </div>
<div class="status" id="upCol"> <div class="status" id="upCol">
<img id="img-up"> <img id="img-up">
<p class='statusLabel' id='up'></p> <p class='statusLabel statusText' id='up'></p>
</div> </div>
<div class="status" id='keyCol'> <div class="status" id='keyCol'>
<span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span> <span class='statusLabel' id='yellowKey' style="color:#FFCCAA"></span>

View File

@ -71,10 +71,10 @@ actions.prototype.onkeyUp = function(e) {
break; break;
} }
} }
this.keyUp(e.keyCode); this.keyUp(e.keyCode, e.altKey);
} else { } else {
if (e.keyCode==17) core.status.ctrlDown = false; if (e.keyCode==17) core.status.ctrlDown = false;
this.keyUp(e.keyCode); this.keyUp(e.keyCode, e.altKey);
} }
} }
@ -187,7 +187,7 @@ actions.prototype.keyDown = function(keyCode) {
} }
////// 根据放开键的code来执行一系列操作 ////// ////// 根据放开键的code来执行一系列操作 //////
actions.prototype.keyUp = function(keyCode) { actions.prototype.keyUp = function(keyCode, altKey) {
if (core.isset(core.status.replay)&&core.status.replay.replaying if (core.isset(core.status.replay)&&core.status.replay.replaying
&&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return; &&core.status.event.id!='save'&&(core.status.event.id||"").indexOf('book')!=0&&core.status.event.id!='viewMaps') return;
@ -239,7 +239,7 @@ actions.prototype.keyUp = function(keyCode) {
return; return;
} }
if (core.status.event.id=='equipbox') { if (core.status.event.id=='equipbox') {
this.keyUpEquipbox(keyCode); this.keyUpEquipbox(keyCode, altKey);
return; return;
} }
if (core.status.event.id=='save' || core.status.event.id=='load' || core.status.event.id=='replayLoad') { if (core.status.event.id=='save' || core.status.event.id=='load' || core.status.event.id=='replayLoad') {
@ -288,6 +288,12 @@ actions.prototype.keyUp = function(keyCode) {
if(!core.status.played) if(!core.status.played)
return; return;
// 0~9的AltKey
if (altKey && keyCode>=48 && keyCode<=57 && core.status.heroStop) {
core.items.quickLoadEquip(keyCode-48);
return;
}
switch (keyCode) { switch (keyCode) {
case 27: // ESC case 27: // ESC
if (core.status.heroStop) if (core.status.heroStop)
@ -357,12 +363,7 @@ actions.prototype.keyUp = function(keyCode) {
break; break;
case 33: case 34: // PAGEUP/PAGEDOWN case 33: case 34: // PAGEUP/PAGEDOWN
if (core.status.heroStop) { if (core.status.heroStop) {
if (core.flags.enableViewMaps) { core.ui.drawMaps();
core.ui.drawMaps();
}
else {
core.drawTip("本塔不允许浏览地图!");
}
} }
break; break;
case 37: // UP case 37: // UP
@ -409,6 +410,18 @@ actions.prototype.keyUp = function(keyCode) {
core.events.useItem('centerFly'); core.events.useItem('centerFly');
} }
break; break;
case 52: // 快捷键4破冰/冰冻/地震/上下楼器/...
if (core.status.heroStop) {
var list = ["icePickaxe", "snow", "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)) {
core.useItem(itemId);
break;
}
}
}
break;
} }
@ -1597,7 +1610,11 @@ actions.prototype.keyDownEquipbox = function (keycode) {
} }
////// 装备栏界面时,放开某个键的操作 ////// ////// 装备栏界面时,放开某个键的操作 //////
actions.prototype.keyUpEquipbox = function (keycode) { actions.prototype.keyUpEquipbox = function (keycode, altKey) {
if (altKey && keycode>=48 && keycode<=57) {
core.items.quickSaveEquip(keycode-48);
return;
}
if (keycode==84){ if (keycode==84){
core.ui.closePanel(); core.ui.closePanel();
core.openToolbox(); core.openToolbox();
@ -1836,13 +1853,12 @@ actions.prototype.clickSwitchs = function (x,y) {
core.ui.drawSwitchs(); core.ui.drawSwitchs();
break; break;
case 6: case 6:
core.flags.clickMoveDirectly=!core.flags.clickMoveDirectly; core.platform.useLocalForage=!core.platform.useLocalForage;
core.setLocalStorage('clickMoveDirectly', core.flags.clickMoveDirectly); core.setLocalStorage('useLocalForage', core.platform.useLocalForage);
core.ui.drawSwitchs(); core.ui.drawSwitchs();
break; break;
case 7: case 7:
core.platform.useLocalForage=!core.platform.useLocalForage; core.setFlag('bigmapMoveDirectly', !core.getFlag('bigmapMoveDirectly', false));
core.setLocalStorage('useLocalForage', core.platform.useLocalForage);
core.ui.drawSwitchs(); core.ui.drawSwitchs();
break; break;
case 8: case 8:
@ -1904,17 +1920,7 @@ actions.prototype.clickSettings = function (x,y) {
core.ui.drawQuickShop(); core.ui.drawQuickShop();
break; break;
case 2: case 2:
if (!core.flags.enableViewMaps) { core.ui.drawMaps();
core.drawTip("本塔不允许浏览地图!");
}
else {
/*
core.drawText("\t[系统提示]即将进入浏览地图模式。\n\n点击地图上半部分或按[↑]键可查看前一张地图\n点击地图下半部分或按[↓]键可查看后一张地图\n点击地图中间或按[ESC]键可离开浏览地图模式\n此模式下可以打开怪物手册以查看某层楼的怪物属性", function () {
core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId));
})
*/
core.ui.drawMaps();
}
break; break;
case 3: case 3:
core.status.event.selection=0; core.status.event.selection=0;
@ -2375,6 +2381,9 @@ actions.prototype.clickReplay = function (x, y) {
break; break;
} }
case 2: case 2:
core.chooseReplayFile();
break;
case 3:
if (core.hasFlag('debug')) { if (core.hasFlag('debug')) {
core.drawText("\t[系统提示]调试模式下无法下载录像"); core.drawText("\t[系统提示]调试模式下无法下载录像");
break; break;
@ -2387,7 +2396,7 @@ actions.prototype.clickReplay = function (x, y) {
})); }));
break; break;
break; break;
case 3: case 4:
core.ui.closePanel(); core.ui.closePanel();
break; break;
} }

View File

@ -471,7 +471,7 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) {
if (core.timeout.turnHeroTimeout!=null) return; if (core.timeout.turnHeroTimeout!=null) return;
// 单击瞬间移动 // 单击瞬间移动
if (core.flags.clickMoveDirectly && core.status.heroStop) { if (core.status.heroStop) {
if (core.control.tryMoveDirectly(destX, destY)) if (core.control.tryMoveDirectly(destX, destY))
return; return;
} }
@ -1658,25 +1658,37 @@ control.prototype.doEffect = function (effect) {
////// 开启debug模式 ////// ////// 开启debug模式 //////
control.prototype.debug = function() { control.prototype.debug = function() {
core.setFlag('debug', true); core.setFlag('debug', true);
core.insertAction(["\t[调试模式开启]此模式下按住Ctrl键或Ctrl+Shift键可以穿墙并忽略一切事件。\n同时录像将失效也无法上传成绩。"]); core.drawText("\t[调试模式开启]此模式下按住Ctrl键或Ctrl+Shift键可以穿墙并忽略一切事件。\n同时录像将失效也无法上传成绩。");
/* }
core.setStatus('hp', 999999);
core.setStatus('atk', 10000); ////// 选择录像文件 //////
core.setStatus('def', 10000); control.prototype.chooseReplayFile = function () {
core.setStatus('mdef', 10000); core.readFile(function (obj) {
core.setStatus('money', 10000); if (obj.name!=core.firstData.name) {
core.setStatus('experience', 10000); alert("存档和游戏不一致!");
core.setItem('yellowKey', 50); return;
core.setItem('blueKey', 50); }
core.setItem('redKey', 50); if (core.isset(obj.version) && obj.version!=core.firstData.version) {
core.setItem('book', 1); // alert("游戏版本不一致!");
core.setItem('fly', 1); if (!confirm("游戏版本不一致!\n你仍然想播放录像吗"))
for (var i in core.status.maps) return;
if (core.status.maps[i].canFlyTo && core.status.hero.flyRange.indexOf(i)<0) }
core.status.hero.flyRange.push(i); if (!core.isset(obj.route) || !core.isset(obj.hard)) {
core.updateStatusBar(); alert("无效的录像!");
core.drawTip("作弊成功"); 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 () {
})
} }
////// 开始播放 ////// ////// 开始播放 //////
@ -2977,6 +2989,8 @@ control.prototype.resize = function(clientWidth, clientHeight) {
height: (gameGroupHeight - SPACE*2) + unit, height: (gameGroupHeight - SPACE*2) + unit,
top: SPACE + unit, top: SPACE + unit,
right: SPACE + unit, right: SPACE + unit,
background: main.floorChangingBackground||"black",
color: main.floorChangingTextColor||"white"
} }
}, },
{ {
@ -2992,7 +3006,7 @@ control.prototype.resize = function(clientWidth, clientHeight) {
borderLeft: statusBarBorder, borderLeft: statusBarBorder,
borderRight: borderRight, borderRight: borderRight,
fontSize: fontSize + unit, fontSize: fontSize + unit,
background: statusBackground, background: statusBackground
} }
}, },
{ {
@ -3008,7 +3022,13 @@ control.prototype.resize = function(clientWidth, clientHeight) {
className: 'statusLabels', className: 'statusLabels',
rules:{ rules:{
marginLeft: margin + unit, marginLeft: margin + unit,
lineHeight: statusLabelsLH + unit, lineHeight: statusLabelsLH + unit
}
},
{
className: 'statusTexts',
rules: {
color: main.statusBarColor||"white"
} }
}, },
{ {
@ -3110,9 +3130,10 @@ control.prototype.resize = function(clientWidth, clientHeight) {
{ {
id: 'hard', id: 'hard',
rules: { rules: {
lineHeight: toolsHeight + unit lineHeight: toolsHeight + unit,
color: main.hardLabelColor||"red"
} }
} },
] ]
core.domRenderer(); core.domRenderer();
} }
@ -3133,8 +3154,11 @@ control.prototype.domRenderer = function(){
if(styles[i].hasOwnProperty('className')){ if(styles[i].hasOwnProperty('className')){
var className = styles[i].className var className = styles[i].className
for(var j=0; j<core.dom[className].length; j++) for(var j=0; j<core.dom[className].length; j++)
for(var k=0; k<rulesProp.length; k++) for(var k=0; k<rulesProp.length; k++) {
core.dom[className][j].style[rulesProp[k]] = rules[rulesProp[k]]; var one = core.dom[className][j];
if (one.id !== styles[i].noid)
one.style[rulesProp[k]] = rules[rulesProp[k]];
}
} }
if(styles[i].hasOwnProperty('id')){ if(styles[i].hasOwnProperty('id')){
var id = styles[i].id; var id = styles[i].id;

View File

@ -145,6 +145,7 @@ function core() {
}, },
'textAttribute': { 'textAttribute': {
'position': "center", 'position': "center",
"offset": 20,
"title": [255,215,0,1], "title": [255,215,0,1],
"background": [0,0,0,0.85], "background": [0,0,0,0.85],
"text": [255,255,255,1], "text": [255,255,255,1],
@ -293,7 +294,6 @@ core.prototype.init = function (coreData, callback) {
core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage); core.flags.displayEnemyDamage = core.getLocalStorage('enemyDamage', core.flags.displayEnemyDamage);
core.flags.displayCritical = core.getLocalStorage('critical', core.flags.displayCritical); core.flags.displayCritical = core.getLocalStorage('critical', core.flags.displayCritical);
core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage); core.flags.displayExtraDamage = core.getLocalStorage('extraDamage', core.flags.displayExtraDamage);
core.flags.clickMoveDirectly = core.getLocalStorage('clickMoveDirectly', core.flags.clickMoveDirectly);
core.material.ground = new Image(); core.material.ground = new Image();
core.material.ground.src = "project/images/ground.png"; core.material.ground.src = "project/images/ground.png";
@ -388,8 +388,8 @@ core.prototype.keyDown = function(keyCode) {
} }
////// 根据放开键的code来执行一系列操作 ////// ////// 根据放开键的code来执行一系列操作 //////
core.prototype.keyUp = function(keyCode) { core.prototype.keyUp = function(keyCode, altKey) {
return core.actions.keyUp(keyCode); return core.actions.keyUp(keyCode, altKey);
} }
////// 点击(触摸)事件按下时 ////// ////// 点击(触摸)事件按下时 //////
@ -1031,6 +1031,11 @@ core.prototype.resetMap = function(floorId) {
core.maps.resetMap(floorId); core.maps.resetMap(floorId);
} }
////// 选择录像文件 //////
core.prototype.chooseReplayFile = function () {
core.control.chooseReplayFile();
}
////// 开始播放 ////// ////// 开始播放 //////
core.prototype.startReplay = function (list) { core.prototype.startReplay = function (list) {
core.control.startReplay(list); core.control.startReplay(list);

View File

@ -348,10 +348,7 @@ events.prototype.doAction = function() {
} }
break; break;
case "setText": // 设置文本状态 case "setText": // 设置文本状态
if (data.position=='up'||data.position=='down'||data.position=='center') { ["position", "offset", "bold", "titlefont", "textfont", "time"].forEach(function (t) {
core.status.textAttribute.position=data.position;
}
["bold", "titlefont", "textfont", "time"].forEach(function (t) {
if (core.isset(data[t])) core.status.textAttribute[t]=data[t]; if (core.isset(data[t])) core.status.textAttribute[t]=data[t];
}); });
["background", "title", "text"].forEach(function (t) { ["background", "title", "text"].forEach(function (t) {
@ -684,18 +681,15 @@ events.prototype.doAction = function() {
y = core.calValue(data.loc[1]); y = core.calValue(data.loc[1]);
} }
var floorId=data.floorId || core.status.floorId; var floorId=data.floorId || core.status.floorId;
var block=core.getBlock(x, y, floorId); if (floorId==core.status.floorId)
if (block!=null) { core.openDoor(null, x, y, false, function() {
if (floorId==core.status.floorId) core.events.doAction();
core.openDoor(block.block.event.id, block.block.x, block.block.y, false, function() { })
core.events.doAction(); else {
}) core.removeBlock(x, y, floorId);
else { this.doAction();
core.removeBlock(block.block.x,block.block.y,floorId);
this.doAction();
}
break;
} }
break;
this.doAction(); this.doAction();
break; break;
} }
@ -1067,8 +1061,11 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
if (core.interval.openDoorAnimate!=null) return; if (core.interval.openDoorAnimate!=null) return;
if (!core.isset(id)) id = core.getBlockId(x, y);
// 是否存在门 // 是否存在门
if (!core.terrainExists(x, y, id) && id!='lava' && id!='star') { if (!core.terrainExists(x, y, id) || !(id.endsWith("Door") || id.endsWith("Wall"))
|| !core.isset(core.material.icons.animates[id])) {
if (core.isset(callback)) callback(); if (core.isset(callback)) callback();
return; return;
} }
@ -1078,24 +1075,13 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
} }
core.stopAutomaticRoute(); core.stopAutomaticRoute();
var speed=30; var speed = id.endsWith("Wall")?70:30;
var doorId = id;
if (doorId.length<4 || doorId.substring(doorId.length-4)!="Door") {
doorId=doorId+"Door";
speed=70;
}
// 不存在门
if (!core.isset(core.material.icons.animates[doorId])) {
if (core.isset(callback)) callback();
return;
}
var key = id.replace("Door", "Key"); if (needKey && id.endsWith("Door")) {
if (needKey && (key=="specialKey" || core.isset(core.material.items[key]))) {
var key = id.replace("Door", "Key"); var key = id.replace("Door", "Key");
if (!core.hasItem(key)) { if (!core.hasItem(key)) {
if (key != "specialKey") if (key != "specialKey")
core.drawTip("你没有" + core.material.items[key].name); core.drawTip("你没有" + ((core.material.items[key]||{}).name||"钥匙"));
else core.drawTip("无法开启此门"); else core.drawTip("无法开启此门");
core.clearContinueAutomaticRoute(); core.clearContinueAutomaticRoute();
return; return;
@ -1107,7 +1093,7 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
// open // open
core.playSound("door.mp3"); core.playSound("door.mp3");
var state = 0; var state = 0;
var door = core.material.icons.animates[doorId]; var door = core.material.icons.animates[id];
core.status.replay.animate=true; core.status.replay.animate=true;
core.removeGlobalAnimate(x,y); core.removeGlobalAnimate(x,y);
core.interval.openDoorAnimate = window.setInterval(function () { core.interval.openDoorAnimate = window.setInterval(function () {
@ -1134,6 +1120,12 @@ events.prototype.battle = function (id, x, y, force, callback) {
core.stopHero(); core.stopHero();
core.stopAutomaticRoute(); core.stopAutomaticRoute();
if (!core.isset(id)) id = core.getBlockId(x, y);
if (!core.isset(id)) {
if (core.isset(callback)) callback();
return;
}
// 非强制战斗 // 非强制战斗
if (!core.enemys.canBattle(id, x, y) && !force && !core.isset(core.status.event.id)) { if (!core.enemys.canBattle(id, x, y) && !force && !core.isset(core.status.event.id)) {
core.drawTip("你打不过此怪物!"); core.drawTip("你打不过此怪物!");

View File

@ -262,4 +262,47 @@ items.prototype.compareEquipment = function (compareEquipId, beComparedEquipId)
compareMdef -= (beComparedEquip.equip||{}).mdef || 0; compareMdef -= (beComparedEquip.equip||{}).mdef || 0;
} }
return {"atk":compareAtk,"def":compareDef,"mdef":compareMdef}; return {"atk":compareAtk,"def":compareDef,"mdef":compareMdef};
} }
////// 保存装备 //////
items.prototype.quickSaveEquip = function (index) {
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
var saveEquips = core.getFlag("saveEquips", []);
saveEquips[index] = core.clone(core.status.hero.equipment);
core.setFlag("saveEquips", saveEquips);
core.drawTip("已保存"+index+"号套装");
}
////// 读取装备 //////
items.prototype.quickLoadEquip = function (index) {
var current = core.getFlag("saveEquips", [])[index];
if (!core.isset(current)) {
core.drawTip(index+"号套装不存在");
return;
}
// 检查所有的装备
var equipSize = (main.equipName||[]).length;
for (var i=0;i<equipSize;i++) {
var v = current[i];
if (core.isset(v) && !core.hasItem(v) && !core.hasEquip(v)) {
core.drawTip("你当前没有"+((core.material.items[v]||{}).name||"未知装备")+",无法换装");
return;
}
}
// 快速换装
if (!core.isset(core.status.hero.equipment)) core.status.hero.equipment = [];
for (var i=0;i<equipSize;i++) {
var now = core.status.hero.equipment[i]||null;
var to = current[i]||null;
if (now==to) continue;
if (to==null) {
this.unloadEquip(i);
core.status.route.push("unEquip:"+i);
}
else {
this.loadEquip(to);
core.status.route.push("equip:"+to);
}
}
core.drawTip("成功换上"+index+"号套装");
}

View File

@ -306,7 +306,7 @@ maps.prototype.canMoveHero = function(x,y,direction,floorId) {
////// 能否瞬间移动 ////// ////// 能否瞬间移动 //////
maps.prototype.canMoveDirectly = function (destX,destY) { maps.prototype.canMoveDirectly = function (destX,destY) {
// 不可瞬间移动请返回0 // 不可瞬间移动请返回-1
if (!core.flags.enableMoveDirectly) return -1; if (!core.flags.enableMoveDirectly) return -1;
// 中毒状态:不能 // 中毒状态:不能
@ -315,7 +315,13 @@ maps.prototype.canMoveDirectly = function (destX,destY) {
var fromX = core.getHeroLoc('x'), fromY = core.getHeroLoc('y'); var fromX = core.getHeroLoc('x'), fromY = core.getHeroLoc('y');
if (fromX==destX&&fromY==destY) return 0; 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.height-13),
ex = core.clamp(destX-6,0,core.bigmap.width-13), ey = core.clamp(destY-6,0,core.bigmap.height-13);
if (!core.hasFlag('bigmapMoveDirectly') && (sx!=ex || sy!=ey)) return -1;
// 无视起点事件
var nowBlockId = core.getBlockId(fromX, fromY); var nowBlockId = core.getBlockId(fromX, fromY);
if ((nowBlockId!=null&&nowBlockId!='upFloor'&&nowBlockId!='downFloor'&&nowBlockId!='portal' if ((nowBlockId!=null&&nowBlockId!='upFloor'&&nowBlockId!='downFloor'&&nowBlockId!='portal'
&&nowBlockId!='upPortal'&&nowBlockId!='leftPortal'&&nowBlockId!='downPortal'&&nowBlockId!='rightPortal') &&nowBlockId!='upPortal'&&nowBlockId!='leftPortal'&&nowBlockId!='downPortal'&&nowBlockId!='rightPortal')

View File

@ -373,6 +373,7 @@ ui.prototype.drawTextBox = function(content, showAll) {
var titlefont = textAttribute.titlefont || 22; var titlefont = textAttribute.titlefont || 22;
var textfont = textAttribute.textfont || 16; var textfont = textAttribute.textfont || 16;
var offset = textAttribute.offset || 0;
var position = textAttribute.position, px=null, py=null, ydelta=iconHeight-32; var position = textAttribute.position, px=null, py=null, ydelta=iconHeight-32;
if (content.indexOf("\b[")==0 || content.indexOf("\\b[")==0) { if (content.indexOf("\b[")==0 || content.indexOf("\\b[")==0) {
@ -434,7 +435,7 @@ ui.prototype.drawTextBox = function(content, showAll) {
} }
else if (position=='up') { else if (position=='up') {
if (px==null || py==null) { if (px==null || py==null) {
top = 5; top = 5 + offset;
} }
else { else {
top = 32 * py - height - ydelta - yoffset; top = 32 * py - height - ydelta - yoffset;
@ -442,7 +443,7 @@ ui.prototype.drawTextBox = function(content, showAll) {
} }
else if (position=='down') { else if (position=='down') {
if (px==null || py==null) { if (px==null || py==null) {
top = 416 - height - 5; top = 416 - height - 5 - offset;
} }
else { else {
top = 32 * py + 32 + yoffset; top = 32 * py + 32 + yoffset;
@ -821,8 +822,8 @@ ui.prototype.drawSwitchs = function() {
"怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"), "怪物显伤: "+(core.flags.displayEnemyDamage ? "[ON]" : "[OFF]"),
"临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"), "临界显伤: "+(core.flags.displayCritical ? "[ON]" : "[OFF]"),
"领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"), "领域显伤: "+(core.flags.displayExtraDamage ? "[ON]" : "[OFF]"),
"单击瞬移: "+(core.flags.clickMoveDirectly ? "[ON]" : "[OFF]"),
"新版存档: "+(core.platform.useLocalForage ? "[ON]":"[OFF]"), "新版存档: "+(core.platform.useLocalForage ? "[ON]":"[OFF]"),
"大地图瞬移:"+(core.hasFlag('bigmapMoveDirectly') ? "[ON]":"[OFF]"),
"查看工程", "查看工程",
"下载离线版本", "下载离线版本",
"返回主菜单" "返回主菜单"
@ -1231,7 +1232,7 @@ ui.prototype.drawReplay = function () {
core.lockControl(); core.lockControl();
core.status.event.id = 'replay'; core.status.event.id = 'replay';
this.drawChoices(null, [ this.drawChoices(null, [
"从头回放录像", "从存档开始回放", "下载当前录像", "返回游戏" "从头回放录像", "从存档开始回放", "选择录像文件", "下载当前录像", "返回游戏"
]); ]);
} }
@ -1769,6 +1770,11 @@ ui.prototype.drawToolbox = function(index) {
core.fillText('ui', item.name, 10, 32, '#FFD700', "bold 20px Verdana") core.fillText('ui', item.name, 10, 32, '#FFD700', "bold 20px Verdana")
var text = item.text||"该道具暂无描述。"; var text = item.text||"该道具暂无描述。";
try {
// 检查能否eval
text = eval(text);
} catch (e) {}
var lines = core.splitLines('ui', text, 406, '17px Verdana'); var lines = core.splitLines('ui', text, 406, '17px Verdana');
core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px Verdana'); core.fillText('ui', lines[0], 10, 62, '#FFFFFF', '17px Verdana');
@ -2232,9 +2238,24 @@ ui.prototype.drawStatistics = function () {
// 5. 当前已走的步数;瞬间移动的步数,瞬间移动的次数(和少走的步数);游戏时长 // 5. 当前已走的步数;瞬间移动的步数,瞬间移动的次数(和少走的步数);游戏时长
// 6. 当前已恢复的生命值;当前总伤害、战斗伤害、阻激夹域血网伤害、中毒伤害。 // 6. 当前已恢复的生命值;当前总伤害、战斗伤害、阻激夹域血网伤害、中毒伤害。
var ids = this.uidata.drawStatistics(); var ori = this.uidata.drawStatistics();
var ids = ori.filter(function (e) {
return e.endsWith("Door") || core.isset(core.material.items[e]);
});
var obj = {}; var obj = {};
ids.forEach(function (e) {obj[e] = 0;}) var cls = {};
ids.forEach(function (e) {
if (e.endsWith("Door")) cls[e] = "doors";
else cls[e] = core.material.items[e].cls;
obj[e] = 0;
})
var order = ["doors", "keys", "items", "tools", "constants", "equips"];
ids.sort(function (a, b) {
var c1 = order.indexOf(cls[a]), c2 = order.indexOf(cls[b]);
if (c1==c2) return ori.indexOf(a)-ori.indexOf(b);
return c1-c2;
});
var ext = {};
var total = { var total = {
'monster': { 'monster': {
@ -2278,7 +2299,7 @@ ui.prototype.drawStatistics = function () {
if (core.isset(total.count[id])) { if (core.isset(total.count[id])) {
var hp=0, atk=0, def=0, mdef=0; var hp=0, atk=0, def=0, mdef=0;
if (core.isset(core.material.items[id]) && core.material.items[id].cls=='items' && id!='superPotion') { if (cls[id]=='items' && id!='superPotion') {
var ratio = floor.item_ratio||1; var ratio = floor.item_ratio||1;
if (core.isset(core.items.itemEffect[id])) { if (core.isset(core.items.itemEffect[id])) {
eval(core.items.itemEffect[id]); eval(core.items.itemEffect[id]);
@ -2289,21 +2310,23 @@ ui.prototype.drawStatistics = function () {
mdef = core.status.hero.mdef - temp.mdef; mdef = core.status.hero.mdef - temp.mdef;
} }
else { else {
if (id.indexOf('sword')==0 && core.isset(core.values[id])) { // 装备
var x = core.values[id]; if (id.indexOf('sword')==0 || id.indexOf('shield')==0) {
if (typeof x == 'number') x = {'atk': x}; var values = core.material.items[id].equip||{};
atk += x.atk||0; atk = values.atk||0;
def += x.def||0; def = values.def||0;
mdef += x.mdef||0; mdef = values.mdef||0;
}
if (id.indexOf('shield')==0 && core.isset(core.values[id])) {
var x = core.values[id];
if (typeof x == 'number') x = {'def': x};
atk += x.atk||0;
def += x.def||0;
mdef += x.mdef||0;
} }
} }
if (id.indexOf('sword')==0 || id.indexOf('shield')==0) {
var t = "";
if (atk>0) t+=atk+"攻";
if (def>0) t+=def+"防";
if (mdef>0) t+=mdef+"魔防";
if (t!="") ext[id]=t;
}
core.status.hero = core.clone(temp); core.status.hero = core.clone(temp);
total.count[id]++; total.count[id]++;
total.add.hp+=hp; total.add.hp+=hp;
@ -2328,22 +2351,33 @@ ui.prototype.drawStatistics = function () {
if (core.flags.enableMoney) text+=",总金币数"+data.monster.money; if (core.flags.enableMoney) text+=",总金币数"+data.monster.money;
if (core.flags.enableExperience) text+=",总经验数"+data.monster.experience; if (core.flags.enableExperience) text+=",总经验数"+data.monster.experience;
if (core.flags.enableAddPoint) text+=",总加点数"+data.monster.point; if (core.flags.enableAddPoint) text+=",总加点数"+data.monster.point;
text+="。\n\n"; text+="。\n";
Object.keys(data.count).forEach(function (key) {
var value=data.count[key]; var prev = "";
if (value>0) { ids.forEach(function (key) {
var name=null; var value = data.count[key];
if (key=='yellowDoor') name="黄门"; if (value==0) return;
else if (key=='blueDoor') name="蓝门"; var c = cls[key];
else if (key=='redDoor') name="红门"; if (c!=prev) {
else if (key=='greenDoor') name="绿门"; if (prev != "") text += "。";
else if (key=='steelDoor') name="铁门"; text += "\n";
else name=(core.material.items[key]||{}).name;
if (core.isset(name)) {
text+=name+value+"个;";
}
} }
else
text += "";
prev = c;
var name = null;
if (key=='yellowDoor') name="黄门";
else if (key=='blueDoor') name="蓝门";
else if (key=='redDoor') name="红门";
else if (key=='greenDoor') name="绿门";
else if (key=='steelDoor') name="铁门";
else name=core.material.items[key].name;
text+=name+value+"个";
if (core.isset(ext[key]))
text+="("+ext[key]+")";
}) })
if (prev!="") text+="。";
text+="\n\n"; text+="\n\n";
text+="共加生命值"+core.formatBigNumber(data.add.hp)+"点,攻击" text+="共加生命值"+core.formatBigNumber(data.add.hp)+"点,攻击"
+core.formatBigNumber(data.add.atk)+"点,防御" +core.formatBigNumber(data.add.atk)+"点,防御"

28
main.js
View File

@ -50,6 +50,7 @@ function main() {
'levelChooseButtons': document.getElementById('levelChooseButtons'), 'levelChooseButtons': document.getElementById('levelChooseButtons'),
'data': document.getElementById('data'), 'data': document.getElementById('data'),
'statusLabels': document.getElementsByClassName('statusLabel'), 'statusLabels': document.getElementsByClassName('statusLabel'),
'statusTexts': document.getElementsByClassName('statusText'),
'floorCol': document.getElementById('floorCol'), 'floorCol': document.getElementById('floorCol'),
'nameCol': document.getElementById('nameCol'), 'nameCol': document.getElementById('nameCol'),
'lvCol': document.getElementById('lvCol'), 'lvCol': document.getElementById('lvCol'),
@ -531,32 +532,7 @@ main.dom.replayGame.onclick = function () {
} }
} }
core.readFile(function (obj) { core.chooseReplayFile();
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

@ -27,7 +27,10 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"item.mp3", "item.mp3",
"equip.mp3", "equip.mp3",
"zone.mp3", "zone.mp3",
"jump.mp3" "jump.mp3",
"pickaxe.mp3",
"bomb.mp3",
"centerFly.mp3"
], ],
"startBackground": "bg.jpg", "startBackground": "bg.jpg",
"startLogoStyle": "color: black", "startLogoStyle": "color: black",
@ -56,7 +59,11 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"statusLeftBackground": "url(project/images/ground.png) repeat", "statusLeftBackground": "url(project/images/ground.png) repeat",
"statusTopBackground": "url(project/images/ground.png) repeat", "statusTopBackground": "url(project/images/ground.png) repeat",
"toolsBackground": "url(project/images/ground.png) repeat", "toolsBackground": "url(project/images/ground.png) repeat",
"borderColor": "white" "borderColor": "white",
"statusBarColor": "white",
"hardLabelColor": "red",
"floorChangingBackground": "black",
"floorChangingTextColor": "white"
}, },
"firstData": { "firstData": {
"title": "魔塔样板", "title": "魔塔样板",
@ -219,10 +226,8 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"displayExtraDamage": true, "displayExtraDamage": true,
"enableGentleClick": true, "enableGentleClick": true,
"potionWhileRouting": false, "potionWhileRouting": false,
"enableViewMaps": true,
"portalWithoutTrigger": true, "portalWithoutTrigger": true,
"canGoDeadZone": false, "canGoDeadZone": false,
"enableMoveDirectly": true, "enableMoveDirectly": true
"clickMoveDirectly": true
} }
} }

View File

@ -64,11 +64,11 @@ icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
'greenDoor': 7, 'greenDoor': 7,
'specialDoor': 8, 'specialDoor': 8,
'steelDoor': 9, 'steelDoor': 9,
'yellowWallDoor': 10, 'yellowWall': 10,
'whiteWallDoor': 11, 'whiteWall': 11,
'blueWallDoor': 12, 'blueWall': 12,
'lavaDoor': 13, 'crystalUp': 13,
'starDoor': 14, 'crystalBottom': 14,
'starPortal': 15, 'starPortal': 15,
'fire': 16, 'fire': 16,
'portal': 17, 'portal': 17,

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 32 KiB

View File

@ -15,35 +15,43 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
}, },
"redJewel": { "redJewel": {
"cls": "items", "cls": "items",
"name": "红宝石" "name": "红宝石",
"text": "',攻击+'+core.values.redJewel"
}, },
"blueJewel": { "blueJewel": {
"cls": "items", "cls": "items",
"name": "蓝宝石" "name": "蓝宝石",
"text": "',防御+'+core.values.blueJewel"
}, },
"greenJewel": { "greenJewel": {
"cls": "items", "cls": "items",
"name": "绿宝石" "name": "绿宝石",
"text": "',魔防+'+core.values.greenJewel"
}, },
"yellowJewel": { "yellowJewel": {
"cls": "items", "cls": "items",
"name": "黄宝石" "name": "黄宝石",
"text": "可以进行加点"
}, },
"redPotion": { "redPotion": {
"cls": "items", "cls": "items",
"name": "红血瓶" "name": "红血瓶",
"text": "',生命+'+core.values.redPotion"
}, },
"bluePotion": { "bluePotion": {
"cls": "items", "cls": "items",
"name": "蓝血瓶" "name": "蓝血瓶",
"text": "',生命+'+core.values.bluePotion"
}, },
"yellowPotion": { "yellowPotion": {
"cls": "items", "cls": "items",
"name": "黄血瓶" "name": "黄血瓶",
"text": "'生命+'+core.values.yellowPotion"
}, },
"greenPotion": { "greenPotion": {
"cls": "items", "cls": "items",
"name": "绿血瓶" "name": "绿血瓶",
"text": "',生命+'+core.values.greenPotion"
}, },
"sword0": { "sword0": {
"cls": "items", "cls": "items",
@ -343,13 +351,13 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"book": "core.ui.drawBook(0);", "book": "core.ui.drawBook(0);",
"fly": "core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId));", "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});", "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});", "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});", "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});", "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});", "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.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.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 + '使用成功');", "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});", "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});", "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);", "poisonWine": "core.setFlag('poison', false);",
@ -357,7 +365,15 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"curseWine": "core.setFlag('curse', false);", "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);", "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);", "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": { "canUseItemEffect": {
"book": "true", "book": "true",
@ -377,6 +393,14 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a =
"curseWine": "core.hasFlag('curse')", "curseWine": "core.hasFlag('curse')",
"superWine": "core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse')", "superWine": "core.hasFlag('poison') || core.hasFlag('weak') || core.hasFlag('curse')",
"lifeWand": "true", "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"
} }
} }

View File

@ -99,6 +99,11 @@ maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
'93':{'cls': 'animates', 'id': 'downPortal', 'noPass': false}, // 下箭头 '93':{'cls': 'animates', 'id': 'downPortal', 'noPass': false}, // 下箭头
'94':{'cls': 'animates', 'id': 'rightPortal', 'noPass': false}, // 右箭头 '94':{'cls': 'animates', 'id': 'rightPortal', 'noPass': false}, // 右箭头
// 101~120 其他的animates
'101':{'cls': 'animates', 'id': 'crystalUp'},
'102':{'cls': 'animates', 'id': 'crystalBottom'},
'103':{'cls': 'animates', 'id': 'fire'},
'104':{'cls': 'animates', 'id': 'switch'},
////////////////////////// NPC部分 ////////////////////////// ////////////////////////// NPC部分 //////////////////////////

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.