fix: fix hero direction when changefloor, color in statusbar, color on damage, add q/e for down/up

This commit is contained in:
bdf1 2022-11-13 02:35:25 +13:00
parent 13e08b122f
commit 2be53ffca8
3 changed files with 120 additions and 11 deletions

View File

@ -197,7 +197,7 @@ enemys.prototype.getDamageString = function (enemy, x, y, floorId) {
color = '#FF2222'; color = '#FF2222';
} }
else { else {
if (damage < 0) color = '#11FF11'; if (damage <= 0) color = '#11FF11';
else if (damage < core.status.hero.hp / 3) color = '#FFFFFF'; else if (damage < core.status.hero.hp / 3) color = '#FFFFFF';
else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00'; else if (damage < core.status.hero.hp * 2 / 3) color = '#FFFF00';
else if (damage < core.status.hero.hp) color = '#FF9933'; else if (damage < core.status.hero.hp) color = '#FF9933';

View File

@ -120,6 +120,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
// 设置勇士的位置 // 设置勇士的位置
heroLoc.direction = core.turnDirection(heroLoc.direction); heroLoc.direction = core.turnDirection(heroLoc.direction);
core.status.hero.loc = heroLoc; core.status.hero.loc = heroLoc;
if (!fromLoad && null == core.getBlock(heroLoc.x, heroLoc.y, floorId))
core.setHeroLoc('direction', core.turnDirection('down'), true);
// 检查重生怪并重置 // 检查重生怪并重置
if (!fromLoad) { if (!fromLoad) {
core.extractBlocks(floorId); core.extractBlocks(floorId);
@ -845,14 +847,44 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
case 68: // D读档 case 68: // D读档
core.load(true); core.load(true);
break; break;
case 69: // E打开光标 case 69: // E上 //打开光标
core.ui._drawCursor(); if ((core.flags.flyNearStair && !core.nearStair()))
core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly');
else if (!core.canUseItem('fly'))
core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly');
else {
var tmp = core.status.floorId;
if (tmp[0] == 'M' && tmp[1] == 'T' && tmp[2] >= '0' && tmp[2] <= '9') {
tmp = 'MT' + (tmp.substring(2) - (-1));
}
else if (tmp == 'U1') tmp = 'MT0';
else if (tmp[0] == 'U' && tmp[1] >= '0' && tmp[1] <= '9') {
tmp = 'U' + (tmp.substring(1) - 1);
}
if (!core.flyTo(tmp)) core.drawTip("您不能去该楼层!", 'fly');
}
//core.ui._drawCursor();
break; break;
case 84: // T打开道具栏 case 84: // T打开道具栏
core.openToolbox(true); core.openToolbox(true);
break; break;
case 81: // Q打开装备栏 case 81: // Q下 //打开装备栏
core.openEquipbox(true); if ((core.flags.flyNearStair && !core.nearStair()))
core.drawTip("必须在楼梯口才能使用" + core.material.items['fly'].name, 'fly');
else if (!core.canUseItem('fly'))
core.drawTip("不知道为什么," + core.material.items['fly'].name + "在此层失效了!", 'fly');
else {
var tmp = core.status.floorId;
if (tmp[0] == 'U' && tmp[1] >= '0' && tmp[1] <= '9') {
tmp = 'U' + (tmp.substring(1) - (-1));
}
else if (tmp == 'MT0') tmp = 'U1';
else if (tmp[0] == 'M' && tmp[1] == 'T' && tmp[2] >= '0' && tmp[2] <= '9') {
tmp = 'MT' + (tmp.substring(2) - 1);
}
if (!core.flyTo(tmp)) core.drawTip("您不能去该楼层!", 'fly');
}
//core.openEquipbox(true);
break; break;
case 90: // Z转向 case 90: // Z转向
core.turnHero(); core.turnHero();
@ -1645,14 +1677,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
ctx.textAlign = 'left'; ctx.textAlign = 'left';
if (flags.hard - 4) fill1('[' + core.formatBigNumber(core.getRealStatus('mdef')) + ']', 76, 174, '#FF1495'); if (flags.hard - 4) fill1('[' + core.formatBigNumber(core.getRealStatus('mdef')) + ']', 76, 174, '#FF1495');
core.drawImage(ctx, core.material.images.items, 0, 0, 32, 128, 13, 300, 28, 112); core.drawImage(ctx, core.material.images.items, 0, 0, 32, 128, 13, 300, 28, 112);
fill('黄钥匙', 50, 320, '#F0E6BC'); fill('黄钥匙', 50, 320, '#FFFF80');
fill('蓝钥匙', 50, 320 + 28, '#7FFFD4'); fill('蓝钥匙', 50, 320 + 28, '#80FFFF');
fill('红钥匙', 50, 320 + 56, '#E9967A'); fill('红钥匙', 50, 320 + 56, '#FF8080');
fill('黑钥匙', 50, 320 + 84, '#000000'); fill('黑钥匙', 50, 320 + 84, '#000000');
ctx.textAlign = 'right'; ctx.textAlign = 'right';
fill(core.itemCount('yellowKey'), 140, 320, '#F0E6BC'); fill(core.itemCount('yellowKey'), 140, 320, '#FFFF80');
fill(core.itemCount('blueKey'), 140, 320 + 28, '#7FFFD4'); fill(core.itemCount('blueKey'), 140, 320 + 28, '#80FFFF');
fill(core.itemCount('redKey'), 140, 320 + 56, '#E9967A'); fill(core.itemCount('redKey'), 140, 320 + 56, '#FF8080');
fill(core.itemCount('greenKey'), 140, 320 + 84, '#000000'); fill(core.itemCount('greenKey'), 140, 320 + 84, '#000000');
core.drawImage(ctx, core.material.images.images[['00005.png','00001.png','00002.png','00003.png','00004.png','00005.png'][flags.hard || 0]], 7, 404 - [0,10,10,0,0,0][flags.hard || 0]); core.drawImage(ctx, core.material.images.images[['00005.png','00001.png','00002.png','00003.png','00004.png','00005.png'][flags.hard || 0]], 7, 404 - [0,10,10,0,0,0][flags.hard || 0]);
ctx.textAlign = 'left'; ctx.textAlign = 'left';

View File

@ -528,6 +528,83 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
this.afterGetItem(id, x, y, isGentleClick); this.afterGetItem(id, x, y, isGentleClick);
if (callback) callback(); if (callback) callback();
} }
core.enemys.getDamageString = function (enemy, x, y, floorId) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
var damage = this.getDamage(enemy, x, y, floorId);
var color = '#000000';
if (damage == null) {
damage = "???";
color = '#FF2222';
}
else {
if (damage < 0) color = '#11FF11';
else if (damage == 0) color = '#FFFFFF';
else if (damage < core.status.hero.hp / 3) color = '#FFFF00';
else if (damage < core.status.hero.hp * 2 / 3) color = '#FF9933';
else if (damage < core.status.hero.hp) color = '#FF9933';
else color = '#FF2222';
damage = core.formatBigNumber(damage, true);
if (core.enemys.hasSpecial(enemy, 19))
damage += "+";
if (core.enemys.hasSpecial(enemy, 21))
damage += "-";
if (core.enemys.hasSpecial(enemy, 11))
damage += "^";
}
return {
"damage": damage,
"color": color
};
}
core.ui._drawBook_drawBackground = function () {
core.setAlpha('ui', 1);
core.setFillStyle('ui', '#000000');
core.fillRect('ui', 0, 0, core._PX_, core._PY_);
core.drawWindowSkin('winskin.png', 'ui', 0, 0, core._PX_, core._PY_);
}
core.ui.drawFly = function (page) {
core.status.event.data = page;
var floorId = core.floorIds[page];
var title = core.status.maps[floorId].title;
core.clearMap('ui');
core.setAlpha('ui', 0.85);
core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000');
core.setAlpha('ui', 1);
core.setTextAlign('ui', 'center');
core.fillText('ui', '楼层跳跃', core._PX_ / 2, 48, '#FFFFFF', this._buildFont(28, true));
core.fillText('ui', '返回游戏', core._PX_ / 2, core._PY_ - 13, null, this._buildFont(15, true))
core.setTextAlign('ui', 'right');
core.fillText('ui', '浏览地图时也', core._PX_ - 10, core._PY_ - 23, '#aaaaaa', this._buildFont(10, false));
core.fillText('ui', '可楼层跳跃!', core._PX_ - 10, core._PY_ - 11, null, this._buildFont(10, false));
core.setTextAlign('ui', 'center');
var middle = core._PY_ / 2 + 39;
// 换行
var lines = core.splitLines('ui', title, 120, this._buildFont(19, true));
var start_y = middle - (lines.length - 1) * 11;
for (var i in lines) {
core.fillText('ui', lines[i], core._PX_ - 53, start_y, '#FFFFFF', this._buildFont(17, true));
start_y += 22;
}
if (core.actions._getNextFlyFloor(1) != page) {
core.fillText('ui', '▲', core._PX_ - 60, middle - 64, null, this._buildFont(17, false));
core.fillText('ui', '▲', core._PX_ - 60, middle - 96);
core.fillText('ui', '▲', core._PX_ - 60, middle - 96 - 7);
}
if (core.actions._getNextFlyFloor(-1) != page) {
core.fillText('ui', '▼', core._PX_ - 60, middle + 64, null, this._buildFont(17, false));
core.fillText('ui', '▼', core._PX_ - 60, middle + 96);
core.fillText('ui', '▼', core._PX_ - 60, middle + 96 + 7);
}
var size = 0.75;
core.strokeRect('ui', 16, 64, size * core._PX_, size * core._PY_, '#FFFFFF', 2);
core.drawThumbnail(floorId, null, { ctx: 'ui', x: 16, y: 64, size: size, damage: true, all: true });
}
}, },
"drawLight": function () { "drawLight": function () {