remake difficuity choosing, fix some numerical mistake, fix scroll, etc

This commit is contained in:
bdf1 2022-10-23 08:51:08 +13:00
parent 9500685066
commit f2fc4fe43e
12 changed files with 326 additions and 288 deletions

View File

@ -1 +1 @@
{"viewportLoc":[0,0],"editorLastFloorId":"U2"} {"viewportLoc":[0,0],"editorLastFloorId":"QISHI"}

View File

@ -1095,16 +1095,16 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d =
"operator": "-=", "operator": "-=",
"value": "flag:mdefShop" "value": "flag:mdefShop"
}, },
{
"type": "setValue",
"name": "flag:mdefShop",
"value": "flag:mdefShop+1"
},
{ {
"type": "setValue", "type": "setValue",
"name": "status:mdef", "name": "status:mdef",
"operator": "+=", "operator": "+=",
"value": "flag:mdefShop" "value": "flag:mdefShop"
},
{
"type": "setValue",
"name": "flag:mdefShop",
"value": "flag:mdefShop+1"
} }
], ],
"false": [ "false": [

View File

@ -791,6 +791,17 @@ main.floors.MT0=
"type": "if", "type": "if",
"condition": "(flag:hard==2)", "condition": "(flag:hard==2)",
"true": [ "true": [
{
"type": "if",
"condition": "(flag:mdefShop<5)",
"true": [
{
"type": "setValue",
"name": "flag:mdefShop",
"value": "5"
}
]
},
{ {
"type": "openShop", "type": "openShop",
"id": "mdefShop", "id": "mdefShop",

View File

@ -10,7 +10,7 @@ main.floors.nandu=
{ {
"name": "nanduxuanze.jpg", "name": "nanduxuanze.jpg",
"canvas": "bg", "canvas": "bg",
"x": 0, "x": -80,
"y": 0 "y": 0
} }
], ],
@ -129,7 +129,7 @@ main.floors.nandu=
"code": 6, "code": 6,
"image": "0easy.png", "image": "0easy.png",
"loc": [ "loc": [
0, -160,
0 0
], ],
"opacity": 1, "opacity": 1,
@ -385,7 +385,7 @@ main.floors.nandu=
"code": 6, "code": 6,
"image": "0easy.png", "image": "0easy.png",
"loc": [ "loc": [
0, -160,
0 0
], ],
"opacity": 1, "opacity": 1,
@ -426,7 +426,7 @@ main.floors.nandu=
"code": 6, "code": 6,
"image": "0normal.png", "image": "0normal.png",
"loc": [ "loc": [
0, -160,
0 0
], ],
"opacity": 1, "opacity": 1,
@ -467,8 +467,8 @@ main.floors.nandu=
"code": 6, "code": 6,
"image": "0hard.png", "image": "0hard.png",
"loc": [ "loc": [
20, -160,
10 0
], ],
"opacity": 1, "opacity": 1,
"time": 0 "time": 0
@ -508,7 +508,7 @@ main.floors.nandu=
"code": 6, "code": 6,
"image": "0hell.png", "image": "0hell.png",
"loc": [ "loc": [
0, -160,
0 0
], ],
"opacity": 1, "opacity": 1,
@ -549,7 +549,7 @@ main.floors.nandu=
"code": 6, "code": 6,
"image": "0cheating.png", "image": "0cheating.png",
"loc": [ "loc": [
0, -160,
0 0
], ],
"opacity": 1, "opacity": 1,

View File

@ -307,6 +307,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.removeFlag("__guards__" + x + "_" + y); core.removeFlag("__guards__" + x + "_" + y);
} }
core.status.hero.mdef += [20, 3, 2, 1, 0, 20][core.getFlag('hard', 0)];
// 获得金币 // 获得金币
var money = guards.reduce(function (curr, g) { var money = guards.reduce(function (curr, g) {
return curr + core.material.enemys[g[2]].money; return curr + core.material.enemys[g[2]].money;
@ -1594,7 +1595,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
}, },
"drawStatusBar": function () { "drawStatusBar": function () {
core.dom.caidan1Ctx.drawImage(core.material.images.images['caidan.png'],0,0) core.dom.caidan1Ctx.drawImage(core.material.images.images['caidan.png'],0,0)
core.drawImage('caidan','caidan.png',-161,0) if (core.status.floorId == 'nandu') core.clearMap('caidan');
else core.drawImage('caidan','caidan.png',-161,0);
var ctx, fill = function (text, x, y, style) { var ctx, fill = function (text, x, y, style) {
core.ui.setFont(ctx, /*(/\w+/.test(text) ? 'italic ' : '') + */'18px fzchyjw'); core.ui.setFont(ctx, /*(/\w+/.test(text) ? 'italic ' : '') + */'18px fzchyjw');
core.ui.fillText(ctx, text, x, y, style); core.ui.fillText(ctx, text, x, y, style);
@ -1634,9 +1636,9 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
fill(core.formatBigNumber(core.getRealStatus('def')), 108, 82 + 35 + 36, '#000000'); fill(core.formatBigNumber(core.getRealStatus('def')), 108, 82 + 35 + 36, '#000000');
//core.drawImage(ctx, core.statusBar.icons.mdef, 6, 145, 25, 25); //core.drawImage(ctx, core.statusBar.icons.mdef, 6, 145, 25, 25);
//core.drawImage(ctx, core.statusBar.icons.money, 6, 179, 25, 25); //core.drawImage(ctx, core.statusBar.icons.money, 6, 179, 25, 25);
fill(core.formatBigNumber(core.status.hero.money), 108, 82 + 35 + 36 + 33, '#000000'); fill(core.formatBigNumber(core.status.hero.exp), 108, 82 + 35 + 36 + 33, '#000000');
//core.drawImage(ctx, core.statusBar.icons.exp, 6, 213, 25, 25); //core.drawImage(ctx, core.statusBar.icons.exp, 6, 213, 25, 25);
fill(core.formatBigNumber(core.status.hero.exp), 108, 82 + 35 + 36 + 33 + 33, '#000000'); fill(core.formatBigNumber(core.status.hero.money), 108, 82 + 35 + 36 + 33 + 33, '#000000');
fill(core.getFlag("juqing", 0), 108, 82 + 35 + 36 + 33 + 33 + 32, '#FF0000'); fill(core.getFlag("juqing", 0), 108, 82 + 35 + 36 + 33 + 33 + 32, '#FF0000');
ctx.textAlign = 'left'; ctx.textAlign = 'left';
if (flags.hard - 4) fill1(core.formatBigNumber(core.getRealStatus('mdef')), 76, 166, '#FF1495'); if (flags.hard - 4) fill1(core.formatBigNumber(core.getRealStatus('mdef')), 76, 166, '#FF1495');

Binary file not shown.

Before

Width:  |  Height:  |  Size: 55 KiB

After

Width:  |  Height:  |  Size: 29 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 52 KiB

After

Width:  |  Height:  |  Size: 28 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 18 KiB

After

Width:  |  Height:  |  Size: 23 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 47 KiB

After

Width:  |  Height:  |  Size: 26 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 44 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 78 KiB

After

Width:  |  Height:  |  Size: 131 KiB

View File

@ -117,6 +117,31 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.dom.statusCanvas.style.display = core.flags.statusCanvas && !obj.extendToolbar ? "block" : "none"; core.dom.statusCanvas.style.display = core.flags.statusCanvas && !obj.extendToolbar ? "block" : "none";
} }
core.registerResize("statusBar", core.control._resize_statusBar); core.registerResize("statusBar", core.control._resize_statusBar);
core.maps._drawThumbnail_realDrawTempCanvas = function (floorId, blocks, options) {
// 缩略图:背景
this.drawBg(floorId, options);
// 缩略图:事件
this.drawEvents(floorId, blocks, options);
// 缩略图:勇士
if (options.heroLoc) {
options.heroIcon = options.heroIcon || core.status.hero.image || 'hero.png';
options.heroIcon = core.getMappedName(options.heroIcon);
var icon = core.material.icons.hero[options.heroLoc.direction];
var height = core.material.images.images[options.heroIcon].height / 4;
var width = (core.material.images.images[options.heroIcon].width || 128) / 4;
core.drawImage(options.ctx, core.material.images.images[options.heroIcon], icon.stop * width, icon.loc * height, width, height,
32 * options.heroLoc.x + 32 - width, 32 * options.heroLoc.y + 32 - height, width, height);
}
// 缩略图:卷轴
if (floorId != 'nandu') core.drawImage(options.ctx, 'caidan.png', -161, 0);
// 缩略图:前景
this.drawFg(floorId, options);
// 缩略图:显伤
if (options.damage && core.hasItem('book')) {
core.updateCheckBlock(floorId);
core.control.updateDamage(floorId, options.ctx);
}
}
}, },
"drawLight": function () { "drawLight": function () {
@ -644,47 +669,47 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
core.ui.clearUIEventSelector(); core.ui.clearUIEventSelector();
core.setTextAlign('uievent', 'left'); core.setTextAlign('uievent', 'left');
core.setTextBaseline('uievent', 'top'); core.setTextBaseline('uievent', 'top');
core.fillRect('uievent', 0, 0, 416, 416, 'black'); core.fillRect('uievent', 0, 0, 480, 480, 'black');
core.drawWindowSkin('winskin.png', 'uievent', 0, 0, 416, 56); core.drawWindowSkin('winskin.png', 'uievent', 0, 0, 480, 64);
core.drawWindowSkin('winskin.png', 'uievent', 0, 56, 312, 56); core.drawWindowSkin('winskin.png', 'uievent', 0, 64, 360, 64);
core.drawWindowSkin('winskin.png', 'uievent', 0, 112, 312, 304); core.drawWindowSkin('winskin.png', 'uievent', 0, 128, 360, 352);
core.drawWindowSkin('winskin.png', 'uievent', 312, 56, 104, 56); core.drawWindowSkin('winskin.png', 'uievent', 360, 64, 120, 64);
core.drawWindowSkin('winskin.png', 'uievent', 312, 112, 104, 304); core.drawWindowSkin('winskin.png', 'uievent', 360, 128, 120, 352);
core.setFillStyle('uievent', 'white'); core.setFillStyle('uievent', 'white');
core.setStrokeStyle('uievent', 'white'); core.setStrokeStyle('uievent', 'white');
core.fillText("uievent", "购买", 32, 74, 'white', bigFont); core.fillText("uievent", "购买", 32, 84, 'white', bigFont);
core.fillText("uievent", "卖出", 132, 74); core.fillText("uievent", "卖出", 152, 84);
core.fillText("uievent", "离开", 232, 74); core.fillText("uievent", "离开", 272, 84);
core.fillText("uievent", "当前" + useText, 324, 66, null, middleFont); core.fillText("uievent", "当前" + useText, 374, 75, null, middleFont);
core.setTextAlign("uievent", "right"); core.setTextAlign("uievent", "right");
core.fillText("uievent", core.formatBigNumber(core.status.hero[use]), 405, 89); core.fillText("uievent", core.formatBigNumber(core.status.hero.money), 466, 100);
core.setTextAlign("uievent", "left"); core.setTextAlign("uievent", "left");
core.ui.drawUIEventSelector(1, "winskin.png", 22 + 100 * type, 66, 60, 33); core.ui.drawUIEventSelector(1, "winskin.png", 22 + 120 * type, 76, 60, 33);
if (selectItem != null) { if (selectItem != null) {
core.setTextAlign('uievent', 'center'); core.setTextAlign('uievent', 'center');
core.fillText("uievent", type == 0 ? "买入个数" : "卖出个数", 364, 320, null, bigFont); core.fillText("uievent", type == 0 ? "买入个数" : "卖出个数", 420, 360, null, bigFont);
core.fillText("uievent", "< " + selectCount + " >", 364, 350); core.fillText("uievent", "< " + selectCount + " >", 420, 390);
core.fillText("uievent", "确定", 364, 380); core.fillText("uievent", "确定", 420, 420);
} }
// Step 2获得列表并展示 // Step 2获得列表并展示
list = choices.filter(function (one) { list = choices.filter(function (one) {
if (one.condition != null && one.condition != '') { if (one.condition != null && one.condition != '') {
try { if (!core.calValue(one.condition)) return false; } catch (e) { } try { if (!core.calValue(one.condition)) return false; } catch (e) {}
} }
return (type == 0 && one.money != null) || (type == 1 && one.sell != null); return (type == 0 && one.money != null) || (type == 1 && one.sell != null);
}); });
var per_page = 6; var per_page = 7;
totalPage = Math.ceil(list.length / per_page); totalPage = Math.ceil(list.length / per_page);
page = Math.floor((selectItem || 0) / per_page) + 1; page = Math.floor((selectItem || 0) / per_page) + 1;
// 绘制分页 // 绘制分页
if (totalPage > 1) { if (totalPage > 1) {
var half = 156; var half = 180;
core.setTextAlign('uievent', 'center'); core.setTextAlign('uievent', 'center');
core.fillText('uievent', page + " / " + totalPage, half, 388, null, middleFont); core.fillText('uievent', page + " / " + totalPage, half, 450, null, middleFont);
if (page > 1) core.fillText('uievent', '上一页', half - 80, 388); if (page > 1) core.fillText('uievent', '上一页', half - 80, 450);
if (page < totalPage) core.fillText('uievent', '下一页', half + 80, 388); if (page < totalPage) core.fillText('uievent', '下一页', half + 80, 450);
} }
core.setTextAlign('uievent', 'left'); core.setTextAlign('uievent', 'left');
@ -694,45 +719,45 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
var curr = start + i; var curr = start + i;
if (curr >= list.length) break; if (curr >= list.length) break;
var item = list[curr]; var item = list[curr];
core.drawIcon('uievent', item.id, 10, 125 + i * 40); core.drawIcon('uievent', item.id, 10, 141 + i * 40);
core.setTextAlign('uievent', 'left'); core.setTextAlign('uievent', 'left');
core.fillText('uievent', core.material.items[item.id].name, 50, 132 + i * 40, null, bigFont); core.fillText('uievent', core.material.items[item.id].name, 50, 148 + i * 40, null, bigFont);
core.setTextAlign('uievent', 'right'); core.setTextAlign('uievent', 'right');
core.fillText('uievent', (type == 0 ? core.calValue(item.money) : core.calValue(item.sell)) + useText + "/个", 300, 133 + i * 40, null, middleFont); core.fillText('uievent', (type == 0 ? core.calValue(item.money) : core.calValue(item.sell)) + useText + "/个", 340, 149 + i * 40, null, middleFont);
core.setTextAlign("uievent", "left"); core.setTextAlign("uievent", "left");
if (curr == selectItem) { if (curr == selectItem) {
// 绘制描述,文字自动放缩 // 绘制描述,文字自动放缩
var text = core.material.items[item.id].text || "该道具暂无描述"; var text = core.material.items[item.id].text || "该道具暂无描述";
try { text = core.replaceText(text); } catch (e) { } try { text = core.replaceText(text); } catch (e) {}
for (var fontSize = 20; fontSize >= 8; fontSize -= 2) { for (var fontSize = 20; fontSize >= 8; fontSize -= 2) {
var config = { left: 10, fontSize: fontSize, maxWidth: 403 }; var config = { left: 10, fontSize: fontSize, maxWidth: 467 };
var height = core.getTextContentHeight(text, config); var height = core.getTextContentHeight(text, config);
if (height <= 50) { if (height <= 60) {
config.top = (56 - height) / 2; config.top = (64 - height) / 2;
core.drawTextContent("uievent", text, config); core.drawTextContent("uievent", text, config);
break; break;
} }
} }
core.ui.drawUIEventSelector(2, "winskin.png", 8, 120 + i * 40, 295, 40); core.ui.drawUIEventSelector(2, "winskin.png", 8, 137 + i * 40, 343, 40);
if (type == 0 && item.number != null) { if (type == 0 && item.number != null) {
core.fillText("uievent", "存货", 324, 132, null, bigFont); core.fillText("uievent", "存货", 370, 152, null, bigFont);
core.setTextAlign("uievent", "right"); core.setTextAlign("uievent", "right");
core.fillText("uievent", item.number, 406, 132, null, null, 40); core.fillText("uievent", item.number, 470, 152, null, null, 60);
} else if (type == 1) { } else if (type == 1) {
core.fillText("uievent", "数量", 324, 132, null, bigFont); core.fillText("uievent", "数量", 370, 152, null, bigFont);
core.setTextAlign("uievent", "right"); core.setTextAlign("uievent", "right");
core.fillText("uievent", core.itemCount(item.id), 406, 132, null, null, 40); core.fillText("uievent", core.itemCount(item.id), 470, 152, null, null, 40);
} }
core.setTextAlign("uievent", "left"); core.setTextAlign("uievent", "left");
core.fillText("uievent", "预计" + useText, 324, 250); core.fillText("uievent", "预计" + useText, 370, 280);
core.setTextAlign("uievent", "right"); core.setTextAlign("uievent", "right");
totalMoney = selectCount * (type == 0 ? core.calValue(item.money) : core.calValue(item.sell)); totalMoney = selectCount * (type == 0 ? core.calValue(item.money) : core.calValue(item.sell));
core.fillText("uievent", core.formatBigNumber(totalMoney), 405, 280); core.fillText("uievent", core.formatBigNumber(totalMoney), 470, 310);
core.setTextAlign("uievent", "left"); core.setTextAlign("uievent", "left");
core.fillText("uievent", type == 0 ? "已购次数" : "已卖次数", 324, 170); core.fillText("uievent", type == 0 ? "已购次数" : "已卖次数", 370, 190);
core.setTextAlign("uievent", "right"); core.setTextAlign("uievent", "right");
core.fillText("uievent", (type == 0 ? item.money_count : item.sell_count) || 0, 405, 200); core.fillText("uievent", (type == 0 ? item.money_count : item.sell_count) || 0, 470, 220);
} }
} }
@ -826,7 +851,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this._performItemShopClick = function (px, py) { this._performItemShopClick = function (px, py) {
var item = list[selectItem] || null; var item = list[selectItem] || null;
// 鼠标操作 // 鼠标操作
if (px >= 22 && px <= 82 && py >= 71 && py <= 102) { if (px >= 22 && px <= 82 && py >= 81 && py <= 112) {
// 买 // 买
if (type != 0) { if (type != 0) {
type = 0; type = 0;
@ -835,7 +860,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
return; return;
} }
if (px >= 122 && px <= 182 && py >= 71 && py <= 102) { if (px >= 142 && px <= 202 && py >= 81 && py <= 112) {
// 卖 // 卖
if (type != 1) { if (type != 1) {
type = 1; type = 1;
@ -844,38 +869,38 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
} }
return; return;
} }
if (px >= 222 && px <= 282 && py >= 71 && py <= 102) // 离开 if (px >= 262 && px <= 322 && py >= 81 && py <= 112) // 离开
return core.insertAction({ "type": "break" }); return core.insertAction({ "type": "break" });
// < > // <>
if (px >= 318 && px <= 341 && py >= 348 && py <= 376) if (px >= 370 && px <= 395 && py >= 392 && py <= 415)
return _add(item, -1); return _add(item, -1);
if (px >= 388 && px <= 416 && py >= 348 && py <= 376) if (px >= 445 && px <= 470 && py >= 302 && py <= 415)
return _add(item, 1); return _add(item, 1);
// 确定 // 确定
if (px >= 341 && px <= 387 && py >= 380 && py <= 407) if (px >= 392 && px <= 443 && py >= 421 && py <= 446)
return _confirm(item); return _confirm(item);
// 上一页/下一页 // 上一页/下一页
if (px >= 45 && px <= 105 && py >= 388) { if (px >= 70 && px <= 130 && py >= 450) {
if (page > 1) { if (page > 1) {
selectItem -= 6; selectItem -= 7;
selectCount = 0; selectCount = 0;
} }
return; return;
} }
if (px >= 208 && px <= 268 && py >= 388) { if (px >= 230 && px <= 290 && py >= 450) {
if (page < totalPage) { if (page < totalPage) {
selectItem = Math.min(selectItem + 6, list.length - 1); selectItem = Math.min(selectItem + 7, list.length - 1);
selectCount = 0; selectCount = 0;
} }
return; return;
} }
// 实际区域 // 实际区域
if (px >= 9 && px <= 300 && py >= 120 && py < 360) { if (px >= 9 && px <= 351 && py >= 142 && py < 422) {
if (list.length == 0) return; if (list.length == 0) return;
var index = parseInt((py - 120) / 40); var index = parseInt((py - 142) / 40);
var newItem = 6 * (page - 1) + index; var newItem = 7 * (page - 1) + index;
if (newItem >= list.length) newItem = list.length - 1; if (newItem >= list.length) newItem = list.length - 1;
if (newItem != selectItem) { if (newItem != selectItem) {
selectItem = newItem; selectItem = newItem;
@ -920,7 +945,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
]); ]);
} }
}, },
"enemyLevel": function () { "enemyLevel": function () {
// 此插件将提供怪物手册中的怪物境界显示 // 此插件将提供怪物手册中的怪物境界显示
// 使用此插件需要先给每个怪物定义境界,方法如下: // 使用此插件需要先给每个怪物定义境界,方法如下: