mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-02-28 17:37:07 +08:00
修改定点查看
This commit is contained in:
parent
d47ee01b40
commit
62e8f91436
1
idea.md
1
idea.md
@ -76,3 +76,4 @@ dam4.png ---- 存档 59
|
|||||||
[] 玩家可以设置字体大小
|
[] 玩家可以设置字体大小
|
||||||
[] 完全删除 functions.js
|
[] 完全删除 functions.js
|
||||||
[] 优化插件加载系统
|
[] 优化插件加载系统
|
||||||
|
[] 优化 Scroll 组件
|
||||||
|
@ -21,6 +21,15 @@ interface BookDetailInfo {
|
|||||||
|
|
||||||
export const detailInfo: BookDetailInfo = {};
|
export const detailInfo: BookDetailInfo = {};
|
||||||
|
|
||||||
|
export const specials = Object.fromEntries(
|
||||||
|
core.getSpecials().map(v => {
|
||||||
|
return [v[0], v.slice(1)];
|
||||||
|
})
|
||||||
|
) as Record<
|
||||||
|
string,
|
||||||
|
EnemySpecialDeclaration extends [number, ...infer F] ? F : never
|
||||||
|
>;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取怪物的特殊技能描述
|
* 获取怪物的特殊技能描述
|
||||||
* @param enemy 怪物实例
|
* @param enemy 怪物实例
|
||||||
@ -51,7 +60,6 @@ export function getDefDamage(
|
|||||||
addDef: number = 0,
|
addDef: number = 0,
|
||||||
addAtk: number = 0
|
addAtk: number = 0
|
||||||
) {
|
) {
|
||||||
// todo: 删除 getDamageInfo
|
|
||||||
const ratio = core.status.thisMap.ratio;
|
const ratio = core.status.thisMap.ratio;
|
||||||
const res: [number, number][] = [];
|
const res: [number, number][] = [];
|
||||||
|
|
||||||
@ -95,7 +103,6 @@ export function getCriticalDamage(
|
|||||||
addAtk: number = 0,
|
addAtk: number = 0,
|
||||||
addDef: number = 0
|
addDef: number = 0
|
||||||
): [number, number][] {
|
): [number, number][] {
|
||||||
// todo: 删除 getDamageInfo
|
|
||||||
const ratio = core.status.thisMap.ratio;
|
const ratio = core.status.thisMap.ratio;
|
||||||
const res: [number, number][] = [];
|
const res: [number, number][] = [];
|
||||||
|
|
||||||
|
@ -1,6 +1,8 @@
|
|||||||
import { cloneDeep, debounce } from 'lodash-es';
|
import { cloneDeep, debounce } from 'lodash-es';
|
||||||
import { ref } from 'vue';
|
import { ref } from 'vue';
|
||||||
import { getDamageColor } from '../utils';
|
import { getDamageColor } from '../utils';
|
||||||
|
import { ToShowEnemy, detailInfo, specials } from './book';
|
||||||
|
import { DamageEnemy } from '../game/enemy/damage';
|
||||||
|
|
||||||
export const showFixed = ref(false);
|
export const showFixed = ref(false);
|
||||||
|
|
||||||
@ -11,14 +13,15 @@ const show = debounce((ev: MouseEvent) => {
|
|||||||
if (!flags.mouseLoc) return;
|
if (!flags.mouseLoc) return;
|
||||||
flags.clientLoc = [ev.clientX, ev.clientY];
|
flags.clientLoc = [ev.clientX, ev.clientY];
|
||||||
const [mx, my] = getLocFromMouseLoc(...flags.mouseLoc);
|
const [mx, my] = getLocFromMouseLoc(...flags.mouseLoc);
|
||||||
const e = core.getBlockId(mx, my);
|
const e = core.status.thisMap.enemy.list.find(v => {
|
||||||
if (e !== lastId) showFixed.value = false;
|
v.x === mx && v.y === my;
|
||||||
if (!e || !core.getClsFromId(e)?.startsWith('enemy')) return;
|
});
|
||||||
|
|
||||||
lastId = e as EnemyIds;
|
if (!e) return;
|
||||||
const enemy = core.material.enemys[e as EnemyIds];
|
|
||||||
const detail = getDetailedEnemy(enemy, mx, my);
|
lastId = e.id;
|
||||||
core.plugin.bookDetailEnemy = detail;
|
const detail = getDetailedEnemy(e);
|
||||||
|
detailInfo.enemy = detail;
|
||||||
showFixed.value = true;
|
showFixed.value = true;
|
||||||
}, 200);
|
}, 200);
|
||||||
|
|
||||||
@ -47,47 +50,54 @@ export function getLocFromMouseLoc(x: number, y: number): LocArr {
|
|||||||
return [mx, my];
|
return [mx, my];
|
||||||
}
|
}
|
||||||
|
|
||||||
export function getDetailedEnemy<I extends EnemyIds>(
|
export function getDetailedEnemy(
|
||||||
enemy: Enemy<I>,
|
enemy: DamageEnemy,
|
||||||
x: number,
|
|
||||||
y: number,
|
|
||||||
floorId: FloorIds = core.status.floorId
|
floorId: FloorIds = core.status.floorId
|
||||||
): DetailedEnemy<I> {
|
): ToShowEnemy {
|
||||||
// todo: 删除 getDamageInfo
|
// todo: 删除 getDamageInfo
|
||||||
// todo: 不使用 nextCriticals
|
// todo: 不使用 nextCriticals
|
||||||
const ratio = core.status.maps[floorId].ratio;
|
const ratio = core.status.maps[floorId].ratio;
|
||||||
const enemyInfo = Object.assign(
|
|
||||||
{},
|
const dam = enemy.calEnemyDamage(core.status.hero, 'none')[0].damage;
|
||||||
enemy,
|
const cri = enemy.calCritical(1, 'none')[0]?.[0];
|
||||||
core.getEnemyInfo(enemy, void 0, x, y, floorId),
|
const critical = core.formatBigNumber(cri?.atkDelta);
|
||||||
core.getDamageInfo(enemy, void 0, x, y, floorId) ?? {}
|
const criticalDam = core.formatBigNumber(cri?.delta);
|
||||||
|
const defDam = core.formatBigNumber(
|
||||||
|
enemy.calDefDamage(ratio, 'none')[0].damage
|
||||||
);
|
);
|
||||||
const critical = core.nextCriticals(enemy, 1, x, y, floorId);
|
const damage = core.formatBigNumber(dam);
|
||||||
const defDamage = core.getDefDamage(enemy, ratio, x, y, floorId);
|
|
||||||
const specialText = core.getSpecialText(enemyInfo);
|
const fromFunc = (
|
||||||
let toShowSpecial = cloneDeep(specialText);
|
func: string | ((enemy: Enemy) => string),
|
||||||
if (toShowSpecial.length > 2) {
|
enemy: Enemy
|
||||||
toShowSpecial = toShowSpecial.slice(0, 2).concat(['...']);
|
) => {
|
||||||
}
|
return typeof func === 'string' ? func : func(enemy);
|
||||||
const specialColor = core.getSpecialColor(enemyInfo);
|
};
|
||||||
let toShowColor = cloneDeep(specialColor);
|
const special: [string, string, string][] = enemy.enemy.special.map(vv => {
|
||||||
if (toShowColor.length > 2) {
|
const s = specials[vv];
|
||||||
toShowColor = toShowColor.slice(0, 2).concat(['#fff']);
|
return [
|
||||||
}
|
fromFunc(s[0], enemy.enemy),
|
||||||
if (toShowSpecial.length === 0) {
|
fromFunc(s[1], enemy.enemy),
|
||||||
toShowSpecial = ['无属性'];
|
s[2] as string
|
||||||
toShowColor = ['#fff'];
|
];
|
||||||
}
|
|
||||||
const damageColor = getDamageColor(enemyInfo.damage);
|
|
||||||
const detail: DetailedEnemy<I> = Object.assign(enemyInfo, {
|
|
||||||
critical: critical[0]?.[0] ?? '???',
|
|
||||||
criticalDamage: critical[0]?.[1] ?? '???',
|
|
||||||
defDamage,
|
|
||||||
specialColor,
|
|
||||||
specialText,
|
|
||||||
toShowColor,
|
|
||||||
toShowSpecial,
|
|
||||||
damageColor
|
|
||||||
});
|
});
|
||||||
|
const showSpecial =
|
||||||
|
special.length > 2
|
||||||
|
? special.slice(0, 2).concat(['...', '', '#fff'])
|
||||||
|
: special.slice();
|
||||||
|
|
||||||
|
const damageColor = getDamageColor(dam) as string;
|
||||||
|
|
||||||
|
const detail: ToShowEnemy = {
|
||||||
|
enemy,
|
||||||
|
onMapEnemy: [enemy],
|
||||||
|
critical,
|
||||||
|
criticalDam,
|
||||||
|
defDam,
|
||||||
|
damageColor,
|
||||||
|
special,
|
||||||
|
showSpecial,
|
||||||
|
damage
|
||||||
|
};
|
||||||
return detail;
|
return detail;
|
||||||
}
|
}
|
||||||
|
@ -47,21 +47,12 @@ import BookDetail from './bookDetail.vue';
|
|||||||
import { LeftOutlined } from '@ant-design/icons-vue';
|
import { LeftOutlined } from '@ant-design/icons-vue';
|
||||||
import { KeyCode } from '../plugin/keyCodes';
|
import { KeyCode } from '../plugin/keyCodes';
|
||||||
import { noClosePanel } from '../plugin/uiController';
|
import { noClosePanel } from '../plugin/uiController';
|
||||||
import { ToShowEnemy, detailInfo } from '../plugin/ui/book';
|
import { ToShowEnemy, detailInfo, specials } from '../plugin/ui/book';
|
||||||
|
|
||||||
const floorId =
|
const floorId =
|
||||||
// @ts-ignore
|
// @ts-ignore
|
||||||
core.floorIds[core.status.event?.ui?.index] ?? core.status.floorId;
|
core.floorIds[core.status.event?.ui?.index] ?? core.status.floorId;
|
||||||
|
|
||||||
const specials = Object.fromEntries(
|
|
||||||
core.getSpecials().map(v => {
|
|
||||||
return [v[0], v.slice(1)];
|
|
||||||
})
|
|
||||||
) as Record<
|
|
||||||
string,
|
|
||||||
EnemySpecialDeclaration extends [number, ...infer F] ? F : never
|
|
||||||
>;
|
|
||||||
|
|
||||||
const enemy = core.getCurrentEnemys(floorId);
|
const enemy = core.getCurrentEnemys(floorId);
|
||||||
const toShow: ToShowEnemy[] = enemy.map(v => {
|
const toShow: ToShowEnemy[] = enemy.map(v => {
|
||||||
const cri = v.enemy.calCritical(1, 'none')[0];
|
const cri = v.enemy.calCritical(1, 'none')[0];
|
||||||
|
Loading…
Reference in New Issue
Block a user