完善各种ui

This commit is contained in:
unanmed 2023-01-11 09:45:18 +08:00
parent 7465dd92c8
commit eaa8644df6
22 changed files with 359 additions and 312 deletions

View File

@ -1030,7 +1030,10 @@ control.prototype.tryMoveDirectly = function (destX, destY) {
if (dir && !core.inArray(canMoveArray[dx][dy], dir)) continue; if (dir && !core.inArray(canMoveArray[dx][dy], dir)) continue;
if (canMoveDirectlyArray[i] < 0) continue; if (canMoveDirectlyArray[i] < 0) continue;
if (core.control.moveDirectly(dx, dy, canMoveDirectlyArray[i])) { if (core.control.moveDirectly(dx, dy, canMoveDirectlyArray[i])) {
if (dir) core.moveHero(dir, function () {}); if (dir) {
console.log(dir);
core.moveHero(dir, function () {});
}
return true; return true;
} }
} }
@ -4288,19 +4291,12 @@ control.prototype._resize_canvas = function (obj) {
// resize bigmap // resize bigmap
core.bigmap.canvas.forEach(function (cn) { core.bigmap.canvas.forEach(function (cn) {
var ratio = core.canvas[cn].canvas.hasAttribute('isHD') var ratio = core.canvas[cn].canvas.hasAttribute('isHD')
? core.domStyle.ratio ? core.domStyle.scale * devicePixelRatio
: 1; : 1;
core.canvas[cn].canvas.style.width = core.canvas[cn].canvas.style.width =
(core.canvas[cn].canvas.width / (core.canvas[cn].canvas.width / ratio) * core.domStyle.scale + 'px';
devicePixelRatio /
core.domStyle.ratio) *
core.domStyle.scale +
'px';
core.canvas[cn].canvas.style.height = core.canvas[cn].canvas.style.height =
(core.canvas[cn].canvas.height / (core.canvas[cn].canvas.height / ratio) * core.domStyle.scale +
devicePixelRatio /
core.domStyle.ratio) *
core.domStyle.scale +
'px'; 'px';
}); });
// resize dynamic canvas // resize dynamic canvas

View File

@ -108,7 +108,8 @@ function core() {
availableScale: [], availableScale: [],
isVertical: false, isVertical: false,
showStatusBar: true, showStatusBar: true,
toolbarBtn: false toolbarBtn: false,
hdCanvas: ['damage', 'ui', 'data']
}; };
this.bigmap = { this.bigmap = {
canvas: ['bg', 'event', 'event2', 'fg', 'damage'], canvas: ['bg', 'event', 'event2', 'fg', 'damage'],
@ -294,11 +295,16 @@ core.prototype.init = function (coreData, callback) {
var b = main.mode == 'editor'; var b = main.mode == 'editor';
// 初始化画布 // 初始化画布
for (var name in core.canvas) { for (var name in core.canvas) {
core.maps._setHDCanvasSize( if (core.domStyle.hdCanvas.includes(name))
core.canvas[name], core.maps._setHDCanvasSize(
b ? core.__PIXELS__ : core._PX_, core.canvas[name],
b ? core.__PIXELS__ : core._PY_ b ? core.__PIXELS__ : core._PX_,
); b ? core.__PIXELS__ : core._PY_
);
else {
core.canvas[name].canvas.width = b ? core.__PIXELS__ : core._PX_;
core.canvas[name].canvas.height = b ? core.__PIXELS__ : core._PY_;
}
} }
core.loader._load(function () { core.loader._load(function () {

View File

@ -208,9 +208,9 @@ enemys.prototype.canBattle = function (enemy, x, y, floorId) {
return damage != null && damage < core.status.hero.hp; return damage != null && damage < core.status.hero.hp;
}; };
enemys.prototype.getDamageString = function (enemy, x, y, floorId) { enemys.prototype.getDamageString = function (enemy, x, y, floorId, hero) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
var damage = this.getDamage(enemy, x, y, floorId); var damage = this.getDamage(enemy, x, y, floorId, hero);
var color = '#000000'; var color = '#000000';
@ -234,7 +234,7 @@ enemys.prototype.getDamageString = function (enemy, x, y, floorId) {
}; };
////// 接下来N个临界值和临界减伤计算 ////// ////// 接下来N个临界值和临界减伤计算 //////
enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) { enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId, hero) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
number = number || 1; number = number || 1;
@ -246,7 +246,7 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
floorId floorId
); );
if (specialCriticals != null) return specialCriticals; if (specialCriticals != null) return specialCriticals;
var info = this.getDamageInfo(enemy, null, x, y, floorId); var info = this.getDamageInfo(enemy, hero, x, y, floorId);
if (info == null) { if (info == null) {
// 如果未破防... // 如果未破防...
var overAtk = this._nextCriticals_overAtk(enemy, x, y, floorId); var overAtk = this._nextCriticals_overAtk(enemy, x, y, floorId);
@ -268,12 +268,19 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
number, number,
x, x,
y, y,
floorId floorId,
hero
); );
}; };
/// 未破防临界采用二分计算 /// 未破防临界采用二分计算
enemys.prototype._nextCriticals_overAtk = function (enemy, x, y, floorId) { enemys.prototype._nextCriticals_overAtk = function (
enemy,
x,
y,
floorId,
hero
) {
var calNext = function (currAtk, maxAtk) { var calNext = function (currAtk, maxAtk) {
var start = currAtk, var start = currAtk,
end = maxAtk; end = maxAtk;
@ -284,7 +291,7 @@ enemys.prototype._nextCriticals_overAtk = function (enemy, x, y, floorId) {
if (mid - start > end - mid) mid--; if (mid - start > end - mid) mid--;
var nextInfo = core.enemys.getDamageInfo( var nextInfo = core.enemys.getDamageInfo(
enemy, enemy,
{ atk: mid }, { atk: mid, x: hero?.x, y: hero?.y },
x, x,
y, y,
floorId floorId
@ -294,17 +301,17 @@ enemys.prototype._nextCriticals_overAtk = function (enemy, x, y, floorId) {
} }
var nextInfo = core.enemys.getDamageInfo( var nextInfo = core.enemys.getDamageInfo(
enemy, enemy,
{ atk: start }, { atk: start, x: hero?.x, y: hero?.y },
x, x,
y, y,
floorId floorId
); );
return nextInfo == null return nextInfo == null
? null ? null
: [start - core.getStatus('atk'), nextInfo]; : [start - core.getStatusOrDefault(hero, 'atk'), nextInfo];
}; };
return calNext( return calNext(
core.getStatus('atk') + 1, core.getStatusOrDefault(hero, 'atk') + 1,
core.getEnemyValue(enemy, 'hp', x, y, floorId) + core.getEnemyValue(enemy, 'hp', x, y, floorId) +
core.getEnemyValue(enemy, 'def', x, y, floorId) core.getEnemyValue(enemy, 'def', x, y, floorId)
); );
@ -322,48 +329,17 @@ enemys.prototype._nextCriticals_special = function (
return null; return null;
}; };
enemys.prototype._nextCriticals_useLoop = function (
enemy,
info,
number,
x,
y,
floorId
) {
var mon_hp = info.mon_hp,
hero_atk = core.getStatus('atk'),
mon_def = info.mon_def,
pre = info.damage;
var list = [];
var start_atk = hero_atk;
if (info.__over__) {
start_atk += info.__overAtk__;
list.push([info.__overAtk__, -info.damage]);
}
for (var atk = start_atk + 1; atk <= mon_hp + mon_def; atk++) {
var nextInfo = this.getDamageInfo(enemy, { atk: atk }, x, y, floorId);
if (nextInfo == null || typeof nextInfo == 'number') break;
if (pre > nextInfo.damage) {
pre = nextInfo.damage;
list.push([atk - hero_atk, info.damage - nextInfo.damage]);
if (nextInfo.damage <= 0 && !core.flags.enableNegativeDamage) break;
if (list.length >= number) break;
}
}
if (list.length == 0) list.push([0, 0]);
return list;
};
enemys.prototype._nextCriticals_useBinarySearch = function ( enemys.prototype._nextCriticals_useBinarySearch = function (
enemy, enemy,
info, info,
number, number,
x, x,
y, y,
floorId floorId,
hero
) { ) {
var mon_hp = info.mon_hp, var mon_hp = info.mon_hp,
hero_atk = core.getStatus('atk'), hero_atk = core.getStatusOrDefault(hero, 'atk'),
mon_def = info.mon_def, mon_def = info.mon_def,
pre = info.damage; pre = info.damage;
var list = []; var list = [];
@ -382,7 +358,7 @@ enemys.prototype._nextCriticals_useBinarySearch = function (
if (mid - start > end - mid) mid--; if (mid - start > end - mid) mid--;
var nextInfo = core.enemys.getDamageInfo( var nextInfo = core.enemys.getDamageInfo(
enemy, enemy,
{ atk: mid }, { atk: mid, x: hero?.x, y: hero?.y },
x, x,
y, y,
floorId floorId
@ -393,7 +369,7 @@ enemys.prototype._nextCriticals_useBinarySearch = function (
} }
var nextInfo = core.enemys.getDamageInfo( var nextInfo = core.enemys.getDamageInfo(
enemy, enemy,
{ atk: start }, { atk: start, x: hero?.x, y: hero?.y },
x, x,
y, y,
floorId floorId
@ -418,73 +394,14 @@ enemys.prototype._nextCriticals_useBinarySearch = function (
return list; return list;
}; };
enemys.prototype._nextCriticals_useTurn = function (
enemy,
info,
number,
x,
y,
floorId
) {
var mon_hp = info.mon_hp,
hero_atk = core.getStatus('atk'),
mon_def = info.mon_def,
turn = info.turn;
// ------ 超大回合数强制使用二分算临界
// 以避免1攻10e回合2攻5e回合导致下述循环卡死问题
if (turn >= 1e6) {
// 100w回合以上强制二分计算临界
return this._nextCriticals_useBinarySearch(
enemy,
info,
number,
x,
y,
floorId
);
}
var list = [],
pre = null;
var start_atk = hero_atk;
if (info.__over__) {
start_atk += info.__overAtk__;
list.push([info.__overAtk__, -info.damage]);
}
for (var t = turn - 1; t >= 1; t--) {
var nextAtk = Math.ceil(mon_hp / t) + mon_def;
// 装备提升比例的计算临界
nextAtk = Math.ceil(nextAtk / core.getBuff('atk'));
if (nextAtk <= start_atk) break;
if (nextAtk != pre) {
var nextInfo = this.getDamageInfo(
enemy,
{ atk: nextAtk },
x,
y,
floorId
);
if (nextInfo == null || typeof nextInfo == 'number') break;
list.push([
nextAtk - hero_atk,
Math.floor(info.damage - nextInfo.damage)
]);
if (nextInfo.damage <= 0 && !core.flags.enableNegativeDamage) break;
pre = nextAtk;
}
if (list.length >= number) break;
}
if (list.length == 0) list.push([0, 0]);
return list;
};
////// N防减伤计算 ////// ////// N防减伤计算 //////
enemys.prototype.getDefDamage = function (enemy, k, x, y, floorId) { enemys.prototype.getDefDamage = function (enemy, k, x, y, floorId, hero) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
k = k || 1; k = k || 1;
var nowDamage = this._getDamage(enemy, null, x, y, floorId); var nowDamage = this._getDamage(enemy, hero, x, y, floorId);
var nextDamage = this._getDamage( var nextDamage = this._getDamage(
enemy, enemy,
{ def: core.getStatus('def') + k }, Object.assign({}, hero ?? {}, { def: core.getStatus('def') + k }),
x, x,
y, y,
floorId floorId
@ -508,8 +425,8 @@ enemys.prototype.getDamageInfo = function (enemy, hero, x, y, floorId) {
}; };
////// 获得在某个勇士属性下怪物伤害 ////// ////// 获得在某个勇士属性下怪物伤害 //////
enemys.prototype.getDamage = function (enemy, x, y, floorId) { enemys.prototype.getDamage = function (enemy, x, y, floorId, hero) {
return this._getDamage(enemy, null, x, y, floorId); return this._getDamage(enemy, hero, x, y, floorId);
}; };
enemys.prototype._getDamage = function (enemy, hero, x, y, floorId) { enemys.prototype._getDamage = function (enemy, hero, x, y, floorId) {
@ -517,7 +434,6 @@ enemys.prototype._getDamage = function (enemy, hero, x, y, floorId) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
if (enemy == null) return null; if (enemy == null) return null;
if (x === 9 && y === 3) debugger;
var info = this.getDamageInfo(enemy, hero, x, y, floorId); var info = this.getDamageInfo(enemy, hero, x, y, floorId);
if (info == null) return null; if (info == null) return null;
if (typeof info == 'number') return info; if (typeof info == 'number') return info;

View File

@ -634,7 +634,12 @@ maps.prototype.resizeMap = function (floorId) {
var height = core.bigmap.v2 ? core._PY_ + 64 : core.bigmap.height * 32; var height = core.bigmap.v2 ? core._PY_ + 64 : core.bigmap.height * 32;
core.bigmap.canvas.forEach(function (cn) { core.bigmap.canvas.forEach(function (cn) {
core.maps._setHDCanvasSize(core.canvas[cn], width, height); if (core.domStyle.hdCanvas.includes(cn))
core.maps._setHDCanvasSize(core.canvas[cn], width, height);
else {
core.canvas[cn].canvas.width = width;
core.canvas[cn].canvas.height = height;
}
core.canvas[cn].canvas.style.width = width * core.domStyle.scale + 'px'; core.canvas[cn].canvas.style.width = width * core.domStyle.scale + 'px';
core.canvas[cn].canvas.style.height = core.canvas[cn].canvas.style.height =
@ -2581,7 +2586,7 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (
tempCanvas.canvas.height = height * 32; tempCanvas.canvas.height = height * 32;
tempCanvas.canvas.removeAttribute('isHD'); tempCanvas.canvas.removeAttribute('isHD');
} else { } else {
core.resizeCanvas(tempCanvas, width * 32, height * 32, false, true); core.maps._setHDCanvasSize(tempCanvas, width * 32, height * 32);
} }
} else if (width * height > core.bigmap.threshold) { } else if (width * height > core.bigmap.threshold) {
options.v2 = true; options.v2 = true;
@ -2589,7 +2594,7 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (
tempCanvas.canvas.width = core._PX_; tempCanvas.canvas.width = core._PX_;
tempCanvas.canvas.height = core._PY_; tempCanvas.canvas.height = core._PY_;
tempCanvas.canvas.removeAttribute('isHD'); tempCanvas.canvas.removeAttribute('isHD');
} else core.resizeCanvas(tempCanvas, core._PX_, core._PY_); } else core.maps._setHDCanvasSize(tempCanvas, width * 32, height * 32);
var centerX = options.centerX, var centerX = options.centerX,
centerY = options.centerY; centerY = options.centerY;
if (centerX == null) centerX = Math.floor(width / 2); if (centerX == null) centerX = Math.floor(width / 2);
@ -2611,8 +2616,7 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (
tempCanvas.canvas.width = width * 32; tempCanvas.canvas.width = width * 32;
tempCanvas.canvas.height = height * 32; tempCanvas.canvas.height = height * 32;
tempCanvas.canvas.removeAttribute('isHD'); tempCanvas.canvas.removeAttribute('isHD');
} else } else core.maps._setHDCanvasSize(tempCanvas, width * 32, height * 32);
core.resizeCanvas(tempCanvas, width * 32, height * 32, false, true);
} }
options.ctx = tempCanvas; options.ctx = tempCanvas;
@ -2695,6 +2699,10 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
if (centerY == null) centerY = Math.floor(height / 2); if (centerY == null) centerY = Math.floor(height / 2);
var tempCanvas = core.bigmap.tempCanvas; var tempCanvas = core.bigmap.tempCanvas;
if (!core.getLocalStorage('antiAliasing')) {
ctx.imageSmoothingEnabled = false;
}
if (options.inFlyMap) { if (options.inFlyMap) {
ctx.drawImage( ctx.drawImage(
tempCanvas.canvas, tempCanvas.canvas,
@ -2707,6 +2715,7 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
options.w, options.w,
options.h options.h
); );
ctx.imageSmoothingEnabled = true;
return; return;
} }
@ -2752,6 +2761,7 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
realHeight realHeight
); );
} }
ctx.imageSmoothingEnabled = true;
} else { } else {
// 只绘制可见窗口 // 只绘制可见窗口
var pw = core._PX_, var pw = core._PX_,
@ -2793,6 +2803,7 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
h h
); );
} }
ctx.imageSmoothingEnabled = true;
} else { } else {
var offsetX = core.clamp(centerX - hw, 0, width - W), var offsetX = core.clamp(centerX - hw, 0, width - W),
offsetY = core.clamp(centerY - hh, 0, height - H); offsetY = core.clamp(centerY - hh, 0, height - H);
@ -2809,6 +2820,7 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
w, w,
h h
); );
ctx.imageSmoothingEnabled = true;
return; return;
} }
core.drawImage( core.drawImage(
@ -2823,6 +2835,7 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
w, w,
h h
); );
ctx.imageSmoothingEnabled = true;
} }
} }
}; };

