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

+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);