feat: 苍蓝之殿南部两区

This commit is contained in:
AncTe committed 2024-05-03 12:52:23 +08:00
1 parent cb72e53c3d
commit 06bcb94eae
72 files changed
+1352 -2288

No files matched your search

+1 -1
View File
@@ -7,7 +7,7 @@
</template>
<script lang="tsx" setup>
import { onMounted, onUnmounted, onUpdated, ref } from 'vue';
import { onMounted, onUnmounted, onUpdated } from 'vue';
import { addAnimate, removeAnimate } from '../plugin/animateController';
import { has, requireUniqueSymbol } from '../plugin/utils';
+8 -4
View File
@@ -9,6 +9,7 @@ import { MinimapDrawer, getArea } from '../plugin/ui/fly';
import { hook } from '@/game/game';
import { useDrag, useWheel } from '@/plugin/use';
import { debounce } from 'lodash-es';
import { mainSetting } from '@/core/main/setting';
const props = defineProps<{
action?: boolean;
@@ -22,6 +23,7 @@ const props = defineProps<{
const area = getArea();
const id = requireUniqueSymbol().toFixed(0);
const setting = mainSetting.getSetting('ui.mapLazy')!;
let canvas: HTMLCanvasElement;
let drawer: MinimapDrawer;
@@ -106,10 +108,12 @@ function touchmove(e: TouchEvent) {
}
function afterBattle() {
requestAnimationFrame(() => {
drawer.drawedThumbnail = {};
drawer.drawMap();
});
if (!setting.value) {
requestAnimationFrame(() => {
drawer.drawedThumbnail = {};
drawer.drawMap();
});
}
}
onMounted(() => {
File diff suppressed because it is too large. Load diff
+1
View File
@@ -264,6 +264,7 @@ export class UiController extends Focus<IndexedGameUi> {
* @returns ui的唯一标识符
*/
open(id: string, vBind?: UiVBind, vOn?: UiVOn) {
if (core.isReplaying() && !this.equal) return -1;
const ui = this.get(id);
if (!ui) {
console.warn(`Unknown UI: '${id}'.`);
+3
View File
@@ -481,6 +481,7 @@ mainSetting
new MotaSetting()
.register('mapScale', '小地图缩放', 100, COM.Number, [50, 1000, 50])
.setDisplayFunc('mapScale', value => `${value}%`)
.register('mapLazy', '小地图懒更新', false, COM.Boolean)
.register('toolbarScale', '工具栏缩放', 100, COM.Number, [10, 500, 10])
.setDisplayFunc('toolbarScale', value => `${value}%`)
.register('bookScale', '怪物手册缩放', 100, COM.Number, [10, 500, 10])
@@ -515,6 +516,7 @@ loading.once('coreInit', () => {
'ui.mapScale',
isMobile ? 300 : Math.floor(window.innerWidth / 600) * 50
),
'ui.mapLazy': storage.getValue('ui.mapLazy', false),
'ui.toolbarScale': storage.getValue(
'ui.toolbarScale',
isMobile ? 50 : Math.floor((window.innerWidth / 1700) * 10) * 10
@@ -557,6 +559,7 @@ mainSetting
.setDescription('audio.soundEnabled', `是否开启音效`)
.setDescription('audio.soundVolume', `音效的音量`)
.setDescription('ui.mapScale', `楼传小地图的缩放,百分比格式`)
.setDescription('ui.mapLazy', `是否启用小地图懒更新模式,此模式下剩余怪物数量不会实时更新而变成切换地图后更新,打开小地图时出现卡顿可以尝试开启此设置`)
.setDescription('ui.toolbarScale', `自定义工具栏的缩放比例`)
.setDescription('ui.bookScale', `怪物手册界面中每个怪物框体的高度缩放,最小值限定为 20% 屏幕高度`)
.setDescription('ui.danmaku', '是否显示弹幕')
+1 -1
View File
@@ -33,7 +33,7 @@ Mota.Plugin.register('shadow_r', shadow, shadow.init);
Mota.Plugin.register('gameShadow_r', gameShadow, gameShadow.init);
Mota.Plugin.register('fly_r', fly);
Mota.Plugin.register('chase_r', chase);
Mota.Plugin.register('completion_r', completion);
Mota.Plugin.register('completion_r', completion, completion.init);
Mota.Plugin.register('pop_r', pop, pop.init);
Mota.Plugin.register('frag_r', frag, frag.init);
Mota.Plugin.register('use_r', use);
+2 -2
View File
@@ -37,7 +37,7 @@
"text": [
"第一章完成度达到100%"
],
"progress": "${mota.plugin.completion.getChapterCompletion(1)} / 100",
"progress": "${Mota.Plugin.require('completion_r').getChapterCompletion(1)} / 100",
"percent": true,
"point": 50
},
@@ -55,7 +55,7 @@
"text": [
"第二章完成度达到100%"
],
"progress": "${mota.plugin.completion.getChapterCompletion(2)} / 100",
"progress": "${Mota.Plugin.require('completion_r').getChapterCompletion(2)} / 100",
"percent": true,
"point": 50
},
+2
View File
@@ -266,6 +266,8 @@ function init() {
if (core.status.event.id == null) core.continueAutomaticRoute();
else core.clearContinueAutomaticRoute();
core.checkAutoEvents();
hook.emit('afterBattle', enemy, x, y);
};
}
+159 -26
View File
@@ -48,6 +48,7 @@ interface MapDamage {
damage: number;
type: Set<string>;
mockery?: LocArr[];
hunt?: [x: number, y: number, dir: Dir][];
}
interface HaloData<T extends keyof HaloType = keyof HaloType> {
@@ -102,6 +103,9 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
mapDamage: Record<string, MapDamage> = {};
haloList: HaloData[] = [];
/** 乾坤挪移属性 */
translation: [number, number] = [0, 0];
constructor(floorId: FloorIds) {
this.floorId = floorId;
this.extract();
@@ -128,10 +132,10 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
/**
* 计算怪物真实属性
* @param noCache 是否不使用缓存
*/
calRealAttribute() {
this.haloList = [];
this.translation = [0, 0];
this.list.forEach(v => {
v.reset();
});
@@ -311,6 +315,17 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
alpha: 1
});
}
// 追猎
if (dam.hunt) {
core.status.damage.extraData.push({
text: '猎',
px: 32 * x + 16,
py: 32 * (y + 1) - 14,
color: '#fd4',
alpha: 1
});
}
}
}
}
@@ -381,6 +396,12 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
}
this.progress = 0;
this.providedHalo.clear();
// 在这里计算乾坤挪移
if (this.col && enemy.special.includes(30)) {
this.col.translation[0] += enemy.translation![0];
this.col.translation[1] += enemy.translation![1];
}
}
/**
@@ -392,6 +413,11 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
const special = this.info.special;
const info = this.info;
const floorId = this.floorId ?? core.status.floorId;
let [dx, dy] = [0, 0];
const col = this.col ?? core.status.maps[this.floorId!]?.enemy;
if (col) {
[dx, dy] = col.translation;
}
// 智慧之源
if (flags.hard === 2 && special.includes(14)) {
@@ -406,7 +432,10 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
if (has(flags[`melt_${floorId}`]) && has(this.x) && has(this.y)) {
for (const [loc, per] of Object.entries(flags[`melt_${floorId}`])) {
const [mx, my] = loc.split(',').map(v => parseInt(v));
if (Math.abs(mx - this.x) <= 1 && Math.abs(my - this.y) <= 1) {
if (
Math.abs(mx + dx - this.x) <= 1 &&
Math.abs(my + dy - this.y) <= 1
) {
info.atkBuff_ += per as number;
info.defBuff_ += per as number;
}
@@ -463,6 +492,8 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
if (!has(this.x) || !has(this.y)) return;
const special = this.getHaloSpecials();
const col = this.col ?? core.status.maps[this.floorId!].enemy;
let [dx, dy] = [0, 0];
if (col) [dx, dy] = col.translation;
for (const halo of special) {
switch (halo) {
@@ -472,7 +503,7 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
const type = 'square';
const r = Math.floor(e.haloRange!);
const d = r * 2 + 1;
const range = { x: this.x, y: this.y, d };
const range = { x: this.x + dx, y: this.y + dy, d };
// 这一句必须放到applyHalo之前
this.providedHalo.add(29);
@@ -512,7 +543,7 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
);
col.haloList.push({
type: 'square',
data: { x: this.x, y: this.y, d },
data: { x: this.x + dx, y: this.y + dy, d },
special: 29,
from: this
});
@@ -532,6 +563,7 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
const col = this.col ?? core.status.maps[this.floorId].enemy;
if (!col) return;
const special = this.getHaloSpecials();
const [dx, dy] = col.translation;
const square7: HaloFn[] = [];
const square5: HaloFn[] = [];
@@ -540,27 +572,32 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
// 抱团
if (special.includes(8)) {
square5.push((e, enemy) => {
if (
e.special.includes(8) &&
(e.x !== this.x || this.y !== e.y)
) {
e.atkBuff_ += enemy.together ?? 0;
e.defBuff_ += enemy.together ?? 0;
col.applyHalo(
'square',
{ x: this.x, y: this.y, d: 5 },
this,
(e, enemy) => {
if (
e.special.includes(8) &&
(e.x !== this.x || this.y !== e.y)
) {
e.atkBuff_ += enemy.together ?? 0;
e.defBuff_ += enemy.together ?? 0;
}
}
});
);
this.providedHalo.add(8);
}
// 冰封光环
if (special.includes(21)) {
square7.push(e => {
e.damageDecline += this.enemy.iceHalo ?? 0;
e.damageDecline += this.info.iceHalo ?? 0;
});
this.providedHalo.add(21);
col.haloList.push({
type: 'square',
data: { x: this.x, y: this.y, d: 7 },
data: { x: this.x + dx, y: this.y + dy, d: 7 },
special: 21,
from: this
});
@@ -569,12 +606,12 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
// 冰封之核
if (special.includes(26)) {
square5.push(e => {
e.defBuff_ += this.enemy.iceCore ?? 0;
e.defBuff_ += this.info.iceCore ?? 0;
});
this.providedHalo.add(26);
col.haloList.push({
type: 'square',
data: { x: this.x, y: this.y, d: 5 },
data: { x: this.x + dx, y: this.y + dy, d: 5 },
special: 26,
from: this
});
@@ -583,19 +620,29 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
// 火焰之核
if (special.includes(27)) {
square5.push(e => {
e.atkBuff_ += this.enemy.fireCore ?? 0;
e.atkBuff_ += this.info.fireCore ?? 0;
});
this.providedHalo.add(27);
col.haloList.push({
type: 'square',
data: { x: this.x, y: this.y, d: 5 },
data: { x: this.x + dx, y: this.y + dy, d: 5 },
special: 27,
from: this
});
}
col.applyHalo('square', { x: this.x, y: this.y, d: 7 }, this, square7);
col.applyHalo('square', { x: this.x, y: this.y, d: 5 }, this, square5);
col.applyHalo(
'square',
{ x: this.x + dx, y: this.y + dy, d: 7 },
this,
square7
);
col.applyHalo(
'square',
{ x: this.x + dx, y: this.y + dy, d: 5 },
this,
square5
);
}
/**
@@ -703,6 +750,37 @@ export class DamageEnemy<T extends EnemyIds = EnemyIds> {
}
}
// 追猎
if (this.info.special.includes(12)) {
const objs = core.getMapBlocksObj(this.floorId);
for (let nx = 0; nx < w; nx++) {
const loc = `${nx},${this.y}` as LocString;
const block = objs[loc];
if (!block?.event.noPass) {
damage[loc] ??= { damage: 0, type: new Set() };
damage[loc].hunt ??= [];
damage[loc].hunt!.push([
this.x,
this.y,
nx < this.x ? 'left' : 'right'
]);
}
}
for (let ny = 0; ny < h; ny++) {
const loc = `${this.x},${ny}` as LocString;
const block = objs[loc];
if (!block?.event.noPass) {
damage[loc] ??= { damage: 0, type: new Set() };
damage[loc].hunt ??= [];
damage[loc].hunt!.push([
this.x,
this.y,
ny < this.y ? 'up' : 'down'
]);
}
}
}
return damage;
}
@@ -927,9 +1005,6 @@ const skills: [unlock: string, condition: string][] = [
['shieldOn', 'shield']
];
const haloValue: Map<number, SelectKey<Enemy, number | undefined>[]> =
new Map();
/**
* 计算怪物伤害
* @param info 怪物信息
@@ -939,7 +1014,13 @@ export function calDamageWith(
info: EnemyInfo,
hero: Partial<HeroStatus>
): number | null {
const { hp, hpmax, mana, mdef } = core.status.hero;
const {
hp,
hpmax,
mana,
mdef,
special: heroSpec = { num: [], last: [] }
} = core.status.hero;
let { atk, def } = hero as HeroStatus;
let { hp: monHp, atk: monAtk, def: monDef, special, enemy } = info;
@@ -952,6 +1033,13 @@ export function calDamageWith(
monAtk += delta;
}
// 勇士学习的饥渴
if (heroSpec.num.includes(7)) {
const delta = Math.floor((monAtk * heroSpec.hungry!) / 100);
atk += delta;
monAtk -= delta;
}
let heroPerDamage: number;
// 绝对防御
@@ -975,11 +1063,19 @@ export function calDamageWith(
heroPerDamage *= 1 - info.damageDecline / 100;
// 勇士学习勇气之刃
if (heroSpec.num.includes(10)) {
monHp -= (heroSpec.courage / 100 - 1) * heroPerDamage;
}
let enemyPerDamage: number;
// 魔攻
if (special.includes(2) || special.includes(13)) {
enemyPerDamage = monAtk;
if (core.hasEquip('I663')) {
enemyPerDamage = Math.max(0, enemyPerDamage - 500);
}
} else {
enemyPerDamage = monAtk - def;
if (enemyPerDamage < 0) enemyPerDamage = 0;
@@ -995,13 +1091,49 @@ export function calDamageWith(
if (special.includes(5)) enemyPerDamage *= 3;
if (special.includes(6)) enemyPerDamage *= enemy.n!;
// 勇士学习霜冻
if (heroSpec.num.includes(20)) {
enemyPerDamage *= 1 - heroSpec.ice / 100;
}
// 勇士学习苍蓝刻
if (heroSpec.num.includes(28)) {
enemyPerDamage *= 1 - heroSpec.paleShield / 100;
}
// 苍蓝刻
if (special.includes(28)) {
heroPerDamage *= 1 - info.paleShield! / 100;
}
// 勇士学习的连击
if (heroSpec.num.includes(4)) heroPerDamage *= 2;
if (heroSpec.num.includes(5)) heroPerDamage *= 3;
if (heroSpec.num.includes(6)) heroPerDamage *= heroSpec.n;
// 勇士学习勇气冲锋
const hasCharge = heroSpec.num.includes(11);
if (hasCharge) {
monHp -= (heroSpec.charge / 100) * heroPerDamage;
}
let turn = Math.ceil(monHp / heroPerDamage);
// 勇士学习致命一击
if (heroSpec.num.includes(1)) {
const five =
4 * heroPerDamage + (heroPerDamage * (info.crit! - 100)) / 100;
const fTurn = Math.floor(monHp / five);
const last = monHp - fTurn * five;
const lastTurn = Math.min(last / heroPerDamage, 5);
turn = fTurn * 5 + lastTurn;
}
if (hasCharge) {
turn -= 5;
if (turn < 0) turn = 0;
}
// 致命一击
if (special.includes(1)) {
const times = Math.floor(turn / 5);
@@ -1014,7 +1146,7 @@ export function calDamageWith(
}
// 勇气冲锋
if (special.includes(11)) {
if (special.includes(11) && !hasCharge) {
damage += (info.charge! / 100) * enemyPerDamage;
turn += 5;
}
@@ -1029,7 +1161,8 @@ export function calDamageWith(
if (flags.hard === 1) damage *= 0.9;
if (flags.chapter > 1 && damage < 0) {
damage *= 0.25;
const dm = -enemy.hp * 0.25;
if (damage < dm) damage = dm;
}
return damage;
+13
View File
@@ -233,5 +233,18 @@ export const specials: SpecialDeclaration[] = [
);
},
color: '#F721F7'
},
{
code: 30,
name: '乾坤挪移',
desc: enemy => {
const [dx, dy] = enemy.translation!;
return `此怪物在场时,所有光环向${
dx < 0 ? '左' : '右'
}平移${Math.abs(dx)}格,向${dy < 0 ? '上' : '下'}平移${Math.abs(
dy
)}格。不同怪物间为加算叠加`;
},
color: '#FDCD0B'
}
];
+3 -1
View File
@@ -8,6 +8,7 @@ import { gameListener, hook, loading } from './game';
import * as battle from './enemy/battle';
import * as hero from './hero';
import * as miscMechanism from './mechanism/misc';
import * as study from './mechanism/study';
// ----- 类注册
Mota.register('class', 'DamageEnemy', damage.DamageEnemy);
@@ -27,7 +28,8 @@ Mota.register('var', 'gameListener', gameListener);
Mota.register('var', 'loading', loading);
// ----- 模块注册
Mota.register('module', 'Mechanism', {
BluePalace: miscMechanism.BluePalace
BluePalace: miscMechanism.BluePalace,
Study: study
});
main.loading = loading;
+81
View File
@@ -0,0 +1,81 @@
import { has } from '@/plugin/game/utils';
import { EnemyInfo } from '../enemy/damage';
import { getSkillLevel } from '@/plugin/game/skillTree';
import { hook } from '../game';
// 负责勇士技能:学习
const canStudy: Set<number> = new Set([1, 4, 5, 6, 7, 10, 11, 20, 28, 30]);
const numberProp: Record<number, (keyof Enemy)[]> = {
1: ['crit'],
6: ['n'],
7: ['hungry'],
10: ['courage'],
11: ['charge'],
20: ['ice'],
28: ['paleShield']
};
hook.on('afterBattle', () => {
declineStudiedSkill();
});
/**
* 判断是否可以学习某个技能
* @param number 要学习的技能
*/
export function canStudySkill(number: number) {
const s = (core.status.hero.special ??= { num: [], last: [] });
if (Mota.Plugin.require('skillTree_g').getSkillLevel(11) === 0)
return false;
if (s.num.length >= 1) return false;
if (s.num.includes(number)) return false;
return canStudy.has(number);
}
/**
* 学习某个怪物的某个技能
* @param enemy 被学习的怪物
* @param number 学习的技能
*/
export function studySkill(enemy: EnemyInfo, number: number) {
core.status.hero.special ??= { num: [], last: [] };
const s = core.status.hero.special;
if (!canStudySkill(number)) return false;
s.num.push(number);
s.last.push(getSkillLevel(11) * 3 + 2);
const value = numberProp[number] ?? [];
for (const key of value) {
s[key] = enemy[key];
}
return true;
}
/**
* 忘记某个学习过的技能
* @param num 要忘记的技能
* @param i 技能所在索引
*/
export function forgetStudiedSkill(num: number, i: number) {
const s = core.status.hero.special;
const index = has(i) ? i : s.num.indexOf(num);
if (index === -1) return;
s.num.splice(index, 1);
s.last.splice(index, 1);
const value = numberProp[num] ?? [];
for (const key of value) {
delete s[key];
}
}
/**
* 战斗后减少剩余次数
*/
export function declineStudiedSkill() {
const s = (core.status.hero.special ??= { num: [], last: [] });
for (let i = 0; i < s.last.length; i++) {
s.last[i]--;
if (s.last[i] === 0) {
forgetStudiedSkill(s.num[i], i);
}
}
}
+1 -1
View File
@@ -136,7 +136,7 @@ interface PluginInterface {
itemDetail_g: typeof import('../plugin/game/fx/itemDetail');
checkBlock_g: typeof import('../plugin/game/enemy/checkblock');
halo_g: typeof import('../plugin/game/fx/halo');
study_g: typeof import('../plugin/game/study');
// study_g: typeof import('../plugin/game/study');
}
interface PackageInterface {
+2 -3
View File
@@ -100,7 +100,6 @@ import { has, setCanvasSize } from '../plugin/utils';
import { debounce } from 'lodash-es';
import { isMobile } from '../plugin/use';
import { createChangable } from '@/plugin/ui/common';
const props = defineProps<{
fromBook?: boolean;
}>();
@@ -111,8 +110,8 @@ const def = ref<HTMLCanvasElement>();
const enemy = detailInfo.enemy!;
const ceil = Math.ceil;
const x = ref(props.fromBook ? void 0 : flags.mouseLoc[0]);
const y = ref(props.fromBook ? void 0 : flags.mouseLoc[1]);
const x = ref<number>();
const y = ref<number>();
x.value = has(x.value)
? Math.round(x.value + core.bigmap.offsetX / 32)
: void 0;
+2 -4
View File
@@ -21,16 +21,14 @@ export const achiDict: Record<number, number> = {
1: 0
};
const loading = Mota.require('var', 'loading');
loading.once('coreInit', () => {
export function init() {
Object.values(floors).forEach((v, i) => {
const from = core.floorIds.indexOf(v[0]);
const to = core.floorIds.indexOf(v[1]);
const all = core.floorIds.slice(from, to + 1);
floors[i + 1] = all;
});
});
}
/**
* 检查所有到达过的楼层,用于成就的计算
+7 -2
View File
@@ -11,7 +11,7 @@ export function init() {
const setting = Mota.require('var', 'mainSetting');
tran.ticker.add(() => {
if (core.isPlaying() && needSmooth) {
if (core.isPlaying() && needSmooth && !core.isReplaying()) {
core.setViewport(tran.value.x, tran.value.y);
}
});
@@ -39,7 +39,12 @@ export function init() {
tran.transition('x', ox).transition('y', oy);
const t = setting.getValue('screen.smoothView', false);
if (!t) return;
if (!t || core.isReplaying()) {
core.bigmap.offsetX = ox;
core.bigmap.offsetY = oy;
core.control.updateViewport();
return;
}
if (tran.easeTime > 0) {
needSmooth = true;
func();
+46
View File
@@ -1,3 +1,4 @@
import { has, ofDir } from '@/plugin/game/utils';
import { drawHalo } from '../fx/halo';
export function init() {
@@ -34,6 +35,7 @@ export function init() {
}
}
checkMockery(loc, forceMockery);
checkHunt(loc);
};
control.prototype._drawDamage_draw = function (
@@ -170,3 +172,47 @@ function checkMockery(loc: string, force: boolean = false) {
core.insertAction(action);
}
}
function checkHunt(loc: string) {
const hunt = core.status.thisMap.enemy.mapDamage[loc]?.hunt;
if (!hunt) return;
const { x: hx, y: hy } = core.status.hero.loc;
const action: any = [];
for (const [x, y, dir] of hunt) {
action.push(
{
type: 'move',
loc: [x, y],
time: 100,
keep: true,
steps: [`${dir}:1`]
},
{
type: 'update'
}
);
const [tx, ty] = ofDir(x, y, dir);
if (core.noPass(tx, ty)) return;
if (has(hy) && x === hx) {
if (Math.abs(y - hy) <= 2) {
action.push({
type: 'battle',
loc: [tx, ty]
});
}
}
if (has(hx) && y === hy) {
if (Math.abs(x - hx) <= 2) {
action.push({
type: 'battle',
loc: [tx, ty]
});
}
}
}
core.insertAction(action);
}
+7 -5
View File
@@ -3,7 +3,7 @@ const haloColor: Record<number, string[]> = {
25: ['purple'],
26: ['blue'],
27: ['red'],
29: ['#C3D100']
29: ['#3CFF49']
};
export function drawHalo(
@@ -13,15 +13,17 @@ export function drawHalo(
) {
if (main.replayChecking) return;
const setting = Mota.require('var', 'mainSetting');
if (!setting.getValue('screen.showHalo', true)) return;
const list = core.status.maps[floorId].enemy.haloList.concat(
if (!setting.getValue('screen.halo', true)) return;
const col = core.status.maps[floorId].enemy;
const [dx, dy] = col.translation;
const list = col.haloList.concat(
Object.keys(flags[`melt_${floorId}`] ?? {}).map(v => {
const [x, y] = v.split(',').map(v => parseInt(v));
return {
type: 'square',
data: {
x,
y,
x: x + dx,
y: y + dy,
d: 3
},
special: 25
+2 -2
View File
@@ -37,7 +37,7 @@ export function init() {
displayDamage
) {
const enemy = getEnemy(x, y);
const dam = enemy.calDamage();
const dam = enemy?.calDamage() ?? { damage: 0 };
const { damage, color } = formatDamage(dam.damage);
damageCanvas = '__damage_' + x + '_' + y;
@@ -46,7 +46,7 @@ export function init() {
ctx.font = '14px normal';
core.fillBoldText(ctx, damage, 1, 31, color as string);
if (core.flags.displayCritical) {
const critical = enemy.calCritical(1);
const critical = enemy?.calCritical(1) ?? [];
const atk = core.formatBigNumber(critical[0]?.delta, true);
const display = atk === '???' ? '?' : atk;
core.fillBoldText(ctx, display, 1, 21, '#FFFFFF');
+1 -2
View File
@@ -11,7 +11,6 @@ import * as removeMap from './removeMap';
import * as shop from './shop';
import * as skill from './skill';
import * as skillTree from './skillTree';
import * as study from './study';
import * as towerBoss from './towerBoss';
import * as utils from './utils';
import * as chase from './chase';
@@ -33,7 +32,7 @@ Mota.Plugin.register('heroFourFrames_g', heroFourFrames, heroFourFrames.init);
Mota.Plugin.register('rewrite_g', rewrite, rewrite.init);
Mota.Plugin.register('itemDetail_g', itemDetail, itemDetail.init);
Mota.Plugin.register('halo_g', halo);
Mota.Plugin.register('study_g', study);
// Mota.Plugin.register('study_g', study);
Mota.Plugin.register('remainEnemy_g', remainEnemy);
Mota.Plugin.register('checkBlock_g', checkBlock, checkBlock.init);
// todo: 这几个不应该放到插件
+44 -16
View File
@@ -1,4 +1,6 @@
import { canStudySkill, studySkill } from '@/game/mechanism/study';
import { upgradeSkill } from './skillTree';
import { ensureFloorDamage } from '@/game/enemy/damage';
const replayableSettings = ['autoSkill'];
@@ -44,19 +46,21 @@ export function init() {
});
core.registerReplayAction('study', name => {
// 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();
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);
ensureFloorDamage(core.status.floorId);
const col = core.status.thisMap.enemy;
col.calRealAttribute();
const enemy = col.list.find(v => v.x === x && v.y === y)!.info;
if (!enemy.special.includes(num)) return false;
studySkill(enemy, num);
core.status.route.push(name);
core.replay();
return true;
});
@@ -117,9 +121,7 @@ export function init() {
return true;
});
core.registerReplayAction('skill', name => {
if (!name.startsWith('skill:')) return false;
const [type, skill] = name.split(':');
function skillAction(skill: string) {
if (skill === '1') {
if (flags.autoSkill || !flags.bladeOn) return true;
if (flags.blade) flags.blade = false;
@@ -142,6 +144,32 @@ export function init() {
else flags.shield = true;
}
core.updateStatusBar();
core.replay();
return true;
}
core.registerReplayAction('skill', name => {
if (!name.startsWith('skill:')) return false;
const [type, skill] = name.split(':');
return skillAction(skill);
});
// 兼容旧版
core.registerReplayAction('key', name => {
if (!name.startsWith('key:')) return false;
const key = parseInt(name.slice(4));
if (key === 49) {
core.status.route.push(`skill:1`);
return skillAction('1');
} else if (key === 50) {
core.status.route.push(`skill:2`);
return skillAction('2');
} else if (key === 51) {
core.status.route.push(`skill:3`);
return skillAction('3');
}
return false;
});
}
+6 -3
View File
@@ -39,12 +39,14 @@ export const jumpIgnoreFloor: FloorIds[] = [
'MT57',
'MT59',
'MT60',
'MT61'
'MT61',
'MT71'
];
// 跳跃
export function jumpSkill() {
if (core.status.floorId.startsWith('tower'))
return core.drawTip('当无法使用该技能');
if (core.status.floorId.startsWith('tower')) {
return core.drawTip('当前无法使用该技能');
}
if (jumpIgnoreFloor.includes(core.status.floorId) || flags.onChase) {
return core.drawTip('当前楼层无法使用该技能');
}
@@ -140,6 +142,7 @@ export function jumpSkill() {
}
]);
}
// 检查一条线上的不可通过
function checkNoPass(direction, x, y, startNo) {
if (!startNo) startNo = false;
+1 -1
View File
@@ -141,7 +141,7 @@ export const skills: Record<Chapter, Skill[]> = {
consume: '2500 * 2 ** level + 5000',
front: [
[8, 10],
[12, 5]
[12, 10]
],
loc: [4, 1],
max: 6,
-53
View File
@@ -1,53 +0,0 @@
// 负责勇士技能:学习
const values: Record<number, string[]> = {
1: ['crit'],
6: ['n'],
7: ['hungry'],
8: ['together'],
10: ['courage'],
11: ['charge']
};
const cannotStudy = [9, 12, 14, 15, 24];
export function canStudySkill(number: number) {
const s = (core.status.hero.special ??= { num: [], last: [] });
if (Mota.Plugin.require('skillTree_g').getSkillLevel(11) === 0)
return false;
if (s.num.length >= 1) return false;
if (s.num.includes(number)) return false;
if (cannotStudy.includes(number)) return false;
return true;
}
export function studySkill(enemy: any, number: number) {
core.status.hero.special ??= { num: [], last: [] };
const s = core.status.hero.special;
}
export function forgetStudiedSkill(num: number, i: number) {
const s = core.status.hero.special;
const index = i !== void 0 && i !== null ? i : s.num.indexOf(num);
if (index === -1) return;
s.num.splice(index, 1);
s.last.splice(index, 1);
const value = values[num] ?? [];
for (const key of value) {
delete s[key];
}
}
export function declineStudiedSkill() {
const s = (core.status.hero.special ??= { num: [], last: [] });
s.last = s.last.map(v => v - 1);
}
export function checkStudiedSkill() {
const s = core.status.hero.special;
for (let i = 0; i < s.last.length; i++) {
if (s.last[i] <= 0) {
forgetStudiedSkill(1, i);
i--;
}
}
}
+3 -1
View File
@@ -66,6 +66,7 @@ export function getMapDrawData(
noCache: boolean = false
): MapDrawData {
const id = `${floorId},${interval},${border}`;
if (!floorId) return { locs: {}, line: [], width: 1, height: 1 };
if (drawCache[id] && !noCache) return drawCache[id];
const { link, maps } = getMapData(floorId, noCache);
const locs: Partial<Record<FloorIds, LocArr>> = {};
@@ -161,6 +162,7 @@ export function getMapData(
floorId: FloorIds,
noCache: boolean = false
): MapBFSResult {
if (!floorId) return { maps: [], link: {} };
if (has(bfsCache[floorId]) && !noCache) return bfsCache[floorId]!;
const queue = [floorId];
@@ -531,7 +533,7 @@ export class MinimapDrawer {
ctx.lineTo(x - 0.5, y + 1);
ctx.lineTo(x + 1.5, y - 1);
ctx.stroke();
} else if (enemy.length < 2) {
} else if (enemy.length <= 2) {
const ids = [...new Set(enemy.map(v => v.id))];
if (ids.length === 1) {
core.drawIcon(ctx, ids[0], x - 2, y - 2, 4, 4);
+6
View File
@@ -595,6 +595,12 @@ interface IdToCls {
I665: 'items';
E666: 'enemys';
E667: 'enemys';
E668: 'enemys';
E669: 'enemys';
E670: 'enemys';
E671: 'enemys';
E672: 'enemys';
E673: 'enemys';
X20032: 'tileset';
X20033: 'tileset';
X20034: 'tileset';
+1 -1
View File
@@ -188,7 +188,7 @@ interface ItemDeclaration {
I641: 'equips';
I642: 'constants';
I662: 'equips';
I663: 'items';
I663: 'equips';
I664: 'items';
I665: 'items';
}
+12
View File
@@ -595,6 +595,12 @@ interface IdToNumber {
I665: 665;
E666: 666;
E667: 667;
E668: 668;
E669: 669;
E670: 670;
E671: 671;
E672: 672;
E673: 673;
X20032: 20032;
X20033: 20033;
X20034: 20034;
@@ -1275,6 +1281,12 @@ interface NumberToId {
665: 'I665';
666: 'E666';
667: 'E667';
668: 'E668';
669: 'E669';
670: 'E670';
671: 'E671';
672: 'E672';
673: 'E673';
20032: 'X20032';
20033: 'X20033';
20034: 'X20034';
+1
View File
@@ -88,6 +88,7 @@ type Enemy<I extends EnemyIds = EnemyIds> = {
afterBattle: MotaEvent;
specialHalo?: number[];
translation?: [number, number];
} & {
[P in PartialNumbericEnemyProperty]?: number;
} & {
+4 -5
View File
@@ -81,7 +81,6 @@ import { useDrag } from '../plugin/use';
import EnemySpecial from '../panel/enemySpecial.vue';
import { LeftOutlined, RightOutlined } from '@ant-design/icons-vue';
import EnemyCritical from '../panel/enemyCritical.vue';
import { sleep } from 'mutate-animate';
import EnemyTarget from '../panel/enemyTarget.vue';
import { detailInfo } from '../plugin/ui/book';
import { gameKey } from '@/core/main/init/hotkey';
@@ -91,6 +90,10 @@ const props = defineProps<{
defaultPanel?: 'special' | 'critical' | 'target';
}>();
const emits = defineEmits<{
(e: 'close'): void;
}>();
const enemy = detailInfo.enemy;
const top = ref(detailInfo.pos);
const panel = ref<string>(props.defaultPanel ?? 'special');
@@ -98,10 +101,6 @@ const symbol = Symbol();
let detail: HTMLDivElement;
const emits = defineEmits<{
(e: 'close'): void;
}>();
function changePanel(e: MouseEvent, to: string) {
e.stopPropagation();
panel.value = to;
+1
View File
@@ -402,6 +402,7 @@ onMounted(async () => {
drawer.scale = scale;
drawer.noBorder = noBorder.value;
drawer.showInfo = true;
drawer.nowArea = nowArea.value;
const mapStyle = getComputedStyle(map);
const thumbStyle = getComputedStyle(thumb);
-1
View File
@@ -16,7 +16,6 @@ export { default as Skill } from './skill.vue';
export { default as SkillTree } from './skillTree.vue';
export { default as Start } from './start.vue';
export { default as StatusBar } from './statusBar.vue';
export { default as Studied } from './studied.vue';
export { default as Study } from './study.vue';
export { default as Toolbox } from './toolbox.vue';
export { default as Hotkey } from './hotkey.vue';
+3
View File
@@ -123,6 +123,9 @@
>学习</span
>
</div>
<div v-if="studyOpened" class="status-item">
<!-- 当前学习的技能 -->
</div>
</div>
</Scroll>
</Box>
-82
View File
@@ -1,82 +0,0 @@
<template>
<div id="studied">
<Box
:resizable="true"
:dragable="true"
v-model:width="width"
v-model:height="height"
v-model:left="left"
v-model:top="top"
>
<Scroll :no-scroll="true" style="height: 100%">
<div id="studied-main">
<div
v-for="(num, i) of studied"
:key="i"
></div></div></Scroll
></Box>
</div>
</template>
<script lang="ts" setup>
import { computed, onMounted, onUpdated, reactive, ref, watch } from 'vue';
import Box from '../components/box.vue';
import { status } from '../plugin/ui/statusBar';
import { RightOutlined } from '@ant-design/icons-vue';
import Scroll from '../components/scroll.vue';
watch(status, n => {});
let main: HTMLDivElement;
const width = ref(200);
const height = ref(0);
const left = ref(window.innerWidth - 300);
const top = ref(window.innerHeight - 300);
const folded = reactive<boolean[]>([]);
const studied = computed(() => {
status.value;
return core.status.hero.special?.num ?? [];
});
const last = computed(() => {
status.value;
return core.status.hero.special?.last ?? [];
});
async function calHeight() {
await new Promise<void>(resolve => {
requestAnimationFrame(() => {
const style = getComputedStyle(main);
height.value = parseFloat(style.height);
resolve();
});
});
}
onUpdated(() => {
calHeight();
});
onMounted(() => {
main = document.getElementById('studied-main') as HTMLDivElement;
calHeight();
});
</script>
<style lang="less" scoped>
#studied {
font-family: 'normal';
font-size: 1vw;
}
#studied-fold {
transition: transform 0.2s ease-out;
}
#studied-fold.folded {
transform: rotate(90deg);
}
</style>