mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-04 02:45:04 +08:00
处理完毕所有需要删除的todo
This commit is contained in:
1 parent
993ff3c669
commit
1854389966
17 files changed
+66
-951
No files matched your search
@@ -115,6 +115,13 @@ function getRealStatus(
|
||||
return s;
|
||||
}
|
||||
|
||||
declare global {
|
||||
interface PluginDeclaration {
|
||||
getHeroStatusOf: typeof getHeroStatusOf;
|
||||
getHeroStatusOn: typeof getHeroStatusOn;
|
||||
}
|
||||
}
|
||||
|
||||
core.plugin.hero = {
|
||||
getHeroStatusOf,
|
||||
getHeroStatusOn
|
||||
|
||||
+14
-14
@@ -45,20 +45,20 @@ core.registerReplayAction('upgradeSkill', name => {
|
||||
});
|
||||
|
||||
core.registerReplayAction('study', name => {
|
||||
// todo: 删除getEnemyInfo
|
||||
if (!name.startsWith('study:')) return false;
|
||||
const [num, x, y] = name
|
||||
.slice(6)
|
||||
.split(',')
|
||||
.map(v => parseInt(v));
|
||||
if (!canStudySkill(num)) return false;
|
||||
const id = core.getBlockId(x, y);
|
||||
const enemy = core.getEnemyInfo(id, void 0, x, y);
|
||||
if (!enemy.special.includes(num)) return false;
|
||||
studySkill(enemy, num);
|
||||
core.status.route.push(name);
|
||||
core.replay();
|
||||
return true;
|
||||
// todo
|
||||
// if (!name.startsWith('study:')) return false;
|
||||
// const [num, x, y] = name
|
||||
// .slice(6)
|
||||
// .split(',')
|
||||
// .map(v => parseInt(v));
|
||||
// if (!canStudySkill(num)) return false;
|
||||
// const id = core.getBlockId(x, y);
|
||||
// const enemy = core.getEnemyInfo(id, void 0, x, y);
|
||||
// if (!enemy.special.includes(num)) return false;
|
||||
// studySkill(enemy, num);
|
||||
// core.status.route.push(name);
|
||||
// core.replay();
|
||||
// return true;
|
||||
});
|
||||
|
||||
// 商店
|
||||
|
||||
+13
-10
@@ -1,15 +1,17 @@
|
||||
import { reactive, ref } from 'vue';
|
||||
import { tip } from './utils';
|
||||
import type { DamageEnemy } from './game/enemy/damage';
|
||||
|
||||
export const showMarkedEnemy = ref(false);
|
||||
|
||||
const markedEnemy = reactive<EnemyIds[]>([]);
|
||||
|
||||
interface MarkInfo {
|
||||
enemy: DamageEnemy;
|
||||
nextCritical: number;
|
||||
}
|
||||
|
||||
const markInfo: Partial<Record<EnemyIds, MarkInfo>> = {};
|
||||
export const markInfo: Partial<Record<EnemyIds, MarkInfo>> = {};
|
||||
const criticalReached: Partial<Record<EnemyIds, Record<number, boolean>>> = {};
|
||||
const enemyDamageInfo: Partial<Record<EnemyIds, Record<number, boolean>>> = {};
|
||||
|
||||
@@ -18,12 +20,16 @@ const enemyDamageInfo: Partial<Record<EnemyIds, Record<number, boolean>>> = {};
|
||||
* @param id 标记的怪物id
|
||||
*/
|
||||
export function markEnemy(id: EnemyIds) {
|
||||
// todo: 不使用 nextCriticals
|
||||
const { Enemy } = core.plugin.damage;
|
||||
if (hasMarkedEnemy(id)) return;
|
||||
markedEnemy.push(id);
|
||||
const enemy = new Enemy(core.material.enemys[id]);
|
||||
enemy.calAttribute();
|
||||
enemy.getRealInfo();
|
||||
markInfo[id] = {
|
||||
nextCritical:
|
||||
core.nextCriticals(id, 1)[0]?.[0] ?? 0 + core.status.hero.atk
|
||||
enemy.calCritical(1)[0]?.atkDelta ?? 0 + core.status.hero.atk,
|
||||
enemy
|
||||
};
|
||||
criticalReached[id] = { 0: true };
|
||||
enemyDamageInfo[id] = { 1: false, 2: false, 3: false };
|
||||
@@ -65,7 +71,6 @@ export function getMarkedEnemy() {
|
||||
* @param id 怪物id
|
||||
*/
|
||||
export function getMarkInfo(id: EnemyIds, noMessage: boolean = false) {
|
||||
// todo: 不使用 nextCriticals
|
||||
const reached = criticalReached[id]!;
|
||||
const info = markInfo[id]!;
|
||||
if (core.status.hero.atk >= info.nextCritical) {
|
||||
@@ -73,7 +78,7 @@ export function getMarkInfo(id: EnemyIds, noMessage: boolean = false) {
|
||||
tip('success', `踩到了${core.material.enemys[id].name}的临界!`);
|
||||
}
|
||||
reached[info.nextCritical] = true;
|
||||
const n = core.nextCriticals(id, 1, void 0, void 0, 'empty')[0]?.[0];
|
||||
const n = info.enemy.calCritical(1)[0]?.atkDelta;
|
||||
const next = (n ?? 0) + core.status.hero.atk;
|
||||
info.nextCritical = next;
|
||||
}
|
||||
@@ -83,15 +88,13 @@ export function getMarkInfo(id: EnemyIds, noMessage: boolean = false) {
|
||||
* 检查被标记怪物的状态
|
||||
*/
|
||||
export function checkMarkedEnemy(noMessage: boolean = false) {
|
||||
// todo: 删除 getDamageInfo
|
||||
checkMarkedStatus.value = !checkMarkedStatus.value;
|
||||
const hp = core.status.hero.hp;
|
||||
getMarkedEnemy().forEach(v => {
|
||||
getMarkInfo(v);
|
||||
const damage =
|
||||
core.getDamageInfo(v, void 0, void 0, void 0, 'empty')?.damage ??
|
||||
-1;
|
||||
if (damage === -1) return;
|
||||
const { enemy } = markInfo[v]!;
|
||||
const damage = enemy.calDamage().damage;
|
||||
if (!isFinite(damage)) return;
|
||||
const info = enemyDamageInfo[v]!;
|
||||
const name = core.material.enemys[v].name;
|
||||
let res = 0;
|
||||
|
||||
@@ -1,128 +0,0 @@
|
||||
import { ref, watch } from 'vue';
|
||||
|
||||
// todo 优化,可以考虑改成reactive
|
||||
|
||||
/** 打开和关闭ui时是否展示动画 */
|
||||
export const transition = ref(false);
|
||||
|
||||
/** 道具详细信息 */
|
||||
export const itemDetail = ref(true);
|
||||
|
||||
/** 自动切换技能 */
|
||||
export const autoSkill = ref(true);
|
||||
|
||||
/** 自动放缩 */
|
||||
export const autoScale = ref(true);
|
||||
|
||||
/** 是否在地图上展示范围光环 */
|
||||
export const showHalo = ref(true);
|
||||
|
||||
/** 是否展示已学习的技能 */
|
||||
export const showStudied = ref(true);
|
||||
|
||||
/** 是否使用定点查看功能 */
|
||||
export const useFixed = ref(true);
|
||||
|
||||
/** 是否使用勇士自动定位功能 */
|
||||
export const autoLocate = ref(true);
|
||||
|
||||
/** 是否开启抗锯齿 */
|
||||
export const antiAliasing = ref(true);
|
||||
|
||||
/** 是否开启全屏 */
|
||||
export const fullscreen = ref(false);
|
||||
|
||||
watch(transition, n => {
|
||||
ancTe.plugin.ui.transition.value = n;
|
||||
core.setLocalStorage('transition', n);
|
||||
});
|
||||
|
||||
watch(itemDetail, n => {
|
||||
flags.itemDetail = n;
|
||||
core.updateStatusBar();
|
||||
});
|
||||
|
||||
watch(autoSkill, n => {
|
||||
flags.autoSkill = n;
|
||||
core.updateStatusBar();
|
||||
core.status.route.push(`set:autoSkill:${n}`);
|
||||
});
|
||||
|
||||
watch(autoScale, n => {
|
||||
core.setLocalStorage('autoScale', n);
|
||||
});
|
||||
|
||||
watch(showStudied, n => {
|
||||
core.setLocalStorage('showStudied', n);
|
||||
});
|
||||
|
||||
watch(showHalo, n => {
|
||||
core.setLocalStorage('showHalo', n);
|
||||
});
|
||||
|
||||
watch(useFixed, n => {
|
||||
core.setLocalStorage('useFixed', n);
|
||||
});
|
||||
|
||||
watch(autoLocate, n => {
|
||||
flags.autoLocate = n;
|
||||
core.updateStatusBar();
|
||||
core.status.route.push(`set:autoLocate:${n}`);
|
||||
});
|
||||
|
||||
watch(antiAliasing, n => {
|
||||
core.setLocalStorage('antiAliasing', n);
|
||||
for (const canvas of core.dom.gameCanvas) {
|
||||
if (core.domStyle.hdCanvas.includes(canvas.id)) continue;
|
||||
if (n) {
|
||||
canvas.classList.remove('no-anti-aliasing');
|
||||
} else {
|
||||
canvas.classList.add('no-anti-aliasing');
|
||||
}
|
||||
}
|
||||
});
|
||||
|
||||
/**
|
||||
* 重置设置信息,从localStorage读取即可
|
||||
*/
|
||||
function reset() {
|
||||
const t = core.getLocalStorage('transition', false);
|
||||
transition.value = t;
|
||||
ancTe.plugin.ui.transition.value = transition.value;
|
||||
autoScale.value = core.getLocalStorage('autoScale', true);
|
||||
showStudied.value = core.getLocalStorage('showStudied', true);
|
||||
showHalo.value = core.getLocalStorage('showHalo', true);
|
||||
antiAliasing.value = core.getLocalStorage('antiAliasing', false);
|
||||
fullscreen.value = !!document.fullscreenElement;
|
||||
}
|
||||
|
||||
function resetFlag() {
|
||||
flags.autoSkill ??= true;
|
||||
flags.itemDetail ??= true;
|
||||
flags.autoLocate ??= true;
|
||||
|
||||
itemDetail.value = !!flags.itemDetail;
|
||||
autoSkill.value = !!flags.autoSkill;
|
||||
autoLocate.value = !!flags.autoLocate;
|
||||
}
|
||||
|
||||
export async function triggerFullscreen() {
|
||||
const { maxGameScale } = core.plugin.utils;
|
||||
if (document.fullscreenElement) {
|
||||
await document.exitFullscreen();
|
||||
requestAnimationFrame(() => {
|
||||
maxGameScale(1);
|
||||
});
|
||||
fullscreen.value = false;
|
||||
} else {
|
||||
await document.body.requestFullscreen();
|
||||
requestAnimationFrame(() => {
|
||||
maxGameScale();
|
||||
});
|
||||
fullscreen.value = true;
|
||||
}
|
||||
}
|
||||
|
||||
export default function init() {
|
||||
return { resetSettings: reset, resetFlagSettings: resetFlag };
|
||||
}
|
||||
@@ -67,7 +67,7 @@ export function getNowStatus(nowEquip?: Equip, onCol: boolean = false) {
|
||||
{toShow.map(v => {
|
||||
let status: string;
|
||||
if (v === 'lv') status = core.getLvName() ?? '';
|
||||
else status = core.getRealStatus(v)?.toString();
|
||||
else status = core.plugin.getHeroStatusOn(v)?.toString();
|
||||
|
||||
let add = 0;
|
||||
if (has(nowEquip)) {
|
||||
|
||||
Reference in new issue
Block a user