重构进度条

This commit is contained in:
strawberry 2025-08-19 20:36:06 +08:00
parent 34b596e1ea
commit 5a44ba3f28
7 changed files with 637 additions and 428 deletions

View File

@ -1256,6 +1256,7 @@ actions.prototype._keyUpBook = function (keycode) {
if (core.book.isAnimate) return if (core.book.isAnimate) return
if (keycode == 27 || keycode == 88) { if (keycode == 27 || keycode == 88) {
core.playSound('取消'); core.playSound('取消');
core.book.close()
if (core.events.recoverEvents(core.status.event.interval)) { if (core.events.recoverEvents(core.status.event.interval)) {
return; return;
} }
@ -1264,7 +1265,6 @@ actions.prototype._keyUpBook = function (keycode) {
core.ui._drawViewMaps(core.status.event.ui); core.ui._drawViewMaps(core.status.event.ui);
} }
else core.ui.closePanel(); else core.ui.closePanel();
core.book.close()
return; return;
} }
/*if (keycode == 13 || keycode == 32 || keycode == 67) { /*if (keycode == 13 || keycode == 32 || keycode == 67) {

View File

@ -204,12 +204,12 @@ enemys.prototype.getDamageString = function (enemy, x, y, floorId) {
else color = '#FF2222'; else color = '#FF2222';
damage = core.formatBigNumber(damage, true); damage = core.formatBigNumber(damage, true);
if (core.enemys.hasSpecial(enemy, 19)) /* if (core.enemys.hasSpecial(enemy, 19))
damage += "+"; damage += "+";
if (core.enemys.hasSpecial(enemy, 21)) if (core.enemys.hasSpecial(enemy, 21))
damage += "-"; damage += "-";
if (core.enemys.hasSpecial(enemy, 11)) if (core.enemys.hasSpecial(enemy, 11))
damage += "^"; damage += "^";*/
} }
return { return {
@ -219,13 +219,13 @@ 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,config={}) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
number = number || 1; number = number || 1;
var specialCriticals = this._nextCriticals_special(enemy, number, x, y, floorId); var specialCriticals = this._nextCriticals_special(enemy, number, x, y, 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, config, 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);
if (overAtk == null) return []; if (overAtk == null) return [];
@ -245,7 +245,7 @@ enemys.prototype.nextCriticals = function (enemy, number, x, y, floorId) {
return this._nextCriticals_useLoop(enemy, info, number, x, y, floorId); return this._nextCriticals_useLoop(enemy, info, number, x, y, floorId);
} }
else { else {
return this._nextCriticals_useBinarySearch(enemy, info, number, x, y, floorId); return this._nextCriticals_useBinarySearch(enemy, info, number, x, y, floorId,config);
} }
} }
else { else {
@ -274,7 +274,7 @@ enemys.prototype._nextCriticals_overAtk = function (enemy, x, y, floorId) {
} }
enemys.prototype._nextCriticals_special = function (enemy, number, x, y, floorId) { enemys.prototype._nextCriticals_special = function (enemy, number, x, y, floorId) {
if (this.hasSpecial(enemy.special, 10) || this.hasSpecial(enemy.special, 3)) if (this.hasSpecial(enemy.special, 3))
return []; // 模仿or坚固临界 return []; // 模仿or坚固临界
return null; return null;
} }

View File

@ -1757,7 +1757,11 @@ maps.prototype._drawThumbnail_drawTempCanvas = function (floorId, blocks, option
} else core.maps._setHDCanvasSize(tempCanvas, width * 32, height * 32); } else core.maps._setHDCanvasSize(tempCanvas, width * 32, height * 32);
} }
options.ctx = tempCanvas; options.ctx = tempCanvas;
if(options.noEnabled){
tempCanvas.imageSmoothingEnabled= false
}else{
tempCanvas.imageSmoothingEnabled= true
}
// 地图过大的缩略图不绘制显伤 // 地图过大的缩略图不绘制显伤
if (width * height > core.bigmap.threshold) if (width * height > core.bigmap.threshold)
options.damage = false; options.damage = false;
@ -1804,6 +1808,12 @@ maps.prototype._drawThumbnail_realDrawTempCanvas = function (floorId, blocks, op
maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) { maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
var ctx = core.getContextByName(options.ctx); var ctx = core.getContextByName(options.ctx);
let imageSmoothingEnabled=ctx.imageSmoothingEnabled
if(options.noEnabled){
ctx.imageSmoothingEnabled= false
}else{
ctx.imageSmoothingEnabled= true
}
if (ctx == null) return; if (ctx == null) return;
var x = options.x || 0, y = options.y || 0, size = options.size || 1; var x = options.x || 0, y = options.y || 0, size = options.size || 1;
// size的含义改为(0,1]范围的系数以适配长方形默认为1楼传为3/4SL界面为0.3 // size的含义改为(0,1]范围的系数以适配长方形默认为1楼传为3/4SL界面为0.3
@ -1861,6 +1871,7 @@ maps.prototype._drawThumbnail_drawToTarget = function (floorId, options) {
} }
} }
} }
ctx.imageSmoothingEnabled= imageSmoothingEnabled
} }
// -------- 获得某个点的图块信息 -------- // // -------- 获得某个点的图块信息 -------- //

View File

