mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-10-31 23:20:18 +08:00
完善装备栏、怪物手册,更新样板
This commit is contained in:
1 parent
bde0a4d1c0
commit
2f88272df8
37 files changed
+10569
-2558
No files matched your search
@@ -75,7 +75,7 @@ export function getDefDamage(
|
||||
if (!has(dam)) continue;
|
||||
if (dam.damage === origin) continue;
|
||||
if (dam.damage === res.at(-1)?.[1]) continue;
|
||||
if (last <= 0) break;
|
||||
if (last === dam.damage) break;
|
||||
last = dam.damage;
|
||||
res.push([ratio * i + addDef, dam.damage]);
|
||||
}
|
||||
@@ -121,7 +121,7 @@ export function getCriticalDamage(
|
||||
if (!has(dam)) continue;
|
||||
if (dam.damage === origin) continue;
|
||||
if (dam.damage === res.at(-1)?.[1]) continue;
|
||||
if (last <= 0) break;
|
||||
if (last === dam.damage) break;
|
||||
last = dam.damage;
|
||||
res.push([ratio * i + addAtk, dam.damage]);
|
||||
}
|
||||
|
||||
@@ -3,8 +3,11 @@ import { has } from '../utils';
|
||||
/**
|
||||
* 获取所有装备
|
||||
*/
|
||||
export function getEquips() {
|
||||
return Object.entries(core.status.hero.items.equips);
|
||||
export function getEquips(): [ItemIdOf<'equips'>, number][] {
|
||||
return Object.entries(core.status.hero.items.equips) as [
|
||||
ItemIdOf<'equips'>,
|
||||
number
|
||||
][];
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -13,7 +16,7 @@ export function getEquips() {
|
||||
*/
|
||||
export function getAddStatus(equip: Equip) {
|
||||
const toGet = Object.assign({}, equip.value, equip.percentage);
|
||||
const keys = Object.keys(toGet);
|
||||
const keys = Object.keys(toGet) as (keyof typeof toGet)[];
|
||||
|
||||
return (
|
||||
<div class="equip-add-detail">
|
||||
@@ -46,15 +49,23 @@ export function getAddStatus(equip: Equip) {
|
||||
* 获取当前勇士属性,如果有选中的装备,会在后面追加显示增加量
|
||||
* @param nowEquip 当前选中的装备
|
||||
*/
|
||||
export function getNowStatus(nowEquip?: Equip) {
|
||||
const toShow = ['hp', 'lv', 'atk', 'def', 'mdef', 'mana', 'hpmax', 'money'];
|
||||
export function getNowStatus(nowEquip?: Equip, onCol: boolean = false) {
|
||||
const toShow = [
|
||||
'hp',
|
||||
'lv',
|
||||
'atk',
|
||||
'def',
|
||||
'mdef',
|
||||
'mana',
|
||||
'hpmax',
|
||||
'money'
|
||||
] as (keyof SelectType<HeroStatus, number>)[];
|
||||
|
||||
return (
|
||||
<div id="hero-status">
|
||||
{toShow.map(v => {
|
||||
let status: string;
|
||||
if (v === 'up') status = core.getNextLvUpNeed()?.toString();
|
||||
else if (v === 'lv') status = core.getLvName() ?? '';
|
||||
if (v === 'lv') status = core.getLvName() ?? '';
|
||||
else status = core.getRealStatus(v)?.toString();
|
||||
|
||||
let add = 0;
|
||||
@@ -63,6 +74,7 @@ export function getNowStatus(nowEquip?: Equip) {
|
||||
const per = nowEquip.percentage[v] * core.getStatus(v);
|
||||
add += isNaN(per) ? 0 : per;
|
||||
}
|
||||
if (onCol) add = -add;
|
||||
|
||||
return (
|
||||
<div class="hero-status-one">
|
||||
|
||||
@@ -7,8 +7,8 @@ interface ClsMap {
|
||||
}
|
||||
|
||||
interface AllItem {
|
||||
tools: [string, number][];
|
||||
constants: [string, number][];
|
||||
tools: [ItemIdOf<'tools'>, number][];
|
||||
constants: [ItemIdOf<'constants'>, number][];
|
||||
}
|
||||
|
||||
const clsMap: ClsMap = {
|
||||
|
||||
+1
-1
@@ -27,7 +27,7 @@ export function has<T>(value: T): value is NonNullable<T> {
|
||||
* 根据伤害大小获取颜色
|
||||
* @param damage 伤害大小
|
||||
*/
|
||||
export function getDamageColor(damage: number): string {
|
||||
export function getDamageColor(damage: number): Color {
|
||||
if (typeof damage !== 'number') return '#f00';
|
||||
if (damage === 0) return '#2f2';
|
||||
if (damage < 0) return '#7f7';
|
||||
|
||||
Reference in new issue
Block a user