mirror of
https://github.com/unanmed/HumanBreak.git
synced 2026-11-15 19:34:32 +08:00
处理完毕所有需要删除的todo
This commit is contained in:
1 parent
993ff3c669
commit
1854389966
17 files changed
+66
-951
No files matched your search
@@ -14,7 +14,6 @@ interface AncTePlugin {
|
||||
utils: ReturnType<typeof import('../plugin/utils').default>;
|
||||
status: ReturnType<typeof import('../plugin/ui/statusBar').default>;
|
||||
mark: ReturnType<typeof import('../plugin/mark').default>;
|
||||
setting: ReturnType<typeof import('../plugin/settings').default>;
|
||||
chapter: ReturnType<typeof import('../plugin/ui/chapter').default>;
|
||||
fly: ReturnType<typeof import('../plugin/ui/fly').default>;
|
||||
chase: ReturnType<typeof import('../plugin/chase/chase').default>;
|
||||
|
||||
@@ -5,7 +5,6 @@ import animate from '../plugin/animateController';
|
||||
import utils from '../plugin/utils';
|
||||
import status from '../plugin/ui/statusBar';
|
||||
import mark from '../plugin/mark';
|
||||
import setting from '../plugin/settings';
|
||||
import chapter from '../plugin/ui/chapter';
|
||||
import fly from '../plugin/ui/fly';
|
||||
import chase from '../plugin/chase/chase';
|
||||
@@ -31,7 +30,6 @@ export function resolvePlugin() {
|
||||
['utils', utils()],
|
||||
['status', status()],
|
||||
['mark', mark()],
|
||||
['setting', setting()],
|
||||
['chapter', chapter()],
|
||||
['fly', fly()],
|
||||
['chase', chase()],
|
||||
|
||||
@@ -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)) {
|
||||
|
||||
Vendored
-51
@@ -323,57 +323,6 @@ interface Enemys extends EnemyData {
|
||||
dir?: Dir | 'none' | (Dir | 'none')[]
|
||||
): boolean;
|
||||
|
||||
/**
|
||||
* 获得某只敌人的地图显伤,包括颜色
|
||||
* @example core.getDamageString('greenSlime', 0, 0, 'MT0') // 绿头怪的地图显伤
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
*/
|
||||
getDamageString(
|
||||
enemy: EnemyIds | Enemy,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: FloorIds
|
||||
): DamageString;
|
||||
|
||||
/**
|
||||
* 获得某只敌人接下来的若干个临界及其减伤,算法基于useLoop开关选择回合法或二分法
|
||||
* @example core.nextCriticals('greenSlime', 9, 0, 0, 'MT0') // 绿头怪接下来的9个临界
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param number 要计算的临界数量,默认为1
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
* @returns 两列的二维数组,每行表示一个临界及其减伤
|
||||
*/
|
||||
nextCriticals(
|
||||
enemy: EnemyIds | Enemy,
|
||||
number?: number,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: FloorIds
|
||||
): [critical: number, damage: number][];
|
||||
|
||||
/**
|
||||
* 计算再加若干点防御能使某只敌人对主角的总伤害降低多少
|
||||
* @example core.nextCriticals('greenSlime', 10, 0, 0, 'MT0') // 再加10点防御能使绿头怪的伤害降低多少
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param k 假设主角增加的防御力,默认为1
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
* @returns 总伤害的减少量
|
||||
*/
|
||||
getDefDamage(
|
||||
enemy: EnemyIds | Enemy,
|
||||
k?: number,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: FloorIds
|
||||
): number;
|
||||
|
||||
/**
|
||||
* 获得某只敌人对主角的总伤害
|
||||
* @example core.getDamage('greenSlime',0,0,'MT0') // 绿头怪的总伤害
|
||||
|
||||
Vendored
-32
@@ -58,38 +58,6 @@ interface EnemyData {
|
||||
*/
|
||||
getSpecials(): EnemySpecialDeclaration[];
|
||||
|
||||
/**
|
||||
* 获得怪物真实属性
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param hero 勇士信息,不填则从core.status.hero获取
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
*/
|
||||
getEnemyInfo(
|
||||
enemy: EnemyIds | Enemy,
|
||||
hero?: HeroStatus,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: FloorIds
|
||||
): EnemyInfo;
|
||||
|
||||
/**
|
||||
* 获得战斗伤害信息(实际伤害计算函数)
|
||||
* @param enemy 敌人id或敌人对象
|
||||
* @param hero 勇士信息,不填则从core.status.hero获取
|
||||
* @param x 敌人的横坐标
|
||||
* @param y 敌人的纵坐标
|
||||
* @param floorId 敌人所在的地图
|
||||
*/
|
||||
getDamageInfo(
|
||||
enemy: EnemyIds | Enemy,
|
||||
hero?: Partial<HeroStatus>,
|
||||
x?: number,
|
||||
y?: number,
|
||||
floorId?: FloorIds
|
||||
): DamageInfo;
|
||||
|
||||
/**
|
||||
* 判定某种特殊属性的有无
|
||||
* @example core.hasSpecial('greenSlime', 1) // 判定绿头怪有无先攻属性
|
||||
|
||||
Vendored
-10
@@ -84,16 +84,6 @@ interface PluginDeclaration
|
||||
*/
|
||||
unmarkEnemy(id: EnemyIds): void;
|
||||
|
||||
/**
|
||||
* 重置设置信息
|
||||
*/
|
||||
resetSettings(): void;
|
||||
|
||||
/**
|
||||
* 重置变量的设置信息
|
||||
*/
|
||||
resetFlagSettings(): void;
|
||||
|
||||
/**
|
||||
* 判定一个值是否不是undefined或null
|
||||
* @param value 要判断的值
|
||||
|
||||
+10
-16
@@ -56,7 +56,12 @@
|
||||
|
||||
<script lang="ts" setup>
|
||||
import { reactive, ref, watch } from 'vue';
|
||||
import { checkMarkedStatus, getMarkedEnemy, unmarkEnemy } from '../plugin/mark';
|
||||
import {
|
||||
checkMarkedStatus,
|
||||
getMarkedEnemy,
|
||||
markInfo,
|
||||
unmarkEnemy
|
||||
} from '../plugin/mark';
|
||||
import { has } from '../plugin/utils';
|
||||
import Box from '../components/box.vue';
|
||||
import Scroll from '../components/scroll.vue';
|
||||
@@ -102,27 +107,16 @@ function getName(id: EnemyIds) {
|
||||
}
|
||||
|
||||
function getDamage(id: EnemyIds) {
|
||||
// todo: 删除 getDamageInfo
|
||||
return (
|
||||
core.formatBigNumber(
|
||||
core.getDamageInfo(id, void 0, void 0, void 0, 'empty')?.damage
|
||||
) ?? '???'
|
||||
);
|
||||
return core.formatBigNumber(markInfo[id]!.enemy.calDamage().damage);
|
||||
}
|
||||
|
||||
function getCritical(id: EnemyIds) {
|
||||
// todo: 不使用 nextCriticals
|
||||
return (
|
||||
core
|
||||
.nextCriticals(id, 1, void 0, void 0, 'empty')[0]
|
||||
?.map(v => core.formatBigNumber(v)) ?? [0, 0]
|
||||
);
|
||||
const { delta, atkDelta } = markInfo[id]!.enemy.calCritical(1)[0];
|
||||
return [-delta, atkDelta];
|
||||
}
|
||||
|
||||
function getDefDamage(id: EnemyIds) {
|
||||
return core.formatBigNumber(
|
||||
core.getDefDamage(id, ratio, void 0, void 0, 'empty')
|
||||
);
|
||||
return core.formatBigNumber(markInfo[id]!.enemy.calDefDamage(ratio).delta);
|
||||
}
|
||||
</script>
|
||||
|
||||
|
||||
@@ -179,7 +179,7 @@ watch(status, update);
|
||||
*/
|
||||
function update() {
|
||||
toShow.forEach(v => {
|
||||
hero[v] = core.getRealStatus(v);
|
||||
hero[v] = core.plugin.getHeroStatusOn(v);
|
||||
});
|
||||
keys[0] = core.itemCount('yellowKey');
|
||||
keys[1] = core.itemCount('blueKey');
|
||||
|
||||
Reference in new issue
Block a user