@ -2556,7 +2556,7 @@ ui.prototype.drawFly = function (page) {
} }
var size = 0.75; var size = 0.75;
core.strokeRect('ui', 16, 64, size * core._PX_, size * core._PY_, '#FFFFFF', 2); 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 }); core.drawThumbnail(floorId, null, { ctx: 'ui', x: 16, y: 64, size: size, damage: true, all: true , noEnabled: true });
} }
////// 绘制中心对称飞行器 ////// 绘制中心对称飞行器
@ -2568,7 +2568,7 @@ ui.prototype._drawCenterFly = function () {
var toX = core.bigmap.width - 1 - core.getHeroLoc('x'), toY = core.bigmap.height - 1 - core.getHeroLoc('y'); var toX = core.bigmap.width - 1 - core.getHeroLoc('x'), toY = core.bigmap.height - 1 - core.getHeroLoc('y');
this.clearUI(); this.clearUI();
core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000'); core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000');
core.drawThumbnail(null, null, { heroLoc: core.status.hero.loc, heroIcon: core.status.hero.image, ctx: 'ui', centerX: toX, centerY: toY }); core.drawThumbnail(null, null, { heroLoc: core.status.hero.loc, heroIcon: core.status.hero.image, ctx: 'ui', centerX: toX, centerY: toY, noEnabled: true });
var offsetX = core.clamp(toX - core._HALF_WIDTH_, 0, core.bigmap.width - core._WIDTH_), var offsetX = core.clamp(toX - core._HALF_WIDTH_, 0, core.bigmap.width - core._WIDTH_),
offsetY = core.clamp(toY - core._HALF_HEIGHT_, 0, core.bigmap.height - core._HEIGHT_); offsetY = core.clamp(toY - core._HALF_HEIGHT_, 0, core.bigmap.height - core._HEIGHT_);
core.fillRect('ui', (toX - offsetX) * 32, (toY - offsetY) * 32, 32, 32, fillstyle); core.fillRect('ui', (toX - offsetX) * 32, (toY - offsetY) * 32, 32, 32, fillstyle);
@ -2588,7 +2588,7 @@ ui.prototype._drawViewMaps = function (index, x, y) {
core.status.checkBlock.cache = {}; core.status.checkBlock.cache = {};
var data = this._drawViewMaps_buildData(index, x, y); var data = this._drawViewMaps_buildData(index, x, y);
core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000'); core.fillRect('ui', 0, 0, core._PX_, core._PY_, '#000000');
core.drawThumbnail(data.floorId, null, { damage: data.damage, ctx: 'ui', centerX: data.x, centerY: data.y, all: data.all }); core.drawThumbnail(data.floorId, null, { damage: data.damage, ctx: 'ui', centerX: data.x, centerY: data.y, all: data.all , noEnabled: true });
core.clearMap('data'); core.clearMap('data');
core.setTextAlign('data', 'left'); core.setTextAlign('data', 'left');
core.setFont('data', '16px Arial'); core.setFont('data', '16px Arial');

File diff suppressed because it is too large Load Diff

View File

@ -788,18 +788,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
if (a) equipInfo.push(a) if (a) equipInfo.push(a)
} }
//处理回合条长度
let oneTurn = [hero_speed, mon_speed]; let oneTurn = 100
if (equipInfo.length > 0) {
for (let i = 0; i < equipInfo.length; i++) {
equipInfo[i].now = 0;
equipInfo[i].isAttack = false;
oneTurn.push(equipInfo[i].speed);
}
}
//需要变更
const onegcd = gcd(...oneTurn) //最大公约数
oneTurn = lcm(...oneTurn) //单次回合长度
//在这里处理equip的初始位置now //在这里处理equip的初始位置now
equipInfo.forEach(v => { equipInfo.forEach(v => {
switch (v.id) { switch (v.id) {
@ -814,24 +804,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
const enemyinfo = { hp: mon_hp, atk: mon_atk, def: mon_def, mhp: 0, mdef: mon_mdef, spell: mon_spell, speed: mon_speed, special: mon_special, now: 0, isAttack: false } //怪物属性 const enemyinfo = { hp: mon_hp, atk: mon_atk, def: mon_def, mhp: 0, mdef: mon_mdef, spell: mon_spell, speed: mon_speed, special: mon_special, now: 0, isAttack: false } //怪物属性
//先攻先攻为怪物50%行动条 //先攻先攻为怪物50%行动条
if (core.hasSpecial(mon_special, 1)) { if (core.hasSpecial(mon_special, 1)) {
enemyinfo.now = oneTurn / 2 enemyinfo.now = 50
heroinfo.now = 0 heroinfo.now = 0
} else { } else {
enemyinfo.now = 0 enemyinfo.now = 0
heroinfo.now = oneTurn / 2 heroinfo.now = 50
} }
let max = heroinfo.speed let Exspeed = hero_speed
if (enemyinfo.speed > max) max = enemyinfo.speed const start = [core.clone(heroinfo), core.clone(enemyinfo), core.clone(equipInfo), Exspeed] //记录开始战斗时的属性并转发
equipInfo.forEach(v => { if (v.speed > max) max = v.speed })
let i = 1
while (oneTurn * i / max < 30) {
i++
}
heroinfo.now *= i
enemyinfo.now *= i
equipInfo.forEach(v => { v.now *= i })
oneTurn *= i
const start = [core.clone(heroinfo), core.clone(enemyinfo), core.clone(equipInfo), oneTurn] //记录开始战斗时的属性并转发
//---第三部分:递归开始--- //---第三部分:递归开始---
let poison = 0 let poison = 0
const heroDiffList = [], const heroDiffList = [],
@ -840,6 +820,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
enemyanimateList = []; enemyanimateList = [];
let beforehp = enemyinfo.hp let beforehp = enemyinfo.hp
while ( while (
enemyinfo.hp > 0 enemyinfo.hp > 0
) { ) {
@ -849,10 +831,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
hero_animate = [], hero_animate = [],
enemy_animate = []; enemy_animate = [];
heroinfo.now += heroinfo.speed heroinfo.now += heroinfo.speed / Exspeed
enemyinfo.now += enemyinfo.speed enemyinfo.now += enemyinfo.speed / Exspeed
equipInfo.forEach(v => { equipInfo.forEach(v => {
v.now += v.speed v.now += v.speed / Exspeed
}) })
if ( if (

View File

@ -4000,10 +4000,11 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
number, number,
x, x,
y, y,
floorId floorId,
config={}
) { ) {
var mon_hp = info.mon_hp, var mon_hp = info.mon_hp,
hero_atk = core.status.hero.atk, hero_atk = config.atk??core.status.hero.atk,
mon_def = info.mon_def, mon_def = info.mon_def,
pre = info.damage; pre = info.damage;
var list = []; var list = [];
@ -4012,26 +4013,29 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
start_atk += info.__overAtk__; start_atk += info.__overAtk__;
list.push([info.__overAtk__, -info.damage]); list.push([info.__overAtk__, -info.damage]);
} }
var start=core.clone(config)
var mid=core.clone(config)
var end=core.clone(config)
var calNext = function (currAtk, maxAtk) { var calNext = function (currAtk, maxAtk) {
var start = Math.floor(currAtk), start.atk = Math.floor(currAtk)
end = Math.floor(maxAtk); end.atk = Math.floor(maxAtk);
if (start > end) return null; if (start.atk > end.atk) return null;
while (start < end) { while (start.atk < end.atk) {
var mid = Math.floor((start + end) / 2); mid.atk = Math.floor((start.atk + end.atk) / 2);
if (mid - start > end - mid) mid--; if (mid.atk - start.atk > end.atk - mid.atk) mid.atk--;
var nextInfo = core.enemys.getDamageInfo( var nextInfo = core.enemys.getDamageInfo(
enemy, { atk: mid }, enemy, mid ,
x, x,
y, y,
floorId floorId
); );
if (nextInfo == null || typeof nextInfo == "number") return null; if (nextInfo == null || typeof nextInfo == "number") return null;
if (pre > nextInfo.damage) end = mid; if (pre > nextInfo.damage) end.atk = mid.atk;
else start = mid + 1; else start.atk = mid.atk + 1;
} }
var nextInfo = core.enemys.getDamageInfo( var nextInfo = core.enemys.getDamageInfo(
enemy, { atk: start }, enemy, start,
x, x,
y, y,
floorId floorId
@ -4039,7 +4043,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
return nextInfo == null || return nextInfo == null ||
typeof nextInfo == "number" || typeof nextInfo == "number" ||
nextInfo.damage >= pre ? nextInfo.damage >= pre ?
null : [start, nextInfo.damage]; null : [start.atk, nextInfo.damage];
}; };
var currAtk = start_atk; var currAtk = start_atk;
while (true) { while (true) {
@ -4082,110 +4086,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
); );
} }
}; };
events.prototype.openBook = function (fromUserAction) {
if (core.isReplaying()) return;
// 如果能恢复事件从callBook事件触发
if (
core.status.event.id == "book" &&
core.events.recoverEvents(core.status.event.interval)
)
return;
// 当前是book且从“浏览地图”打开
if (core.status.event.id == "book" && core.status.event.ui) {
core.status.boxAnimateObjs = [];
core.ui._drawViewMaps(core.status.event.ui);
return;
}
// 从“浏览地图”页面打开
if (core.status.event.id == "viewMaps" || core.status.event.id == "fly") {
fromUserAction = false;
core.status.event.ui = core.status.event.data;
}
if (!this._checkStatus("book", fromUserAction, true)) return;
core.playSound("打开界面");
core.useItem("book", true);
};
////// 怪物手册界面时,放开某个键的操作 //////
core.actions._keyUpBook = function (keycode) {
if (keycode == 27 || keycode == 88) {
core.playSound("取消");
if (core.events.recoverEvents(core.status.event.interval)) {
return;
} else if (core.status.event.ui != null) {
core.status.boxAnimateObjs = [];
if (typeof core.status.event.ui === "number") {
core.status.event.id = "fly";
core.ui.drawFly(core.status.event.ui);
} else {
core.ui._drawViewMaps(core.status.event.ui);
}
} else core.ui.closePanel();
return;
}
if (keycode == 13 || keycode == 32 || keycode == 67) {
var data = core.status.event.data;
if (data != null) {
core.ui._drawBookDetail(data);
}
return;
}
};
////// 怪物手册界面的点击操作 //////
actions.prototype._clickBook = function (x, y) {
var pageinfo = core.ui._drawBook_pageinfo();
// 上一页
if (
(x == this._HX_ - 2 || x == this._HX_ - 3) &&
y === core._HEIGHT_ - 1
) {
core.playSound("光标移动");
core.ui.drawBook(core.status.event.data - pageinfo.per_page);
return;
}
// 下一页
if (
(x == this._HX_ + 2 || x == this._HX_ + 3) &&
y === core._HEIGHT_ - 1
) {
core.playSound("光标移动");
core.ui.drawBook(core.status.event.data + pageinfo.per_page);
return;
}
// 返回
if (x >= this.LAST - 2 && y === core._HEIGHT_ - 1) {
core.playSound("取消");
if (core.events.recoverEvents(core.status.event.interval)) {
return;
} else if (core.status.event.ui != null) {
core.status.boxAnimateObjs = [];
if (typeof core.status.event.ui === "number") {
core.status.event.id = "fly";
core.ui.drawFly(core.status.event.ui);
} else {
core.ui._drawViewMaps(core.status.event.ui);
}
} else core.ui.closePanel();
return;
}
// 怪物信息
var data = core.status.event.data;
if (data != null && y < core._HEIGHT_ - 1) {
var per_page = pageinfo.per_page,
page = parseInt(data / per_page);
var u = (core._HEIGHT_ - 1) / per_page;
for (var i = 0; i < per_page; ++i) {
if (y >= u * i && y < u * (i + 1)) {
var index = per_page * page + i;
core.ui.drawBook(index);
core.ui._drawBookDetail(index);
break;
}
}
return;
}
return;
};
////// 执行当前自定义事件列表中的下一个事件 ////// ////// 执行当前自定义事件列表中的下一个事件 //////
events.prototype.doAction = function () { events.prototype.doAction = function () {
// 清空boxAnimate和UI层 // 清空boxAnimate和UI层
@ -20019,7 +19919,6 @@ let time=0
const changeY = -30 const changeY = -30
let easy = false; let easy = false;
const { imagelighter } = core.plugin.utils; const { imagelighter } = core.plugin.utils;
const { lcm, gcd } = core.plugin.utils;
let a = [] let a = []
@ -20052,7 +19951,6 @@ let time=0
core.animateFrame.animate2Time = 0 core.animateFrame.animate2Time = 0
function animationFrame(callback1) { function animationFrame(callback1) {
let time = 0
const ctx = core.getContextByName("animateAttack") ?? core.createCanvas("animateAttack", 0, 0, 416, 416, 80) const ctx = core.getContextByName("animateAttack") ?? core.createCanvas("animateAttack", 0, 0, 416, 416, 80)
const anctx = core.getContextByName("animate2") ?? core.createCanvas("animate2", 0, 0, 416, 416, 91) const anctx = core.getContextByName("animate2") ?? core.createCanvas("animate2", 0, 0, 416, 416, 91)
core.registerAnimationFrame("animate2", true, function (timestamp) { core.registerAnimationFrame("animate2", true, function (timestamp) {
@ -20117,13 +20015,14 @@ let time=0
drawAnimate(name, 130, 180 + changeY); drawAnimate(name, 130, 180 + changeY);
} }
} }
let sp = [1, 2, 4, 8, 16]
let A = 1
this.attackAnimate = function ( this.attackAnimate = function (
enemyId, enemyId,
heroInfo, heroInfo,
enemyInfo, enemyInfo,
equipInfo, equipInfo,
oneTurn, Exspeed,
heroDiffList, heroDiffList,
enemyDiffList, enemyDiffList,
heroanimateList, heroanimateList,
@ -20140,21 +20039,11 @@ let time=0
enemyInfo.id = enemyId; enemyInfo.id = enemyId;
enemyInfo.cls = core.getClsFromId(enemyId); enemyInfo.cls = core.getClsFromId(enemyId);
enemyInfo.name = core.material.enemys[enemyId].name; enemyInfo.name = core.material.enemys[enemyId].name;
let max = heroInfo.speed
if (enemyInfo.speed > max) max = enemyInfo.speed
equipInfo.forEach(v => { if (v.speed > max) max = v.speed })
let i = 1
while (oneTurn * i / max < 30) {
i++
}
heroInfo.turn = 0 heroInfo.turn = 0
enemyInfo.turn = 0 enemyInfo.turn = 0
heroInfo.now *= i const oneTurn = 100
enemyInfo.now *= i let farme = 0;
equipInfo.forEach(v => { v.now *= i })
oneTurn *= i
let time = 0,
farme = 0;
return new Promise((res) => { return new Promise((res) => {
core.plugin.battle_onclick = function (x, y, px, py) { core.plugin.battle_onclick = function (x, y, px, py) {
const makeBox = ([x, y], [w, h]) => { const makeBox = ([x, y], [w, h]) => {
@ -20184,7 +20073,9 @@ let time=0
(inRect(pos, easyspeedbox) && easy) || (inRect(pos, easyspeedbox) && easy) ||
(inRect(pos, uneasyspeedbox) && !easy) (inRect(pos, uneasyspeedbox) && !easy)
) { ) {
flags.qukly = !flags.qukly A++
if (A >= sp.length) A = 0
flags.qukly = sp[A]
} else if ((inRect(pos, easyClosebox) && easy) || } else if ((inRect(pos, easyClosebox) && easy) ||
(inRect(pos, uneasyClosebox) && !easy) (inRect(pos, uneasyClosebox) && !easy)
@ -20198,7 +20089,6 @@ let time=0
}; };
async function drawAttackAnimate( async function drawAttackAnimate(
heroInfo, heroInfo,
oneTurn,
enemyInfo, enemyInfo,
equipInfo, equipInfo,
farme, farme,
@ -20227,26 +20117,25 @@ let time=0
core.clearMap(ctx); core.clearMap(ctx);
let animate = Math.floor(farme / 15); let animate = Math.floor(farme / 15);
if (flags.qukly) {
while (true) {
let goattack = false
equipInfo.forEach(v => {
if (v.now >= oneTurn) goattack = true
}); for (let i = 0; i < (flags.qukly ?? 2) / 2; i++) {
if (enemyInfo.now >= oneTurn) goattack = true let goattack = false
if (heroInfo.now >= oneTurn) goattack = true equipInfo.forEach(v => {
if (v.now >= oneTurn) goattack = true
if (goattack) break; });
enemyInfo.now += enemyInfo.speed if (enemyInfo.now >= oneTurn) goattack = true
heroInfo.now += heroInfo.speed if (heroInfo.now >= oneTurn) goattack = true
equipInfo.forEach(function (v) { if (goattack || attack || onAttack) break;
v.now += v.speed enemyInfo.now += enemyInfo.speed / Exspeed
heroInfo.now += heroInfo.speed / Exspeed
equipInfo.forEach(function (v) {
v.now += v.speed / Exspeed
}); });
}
} }
if (easy) { if (easy) {
core.fillRect(ctx, 64, 52, 288, 212, "rgba(0,0,0,0.5)"); core.fillRect(ctx, 64, 52, 288, 212, "rgba(0,0,0,0.5)");
core.strokeRect(ctx, 64, 52, 288, 212, "rgba(255,255,255,0.5)", 4); core.strokeRect(ctx, 64, 52, 288, 212, "rgba(255,255,255,0.5)", 4);
@ -20377,7 +20266,7 @@ let time=0
); );
core.fillBoldText( core.fillBoldText(
ctx, ctx,
flags.qukly ? "正常" : "极速", "x" + (flags.qukly ?? 2) / 2,
330, 330,
250 + changeY, 250 + changeY,
"#FFFF60", "#FFFF60",
@ -20412,7 +20301,6 @@ let time=0
"bold 36px pala" "bold 36px pala"
); );
if (!attack && !onAttack && !flags.qukly) enemyInfo.now += enemyInfo.speed;
let enemynow = Math.min(100 + (enemyInfo.now / oneTurn) * 215, 315); let enemynow = Math.min(100 + (enemyInfo.now / oneTurn) * 215, 315);
ctx.fillStyle = "#FFFFFF"; ctx.fillStyle = "#FFFFFF";
ctx.beginPath(); ctx.beginPath();
@ -20425,7 +20313,6 @@ let time=0
core.drawLine(ctx, 100, 125 + changeY, 315, 125 + changeY, "#FFFFFF", 5); core.drawLine(ctx, 100, 125 + changeY, 315, 125 + changeY, "#FFFFFF", 5);
equipInfo.forEach(function (v) { equipInfo.forEach(function (v) {
if (!attack && !onAttack) v.now += v.speed;
let vnow = Math.min(100 + (v.now / oneTurn) * 215, 315); let vnow = Math.min(100 + (v.now / oneTurn) * 215, 315);
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(vnow, 120 + changeY); ctx.moveTo(vnow, 120 + changeY);
@ -20437,7 +20324,6 @@ let time=0
core.drawIcon(ctx, v.id, vnow - 16, 84 + changeY, 32, 32); core.drawIcon(ctx, v.id, vnow - 16, 84 + changeY, 32, 32);
}); });
if (!attack && !onAttack && !flags.qukly) heroInfo.now += hero.speed;
let heronow = Math.min(100 + (heroInfo.now / oneTurn) * 215, 315); let heronow = Math.min(100 + (heroInfo.now / oneTurn) * 215, 315);
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(heronow, 120); ctx.moveTo(heronow, 120);
@ -20697,7 +20583,7 @@ let time=0
); );
core.fillBoldText( core.fillBoldText(
ctx, ctx,
flags.qukly ? "正常" : "极速", "x" + (flags.qukly ?? 2) / 2,
330, 330,
365 + changeY, 365 + changeY,
"#FFFF60", "#FFFF60",
@ -20732,7 +20618,6 @@ let time=0
"bold 36px pala" "bold 36px pala"
); );
if (!attack && !onAttack & !flags.qukly) enemyInfo.now += enemyInfo.speed;
let enemynow = Math.min(100 + (enemyInfo.now / oneTurn) * 215, 315); let enemynow = Math.min(100 + (enemyInfo.now / oneTurn) * 215, 315);
ctx.fillStyle = "#FFFFFF"; ctx.fillStyle = "#FFFFFF";
ctx.beginPath(); ctx.beginPath();
@ -20745,7 +20630,6 @@ let time=0
core.drawLine(ctx, 100, 125 + changeY, 315, 125 + changeY, "#FFFFFF", 5); core.drawLine(ctx, 100, 125 + changeY, 315, 125 + changeY, "#FFFFFF", 5);
equipInfo.forEach(function (v) { equipInfo.forEach(function (v) {
if (!attack && !onAttack) v.now += v.speed;
let vnow = Math.min(100 + (v.now / oneTurn) * 215, 315); let vnow = Math.min(100 + (v.now / oneTurn) * 215, 315);
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(vnow, 120 + changeY); ctx.moveTo(vnow, 120 + changeY);
@ -20757,7 +20641,6 @@ let time=0
core.drawIcon(ctx, v.id, vnow - 16, 84 + changeY, 32, 32); core.drawIcon(ctx, v.id, vnow - 16, 84 + changeY, 32, 32);
}); });
if (!attack && !onAttack && !flags.qukly) heroInfo.now += hero.speed;
let heronow = Math.min(100 + (heroInfo.now / oneTurn) * 215, 315); let heronow = Math.min(100 + (heroInfo.now / oneTurn) * 215, 315);
ctx.beginPath(); ctx.beginPath();
ctx.moveTo(heronow, 120 + changeY); ctx.moveTo(heronow, 120 + changeY);
@ -20852,19 +20735,36 @@ let time=0
if (heroDiffList[turn] < 0) heroInfo.inAttack = true; if (heroDiffList[turn] < 0) heroInfo.inAttack = true;
if (heroInfo.hp < 0) heroInfo.hp = 0; if (heroInfo.hp < 0) heroInfo.hp = 0;
if (enemyInfo.hp < 0) enemyInfo.hp = 0; if (enemyInfo.hp < 0) enemyInfo.hp = 0;
await Promise.all([ await new Promise((resolve) => animationFrame(resolve)).then(() => {
if (heroInfo.isAttack) {
heroInfo.now -= oneTurn;
heroInfo.isAttack = false;
}
if (enemyInfo.isAttack) {
enemyInfo.now -= oneTurn;
enemyInfo.isAttack = false;
}
if (equipanimate.length > 0) {
equipanimate.forEach((v) => {
v.now -= oneTurn;
v.isAttack = false;
});
}
turn++
})
/*await Promise.all([
await new Promise((resolve) => animationFrame(resolve)), await new Promise((resolve) => animationFrame(resolve)),
new Promise((resolve) => { new Promise((resolve) => {
if (heroInfo.isAttack) { if (heroInfo.isAttack) {
heroInfo.now = 0; heroInfo.now -= 100;
heroInfo.isAttack = false; heroInfo.isAttack = false;
} }
resolve(); resolve();
}), }),
new Promise((resolve) => { new Promise((resolve) => {
if (enemyInfo.isAttack) { if (enemyInfo.isAttack) {
enemyInfo.now = 0; enemyInfo.now -= 100;
enemyInfo.isAttack = false; enemyInfo.isAttack = false;
} }
resolve(); resolve();
@ -20872,7 +20772,7 @@ let time=0
new Promise((resolve) => { new Promise((resolve) => {
if (equipanimate.length > 0) { if (equipanimate.length > 0) {
equipanimate.forEach((v) => { equipanimate.forEach((v) => {
v.now = 0; v.now -= 100;
v.isAttack = false; v.isAttack = false;
}); });
} }
@ -20882,7 +20782,7 @@ let time=0
turn++; turn++;
resolve(); resolve();
}), }),
]); ]);*/
if (heroInfo.hp <= 0 || enemyInfo.hp <= 0) { if (heroInfo.hp <= 0 || enemyInfo.hp <= 0) {
core.status.event.id = ""; core.status.event.id = "";
@ -20894,12 +20794,10 @@ let time=0
} }
} }
core.registerAnimationFrame("attackAnimate", true, (temptime) => { core.registerAnimationFrame("attackAnimate", true, () => {
time = temptime;
drawAttackAnimate( drawAttackAnimate(
heroInfo, heroInfo,
oneTurn,
enemyInfo, enemyInfo,
equipInfo, equipInfo,
farme, farme,
@ -21895,29 +21793,36 @@ let time=0
//临界表 //临界表
core.ui._drawBookDetail_turnAndCriticals = function (enemy, floorId, texts) { core.ui._drawBookDetail_turnAndCriticals = function (enemy, floorId, texts) {
// 临界表 // 临界表
var criticals = core.enemys.nextCriticals(enemy.id, 8, enemy.x, enemy.y, floorId).map(function (v) { var criticals = core.enemys.nextCriticals(enemy.id, 5, enemy.x, enemy.y, floorId).map(function (v) {
return core.formatBigNumber(v[0]) + ":" + core.formatBigNumber(v[1]); return core.formatBigNumber(v[0]) + ":" + core.formatBigNumber(v[1]);
}); });
while (criticals[0] == '0:0') criticals.shift(); while (criticals[0] == '0:0') criticals.shift();
texts.push("\r[#FF6A6A]\\d攻击临界表\\d\r[]" + JSON.stringify(criticals)); if (criticals.length > 0) {
var criticals_spell = core.nextCriticals_spell(enemy.id, 8, enemy.x, enemy.y, floorId).map(function (v) { texts.push("\r[#FF6A6A]\\d攻击临界表\\d\r[]" + JSON.stringify(criticals));
}
var criticals_spell = core.nextCriticals_spell(enemy.id, 5, enemy.x, enemy.y, floorId).map(function (v) {
return core.formatBigNumber(v[0]) + ":" + core.formatBigNumber(v[1]); return core.formatBigNumber(v[0]) + ":" + core.formatBigNumber(v[1]);
}); });
while (criticals_spell[0] == '0:0') criticals_spell.shift(); while (criticals_spell[0] == '0:0') criticals_spell.shift();
texts.push("\r[#FF6A6A]\\d法强临界表\\d\r[]" + JSON.stringify(criticals_spell)); if (criticals_spell.length > 0) {
var criticals_speed = core.nextCriticals_speed(enemy.id, 8, enemy.x, enemy.y, floorId).map(function (v) { texts.push("\r[#FF6A6A]\\d法强临界表\\d\r[]" + JSON.stringify(criticals_spell));
}
var criticals_speed = core.nextCriticals_speed(enemy.id, 5, enemy.x, enemy.y, floorId).map(function (v) {
return core.formatBigNumber(v[0]) + ":" + core.formatBigNumber(v[1]); return core.formatBigNumber(v[0]) + ":" + core.formatBigNumber(v[1]);
}); });
while (criticals_speed[0] == '0:0') criticals_speed.shift(); while (criticals_speed[0] == '0:0') criticals_speed.shift();
texts.push("\r[#FF6A6A]\\d速度临界表\\d\r[]" + JSON.stringify(criticals_speed)); if (criticals_speed.length > 0) {
texts.push("\r[#FF6A6A]\\d速度临界表\\d\r[]" + JSON.stringify(criticals_speed));
}
} }
//攻速临界计算 //攻速临界计算
core.nextCriticals_speed = function (enemy, number, x, y, floorId) { core.nextCriticals_speed = function (enemy, number, x, y, floorId, config = {}) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
number = number || 1; number = number || 1;
var info = core.getDamageInfo(enemy, null, x, y, floorId); var info = core.getDamageInfo(enemy, config, x, y, floorId);
if (info == null) { // 如果未破防... if (info == null) { // 如果未破防...
return [ return [
['?', '?'] ['?', '?']
@ -21929,31 +21834,33 @@ let time=0
[0, 0] [0, 0]
]; ];
} }
return core.enemys._nextSpeedCriticals_useBinarySearch(enemy, info, number, x, y, floorId); return core.enemys._nextSpeedCriticals_useBinarySearch(enemy, info, number, x, y, floorId, config);
} }
enemys.prototype._nextSpeedCriticals_useBinarySearch = function (enemy, info, number, x, y, floorId) { enemys.prototype._nextSpeedCriticals_useBinarySearch = function (enemy, info, number, x, y, floorId, config = {}) {
var mon_hp = info.mon_hp, var mon_hp = info.mon_hp,
hero_speed = core.status.hero.speed, hero_speed = config.speed ?? core.status.hero.speed,
mon_def = info.mon_def, mon_def = info.mon_def,
pre = info.damage; pre = info.damage;
var list = []; var list = [];
var start_speed = hero_speed; var start_speed = hero_speed;
var start = core.clone(config)
var mid = core.clone(config)
var end = core.clone(config)
var calNext = function (currSpeed, maxSpeed) { var calNext = function (currSpeed, maxSpeed) {
var start = Math.floor(currSpeed), start.speed = Math.floor(currSpeed)
end = Math.floor(maxSpeed); end.speed = Math.floor(maxSpeed);
if (start > end) return null; if (start.speed > end.speed) return null;
while (start < end) { while (start.speed < end.speed) {
var mid = Math.floor((start + end) / 2); mid.speed = Math.floor((start.speed + end.speed) / 2);
if (mid - start > end - mid) mid--; if (mid.speed - start.speed > end.speed - mid.speed) mid.speed--;
var nextInfo = core.enemys.getDamageInfo(enemy, { "speed": mid }, x, y, floorId); var nextInfo = core.enemys.getDamageInfo(enemy, mid, x, y, floorId);
if (nextInfo == null || (typeof nextInfo == 'number')) return null; if (nextInfo == null || (typeof nextInfo == 'number')) return null;
if (pre > nextInfo.damage) end = mid; if (pre > nextInfo.damage) end.speed = mid.speed;
else start = mid + 1; else start.speed = mid.speed + 1;
} }
var nextInfo = core.enemys.getDamageInfo(enemy, { "speed": start }, x, y, floorId); var nextInfo = core.enemys.getDamageInfo(enemy, start, x, y, floorId);
return nextInfo == null || (typeof nextInfo == 'number') || nextInfo.damage >= pre ? null : [start, nextInfo.damage]; return nextInfo == null || (typeof nextInfo == 'number') || nextInfo.damage >= pre ? null : [start.speed, nextInfo.damage];
} }
var currSpeed = start_speed; var currSpeed = start_speed;
while (true) { while (true) {
@ -21969,7 +21876,7 @@ let time=0
return list; return list;
} }
//法强临界计算 //法强临界计算
core.nextCriticals_spell = function (enemy, number, x, y, floorId) { core.nextCriticals_spell = function (enemy, number, x, y, floorId, config = {}) {
if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; if (typeof enemy == 'string') enemy = core.material.enemys[enemy];
number = number || 1; number = number || 1;
@ -21985,32 +21892,34 @@ let time=0
[0, 0] [0, 0]
]; ];
} }
return core.enemys._nextSpellCriticals_useBinarySearch(enemy, info, number, x, y, floorId); return core.enemys._nextSpellCriticals_useBinarySearch(enemy, info, number, x, y, floorId, config);
} }
enemys.prototype._nextSpellCriticals_useBinarySearch = function (enemy, info, number, x, y, floorId) { enemys.prototype._nextSpellCriticals_useBinarySearch = function (enemy, info, number, x, y, floorId, config = {}) {
var mon_hp = info.mon_hp, var mon_hp = info.mon_hp,
hero_spell = core.status.hero.spell, hero_spell = config.spell ?? core.status.hero.spell,
mon_def = info.mon_def, mon_def = info.mon_def,
turn = info.mon_turn, turn = info.mon_turn,
pre = info.damage; pre = info.damage;
var list = []; var list = [];
var start_spell = hero_spell; var start_spell = hero_spell;
var start = core.clone(config)
var mid = core.clone(config)
var end = core.clone(config)
var calNext = function (currSpell, maxSpell) { var calNext = function (currSpell, maxSpell) {
var start = Math.floor(currSpell), start.spell = Math.floor(currSpell)
end = Math.floor(maxSpell); end.spell = Math.floor(maxSpell);
if (start > end) return null; if (start.spell > end.spell) return null;
while (start < end) { while (start.spell < end.spell) {
var mid = Math.floor((start + end) / 2); mid.spell = Math.floor((start.spell + end.spell) / 2);
if (mid - start > end - mid) mid--; if (mid.spell - start.spell > end.spell - mid.spell) mid.spell--;
var nextInfo = core.enemys.getDamageInfo(enemy, { "spell": mid }, x, y, floorId); var nextInfo = core.enemys.getDamageInfo(enemy, mid, x, y, floorId);
if (nextInfo == null || (typeof nextInfo == 'number')) return null; if (nextInfo == null || (typeof nextInfo == 'number')) return null;
if (turn > nextInfo.mon_turn) end = mid; if (turn > nextInfo.mon_turn) end.spell = mid.spell;
else start = mid + 1; else start.spell = mid.spell + 1;
} }
var nextInfo = core.enemys.getDamageInfo(enemy, { "spell": start }, x, y, floorId); var nextInfo = core.enemys.getDamageInfo(enemy, start, x, y, floorId);
return nextInfo == null || (typeof nextInfo == 'number') || nextInfo.mon_turn >= turn ? null : [start, nextInfo.damage]; return nextInfo == null || (typeof nextInfo == 'number') || nextInfo.mon_turn >= turn ? null : [start.spell, nextInfo.damage];
} }
var currSpell = start_spell; var currSpell = start_spell;
while (true) { while (true) {
@ -22135,6 +22044,14 @@ let time=0
this.tempLeft = this.tempLeft.getContext("2d") this.tempLeft = this.tempLeft.getContext("2d")
this.tempRight = this.tempRight.getContext("2d") this.tempRight = this.tempRight.getContext("2d")
this.animateObjs = {} this.animateObjs = {}
this.atk = 0
this.speed = 0
this.spell = 0
this.def = 0
this.atkStep = 1
this.speedStep = 1
this.spellStep = 1
this.defStep = 1
} }
getCurrentEnemys(floorId) { getCurrentEnemys(floorId) {
@ -22218,9 +22135,6 @@ let time=0
} }
}
pageinfo() {
} }
drawTempLeft(dir) { drawTempLeft(dir) {
core.clearMap(this.tempLeft) core.clearMap(this.tempLeft)
@ -22260,8 +22174,8 @@ let time=0
} }
drawTempRight(dir) { drawTempRight(dir) {
core.clearMap(this.tempRight) core.clearMap(this.tempRight)
const enemy = this.enemys[this.page + dir] const enemy = this.enemys[this.page]
core.maps.drawThumbnail(this.floorId, null, { ctx: this.tempRight, size: 0.4, x: 10, y: 220 }) core.maps.drawThumbnail(this.floorId, null, { ctx: this.tempRight, size: 0.4, x: 10, y: 220, noEnabled: true })
enemy.locs.forEach(v => { enemy.locs.forEach(v => {
this.tempRight.beginPath() this.tempRight.beginPath()
this.tempRight.moveTo(10 + (32 * v[0] + 16) * 0.4, 220 + 32 * v[1] * 0.4) this.tempRight.moveTo(10 + (32 * v[0] + 16) * 0.4, 220 + 32 * v[1] * 0.4)
@ -22272,11 +22186,108 @@ let time=0
this.tempRight.fill() this.tempRight.fill()
}) })
core.setTextAlign(this.tempRight, 'left') core.setTextAlign(this.tempRight, 'left')
core.fillText(this.tempRight, "出手 " + (core.getDamageInfo(enemy, null) ? core.getDamageInfo(enemy, null).hero_turn : '???'), 30, 50, "#000000", core.ui._buildFont(12, true)) let getDamageInfo = core.getDamageInfo(enemy, null)
core.fillText(this.tempRight, "受击 " + (core.getDamageInfo(enemy, null) ? core.getDamageInfo(enemy, null).mon_turn : '???'), 130, 50, "#000000", core.ui._buildFont(12, true)) core.fillText(this.tempRight, "出手次数 " + (getDamageInfo ? getDamageInfo.hero_turn : '???'), 30, 50, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, enemy.damage === "???" ? "你会死的哦~杂鱼❤~" : enemy.damage, 230, 50, "#FF0000", core.ui._buildFont(12, true)) core.fillText(this.tempRight, "受击次数 " + (getDamageInfo ? getDamageInfo.mon_turn : '???'), 130, 50, "#000000", core.ui._buildFont(12, true))
let color = "#FFFF00",
damage = enemy.damage
if (damage == '???') {
damage = '你会死的哦~杂鱼❤~';
color = '#FF2222';
} else {
if (damage >= core.status.hero.hp) color = '#FF2222';
else if (damage >= core.status.hero.hp * 2 / 3) color = '#FF9933';
else if (damage <= 0) color = '#11FF11';
damage = core.formatBigNumber(damage);
}
if (enemy.notBomb) damage += "[b]";
core.fillText(this.tempRight, damage, 230, 50, color, core.ui._buildFont(12, true))
core.fillText(this.tempRight, "攻击临界 " + enemy.criticalAtk[0], 30, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "速度临界 " + enemy.criticalSpeed[0], 120, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, '法强临界 ' + enemy.criticalSpell[0], 210, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "减伤 " + enemy.criticalAtk[1], 30, 90, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "减伤 " + enemy.criticalSpeed[1], 120, 90, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, '减伤 ' + enemy.criticalSpell[1], 210, 90, "#000000", core.ui._buildFont(12, true))
if (this.atk > 0 || this.def > 0 || this.speed > 0 || this.spell > 0) {
core.setTextAlign(this.tempRight, 'center');
core.fillText(this.tempRight, "增幅战斗情况", 150, 110, "#000000", core.ui._buildFont(16, true))
core.setTextAlign(this.tempRight, 'left');
const config = { atk: core.getRealStatus("atk") + this.atk, def: core.getRealStatus("def") + this.def, spell: core.getRealStatus("spell") + this.spell, speed: core.getRealStatus("speed") + this.speed }
getDamageInfo = core.getDamageInfo(enemy, config)
core.fillText(this.tempRight, "出手次数 " + (getDamageInfo ? getDamageInfo.hero_turn : '???'), 30, 130, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "受击次数 " + (getDamageInfo ? getDamageInfo.mon_turn : '???'), 130, 130, "#000000", core.ui._buildFont(12, true))
color = "#FFFF00"
damage = getDamageInfo.damage
if (damage == '???') {
damage = '你会死的哦~杂鱼❤~';
color = '#FF2222';
} else {
if (damage >= core.status.hero.hp) color = '#FF2222';
else if (damage >= core.status.hero.hp * 2 / 3) color = '#FF9933';
else if (damage <= 0) color = '#11FF11';
damage = core.formatBigNumber(damage);
}
if (enemy.notBomb) damage += "[b]";
core.fillText(this.tempRight, damage, 230, 130, color, core.ui._buildFont(12, true))
let atk = core.nextCriticals(enemy, null, null, null, null, config)
let speed = core.nextCriticals_speed(enemy, null, null, null, null, config)
let spell = core.nextCriticals_spell(enemy, null, null, null, null, config)
core.fillText(this.tempRight, "攻击临界 " + atk[0][0], 30, 150, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "速度临界 " + speed[0][0], 120, 150, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, '法强临界 ' + spell[0][0], 210, 150, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "减伤 " + atk[0][1], 30, 170, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "减伤 " + speed[0][1], 120, 170, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, '减伤 ' + spell[0][1], 210, 170, "#000000", core.ui._buildFont(12, true))
} else {
core.setTextAlign(this.tempRight, 'center');
core.fillText(this.tempRight, "临界表", 150, 110, "#000000", core.ui._buildFont(16, true))
let texts = []
core.ui._drawBookDetail_turnAndCriticals(enemy, this.floorId, texts)
core.drawTextContent(this.tempRight, texts.join('\n'), {
left: 30,
top: 115,
maxWidth: 240,
fontSize: 10,
lineHeight: 12,
color: "#000000"
});
}
core.setTextAlign(this.tempRight, 'left')
core.fillText(this.tempRight, "攻 " + core.formatBigNumber(this.atk), 30, 210, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "防 " + core.formatBigNumber(this.def), 90, 210, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "法 " + core.formatBigNumber(this.spell), 150, 210, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "速 " + core.formatBigNumber(this.speed), 210, 210, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "攻", 180, 260, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "防", 180, 290, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "法", 180, 320, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "速", 180, 350, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, "-", 200, 262, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "-", 200, 292, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "-", 200, 322, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "-", 200, 352, "#000000", core.ui._buildFont(24, true))
core.setTextAlign(this.tempRight, 'center'); core.setTextAlign(this.tempRight, 'center');
core.fillText(this.tempRight, "当前战斗情况", 150, 25, "#000000", core.ui._buildFont(16, true)) core.fillText(this.tempRight, core.formatBigNumber(this.atkStep), 230, 260, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, core.formatBigNumber(this.defStep), 230, 290, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, core.formatBigNumber(this.spellStep), 230, 320, "#000000", core.ui._buildFont(12, true))
core.fillText(this.tempRight, core.formatBigNumber(this.speedStep), 230, 350, "#000000", core.ui._buildFont(12, true))
core.setTextAlign(this.tempRight, 'left');
core.fillText(this.tempRight, "+", 250, 263, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "+", 250, 293, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "+", 250, 323, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "+", 250, 353, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "↑", 265, 265, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "↑", 265, 295, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "↑", 265, 325, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "↑", 265, 355, "#000000", core.ui._buildFont(24, true))
core.fillText(this.tempRight, "清零", 180, 380, '#000000', core.ui._buildFont(16, true));
core.setTextAlign(this.tempRight, 'center');
core.fillText(this.tempRight, "当前战斗情况", 150, 30, "#000000", core.ui._buildFont(16, true))
core.fillText(this.tempRight, "模拟属性提升", 150, 190, "#000000", core.ui._buildFont(16, true))
core.fillText(this.tempRight, "模拟属性调整", 230, 233, "#000000", core.ui._buildFont(16, true))
core.fillText(this.tempRight, "合上书本", 254, 380, '#000000', core.ui._buildFont(16, true)); core.fillText(this.tempRight, "合上书本", 254, 380, '#000000', core.ui._buildFont(16, true));
} }
drawLeft() { drawLeft() {
@ -22308,9 +22319,9 @@ let time=0
core.drawTextContent(this.left, hints.join('\n'), { core.drawTextContent(this.left, hints.join('\n'), {
left: 30, left: 30,
top: 240, top: 240,
maxWidth: 220, maxWidth: 240,
fontSize: 14, fontSize: 12,
lineHeight: 20, lineHeight: 16,
color: "#000000" color: "#000000"
}); });
@ -22318,7 +22329,7 @@ let time=0
drawRight() { drawRight() {
core.clearMap(this.right) core.clearMap(this.right)
const enemy = this.enemys[this.page] const enemy = this.enemys[this.page]
core.maps.drawThumbnail(this.floorId, null, { ctx: this.right, size: 0.4, x: 10, y: 220 }) core.maps.drawThumbnail(this.floorId, null, { ctx: this.right, size: 0.4, x: 10, y: 220, noEnabled: true })
enemy.locs.forEach(v => { enemy.locs.forEach(v => {
this.right.beginPath() this.right.beginPath()
this.right.moveTo(10 + (32 * v[0] + 16) * 0.4, 220 + 32 * v[1] * 0.4) this.right.moveTo(10 + (32 * v[0] + 16) * 0.4, 220 + 32 * v[1] * 0.4)
@ -22329,12 +22340,110 @@ let time=0
this.right.fill() this.right.fill()
}) })
core.setTextAlign(this.right, 'left') core.setTextAlign(this.right, 'left')
core.fillText(this.right, "出手 " + (core.getDamageInfo(enemy, null) ? core.getDamageInfo(enemy, null).hero_turn : '???'), 30, 50, "#000000", core.ui._buildFont(12, true)) let getDamageInfo = core.getDamageInfo(enemy, null)
core.fillText(this.right, "受击 " + (core.getDamageInfo(enemy, null) ? core.getDamageInfo(enemy, null).mon_turn : '???'), 130, 50, "#000000", core.ui._buildFont(12, true)) core.fillText(this.right, "出手次数 " + (getDamageInfo ? getDamageInfo.hero_turn : '???'), 30, 50, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, enemy.damage === "???" ? "你会死的哦~杂鱼❤~" : enemy.damage, 230, 50, "#FF0000", core.ui._buildFont(12, true)) core.fillText(this.right, "受击次数 " + (getDamageInfo ? getDamageInfo.mon_turn : '???'), 130, 50, "#000000", core.ui._buildFont(12, true))
let color = "#FFFF00",
damage = enemy.damage
if (damage == '???') {
damage = '你会死的哦~杂鱼❤~';
color = '#FF2222';
} else {
if (damage >= core.status.hero.hp) color = '#FF2222';
else if (damage >= core.status.hero.hp * 2 / 3) color = '#FF9933';
else if (damage <= 0) color = '#11FF11';
damage = core.formatBigNumber(damage);
}
if (enemy.notBomb) damage += "[b]";
core.fillText(this.right, damage, 230, 50, color, core.ui._buildFont(12, true))
core.fillText(this.right, "攻击临界 " + enemy.criticalAtk[0], 30, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "速度临界 " + enemy.criticalSpeed[0], 120, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, '法强临界 ' + enemy.criticalSpell[0], 210, 70, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "减伤 " + enemy.criticalAtk[1], 30, 90, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "减伤 " + enemy.criticalSpeed[1], 120, 90, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, '减伤 ' + enemy.criticalSpell[1], 210, 90, "#000000", core.ui._buildFont(12, true))
if (this.atk > 0 || this.def > 0 || this.speed > 0 || this.spell > 0) {
core.setTextAlign(this.right, 'center');
core.fillText(this.right, "增幅战斗情况", 150, 110, "#000000", core.ui._buildFont(16, true))
core.setTextAlign(this.right, 'left');
const config = { atk: core.getRealStatus("atk") + this.atk, def: core.getRealStatus("def") + this.def, spell: core.getRealStatus("spell") + this.spell, speed: core.getRealStatus("speed") + this.speed }
getDamageInfo = core.getDamageInfo(enemy, config)
core.fillText(this.right, "出手次数 " + (getDamageInfo ? getDamageInfo.hero_turn : '???'), 30, 130, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "受击次数 " + (getDamageInfo ? getDamageInfo.mon_turn : '???'), 130, 130, "#000000", core.ui._buildFont(12, true))
color = "#FFFF00"
damage = getDamageInfo.damage
if (damage == '???') {
damage = '你会死的哦~杂鱼❤~';
color = '#FF2222';
} else {
if (damage >= core.status.hero.hp) color = '#FF2222';
else if (damage >= core.status.hero.hp * 2 / 3) color = '#FF9933';
else if (damage <= 0) color = '#11FF11';
damage = core.formatBigNumber(damage);
}
if (enemy.notBomb) damage += "[b]";
core.fillText(this.right, damage, 230, 130, color, core.ui._buildFont(12, true))
let atk = core.nextCriticals(enemy, null, null, null, null, config)
let speed = core.nextCriticals_speed(enemy, null, null, null, null, config)
let spell = core.nextCriticals_spell(enemy, null, null, null, null, config)
core.fillText(this.right, "攻击临界 " + atk[0][0], 30, 150, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "速度临界 " + speed[0][0], 120, 150, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, '法强临界 ' + spell[0][0], 210, 150, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "减伤 " + atk[0][1], 30, 170, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "减伤 " + speed[0][1], 120, 170, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, '减伤 ' + spell[0][1], 210, 170, "#000000", core.ui._buildFont(12, true))
} else {
core.setTextAlign(this.right, 'center');
core.fillText(this.right, "临界表", 150, 110, "#000000", core.ui._buildFont(16, true))
let texts = []
core.ui._drawBookDetail_turnAndCriticals(enemy, this.floorId, texts)
core.drawTextContent(this.right, texts.join('\n'), {
left: 30,
top: 115,
maxWidth: 240,
fontSize: 10,
lineHeight: 12,
color: "#000000"
});
}
core.setTextAlign(this.right, 'left')
core.fillText(this.right, "攻 " + core.formatBigNumber(this.atk), 30, 210, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "防 " + core.formatBigNumber(this.def), 90, 210, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "法 " + core.formatBigNumber(this.spell), 150, 210, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "速 " + core.formatBigNumber(this.speed), 210, 210, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "攻", 180, 260, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "防", 180, 290, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "法", 180, 320, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "速", 180, 350, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, "-", 200, 262, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "-", 200, 292, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "-", 200, 322, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "-", 200, 352, "#000000", core.ui._buildFont(24, true))
core.setTextAlign(this.right, 'center'); core.setTextAlign(this.right, 'center');
core.fillText(this.right, "当前战斗情况", 150, 25, "#000000", core.ui._buildFont(16, true)) core.fillText(this.right, core.formatBigNumber(this.atkStep), 230, 260, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, core.formatBigNumber(this.defStep), 230, 290, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, core.formatBigNumber(this.spellStep), 230, 320, "#000000", core.ui._buildFont(12, true))
core.fillText(this.right, core.formatBigNumber(this.speedStep), 230, 350, "#000000", core.ui._buildFont(12, true))
core.setTextAlign(this.right, 'left');
core.fillText(this.right, "+", 250, 263, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "+", 250, 293, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "+", 250, 323, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "+", 250, 353, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "↑", 265, 265, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "↑", 265, 295, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "↑", 265, 325, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "↑", 265, 355, "#000000", core.ui._buildFont(24, true))
core.fillText(this.right, "清零", 180, 380, '#000000', core.ui._buildFont(16, true));
core.setTextAlign(this.right, 'center');
core.fillText(this.right, "当前战斗情况", 150, 30, "#000000", core.ui._buildFont(16, true))
core.fillText(this.right, "模拟属性提升", 150, 190, "#000000", core.ui._buildFont(16, true))
core.fillText(this.right, "模拟属性调整", 230, 233, "#000000", core.ui._buildFont(16, true))
core.fillText(this.right, "合上书本", 254, 380, '#000000', core.ui._buildFont(16, true)); core.fillText(this.right, "合上书本", 254, 380, '#000000', core.ui._buildFont(16, true));
} }
clear() { clear() {
@ -22344,7 +22453,12 @@ let time=0
core.clearMap(this.tempLeft) core.clearMap(this.tempLeft)
core.clearMap(this.tempRight) core.clearMap(this.tempRight)
} }
clearEx() {
this.atk = 0
this.speed = 0
this.spell = 0
this.def = 0
}
init(floorId) { init(floorId) {
this.page = 0 this.page = 0
this.getCurrentEnemys(floorId) this.getCurrentEnemys(floorId)
@ -22386,16 +22500,118 @@ let time=0
const leftbox = makeBox([(676 - this.width * 2) / 2, (416 - this.height) / 2], [this.width, this.height]) const leftbox = makeBox([(676 - this.width * 2) / 2, (416 - this.height) / 2], [this.width, this.height])
const rightbox = makeBox([338, (416 - this.height) / 2], [this.width, this.height]) const rightbox = makeBox([338, (416 - this.height) / 2], [this.width, this.height])
const exitbox = makeBox([555, 365], [70, 35]) const exitbox = makeBox([555, 365], [70, 35])
const atkupbox = makeBox([581, 251], [25, 25])
const atkdownbox = makeBox([531, 251], [25, 25])
const atkchangebox = makeBox([606, 251], [25, 25])
const defupbox = makeBox([581, 281], [25, 25])
const defdownbox = makeBox([531, 281], [25, 25])
const defchangebox = makeBox([606, 281], [25, 25])
const spellupbox = makeBox([581, 311], [25, 25])
const spelldownbox = makeBox([531, 311], [25, 25])
const spellchangebox = makeBox([606, 311], [25, 25])
const speedupbox = makeBox([581, 341], [25, 25])
const speeddownbox = makeBox([531, 341], [25, 25])
const speedchangebox = makeBox([606, 341], [25, 25])
const zerochangebox = makeBox([515, 365], [35, 35])
if (this.isAnimate) return if (this.isAnimate) return
if (inRect(pos, exitbox)) { if (inRect(pos, atkupbox)) {
bookInfo.atk += bookInfo.atkStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, atkdownbox)) {
bookInfo.atk -= bookInfo.atkStep
if (bookInfo.atk < 0) bookInfo.atk = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, atkchangebox)) {
core.myprompt("请输入攻击调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.atkStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
}
});
} else if (inRect(pos, defupbox)) {
bookInfo.def += bookInfo.defStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, defdownbox)) {
bookInfo.def -= bookInfo.defStep
if (bookInfo.def < 0) bookInfo.def = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, defchangebox)) {
core.myprompt("请输入防御调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.defStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
}
});
} else if (inRect(pos, spellupbox)) {
bookInfo.spell += bookInfo.spellStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, spelldownbox)) {
bookInfo.spell -= bookInfo.spellStep
if (bookInfo.spell < 0) bookInfo.spell = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, spellchangebox)) {
core.myprompt("请输入法强调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.spellStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
}
});
} else if (inRect(pos, speedupbox)) {
bookInfo.speed += bookInfo.speedStep
bookInfo.drawRight()
this.update()
} else if (inRect(pos, speeddownbox)) {
bookInfo.speed -= bookInfo.speedStep
if (bookInfo.speed < 0) bookInfo.speed = 0
bookInfo.drawRight()
this.update()
} else if (inRect(pos, speedchangebox)) {
core.myprompt("请输入速度调整步距(只可输入数字)", null, (value) => {
if (value && !Number.isNaN(Number(value)) && Number(value) >= 1) {
bookInfo.speedStep = Number(value)
bookInfo.drawRight()
this.update()
} else if (value) {
alert("无效的输入!");
} else if (value === "") {
}
});
} else if (inRect(pos, zerochangebox)) {
bookInfo.clearEx()
bookInfo.drawRight()
this.update()
} else if (inRect(pos, exitbox)) {
core.playSound('取消'); core.playSound('取消');
core.book.close()
if (core.events.recoverEvents(core.status.event.interval)) { if (core.events.recoverEvents(core.status.event.interval)) {
return; return;
} else if (core.status.event.ui != null) { } else if (core.status.event.ui != null) {
core.status.boxAnimateObjs = []; core.status.boxAnimateObjs = [];
core.ui._drawViewMaps(core.status.event.ui); core.ui._drawViewMaps(core.status.event.ui);
} else core.ui.closePanel(); } else core.ui.closePanel();
core.book.close()
return; return;
} else if (inRect(pos, leftbox)) { } else if (inRect(pos, leftbox)) {