mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-01 07:24:30 +08:00
二区 & 修复楼传bug
This commit is contained in:
1 parent
c4417977da
commit
a85cef79ec
19 files changed
+492
-135
No files matched your search
+19
-11
@@ -6,12 +6,15 @@ export const showFixed = ref(false);
|
||||
|
||||
let lastId: EnemyIds;
|
||||
|
||||
const show = debounce((ev: MouseEvent, mx: number, my: number, e: AllIds) => {
|
||||
const show = debounce((ev: MouseEvent) => {
|
||||
if (!window.flags) return;
|
||||
if (!flags.mouseLoc) return;
|
||||
flags.clientLoc = [ev.clientX, ev.clientY];
|
||||
const [mx, my] = getLocFromMouseLoc(...flags.mouseLoc);
|
||||
const e = core.getBlockId(mx, my);
|
||||
if (e !== lastId) showFixed.value = false;
|
||||
if (!e || !core.getClsFromId(e)?.startsWith('enemy')) return;
|
||||
|
||||
lastId = e as EnemyIds;
|
||||
const enemy = core.material.enemys[e as EnemyIds];
|
||||
const detail = getDetailedEnemy(enemy, mx, my);
|
||||
@@ -22,14 +25,12 @@ const show = debounce((ev: MouseEvent, mx: number, my: number, e: AllIds) => {
|
||||
export default function init() {
|
||||
const data = core.canvas.data.canvas;
|
||||
data.addEventListener('mousemove', ev => {
|
||||
if (!core.isPlaying()) return;
|
||||
const [x, y] = flags.mouseLoc;
|
||||
const mx = Math.round(x + core.bigmap.offsetX / 32);
|
||||
const my = Math.round(y + core.bigmap.offsetY / 32);
|
||||
if (!core.isPlaying() || core.status.lockControl) return;
|
||||
const [mx, my] = getLocFromMouseLoc(...flags.mouseLoc);
|
||||
const e = core.getBlockId(mx, my);
|
||||
if (e !== lastId) showFixed.value = false;
|
||||
if (!e) return;
|
||||
show(ev, mx, my, e);
|
||||
show(ev);
|
||||
});
|
||||
|
||||
return {
|
||||
@@ -37,6 +38,12 @@ export default function init() {
|
||||
};
|
||||
}
|
||||
|
||||
export function getLocFromMouseLoc(x: number, y: number): LocArr {
|
||||
const mx = Math.round(x + core.bigmap.offsetX / 32);
|
||||
const my = Math.round(y + core.bigmap.offsetY / 32);
|
||||
return [mx, my];
|
||||
}
|
||||
|
||||
export function getDetailedEnemy<I extends EnemyIds>(
|
||||
enemy: Enemy<I>,
|
||||
x: number,
|
||||
@@ -45,12 +52,13 @@ export function getDetailedEnemy<I extends EnemyIds>(
|
||||
): DetailedEnemy<I> {
|
||||
const ratio = core.status.maps[floorId].ratio;
|
||||
const enemyInfo = Object.assign(
|
||||
core.getEnemyInfo(enemy, void 0, x, y),
|
||||
core.getDamageInfo(enemy, void 0, x, y) ?? {},
|
||||
enemy
|
||||
{},
|
||||
enemy,
|
||||
core.getEnemyInfo(enemy, void 0, x, y, floorId),
|
||||
core.getDamageInfo(enemy, void 0, x, y, floorId) ?? {}
|
||||
);
|
||||
const critical = core.nextCriticals(enemy, 1, x, y);
|
||||
const defDamage = core.getDefDamage(enemy, ratio, x, y);
|
||||
const critical = core.nextCriticals(enemy, 1, x, y, floorId);
|
||||
const defDamage = core.getDefDamage(enemy, ratio, x, y, floorId);
|
||||
const specialText = core.getSpecialText(enemyInfo);
|
||||
let toShowSpecial = cloneDeep(specialText);
|
||||
if (toShowSpecial.length > 2) {
|
||||
|
||||
Reference in new issue
Block a user