View File

@ -4203,12 +4203,12 @@ ui.prototype.resizeCanvas = function (
var ctx = core.getContextByName(name); var ctx = core.getContextByName(name);
if (!ctx) return null; if (!ctx) return null;
if (width != null) { if (width != null) {
if (!styleOnly) if (!styleOnly && ctx.canvas.hasAttribute('isHD'))
core.maps._setHDCanvasSize(ctx, width, null, isTempCanvas); core.maps._setHDCanvasSize(ctx, width, null, isTempCanvas);
ctx.canvas.style.width = width * core.domStyle.scale + 'px'; ctx.canvas.style.width = width * core.domStyle.scale + 'px';
} }
if (height != null) { if (height != null) {
if (!styleOnly) if (!styleOnly && ctx.canvas.hasAttribute('isHD'))
core.maps._setHDCanvasSize(ctx, null, height, isTempCanvas); core.maps._setHDCanvasSize(ctx, null, height, isTempCanvas);
ctx.canvas.style.height = height * core.domStyle.scale + 'px'; ctx.canvas.style.height = height * core.domStyle.scale + 'px';
} }

View File

@ -220,6 +220,15 @@ function main() {
} }
main.prototype.init = function (mode, callback) { main.prototype.init = function (mode, callback) {
try {
var a = {};
var b = {};
new Proxy(a, b);
} catch (e) {
alert('浏览器版本过低,无法游玩本塔!');
return;
}
for (var i = 0; i < main.dom.gameCanvas.length; i++) { for (var i = 0; i < main.dom.gameCanvas.length; i++) {
main.canvas[main.dom.gameCanvas[i].id] = main.canvas[main.dom.gameCanvas[i].id] =
main.dom.gameCanvas[i].getContext('2d'); main.dom.gameCanvas[i].getContext('2d');

View File

@ -34,7 +34,7 @@ main.floors.MT35=
"你来这干什么", "你来这干什么",
{ {
"type": "if", "type": "if",
"condition": "core.getBlock(10,1)", "condition": "(core.getBlockId(10,1)!=='none')",
"true": [ "true": [
"把怪踢到这了,想打?", "把怪踢到这了,想打?",
"没门!", "没门!",
@ -60,7 +60,7 @@ main.floors.MT35=
"你来这干什么", "你来这干什么",
{ {
"type": "if", "type": "if",
"condition": "core.getBlock(4,1)", "condition": "(core.getBlockId(4,1)!=='none')",
"true": [ "true": [
"把怪踢到这了,想打?", "把怪踢到这了,想打?",
"没门!", "没门!",
@ -82,7 +82,7 @@ main.floors.MT35=
"7,0": [ "7,0": [
{ {
"type": "if", "type": "if",
"condition": "flag:inWinter2===true", "condition": "(flag:inWinter2===true)",
"true": [ "true": [
{ {
"type": "changeFloor", "type": "changeFloor",

View File

@ -1,37 +1,85 @@
main.floors.MT36= main.floors.MT36=
{ {
"floorId": "MT36", "floorId": "MT36",
"title": "冰封雪原", "title": "冰封雪原",
"name": "冰封雪原", "name": "冰封雪原",
"width": 15, "width": 15,
"height": 15, "height": 15,
"canFlyTo": true, "canFlyTo": true,
"canFlyFrom": true, "canFlyFrom": true,
"canUseQuickShop": true, "canUseQuickShop": true,
"cannotViewMap": false, "cannotViewMap": false,
"images": [], "images": [],
"ratio": 8, "ratio": 8,
"defaultGround": "T580", "defaultGround": "T580",
"bgm": "winter.mp3", "bgm": "winter.mp3",
"firstArrive": [], "firstArrive": [],
"eachArrive": [], "eachArrive": [],
"parallelDo": "", "parallelDo": "",
"events": {}, "events": {
"changeFloor": {}, "7,14": [
"beforeBattle": {}, {
"afterBattle": {}, "type": "changeFloor",
"afterGetItem": {}, "floorId": "MT35",
"afterOpenDoor": {}, "loc": [
"autoEvent": {}, 7,
"cannotMove": {}, 0
"cannotMoveIn": {}, ]
"map": [ }
],
"6,14": [
"在本地图的右方,会看到一个棕色的线,这是由于抗锯齿出现的像素错误。这里关闭抗锯齿即可解决(默认是关闭的)。"
]
},
"changeFloor": {},
"beforeBattle": {},
"afterBattle": {},
"afterGetItem": {},
"afterOpenDoor": {},
"autoEvent": {},
"cannotMove": {},
"cannotMoveIn": {},
"map": [
[ 0, 0, 0,604,604,604,604,604,604, 91,604, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,604, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70176,70177,70177,70177,70177],
[604, 0, 0, 0, 0, 0, 0, 0, 0, 0,70184,70185,70185,70185, 94],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70208,70209,70209,70209,70209],
[604, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[587, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[587, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 92, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[584,584,584,584,584,584,584,584,584,584,584, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[70056, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[585,585,585,585,585,585,129, 0,585,585,585,585,585,585,585]
],
"bgmap": [
[70073,70073,70073,70056, 0, 0, 0, 0, 0, 0,70058,70086,70086,70086,70086],
[70073,70073,70073,70056, 0, 0, 0, 0, 0, 0,70058,70094,70094,70094,70094],
[70081,70081,70081,70056, 0, 0, 0, 0, 0, 0,70058,70102,70102,70102,70102],
[ 0, 0, 0,70056, 0, 0, 0, 0, 0, 0, 0,70110,70110,70110,70110],
[ 0, 0, 0,70056, 0, 0, 0, 0, 0, 0,70058,70118,70118,70118,70118],
[ 0, 0, 0,70056, 0, 0, 0, 0, 0, 0,70058,70067,70067,70067,70067],
[70049,70049,70049,70051, 0, 0, 0, 0, 0, 0,70058,70067,70067,70067,70067],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70052,70067,70067,70067,70067],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70058],
[70065,70065,70065,70065,70065,70065,70065,70065,70065,70065,70065,70059, 0, 0,70058],
[70070,70070,70070,70070,70070,70070,70070,70070,70070,70070,70070,70056, 0, 0,70058],
[70081,70081,70081,70081,70081,70081,70081,70081,70081,70081,70081,70056, 0, 0,70058],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70051, 0, 0,70058],
[70056, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70058],
[70056, 0, 0, 0, 0, 0, 0, 93, 0, 0, 0, 0, 0, 0,70058]
],
"fgmap": [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70200,70201,70201,70201,70201],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@ -42,4 +90,24 @@ main.floors.MT36=
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
], ],
"bg2map": [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70184,70185,70185,70185,70185],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70192,70193,70193,70193,70193],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,70049,70049,70049,70050],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[70048,70049,70049,70049,70049,70049,70049,70049,70049,70049,70049, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
"fg2map": [
]
} }

View File

@ -336,8 +336,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
var equipId = core.getEquip(0); var equipId = core.getEquip(0);
if (equipId && (core.material.items[equipId].equip || {}).animate) if (equipId && (core.material.items[equipId].equip || {}).animate)
animate = core.material.items[equipId].equip.animate; animate = core.material.items[equipId].equip.animate;
// 你也可以在这里根据自己的需要比如enemyId或special或flag来修改播放的动画效果
// if (enemyId == '...') animate = '...';
// 检查该动画是否存在SE如果不存在则使用默认音效 // 检查该动画是否存在SE如果不存在则使用默认音效
if (!(core.material.animates[animate] || {}).se) if (!(core.material.animates[animate] || {}).se)
@ -348,11 +346,16 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
else core.drawHeroAnimate(animate); else core.drawHeroAnimate(animate);
// 获得战斗伤害信息 // 获得战斗伤害信息
var damageInfo = core.getDamageInfo(enemyId, null, x, y) || {}; // 注意这里勇士坐标要传入当前勇士坐标,不然会默认取伤害最低的地方打怪
const damageInfo =
core.getDamageInfo(
enemyId,
{ x: core.status.hero.loc.x, y: core.status.hero.loc.y },
x,
y
) ?? {};
// 战斗伤害 // 战斗伤害
var damage = damageInfo.damage; const damage = damageInfo.damage;
// 当前战斗回合数,可用于战后所需的判定
var turn = damageInfo.turn;
// 判定是否致死 // 判定是否致死
if (damage == null || damage >= core.status.hero.hp) { if (damage == null || damage >= core.status.hero.hp) {
core.status.hero.hp = 0; core.status.hero.hp = 0;
@ -367,7 +370,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
core.status.hero.statistics.battle++; core.status.hero.statistics.battle++;
// 智慧之源 // 智慧之源
if (core.hasSpecial(special, 14) && flags.hard == 2) { if (core.hasSpecial(special, 14) && flags.hard === 2) {
core.addFlag( core.addFlag(
'inte_' + floorId, 'inte_' + floorId,
Math.ceil((core.status.hero.mdef / 10) * 0.3) * 10 Math.ceil((core.status.hero.mdef / 10) * 0.3) * 10
@ -390,32 +393,18 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
core.declineStudiedSkill(); core.declineStudiedSkill();
} }
// 计算当前怪物的支援怪物
var guards = [];
if (x != null && y != null) {
guards = core.getFlag('__guards__' + x + '_' + y, []);
core.removeFlag('__guards__' + x + '_' + y);
}
// 获得金币 // 获得金币
var money = guards.reduce(function (curr, g) { const money = enemy.money;
return curr + core.material.enemys[g[2]].money;
}, enemy.money);
core.status.hero.money += money; core.status.hero.money += money;
core.status.hero.statistics.money += money; core.status.hero.statistics.money += money;
// 获得经验 // 获得经验
var exp = guards.reduce(function (curr, g) { const exp = enemy.exp;
return curr + core.material.enemys[g[2]].exp;
}, enemy.exp);
core.status.hero.exp += exp; core.status.hero.exp += exp;
core.status.hero.statistics.exp += exp; core.status.hero.statistics.exp += exp;
var hint = '打败 ' + enemy.name; const hint =
if (core.flags.statusBarItems.indexOf('enableMoney') >= 0) '打败 ' + enemy.name + ',金币+' + money + ',经验+' + exp;
hint += ',金币+' + money;
if (core.flags.statusBarItems.indexOf('enableExp') >= 0)
hint += ',经验+' + exp;
core.drawTip(hint, enemy.id); core.drawTip(hint, enemy.id);
if (core.getFlag('bladeOn') && core.getFlag('blade')) { if (core.getFlag('bladeOn') && core.getFlag('blade')) {
@ -940,6 +929,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
x !== void 0 && x !== void 0 &&
y !== null && y !== null &&
y !== void 0 && y !== void 0 &&
(hero?.x === null || hero?.x === void 0) &&
(hero?.y === null || hero?.y === void 0) &&
floorId !== null && floorId !== null &&
floorId !== void 0 && floorId !== void 0 &&
flags.autoLocate && flags.autoLocate &&
@ -950,7 +941,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
for (const [dir, { x: dx, y: dy }] of Object.entries( for (const [dir, { x: dx, y: dy }] of Object.entries(
core.utils.scan core.utils.scan
)) { )) {
// 只有攻击和防御和特殊光环需要注意,其他的一般都不会随楼层与坐标变化 // 只有攻击和防御和特殊光环需要注意,其他的都不会随楼层与坐标变化
const nx = x + dx; const nx = x + dx;
const ny = y + dy; const ny = y + dy;
if ( if (
@ -971,8 +962,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
const status = core.getHeroStatusOf( const status = core.getHeroStatusOf(
hero, hero,
toGet, toGet,
x, nx,
y, ny,
floorId floorId
); );
if ( if (
@ -982,20 +973,28 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
) { ) {
continue; continue;
} }
toMap.push([dir, Object.assign({}, status, { x, y })]); toMap.push([
dir,
Object.assign({}, status, { x: nx, y: ny })
]);
} }
} else { } else {
toMap = [['none', core.getHeroStatusOf(hero, ['atk', 'def'])]]; // 指定了勇士坐标或者没有怪物坐标时
toMap = [
[
'none',
core.getHeroStatusOf(
hero,
['atk', 'def'],
hero?.x,
hero?.y
)
]
];
} }
function getDamage(h) { function getDamage(h) {
const enemyInfo = core.enemys.getEnemyInfo( const enemyInfo = core.getEnemyInfo(enemy, hero, x, y, floorId);
enemy,
hero,
x,
y,
floorId
);
let { let {
hp: mon_hp, hp: mon_hp,
@ -1033,12 +1032,15 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// 每回合怪物对勇士造成的战斗伤害 // 每回合怪物对勇士造成的战斗伤害
var per_damage = mon_atk - hero_def; var per_damage = mon_atk - hero_def;
// 魔攻:战斗伤害就是怪物攻击力 // 魔攻:战斗伤害就是怪物攻击力
if ( if (
core.hasSpecial(mon_special, 2) || core.hasSpecial(mon_special, 2) ||
core.hasSpecial(mon_special, 13) core.hasSpecial(mon_special, 13)
) ) {
per_damage = mon_atk; per_damage = mon_atk;
}
// 战斗伤害不能为负值 // 战斗伤害不能为负值
if (per_damage < 0) per_damage = 0; if (per_damage < 0) per_damage = 0;
@ -1121,20 +1123,21 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
]; ];
function autoSkillOf(h) { function autoSkillOf(h) {
damageInfo = getDamage(h);
damage = damageInfo?.damage ?? Infinity;
if (flags.autoSkill) { if (flags.autoSkill) {
for (const [unlock, condition] of skills) { for (const [unlock, condition] of skills) {
if (flags[unlock]) { if (!flags[unlock]) continue;
flags[condition] = true; flags[condition] = true;
const info = getDamage(h); const info = getDamage(h);
const d = info?.damage; const d = info?.damage;
if (d !== null && d !== void 0) { if (d !== null && d !== void 0) {
if (d < damage) { if (d < damage) {
damage = d; damage = d;
damageInfo = info; damageInfo = info;
}
} }
flags[condition] = false;
} }
flags[condition] = false;
} }
} else { } else {
damageInfo = getDamage(h); damageInfo = getDamage(h);
@ -1142,6 +1145,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
} }
} }
let dirDamageInfo = null;
let dirMinDamage = Infinity;
let damageInfo = null; let damageInfo = null;
let damage = Infinity; let damage = Infinity;
@ -1150,18 +1155,29 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
return damageInfo; return damageInfo;
} }
if (toMap.length === 1) { if (toMap.length <= 1) {
// 单个与多个分开计算,有助于提高性能表现 // 单个与多个分开计算,有助于提高性能表现
const h = toMap[0][1]; const h =
toMap[0]?.[1] ?? core.getHeroStatusOf(hero, ['atk', 'def']);
autoSkillOf(h); autoSkillOf(h);
if (damageInfo) { if (damageInfo) {
return Object.assign(damageInfo, { dir: toMap[0][0] }); return Object.assign(damageInfo, {
dir: [toMap[0]?.[0] ?? 'none', damage]
});
} else return null; } else return null;
} else { } else {
const dirDamage = [];
for (const [dir, h] of toMap) { for (const [dir, h] of toMap) {
damage = Infinity;
damageInfo = null;
autoSkillOf(h); autoSkillOf(h);
if (damageInfo) { dirDamage.push([dir, damage]);
return Object.assign(damageInfo, { dir }); if (damage < dirMinDamage) {
dirMinDamage = damage;
dirDamageInfo = damageInfo;
}
if (dirDamageInfo) {
return Object.assign(dirDamageInfo, { dir: dirDamage });
} else return null; } else return null;
} }
} }
@ -1501,7 +1517,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
repulse = {}, // 每个点的阻击怪信息 repulse = {}, // 每个点的阻击怪信息
mockery = {}, // 电摇嘲讽 mockery = {}, // 电摇嘲讽
halo = {}; // 光环 halo = {}; // 光环
var betweenAttackLocs = {}; // 所有可能的夹击点
var needCache = false; var needCache = false;
var canGoDeadZone = core.flags.canGoDeadZone; var canGoDeadZone = core.flags.canGoDeadZone;
var haveHunt = false; var haveHunt = false;
@ -1702,23 +1717,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
} }
} }
// 夹击;在这里提前计算所有可能的夹击点,具体计算逻辑在下面
// 如果要防止夹击伤害,可以简单的将 flag:no_betweenAttack 设为true
if (
enemy &&
core.enemys.hasSpecial(enemy.special, 16) &&
!core.hasFlag('no_betweenAttack')
) {
for (var dir in core.utils.scan) {
var nx = x + core.utils.scan[dir].x,
ny = y + core.utils.scan[dir].y,
currloc = nx + ',' + ny;
if (nx < 0 || nx >= width || ny < 0 || ny >= height)
continue;
betweenAttackLocs[currloc] = true;
}
}
// 检查地图范围类技能 // 检查地图范围类技能
var specialFlag = core.getSpecialFlag(enemy); var specialFlag = core.getSpecialFlag(enemy);
if (specialFlag & 1) needCache = true; if (specialFlag & 1) needCache = true;
@ -1743,74 +1741,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
} }
} }
// 对每个可能的夹击点计算夹击伤害
for (var loc in betweenAttackLocs) {
var xy = loc.split(','),
x = parseInt(xy[0]),
y = parseInt(xy[1]);
// 夹击怪物的ID
var enemyId1 = null,
enemyId2 = null;
// 检查左右夹击
var leftBlock = blocks[x - 1 + ',' + y],
rightBlock = blocks[x + 1 + ',' + y];
if (
leftBlock &&
!leftBlock.disable &&
rightBlock &&
!rightBlock.disable &&
leftBlock.id == rightBlock.id
) {
if (core.hasSpecial(leftBlock.event.id, 16))
enemyId1 = leftBlock.event.id;
}
// 检查上下夹击
var topBlock = blocks[x + ',' + (y - 1)],
bottomBlock = blocks[x + ',' + (y + 1)];
if (
topBlock &&
!topBlock.disable &&
bottomBlock &&
!bottomBlock.disable &&
topBlock.id == bottomBlock.id
) {
if (core.hasSpecial(topBlock.event.id, 16))
enemyId2 = topBlock.event.id;
}
if (enemyId1 != null || enemyId2 != null) {
var leftHp = core.status.hero.hp - (damage[loc] || 0);
if (leftHp > 1) {
// 夹击伤害值
var value = Math.floor(leftHp / 2);
// 是否不超过怪物伤害值
if (core.flags.betweenAttackMax) {
var enemyDamage1 = core.getDamage(
enemyId1,
x,
y,
floorId
);
if (enemyDamage1 != null && enemyDamage1 < value)
value = enemyDamage1;
var enemyDamage2 = core.getDamage(
enemyId2,
x,
y,
floorId
);
if (enemyDamage2 != null && enemyDamage2 < value)
value = enemyDamage2;
}
if (value > 0) {
damage[loc] = (damage[loc] || 0) + value;
type[loc] = type[loc] || {};
type[loc]['夹击伤害'] = true;
}
}
}
}
core.flags.canGoDeadZone = canGoDeadZone; core.flags.canGoDeadZone = canGoDeadZone;
core.status.checkBlock = { core.status.checkBlock = {
damage: damage, damage: damage,

View File

@ -121,7 +121,8 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"T585": 61, "T585": 61,
"T586": 62, "T586": 62,
"T587": 63, "T587": 63,
"T588": 64 "T588": 64,
"T604": 65
}, },
"animates": { "animates": {
"star": 0, "star": 0,

View File

@ -531,6 +531,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"601": {"cls":"enemys","id":"E601"}, "601": {"cls":"enemys","id":"E601"},
"602": {"cls":"enemys","id":"E602"}, "602": {"cls":"enemys","id":"E602"},
"603": {"cls":"enemys","id":"E603"}, "603": {"cls":"enemys","id":"E603"},
"604": {"cls":"terrains","id":"T604"},
"20037": {"cls":"tileset","id":"X20037","cannotOut":["up","left"],"cannotIn":["up","left"]}, "20037": {"cls":"tileset","id":"X20037","cannotOut":["up","left"],"cannotIn":["up","left"]},
"20038": {"cls":"tileset","id":"X20038","cannotOut":["up"],"cannotIn":["up"]}, "20038": {"cls":"tileset","id":"X20038","cannotOut":["up"],"cannotIn":["up"]},
"20039": {"cls":"tileset","id":"X20039","cannotOut":["up","right"],"cannotIn":["up","right"]}, "20039": {"cls":"tileset","id":"X20039","cannotOut":["up","right"],"cannotIn":["up","right"]},
@ -562,11 +563,24 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"30121": {"cls":"tileset","id":"X30121","canPass":true}, "30121": {"cls":"tileset","id":"X30121","canPass":true},
"30196": {"cls":"tileset","id":"X30196","canPass":true}, "30196": {"cls":"tileset","id":"X30196","canPass":true},
"30204": {"cls":"tileset","id":"X30204","canPass":true}, "30204": {"cls":"tileset","id":"X30204","canPass":true},
"70065": {"cls":"tileset","id":"X70065","cannotIn":["down"],"cannotOut":["down"]}, "70048": {"cls":"tileset","id":"X70048","cannotOut":["up","left"],"cannotIn":["up","left"]},
"70049": {"cls":"tileset","id":"X70049","cannotOut":["up"],"cannotIn":["up"]},
"70050": {"cls":"tileset","id":"X70050","cannotOut":["up","right"],"cannotIn":["up","right"]},
"70056": {"cls":"tileset","id":"X70056","cannotOut":["left"],"cannotIn":["left"]},
"70058": {"cls":"tileset","id":"X70058","cannotOut":["right"],"cannotIn":["right"]},
"70064": {"cls":"tileset","id":"X70064","cannotOut":["down","left"],"cannotIn":["down","left"]},
"70065": {"cls":"tileset","id":"X70065","cannotIn":["up","down","left","right"],"cannotOut":["up","down","left","right"]},
"70066": {"cls":"tileset","id":"X70066","cannotOut":["down","right"],"cannotIn":["down","right"]},
"70112": {"cls":"tileset","id":"X70112","cannotIn":["down"],"cannotOut":["down"]}, "70112": {"cls":"tileset","id":"X70112","cannotIn":["down"],"cannotOut":["down"]},
"70114": {"cls":"tileset","id":"X70114","cannotIn":["down"],"cannotOut":["down"]}, "70114": {"cls":"tileset","id":"X70114","cannotIn":["down"],"cannotOut":["down"]},
"70120": {"cls":"tileset","id":"X70120","cannotIn":["up","down","left","right"]}, "70120": {"cls":"tileset","id":"X70120","cannotIn":["up","down","left","right"]},
"70122": {"cls":"tileset","id":"X70122","cannotIn":["up","down","left","right"]}, "70122": {"cls":"tileset","id":"X70122","cannotIn":["up","down","left","right"]},
"70128": {"cls":"tileset","id":"X70128","cannotIn":["up","down","left","right"]}, "70128": {"cls":"tileset","id":"X70128","cannotIn":["up","down","left","right"]},
"70130": {"cls":"tileset","id":"X70130","cannotIn":["up","down","left","right"]} "70130": {"cls":"tileset","id":"X70130","cannotIn":["up","down","left","right"]},
"70184": {"cls":"tileset","id":"X70184","canPass":true},
"70185": {"cls":"tileset","id":"X70185","canPass":true},
"70186": {"cls":"tileset","id":"X70186","canPass":true},
"70200": {"cls":"tileset","id":"X70200","canPass":true},
"70201": {"cls":"tileset","id":"X70201","canPass":true},
"70202": {"cls":"tileset","id":"X70202","canPass":true}
} }

Binary file not shown.

Before

Width:  |  Height:  |  Size: 53 KiB

After

Width:  |  Height:  |  Size: 54 KiB

View File

@ -659,7 +659,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = {
document.getElementById('gameDraw').appendChild(canvas); document.getElementById('gameDraw').appendChild(canvas);
var ctx = canvas.getContext('2d'); var ctx = canvas.getContext('2d');
core.canvas[name] = ctx; core.canvas[name] = ctx;
core.maps._setHDCanvasSize(ctx, core.__PIXELS__, core.__PIXELS__);
return canvas; return canvas;
} }

View File

@ -435,6 +435,10 @@ p#name {
z-index: 170; z-index: 170;
} }
.no-anti-aliasing {
image-rendering: pixelated;
}
#inputDiv { #inputDiv {
display: none; display: none;
width: 100%; width: 100%;

View File

@ -47,7 +47,19 @@
"text": "自动勇士定位", "text": "自动勇士定位",
"desc": [ "desc": [
"此项会在进入第二章后会起作用。开启后,当勇士处于不同位置打同一个怪物伤害不同时,在地图上使用绿色箭头标出伤害最低的位置,", "此项会在进入第二章后会起作用。开启后,当勇士处于不同位置打同一个怪物伤害不同时,在地图上使用绿色箭头标出伤害最低的位置,",
"使用红色箭头标出伤害较高的位置,在自动寻路中选择伤害最低的位置。" "其余方向,伤害越高,箭头颜色越红,同时在自动寻路中选择可以到达的伤害最低的位置。",
"<br>",
"<br>",
"注:如果出现明显卡顿现象可以考虑关闭本设置或自动切换技能设置。"
]
},
"antiAliasing": {
"text": "抗锯齿",
"desc": [
"是否开启抗锯齿。开启后,画面会变得不那么锐利,观感更加舒适;关闭后,可以更好地展现出像素感。",
"<br>",
"<br>",
"此项只对游戏画面起作用,对浏览地图和楼传均不起作用。"
] ]
}, },
"showStudied": { "showStudied": {

View File

@ -40,6 +40,11 @@ export const useFixed = ref(true);
*/ */
export const autoLocate = ref(true); export const autoLocate = ref(true);
/**
* 齿
*/
export const antiAliasing = ref(true);
watch(transition, n => { watch(transition, n => {
core.plugin.transition.value = n; core.plugin.transition.value = n;
core.setLocalStorage('transition', n); core.setLocalStorage('transition', n);
@ -78,6 +83,17 @@ watch(autoSkill, n => {
core.status.route.push(`set:autoLocate:${n}`); core.status.route.push(`set:autoLocate:${n}`);
}); });
watch(antiAliasing, n => {
core.setLocalStorage('antiAliasing', n);
for (const canvas of core.dom.gameCanvas) {
if (n) {
canvas.classList.remove('no-anti-aliasing');
} else {
canvas.classList.add('no-anti-aliasing');
}
}
});
/** /**
* localStorage读取即可 * localStorage读取即可
*/ */
@ -88,6 +104,7 @@ function reset() {
autoScale.value = core.getLocalStorage('autoScale', true); autoScale.value = core.getLocalStorage('autoScale', true);
showStudied.value = core.getLocalStorage('showStudied', true); showStudied.value = core.getLocalStorage('showStudied', true);
showHalo.value = core.getLocalStorage('showHalo', true); showHalo.value = core.getLocalStorage('showHalo', true);
antiAliasing.value = core.getLocalStorage('antiAliasing', false);
} }
function resetFlag() { function resetFlag() {

View File

@ -75,8 +75,8 @@ export function getDetailedEnemy<I extends EnemyIds>(
} }
const damageColor = getDamageColor(enemyInfo.damage); const damageColor = getDamageColor(enemyInfo.damage);
const detail: DetailedEnemy<I> = Object.assign(enemyInfo, { const detail: DetailedEnemy<I> = Object.assign(enemyInfo, {
critical: critical[0][0], critical: critical[0]?.[0] ?? '???',
criticalDamage: critical[0][1], criticalDamage: critical[0]?.[1] ?? '???',
defDamage, defDamage,
specialColor, specialColor,
specialText, specialText,

14
src/source/cls.d.ts vendored
View File

@ -530,6 +530,7 @@ interface IdToCls {
E601: 'enemys'; E601: 'enemys';
E602: 'enemys'; E602: 'enemys';
E603: 'enemys'; E603: 'enemys';
T604: 'terrains';
X20037: 'tileset'; X20037: 'tileset';
X20038: 'tileset'; X20038: 'tileset';
X20039: 'tileset'; X20039: 'tileset';
@ -561,11 +562,24 @@ interface IdToCls {
X30121: 'tileset'; X30121: 'tileset';
X30196: 'tileset'; X30196: 'tileset';
X30204: 'tileset'; X30204: 'tileset';
X70048: 'tileset';
X70049: 'tileset';
X70050: 'tileset';
X70056: 'tileset';
X70058: 'tileset';
X70064: 'tileset';
X70065: 'tileset'; X70065: 'tileset';
X70066: 'tileset';
X70112: 'tileset'; X70112: 'tileset';
X70114: 'tileset'; X70114: 'tileset';
X70120: 'tileset'; X70120: 'tileset';
X70122: 'tileset'; X70122: 'tileset';
X70128: 'tileset'; X70128: 'tileset';
X70130: 'tileset'; X70130: 'tileset';
X70184: 'tileset';
X70185: 'tileset';
X70186: 'tileset';
X70200: 'tileset';
X70201: 'tileset';
X70202: 'tileset';
} }

28
src/source/maps.d.ts vendored
View File

@ -530,6 +530,7 @@ interface IdToNumber {
E601: 601; E601: 601;
E602: 602; E602: 602;
E603: 603; E603: 603;
T604: 604;
X20037: 20037; X20037: 20037;
X20038: 20038; X20038: 20038;
X20039: 20039; X20039: 20039;
@ -561,13 +562,26 @@ interface IdToNumber {
X30121: 30121; X30121: 30121;
X30196: 30196; X30196: 30196;
X30204: 30204; X30204: 30204;
X70048: 70048;
X70049: 70049;
X70050: 70050;
X70056: 70056;
X70058: 70058;
X70064: 70064;
X70065: 70065; X70065: 70065;
X70066: 70066;
X70112: 70112; X70112: 70112;
X70114: 70114; X70114: 70114;
X70120: 70120; X70120: 70120;
X70122: 70122; X70122: 70122;
X70128: 70128; X70128: 70128;
X70130: 70130; X70130: 70130;
X70184: 70184;
X70185: 70185;
X70186: 70186;
X70200: 70200;
X70201: 70201;
X70202: 70202;
} }
interface NumberToId { interface NumberToId {
1: 'yellowWall'; 1: 'yellowWall';
@ -1101,6 +1115,7 @@ interface NumberToId {
601: 'E601'; 601: 'E601';
602: 'E602'; 602: 'E602';
603: 'E603'; 603: 'E603';
604: 'T604';
20037: 'X20037'; 20037: 'X20037';
20038: 'X20038'; 20038: 'X20038';
20039: 'X20039'; 20039: 'X20039';
@ -1132,11 +1147,24 @@ interface NumberToId {
30121: 'X30121'; 30121: 'X30121';
30196: 'X30196'; 30196: 'X30196';
30204: 'X30204'; 30204: 'X30204';
70048: 'X70048';
70049: 'X70049';
70050: 'X70050';
70056: 'X70056';
70058: 'X70058';
70064: 'X70064';
70065: 'X70065'; 70065: 'X70065';
70066: 'X70066';
70112: 'X70112'; 70112: 'X70112';
70114: 'X70114'; 70114: 'X70114';
70120: 'X70120'; 70120: 'X70120';
70122: 'X70122'; 70122: 'X70122';
70128: 'X70128'; 70128: 'X70128';
70130: 'X70130'; 70130: 'X70130';
70184: 'X70184';
70185: 'X70185';
70186: 'X70186';
70200: 'X70200';
70201: 'X70201';
70202: 'X70202';
} }

View File

@ -98,7 +98,7 @@ async function calHeight() {
function getLabel(attr: keyof DetailedEnemy) { function getLabel(attr: keyof DetailedEnemy) {
if (attr === 'critical') return '临界'; if (attr === 'critical') return '临界';
if (attr === 'criticalDamage') return '临界减伤'; if (attr === 'criticalDamage') return '临界减伤';
if (attr === 'defDamage') return `${core.status.thisMap.ratio}`; if (attr === 'defDamage') return `${core.status?.thisMap?.ratio ?? 1}`;
return core.getStatusLabel(attr); return core.getStatusLabel(attr);
} }

View File

@ -546,6 +546,8 @@ onMounted(async () => {
thumb = document.getElementById('fly-thumbnail') as HTMLCanvasElement; thumb = document.getElementById('fly-thumbnail') as HTMLCanvasElement;
thumbCtx = thumb.getContext('2d')!; thumbCtx = thumb.getContext('2d')!;
const antiAliasing = core.getLocalStorage('antiAliasing', true);
const mapStyle = getComputedStyle(map); const mapStyle = getComputedStyle(map);
const thumbStyle = getComputedStyle(thumb); const thumbStyle = getComputedStyle(thumb);
map.width = parseFloat(mapStyle.width) * devicePixelRatio; map.width = parseFloat(mapStyle.width) * devicePixelRatio;
@ -553,6 +555,13 @@ onMounted(async () => {
thumb.width = parseFloat(thumbStyle.width) * devicePixelRatio; thumb.width = parseFloat(thumbStyle.width) * devicePixelRatio;
thumb.height = parseFloat(thumbStyle.width) * devicePixelRatio; thumb.height = parseFloat(thumbStyle.width) * devicePixelRatio;
if (!antiAliasing) {
requestAnimationFrame(() => {
thumb.classList.add('no-anti-aliasing');
thumbCtx.imageSmoothingEnabled = false;
});
}
Array.from(document.getElementsByClassName('fly-settings')).forEach(v => { Array.from(document.getElementsByClassName('fly-settings')).forEach(v => {
v.addEventListener('click', e => (v as HTMLElement).blur()); v.addEventListener('click', e => (v as HTMLElement).blur());
}); });

View File

@ -58,6 +58,14 @@
autoLocate ? 'ON' : 'OFF' autoLocate ? 'ON' : 'OFF'
}}</span }}</span
> >
<span
class="selectable"
:selected="selected === 'antiAliasing'"
@click="click('antiAliasing')"
>抗锯齿:&nbsp;&nbsp;&nbsp;{{
antiAliasing ? 'ON' : 'OFF'
}}</span
>
<span <span
class="selectable" class="selectable"
:selected="selected === 'showStudied'" :selected="selected === 'showStudied'"
@ -83,7 +91,8 @@ import {
showStudied, showStudied,
showHalo, showHalo,
useFixed, useFixed,
autoLocate autoLocate,
antiAliasing
} from '../plugin/settings'; } from '../plugin/settings';
import settingInfo from '../data/settings.json'; import settingInfo from '../data/settings.json';
import { has, splitText } from '../plugin/utils'; import { has, splitText } from '../plugin/utils';
@ -124,6 +133,8 @@ function click(id: keyof Settings) {
useFixed.value = !useFixed.value; useFixed.value = !useFixed.value;
} else if (id === 'autoLocate') { } else if (id === 'autoLocate') {
autoLocate.value = !autoLocate.value; autoLocate.value = !autoLocate.value;
} else if (id === 'antiAliasing') {
antiAliasing.value = !antiAliasing.value;
} }
} }
</script> </script>