mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-01-31 15:09:26 +08:00
插件转为es模块
This commit is contained in:
parent
d56e54135a
commit
81f6815429
4
idea.md
4
idea.md
@ -28,14 +28,14 @@
|
|||||||
|
|
||||||
#### 技能
|
#### 技能
|
||||||
|
|
||||||
闪避:每 M 回合闪避一次,减少 N%的伤害
|
闪避:每 M 回合闪避一次,减少 N% 的伤害
|
||||||
|
|
||||||
## 机制
|
## 机制
|
||||||
|
|
||||||
### 通用
|
### 通用
|
||||||
|
|
||||||
- 实时天气
|
- 实时天气
|
||||||
- 成就系统
|
- 成就系统(完成)
|
||||||
- 装备合成、装备(孔)强化
|
- 装备合成、装备(孔)强化
|
||||||
- 宝石目标设定
|
- 宝石目标设定
|
||||||
- 自动宝物规划,选中两个或更多宝物后自动在本地图中规划出最优拾取路线,原则是尽量减少其余宝物的捡拾,自动切换主动技能,怪物造成的伤害最低的路线
|
- 自动宝物规划,选中两个或更多宝物后自动在本地图中规划出最优拾取路线,原则是尽量减少其余宝物的捡拾,自动切换主动技能,怪物造成的伤害最低的路线
|
||||||
|
@ -5,9 +5,9 @@
|
|||||||
"type": "module",
|
"type": "module",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "vite",
|
"dev": "vite",
|
||||||
"build": "vue-tsc && vite build && ts-node-esm script/compress.ts",
|
"build": "vue-tsc && vite build && ts-node-esm script/build.ts",
|
||||||
"build-gh": "vue-tsc && vite build --base=/HumanBreak/ && ts-node-esm script/compress.ts",
|
"build-gh": "vue-tsc && vite build --base=/HumanBreak/ && ts-node-esm script/build.ts",
|
||||||
"build-local": "vue-tsc && vite build --base=/ && ts-node-esm script/compress.ts",
|
"build-local": "vue-tsc && vite build --base=/ && ts-node-esm script/build.ts",
|
||||||
"preview": "vite preview",
|
"preview": "vite preview",
|
||||||
"preview-node": "cd dist && node server.cjs",
|
"preview-node": "cd dist && node server.cjs",
|
||||||
"update": "ts-node-esm script/update.ts",
|
"update": "ts-node-esm script/update.ts",
|
||||||
@ -42,6 +42,7 @@
|
|||||||
"form-data": "^4.0.0",
|
"form-data": "^4.0.0",
|
||||||
"fs-extra": "^10.1.0",
|
"fs-extra": "^10.1.0",
|
||||||
"less": "^4.1.3",
|
"less": "^4.1.3",
|
||||||
|
"rollup": "^3.20.2",
|
||||||
"terser": "^5.16.9",
|
"terser": "^5.16.9",
|
||||||
"ts-node": "^10.9.1",
|
"ts-node": "^10.9.1",
|
||||||
"typescript": "^4.9.5",
|
"typescript": "^4.9.5",
|
||||||
|
@ -24,6 +24,7 @@ specifiers:
|
|||||||
lodash: ^4.17.21
|
lodash: ^4.17.21
|
||||||
lz-string: ^1.5.0
|
lz-string: ^1.5.0
|
||||||
mutate-animate: ^1.1.1
|
mutate-animate: ^1.1.1
|
||||||
|
rollup: ^3.20.2
|
||||||
terser: ^5.16.9
|
terser: ^5.16.9
|
||||||
three: ^0.149.0
|
three: ^0.149.0
|
||||||
ts-node: ^10.9.1
|
ts-node: ^10.9.1
|
||||||
@ -61,10 +62,11 @@ devDependencies:
|
|||||||
form-data: 4.0.0
|
form-data: 4.0.0
|
||||||
fs-extra: 10.1.0
|
fs-extra: 10.1.0
|
||||||
less: 4.1.3
|
less: 4.1.3
|
||||||
|
rollup: 3.20.2
|
||||||
terser: 5.16.9
|
terser: 5.16.9
|
||||||
ts-node: 10.9.1_o6avl3oodj6mwqsx3rm2wfkgv4
|
ts-node: 10.9.1_o6avl3oodj6mwqsx3rm2wfkgv4
|
||||||
typescript: 4.9.5
|
typescript: 4.9.5
|
||||||
unplugin-vue-components: 0.22.12_vue@3.2.47
|
unplugin-vue-components: 0.22.12_rollup@3.20.2+vue@3.2.47
|
||||||
vite: 4.2.1_lu7yuwtv4qfbkrotoux232iypi
|
vite: 4.2.1_lu7yuwtv4qfbkrotoux232iypi
|
||||||
vue-tsc: 1.2.0_typescript@4.9.5
|
vue-tsc: 1.2.0_typescript@4.9.5
|
||||||
|
|
||||||
@ -1620,7 +1622,7 @@ packages:
|
|||||||
rimraf: 3.0.2
|
rimraf: 3.0.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@rollup/pluginutils/5.0.2:
|
/@rollup/pluginutils/5.0.2_rollup@3.20.2:
|
||||||
resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==}
|
resolution: {integrity: sha512-pTd9rIsP92h+B6wWwFbW8RkZv4hiR/xKsqre4SIuAOaOEQRxi0lqLke9k2/7WegC85GgUs9pjmOjCUi3In4vwA==}
|
||||||
engines: {node: '>=14.0.0'}
|
engines: {node: '>=14.0.0'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@ -1632,6 +1634,7 @@ packages:
|
|||||||
'@types/estree': 1.0.0
|
'@types/estree': 1.0.0
|
||||||
estree-walker: 2.0.2
|
estree-walker: 2.0.2
|
||||||
picomatch: 2.3.1
|
picomatch: 2.3.1
|
||||||
|
rollup: 3.20.2
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/@simonwep/pickr/1.8.2:
|
/@simonwep/pickr/1.8.2:
|
||||||
@ -4399,7 +4402,7 @@ packages:
|
|||||||
engines: {node: '>= 10.0.0'}
|
engines: {node: '>= 10.0.0'}
|
||||||
dev: true
|
dev: true
|
||||||
|
|
||||||
/unplugin-vue-components/0.22.12_vue@3.2.47:
|
/unplugin-vue-components/0.22.12_rollup@3.20.2+vue@3.2.47:
|
||||||
resolution: {integrity: sha512-FxyzsuBvMCYPIk+8cgscGBQ345tvwVu+qY5IhE++eorkyvA4Z1TiD/HCiim+Kbqozl10i4K+z+NCa2WO2jexRA==}
|
resolution: {integrity: sha512-FxyzsuBvMCYPIk+8cgscGBQ345tvwVu+qY5IhE++eorkyvA4Z1TiD/HCiim+Kbqozl10i4K+z+NCa2WO2jexRA==}
|
||||||
engines: {node: '>=14'}
|
engines: {node: '>=14'}
|
||||||
peerDependencies:
|
peerDependencies:
|
||||||
@ -4410,7 +4413,7 @@ packages:
|
|||||||
optional: true
|
optional: true
|
||||||
dependencies:
|
dependencies:
|
||||||
'@antfu/utils': 0.7.2
|
'@antfu/utils': 0.7.2
|
||||||
'@rollup/pluginutils': 5.0.2
|
'@rollup/pluginutils': 5.0.2_rollup@3.20.2
|
||||||
chokidar: 3.5.3
|
chokidar: 3.5.3
|
||||||
debug: 4.3.4
|
debug: 4.3.4
|
||||||
fast-glob: 3.2.12
|
fast-glob: 3.2.12
|
||||||
|
@ -1,9 +1,8 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
export {};
|
||||||
|
|
||||||
(function () {
|
// 创建新图层
|
||||||
// 创建新图层
|
function createCanvas(name, zIndex) {
|
||||||
function createCanvas(name, zIndex) {
|
|
||||||
if (!name) return;
|
if (!name) return;
|
||||||
var canvas = document.createElement('canvas');
|
var canvas = document.createElement('canvas');
|
||||||
canvas.id = name;
|
canvas.id = name;
|
||||||
@ -16,24 +15,16 @@
|
|||||||
core.canvas[name] = ctx;
|
core.canvas[name] = ctx;
|
||||||
|
|
||||||
return canvas;
|
return canvas;
|
||||||
}
|
}
|
||||||
|
|
||||||
var bg2Canvas = createCanvas('bg2', 20);
|
var bg2Canvas = createCanvas('bg2', 20);
|
||||||
var fg2Canvas = createCanvas('fg2', 63);
|
var fg2Canvas = createCanvas('fg2', 63);
|
||||||
// 大地图适配
|
// 大地图适配
|
||||||
core.bigmap.canvas = [
|
core.bigmap.canvas = ['bg2', 'fg2', 'bg', 'event', 'event2', 'fg', 'damage'];
|
||||||
'bg2',
|
core.initStatus.bg2maps = {};
|
||||||
'fg2',
|
core.initStatus.fg2maps = {};
|
||||||
'bg',
|
|
||||||
'event',
|
|
||||||
'event2',
|
|
||||||
'fg',
|
|
||||||
'damage'
|
|
||||||
];
|
|
||||||
core.initStatus.bg2maps = {};
|
|
||||||
core.initStatus.fg2maps = {};
|
|
||||||
|
|
||||||
if (main.mode == 'editor') {
|
if (main.mode == 'editor') {
|
||||||
/*插入编辑器的图层 不做此步新增图层无法在编辑器显示*/
|
/*插入编辑器的图层 不做此步新增图层无法在编辑器显示*/
|
||||||
// 编辑器图层覆盖优先级 eui > efg > fg(前景层) > event2(48*32图块的事件层) > event(事件层) > bg(背景层)
|
// 编辑器图层覆盖优先级 eui > efg > fg(前景层) > event2(48*32图块的事件层) > event(事件层) > bg(背景层)
|
||||||
// 背景层2(bg2) 插入事件层(event)之前(即bg与event之间)
|
// 背景层2(bg2) 插入事件层(event)之前(即bg与event之间)
|
||||||
@ -109,8 +100,8 @@
|
|||||||
parent.insertBefore(input, parent.children[1]);
|
parent.insertBefore(input, parent.children[1]);
|
||||||
parent.appendChild(input2);
|
parent.appendChild(input2);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
core.maps._loadFloor_doNotCopy = function () {
|
core.maps._loadFloor_doNotCopy = function () {
|
||||||
return [
|
return [
|
||||||
'firstArrive',
|
'firstArrive',
|
||||||
'eachArrive',
|
'eachArrive',
|
||||||
@ -128,9 +119,9 @@
|
|||||||
'afterOpenDoor',
|
'afterOpenDoor',
|
||||||
'cannotMove'
|
'cannotMove'
|
||||||
];
|
];
|
||||||
};
|
};
|
||||||
////// 绘制背景和前景层 //////
|
////// 绘制背景和前景层 //////
|
||||||
core.maps._drawBg_draw = function (floorId, toDrawCtx, cacheCtx, config) {
|
core.maps._drawBg_draw = function (floorId, toDrawCtx, cacheCtx, config) {
|
||||||
config.ctx = cacheCtx;
|
config.ctx = cacheCtx;
|
||||||
core.maps._drawBg_drawBackground(floorId, config);
|
core.maps._drawBg_drawBackground(floorId, config);
|
||||||
// ------ 调整这两行的顺序来控制是先绘制贴图还是先绘制背景图块;后绘制的覆盖先绘制的。
|
// ------ 调整这两行的顺序来控制是先绘制贴图还是先绘制背景图块;后绘制的覆盖先绘制的。
|
||||||
@ -162,8 +153,8 @@
|
|||||||
core.bigmap.v2 ? -32 : 0
|
core.bigmap.v2 ? -32 : 0
|
||||||
);
|
);
|
||||||
config.ctx = toDrawCtx;
|
config.ctx = toDrawCtx;
|
||||||
};
|
};
|
||||||
core.maps._drawFg_draw = function (floorId, toDrawCtx, cacheCtx, config) {
|
core.maps._drawFg_draw = function (floorId, toDrawCtx, cacheCtx, config) {
|
||||||
config.ctx = cacheCtx;
|
config.ctx = cacheCtx;
|
||||||
// ------ 调整这两行的顺序来控制是先绘制贴图还是先绘制前景图块;后绘制的覆盖先绘制的。
|
// ------ 调整这两行的顺序来控制是先绘制贴图还是先绘制前景图块;后绘制的覆盖先绘制的。
|
||||||
core.maps._drawFloorImages(
|
core.maps._drawFloorImages(
|
||||||
@ -194,9 +185,9 @@
|
|||||||
core.bigmap.v2 ? -32 : 0
|
core.bigmap.v2 ? -32 : 0
|
||||||
);
|
);
|
||||||
config.ctx = toDrawCtx;
|
config.ctx = toDrawCtx;
|
||||||
};
|
};
|
||||||
////// 移动判定 //////
|
////// 移动判定 //////
|
||||||
core.maps._generateMovableArray_arrays = function (floorId) {
|
core.maps._generateMovableArray_arrays = function (floorId) {
|
||||||
return {
|
return {
|
||||||
bgArray: this.getBgMapArray(floorId),
|
bgArray: this.getBgMapArray(floorId),
|
||||||
fgArray: this.getFgMapArray(floorId),
|
fgArray: this.getFgMapArray(floorId),
|
||||||
@ -204,5 +195,4 @@
|
|||||||
bg2Array: this._getBgFgMapArray('bg2', floorId),
|
bg2Array: this._getBgFgMapArray('bg2', floorId),
|
||||||
fg2Array: this._getBgFgMapArray('fg2', floorId)
|
fg2Array: this._getBgFgMapArray('fg2', floorId)
|
||||||
};
|
};
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
/**
|
||||||
/**
|
|
||||||
* 绘制光环范围
|
* 绘制光环范围
|
||||||
* @param {CanvasRenderingContext2D} ctx
|
* @param {CanvasRenderingContext2D} ctx
|
||||||
* @param {boolean} onMap
|
* @param {boolean} onMap
|
||||||
*/
|
*/
|
||||||
function drawHalo(ctx, onMap) {
|
export function drawHalo(ctx, onMap) {
|
||||||
if (main.replayChecking) return;
|
if (main.replayChecking) return;
|
||||||
if (!core.getLocalStorage('showHalo', true)) return;
|
if (!core.getLocalStorage('showHalo', true)) return;
|
||||||
const halo = core.status.checkBlock.halo;
|
const halo = core.status.checkBlock.halo;
|
||||||
@ -49,9 +47,8 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
ctx.restore();
|
ctx.restore();
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.halo = {
|
core.plugin.halo = {
|
||||||
drawHalo
|
drawHalo
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,23 +1,21 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
/**
|
||||||
/**
|
|
||||||
* 获取勇士在某一点的属性
|
* 获取勇士在某一点的属性
|
||||||
* @param {keyof HeroStatus | 'all'} name
|
* @param {keyof HeroStatus | 'all'} name
|
||||||
* @param {number} x
|
* @param {number} x
|
||||||
* @param {number} y
|
* @param {number} y
|
||||||
* @param {FloorIds} floorId
|
* @param {FloorIds} floorId
|
||||||
*/
|
*/
|
||||||
function getHeroStatusOn(name, x, y, floorId) {
|
export function getHeroStatusOn(name, x, y, floorId) {
|
||||||
return getRealStatusOf(core.status.hero, name, x, y, floorId);
|
return getHeroStatusOf(core.status.hero, name, x, y, floorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getHeroStatusOf(status, name, x, y, floorId) {
|
export function getHeroStatusOf(status, name, x, y, floorId) {
|
||||||
return getRealStatus(status, name, x, y, floorId);
|
return getRealStatus(status, name, x, y, floorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getRealStatus(status, name, x, y, floorId) {
|
function getRealStatus(status, name, x, y, floorId) {
|
||||||
if (name instanceof Array) {
|
if (name instanceof Array) {
|
||||||
return Object.fromEntries(
|
return Object.fromEntries(
|
||||||
name.map(v => [
|
name.map(v => [
|
||||||
@ -78,10 +76,9 @@
|
|||||||
// 取整
|
// 取整
|
||||||
if (typeof s === 'number') s = Math.floor(s);
|
if (typeof s === 'number') s = Math.floor(s);
|
||||||
return s;
|
return s;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.hero = {
|
core.plugin.hero = {
|
||||||
getHeroStatusOf,
|
getHeroStatusOf,
|
||||||
getHeroStatusOn
|
getHeroStatusOn
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
export {};
|
||||||
|
|
||||||
(function () {
|
['up', 'down', 'left', 'right'].forEach(one => {
|
||||||
['up', 'down', 'left', 'right'].forEach(one => {
|
|
||||||
// 指定中间帧动画
|
// 指定中间帧动画
|
||||||
core.material.icons.hero[one].midFoot = 2;
|
core.material.icons.hero[one].midFoot = 2;
|
||||||
});
|
});
|
||||||
|
|
||||||
var heroMoving = timestamp => {
|
var heroMoving = timestamp => {
|
||||||
if (core.status.heroMoving <= 0) return;
|
if (core.status.heroMoving <= 0) return;
|
||||||
if (timestamp - core.animateFrame.moveTime > core.values.moveSpeed) {
|
if (timestamp - core.animateFrame.moveTime > core.values.moveSpeed) {
|
||||||
core.animateFrame.leftLeg++;
|
core.animateFrame.leftLeg++;
|
||||||
@ -19,10 +18,10 @@
|
|||||||
],
|
],
|
||||||
4 * core.status.heroMoving
|
4 * core.status.heroMoving
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
core.registerAnimationFrame('heroMoving', true, heroMoving);
|
core.registerAnimationFrame('heroMoving', true, heroMoving);
|
||||||
|
|
||||||
core.events._eventMoveHero_moving = function (step, moveSteps) {
|
core.events._eventMoveHero_moving = function (step, moveSteps) {
|
||||||
var curr = moveSteps[0];
|
var curr = moveSteps[0];
|
||||||
var direction = curr[0],
|
var direction = curr[0],
|
||||||
x = core.getHeroLoc('x'),
|
x = core.getHeroLoc('x'),
|
||||||
@ -56,5 +55,4 @@
|
|||||||
return step == 16;
|
return step == 16;
|
||||||
}
|
}
|
||||||
return false;
|
return false;
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
export {};
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
if (main.mode !== 'play' || main.replayChecking) return;
|
if (main.mode !== 'play' || main.replayChecking) return;
|
||||||
|
32
public/project/plugin/index.js
Normal file
32
public/project/plugin/index.js
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
import './fiveLayer';
|
||||||
|
import './heroFourFrames';
|
||||||
|
import './hotReload';
|
||||||
|
import './itemDetail';
|
||||||
|
import './popup';
|
||||||
|
import './replay';
|
||||||
|
import './ui';
|
||||||
|
import * as halo from './halo';
|
||||||
|
import * as hero from './hero';
|
||||||
|
import * as loopMap from './loopMap';
|
||||||
|
import * as remainEnemy from './remainEnemy';
|
||||||
|
import * as removeMap from './removeMap';
|
||||||
|
import * as shop from './shop';
|
||||||
|
import * as skill from './skills';
|
||||||
|
import * as skillTree from './skillTree';
|
||||||
|
import * as study from './study';
|
||||||
|
import * as towerBoss from './towerBoss';
|
||||||
|
import * as utils from './utils';
|
||||||
|
|
||||||
|
export {
|
||||||
|
halo,
|
||||||
|
hero,
|
||||||
|
loopMap,
|
||||||
|
remainEnemy,
|
||||||
|
removeMap,
|
||||||
|
shop,
|
||||||
|
skill,
|
||||||
|
skillTree,
|
||||||
|
study,
|
||||||
|
towerBoss,
|
||||||
|
utils
|
||||||
|
};
|
@ -1,8 +1,7 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
export {};
|
||||||
|
|
||||||
(function () {
|
core.control.updateDamage = function (floorId, ctx) {
|
||||||
core.control.updateDamage = function (floorId, ctx) {
|
|
||||||
floorId = floorId || core.status.floorId;
|
floorId = floorId || core.status.floorId;
|
||||||
if (!floorId || core.status.gameOver || main.mode != 'play') return;
|
if (!floorId || core.status.gameOver || main.mode != 'play') return;
|
||||||
const onMap = ctx == null;
|
const onMap = ctx == null;
|
||||||
@ -21,10 +20,10 @@
|
|||||||
this._updateDamage_extraDamage(floorId, onMap);
|
this._updateDamage_extraDamage(floorId, onMap);
|
||||||
getItemDetail(floorId, onMap); // 宝石血瓶详细信息
|
getItemDetail(floorId, onMap); // 宝石血瓶详细信息
|
||||||
this.drawDamage(ctx);
|
this.drawDamage(ctx);
|
||||||
};
|
};
|
||||||
|
|
||||||
// 获取宝石信息 并绘制
|
// 获取宝石信息 并绘制
|
||||||
function getItemDetail(floorId, onMap) {
|
function getItemDetail(floorId, onMap) {
|
||||||
if (!core.getFlag('itemDetail')) return;
|
if (!core.getFlag('itemDetail')) return;
|
||||||
floorId ??= core.status.thisMap.floorId;
|
floorId ??= core.status.thisMap.floorId;
|
||||||
let diff = {};
|
let diff = {};
|
||||||
@ -77,10 +76,10 @@
|
|||||||
core.status.hero = before;
|
core.status.hero = before;
|
||||||
window.hero = before;
|
window.hero = before;
|
||||||
window.flags = before.flags;
|
window.flags = before.flags;
|
||||||
}
|
}
|
||||||
|
|
||||||
// 绘制
|
// 绘制
|
||||||
function drawItemDetail(diff, x, y) {
|
function drawItemDetail(diff, x, y) {
|
||||||
const px = 32 * x + 2,
|
const px = 32 * x + 2,
|
||||||
py = 32 * y + 31;
|
py = 32 * y + 31;
|
||||||
let content = '';
|
let content = '';
|
||||||
@ -126,5 +125,4 @@
|
|||||||
});
|
});
|
||||||
i++;
|
i++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
import { slide } from './utils';
|
||||||
|
|
||||||
(function () {
|
const list = ['tower6'];
|
||||||
const { slide } = core.plugin.utils;
|
|
||||||
const list = ['tower6'];
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 设置循环地图的偏移量
|
* 设置循环地图的偏移量
|
||||||
* @param {number} offset 横向偏移量
|
* @param {number} offset 横向偏移量
|
||||||
* @param {FloorIds} floorId
|
* @param {FloorIds} floorId
|
||||||
*/
|
*/
|
||||||
function setLoopMap(offset, floorId) {
|
function setLoopMap(offset, floorId) {
|
||||||
const floor = core.status.maps[floorId];
|
const floor = core.status.maps[floorId];
|
||||||
if (offset < 9) {
|
if (offset < 9) {
|
||||||
moveMap(floor.width - 17, floorId);
|
moveMap(floor.width - 17, floorId);
|
||||||
@ -18,28 +16,28 @@
|
|||||||
if (offset > floor.width - 9) {
|
if (offset > floor.width - 9) {
|
||||||
moveMap(17 - floor.width, floorId);
|
moveMap(17 - floor.width, floorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 当勇士移动时自动设置循环地图
|
* 当勇士移动时自动设置循环地图
|
||||||
* @param {FloorIds} floorId
|
* @param {FloorIds} floorId
|
||||||
*/
|
*/
|
||||||
function autoSetLoopMap(floorId) {
|
function autoSetLoopMap(floorId) {
|
||||||
setLoopMap(core.status.hero.loc.x, floorId);
|
setLoopMap(core.status.hero.loc.x, floorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkLoopMap() {
|
export function checkLoopMap() {
|
||||||
if (isLoopMap(core.status.floorId)) {
|
if (isLoopMap(core.status.floorId)) {
|
||||||
autoSetLoopMap(core.status.floorId);
|
autoSetLoopMap(core.status.floorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 移动地图
|
* 移动地图
|
||||||
* @param {number} delta
|
* @param {number} delta
|
||||||
* @param {FloorIds} floorId
|
* @param {FloorIds} floorId
|
||||||
*/
|
*/
|
||||||
function moveMap(delta, floorId) {
|
function moveMap(delta, floorId) {
|
||||||
core.extractBlocks(floorId);
|
core.extractBlocks(floorId);
|
||||||
const floor = core.status.maps[floorId];
|
const floor = core.status.maps[floorId];
|
||||||
core.setHeroLoc('x', core.status.hero.loc.x + delta);
|
core.setHeroLoc('x', core.status.hero.loc.x + delta);
|
||||||
@ -59,13 +57,13 @@
|
|||||||
});
|
});
|
||||||
core.drawMap();
|
core.drawMap();
|
||||||
core.drawHero();
|
core.drawHero();
|
||||||
}
|
}
|
||||||
|
|
||||||
function isLoopMap(floorId) {
|
function isLoopMap(floorId) {
|
||||||
return list.includes(floorId);
|
return list.includes(floorId);
|
||||||
}
|
}
|
||||||
|
|
||||||
events.prototype._sys_changeFloor = function (data, callback) {
|
events.prototype._sys_changeFloor = function (data, callback) {
|
||||||
data = data.event.data;
|
data = data.event.data;
|
||||||
let heroLoc = {};
|
let heroLoc = {};
|
||||||
if (isLoopMap(data.floorId)) {
|
if (isLoopMap(data.floorId)) {
|
||||||
@ -81,19 +79,13 @@
|
|||||||
} else if (data.loc) heroLoc = { x: data.loc[0], y: data.loc[1] };
|
} else if (data.loc) heroLoc = { x: data.loc[0], y: data.loc[1] };
|
||||||
if (data.direction) heroLoc.direction = data.direction;
|
if (data.direction) heroLoc.direction = data.direction;
|
||||||
if (core.status.event.id != 'action') core.status.event.id = null;
|
if (core.status.event.id != 'action') core.status.event.id = null;
|
||||||
core.changeFloor(
|
core.changeFloor(data.floorId, data.stair, heroLoc, data.time, function () {
|
||||||
data.floorId,
|
|
||||||
data.stair,
|
|
||||||
heroLoc,
|
|
||||||
data.time,
|
|
||||||
function () {
|
|
||||||
core.replay();
|
core.replay();
|
||||||
if (callback) callback();
|
if (callback) callback();
|
||||||
}
|
});
|
||||||
);
|
};
|
||||||
};
|
|
||||||
|
|
||||||
events.prototype.trigger = function (x, y, callback) {
|
events.prototype.trigger = function (x, y, callback) {
|
||||||
var _executeCallback = function () {
|
var _executeCallback = function () {
|
||||||
// 因为trigger之后还有可能触发其他同步脚本(比如阻激夹域检测)
|
// 因为trigger之后还有可能触发其他同步脚本(比如阻激夹域检测)
|
||||||
// 所以这里强制callback被异步触发
|
// 所以这里强制callback被异步触发
|
||||||
@ -183,9 +175,9 @@
|
|||||||
this.doSystemEvent(trigger, block);
|
this.doSystemEvent(trigger, block);
|
||||||
}
|
}
|
||||||
return _executeCallback();
|
return _executeCallback();
|
||||||
};
|
};
|
||||||
|
|
||||||
maps.prototype._getBgFgMapArray = function (name, floorId, noCache) {
|
maps.prototype._getBgFgMapArray = function (name, floorId, noCache) {
|
||||||
floorId = floorId || core.status.floorId;
|
floorId = floorId || core.status.floorId;
|
||||||
if (!floorId) return [];
|
if (!floorId) return [];
|
||||||
var width = core.floors[floorId].width;
|
var width = core.floors[floorId].width;
|
||||||
@ -212,16 +204,16 @@
|
|||||||
for (var y = 0; y < height; ++y) {
|
for (var y = 0; y < height; ++y) {
|
||||||
if (arr[y] == null) arr[y] = Array(width).fill(0);
|
if (arr[y] == null) arr[y] = Array(width).fill(0);
|
||||||
}
|
}
|
||||||
(core.getFlag('__' + name + 'v__', {})[floorId] || []).forEach(
|
(core.getFlag('__' + name + 'v__', {})[floorId] || []).forEach(function (
|
||||||
function (one) {
|
one
|
||||||
|
) {
|
||||||
arr[one[1]][one[0]] = one[2] || 0;
|
arr[one[1]][one[0]] = one[2] || 0;
|
||||||
}
|
});
|
||||||
);
|
(core.getFlag('__' + name + 'd__', {})[floorId] || []).forEach(function (
|
||||||
(core.getFlag('__' + name + 'd__', {})[floorId] || []).forEach(
|
one
|
||||||
function (one) {
|
) {
|
||||||
arr[one[1]][one[0]] = 0;
|
arr[one[1]][one[0]] = 0;
|
||||||
}
|
});
|
||||||
);
|
|
||||||
if (main.mode == 'editor') {
|
if (main.mode == 'editor') {
|
||||||
for (var x = 0; x < width; x++) {
|
for (var x = 0; x < width; x++) {
|
||||||
for (var y = 0; y < height; y++) {
|
for (var y = 0; y < height; y++) {
|
||||||
@ -229,12 +221,10 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (core.status[name + 'maps'])
|
if (core.status[name + 'maps']) core.status[name + 'maps'][floorId] = arr;
|
||||||
core.status[name + 'maps'][floorId] = arr;
|
|
||||||
return arr;
|
return arr;
|
||||||
};
|
};
|
||||||
|
|
||||||
core.plugin.loopMap = {
|
core.plugin.loopMap = {
|
||||||
checkLoopMap
|
checkLoopMap
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,10 +1,9 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
export {};
|
||||||
|
|
||||||
(function () {
|
// 伤害弹出
|
||||||
// 伤害弹出
|
// 复写阻激夹域检测
|
||||||
// 复写阻激夹域检测
|
control.prototype.checkBlock = function (forceMockery) {
|
||||||
control.prototype.checkBlock = function (forceMockery) {
|
|
||||||
var x = core.getHeroLoc('x'),
|
var x = core.getHeroLoc('x'),
|
||||||
y = core.getHeroLoc('y'),
|
y = core.getHeroLoc('y'),
|
||||||
loc = x + ',' + y;
|
loc = x + ',' + y;
|
||||||
@ -18,9 +17,8 @@
|
|||||||
);
|
);
|
||||||
core.status.hero.hp -= damage;
|
core.status.hero.hp -= damage;
|
||||||
var text =
|
var text =
|
||||||
Object.keys(core.status.checkBlock.type[loc] || {}).join(
|
Object.keys(core.status.checkBlock.type[loc] || {}).join(',') ||
|
||||||
','
|
'伤害';
|
||||||
) || '伤害';
|
|
||||||
core.drawTip('受到' + text + damage + '点');
|
core.drawTip('受到' + text + damage + '点');
|
||||||
core.drawHeroAnimate('zone');
|
core.drawHeroAnimate('zone');
|
||||||
this._checkBlock_disableQuickShop();
|
this._checkBlock_disableQuickShop();
|
||||||
@ -36,9 +34,9 @@
|
|||||||
}
|
}
|
||||||
this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
|
this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);
|
||||||
checkMockery(loc, forceMockery);
|
checkMockery(loc, forceMockery);
|
||||||
};
|
};
|
||||||
|
|
||||||
control.prototype.moveHero = function (direction, callback) {
|
control.prototype.moveHero = function (direction, callback) {
|
||||||
// 如果正在移动,直接return
|
// 如果正在移动,直接return
|
||||||
if (core.status.heroMoving != 0) return;
|
if (core.status.heroMoving != 0) return;
|
||||||
if (core.isset(direction)) core.setHeroLoc('direction', direction);
|
if (core.isset(direction)) core.setHeroLoc('direction', direction);
|
||||||
@ -51,14 +49,14 @@
|
|||||||
|
|
||||||
if (callback) return this.moveAction(callback);
|
if (callback) return this.moveAction(callback);
|
||||||
this._moveHero_moving();
|
this._moveHero_moving();
|
||||||
};
|
};
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 电摇嘲讽
|
* 电摇嘲讽
|
||||||
* @param {LocString} loc
|
* @param {LocString} loc
|
||||||
* @param {boolean} force
|
* @param {boolean} force
|
||||||
*/
|
*/
|
||||||
function checkMockery(loc, force) {
|
function checkMockery(loc, force) {
|
||||||
if (core.status.lockControl && !force) return;
|
if (core.status.lockControl && !force) return;
|
||||||
const mockery = core.status.checkBlock.mockery[loc];
|
const mockery = core.status.checkBlock.mockery[loc];
|
||||||
if (mockery) {
|
if (mockery) {
|
||||||
@ -66,8 +64,7 @@
|
|||||||
const action = [];
|
const action = [];
|
||||||
const [tx, ty] = mockery[0];
|
const [tx, ty] = mockery[0];
|
||||||
let { x, y } = core.status.hero.loc;
|
let { x, y } = core.status.hero.loc;
|
||||||
const dir =
|
const dir = x > tx ? 'left' : x < tx ? 'right' : y > ty ? 'up' : 'down';
|
||||||
x > tx ? 'left' : x < tx ? 'right' : y > ty ? 'up' : 'down';
|
|
||||||
const { x: dx, y: dy } = core.utils.scan[dir];
|
const { x: dx, y: dy } = core.utils.scan[dir];
|
||||||
|
|
||||||
action.push({ type: 'changePos', direction: dir });
|
action.push({ type: 'changePos', direction: dir });
|
||||||
@ -120,5 +117,4 @@
|
|||||||
action.push({ type: 'stopAsync' });
|
action.push({ type: 'stopAsync' });
|
||||||
core.insertAction(action);
|
core.insertAction(action);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
})();
|
|
||||||
|
@ -1,12 +1,10 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
/**
|
||||||
/**
|
|
||||||
* 检查漏怪
|
* 检查漏怪
|
||||||
* @param {FloorIds[]} floorIds
|
* @param {FloorIds[]} floorIds
|
||||||
*/
|
*/
|
||||||
function checkRemainEnemy(floorIds) {
|
export function checkRemainEnemy(floorIds) {
|
||||||
/**
|
/**
|
||||||
* @type {Record<FloorIds, {loc: LocArr, id: EnemyIds}[]>}
|
* @type {Record<FloorIds, {loc: LocArr, id: EnemyIds}[]>}
|
||||||
*/
|
*/
|
||||||
@ -15,8 +13,7 @@
|
|||||||
core.extractBlocks(v);
|
core.extractBlocks(v);
|
||||||
const blocks = core.status.maps[v].blocks;
|
const blocks = core.status.maps[v].blocks;
|
||||||
blocks.forEach(block => {
|
blocks.forEach(block => {
|
||||||
if (!block.event.cls.startsWith('enemy') || block.disable)
|
if (!block.event.cls.startsWith('enemy') || block.disable) return;
|
||||||
return;
|
|
||||||
/**
|
/**
|
||||||
* @type {EnemyIds}
|
* @type {EnemyIds}
|
||||||
*/
|
*/
|
||||||
@ -27,13 +24,13 @@
|
|||||||
});
|
});
|
||||||
});
|
});
|
||||||
return enemy;
|
return enemy;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取剩余怪物字符串
|
* 获取剩余怪物字符串
|
||||||
* @param {FloorIds[]} floorIds
|
* @param {FloorIds[]} floorIds
|
||||||
*/
|
*/
|
||||||
function getRemainEnemyString(floorIds) {
|
export function getRemainEnemyString(floorIds) {
|
||||||
const enemy = checkRemainEnemy(floorIds);
|
const enemy = checkRemainEnemy(floorIds);
|
||||||
const str = [];
|
const str = [];
|
||||||
let now = [];
|
let now = [];
|
||||||
@ -67,10 +64,9 @@
|
|||||||
}
|
}
|
||||||
|
|
||||||
return str;
|
return str;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.remainEnemy = {
|
core.plugin.remainEnemy = {
|
||||||
checkRemainEnemy,
|
checkRemainEnemy,
|
||||||
getRemainEnemyString
|
getRemainEnemyString
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,8 +1,6 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
export function removeMaps(fromId, toId, force) {
|
||||||
function removeMaps(fromId, toId, force) {
|
|
||||||
toId = toId || fromId;
|
toId = toId || fromId;
|
||||||
var fromIndex = core.floorIds.indexOf(fromId),
|
var fromIndex = core.floorIds.indexOf(fromId),
|
||||||
toIndex = core.floorIds.indexOf(toId);
|
toIndex = core.floorIds.indexOf(toId);
|
||||||
@ -40,20 +38,20 @@
|
|||||||
if (deleted && !main.replayChecking) {
|
if (deleted && !main.replayChecking) {
|
||||||
core.splitArea();
|
core.splitArea();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function deleteFlags(floorId) {
|
export function deleteFlags(floorId) {
|
||||||
delete flags[`jump_${floorId}`];
|
delete flags[`jump_${floorId}`];
|
||||||
delete flags[`inte_${floorId}`];
|
delete flags[`inte_${floorId}`];
|
||||||
delete flags[`loop_${floorId}`];
|
delete flags[`loop_${floorId}`];
|
||||||
delete flags[`melt_${floorId}`];
|
delete flags[`melt_${floorId}`];
|
||||||
delete flags[`night_${floorId}`];
|
delete flags[`night_${floorId}`];
|
||||||
}
|
}
|
||||||
|
|
||||||
// 恢复楼层
|
// 恢复楼层
|
||||||
// core.plugin.removeMap.resumeMaps("MT1", "MT300") 恢复MT1~MT300之间的全部层
|
// core.plugin.removeMap.resumeMaps("MT1", "MT300") 恢复MT1~MT300之间的全部层
|
||||||
// core.plugin.removeMap.resumeMaps("MT10") 只恢复MT10层
|
// core.plugin.removeMap.resumeMaps("MT10") 只恢复MT10层
|
||||||
function resumeMaps(fromId, toId) {
|
export function resumeMaps(fromId, toId) {
|
||||||
toId = toId || fromId;
|
toId = toId || fromId;
|
||||||
var fromIndex = core.floorIds.indexOf(fromId),
|
var fromIndex = core.floorIds.indexOf(fromId),
|
||||||
toIndex = core.floorIds.indexOf(toId);
|
toIndex = core.floorIds.indexOf(toId);
|
||||||
@ -72,10 +70,10 @@
|
|||||||
});
|
});
|
||||||
core.status.maps[floorId] = core.loadFloor(floorId);
|
core.status.maps[floorId] = core.loadFloor(floorId);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// 分区砍层相关
|
// 分区砍层相关
|
||||||
var inAnyPartition = floorId => {
|
var inAnyPartition = floorId => {
|
||||||
var inPartition = false;
|
var inPartition = false;
|
||||||
(core.floorPartitions || []).forEach(floor => {
|
(core.floorPartitions || []).forEach(floor => {
|
||||||
var fromIndex = core.floorIds.indexOf(floor[0]);
|
var fromIndex = core.floorIds.indexOf(floor[0]);
|
||||||
@ -86,10 +84,10 @@
|
|||||||
if (index >= fromIndex && index <= toIndex) inPartition = true;
|
if (index >= fromIndex && index <= toIndex) inPartition = true;
|
||||||
});
|
});
|
||||||
return inPartition;
|
return inPartition;
|
||||||
};
|
};
|
||||||
|
|
||||||
// 分区砍层
|
// 分区砍层
|
||||||
function autoRemoveMaps(floorId) {
|
export function autoRemoveMaps(floorId) {
|
||||||
if (main.mode != 'play' || !inAnyPartition(floorId)) return;
|
if (main.mode != 'play' || !inAnyPartition(floorId)) return;
|
||||||
// 根据分区信息自动砍层与恢复
|
// 根据分区信息自动砍层与恢复
|
||||||
(core.floorPartitions || []).forEach(floor => {
|
(core.floorPartitions || []).forEach(floor => {
|
||||||
@ -107,12 +105,11 @@
|
|||||||
removeMaps(core.floorIds[fromIndex], core.floorIds[toIndex]);
|
removeMaps(core.floorIds[fromIndex], core.floorIds[toIndex]);
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.removeMap = {
|
core.plugin.removeMap = {
|
||||||
removeMaps,
|
removeMaps,
|
||||||
deleteFlags,
|
deleteFlags,
|
||||||
resumeMaps,
|
resumeMaps,
|
||||||
autoRemoveMaps
|
autoRemoveMaps
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,12 +1,11 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
import { studySkill, canStudySkill } from './study';
|
||||||
const { studySkill, canStudySkill } = core.plugin.study;
|
|
||||||
const replayableSettings = ['autoSkill'];
|
|
||||||
|
|
||||||
// 注册修改设置的录像操作
|
const replayableSettings = ['autoSkill'];
|
||||||
core.registerReplayAction('settings', name => {
|
|
||||||
|
// 注册修改设置的录像操作
|
||||||
|
core.registerReplayAction('settings', name => {
|
||||||
if (!name.startsWith('set:')) return false;
|
if (!name.startsWith('set:')) return false;
|
||||||
const [, setting, value] = name.split(':');
|
const [, setting, value] = name.split(':');
|
||||||
const v = eval(value);
|
const v = eval(value);
|
||||||
@ -15,17 +14,17 @@
|
|||||||
flags[setting] = v;
|
flags[setting] = v;
|
||||||
core.replay();
|
core.replay();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
core.registerReplayAction('upgradeSkill', name => {
|
core.registerReplayAction('upgradeSkill', name => {
|
||||||
if (!name.startsWith('skill:')) return false;
|
if (!name.startsWith('skill:')) return false;
|
||||||
const skill = parseInt(name.slice(6));
|
const skill = parseInt(name.slice(6));
|
||||||
core.plugin.skillTree.upgradeSkill(skill);
|
core.plugin.skillTree.upgradeSkill(skill);
|
||||||
core.replay();
|
core.replay();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
core.registerReplayAction('study', name => {
|
core.registerReplayAction('study', name => {
|
||||||
if (!name.startsWith('study:')) return false;
|
if (!name.startsWith('study:')) return false;
|
||||||
const [num, x, y] = name
|
const [num, x, y] = name
|
||||||
.slice(6)
|
.slice(6)
|
||||||
@ -38,20 +37,20 @@
|
|||||||
studySkill(enemy, num);
|
studySkill(enemy, num);
|
||||||
core.replay();
|
core.replay();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
// 商店
|
// 商店
|
||||||
let shopOpened = false;
|
let shopOpened = false;
|
||||||
let openedShopId = '';
|
let openedShopId = '';
|
||||||
core.registerReplayAction('openShop', name => {
|
core.registerReplayAction('openShop', name => {
|
||||||
if (!name.startsWith('openShop:')) return false;
|
if (!name.startsWith('openShop:')) return false;
|
||||||
openedShopId = name.slice(9);
|
openedShopId = name.slice(9);
|
||||||
shopOpened = true;
|
shopOpened = true;
|
||||||
core.replay();
|
core.replay();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
core.registerReplayAction('buy', name => {
|
core.registerReplayAction('buy', name => {
|
||||||
if (!name.startsWith('buy:') && !name.startsWith('sell:')) return false;
|
if (!name.startsWith('buy:') && !name.startsWith('sell:')) return false;
|
||||||
if (!shopOpened) return false;
|
if (!shopOpened) return false;
|
||||||
if (!openedShopId) return false;
|
if (!openedShopId) return false;
|
||||||
@ -78,14 +77,13 @@
|
|||||||
flags.itemShop[openedShopId][id] += type === 'buy' ? num : -num;
|
flags.itemShop[openedShopId][id] += type === 'buy' ? num : -num;
|
||||||
core.replay();
|
core.replay();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
|
|
||||||
core.registerReplayAction('closeShop', name => {
|
core.registerReplayAction('closeShop', name => {
|
||||||
if (name !== 'closeShop') return false;
|
if (name !== 'closeShop') return false;
|
||||||
if (!shopOpened) return false;
|
if (!shopOpened) return false;
|
||||||
shopOpened = false;
|
shopOpened = false;
|
||||||
openedShopId = '';
|
openedShopId = '';
|
||||||
core.replay();
|
core.replay();
|
||||||
return true;
|
return true;
|
||||||
});
|
});
|
||||||
})();
|
|
||||||
|
@ -1,10 +1,8 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
const { openItemShop } = core.plugin.gameUi;
|
||||||
const { openItemShop } = core.plugin.gameUi;
|
|
||||||
|
|
||||||
function openShop(shopId, noRoute) {
|
export function openShop(shopId, noRoute) {
|
||||||
var shop = core.status.shops[shopId];
|
var shop = core.status.shops[shopId];
|
||||||
// Step 1: 检查能否打开此商店
|
// Step 1: 检查能否打开此商店
|
||||||
if (!this.canOpenShop(shopId)) {
|
if (!this.canOpenShop(shopId)) {
|
||||||
@ -18,45 +16,45 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 是否访问过某个快捷商店
|
/// 是否访问过某个快捷商店
|
||||||
function isShopVisited(id) {
|
export function isShopVisited(id) {
|
||||||
flags.__shops__ ??= {};
|
flags.__shops__ ??= {};
|
||||||
var shops = core.getFlag('__shops__');
|
var shops = core.getFlag('__shops__');
|
||||||
if (!shops[id]) shops[id] = {};
|
if (!shops[id]) shops[id] = {};
|
||||||
return shops[id].visited;
|
return shops[id].visited;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 当前应当显示的快捷商店列表
|
/// 当前应当显示的快捷商店列表
|
||||||
function listShopIds() {
|
export function listShopIds() {
|
||||||
return Object.keys(core.status.shops).filter(id => {
|
return Object.keys(core.status.shops).filter(id => {
|
||||||
return (
|
return (
|
||||||
core.plugin.shop.isShopVisited(id) ||
|
core.plugin.shop.isShopVisited(id) ||
|
||||||
!core.status.shops[id].mustEnable
|
!core.status.shops[id].mustEnable
|
||||||
);
|
);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 是否能够打开某个商店
|
/// 是否能够打开某个商店
|
||||||
function canOpenShop(id) {
|
export function canOpenShop(id) {
|
||||||
if (this.isShopVisited(id)) return true;
|
if (this.isShopVisited(id)) return true;
|
||||||
var shop = core.status.shops[id];
|
var shop = core.status.shops[id];
|
||||||
if (shop.item || shop.commonEvent || shop.mustEnable) return false;
|
if (shop.item || shop.commonEvent || shop.mustEnable) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 启用或禁用某个快捷商店
|
/// 启用或禁用某个快捷商店
|
||||||
function setShopVisited(id, visited) {
|
export function setShopVisited(id, visited) {
|
||||||
if (!core.hasFlag('__shops__')) core.setFlag('__shops__', {});
|
if (!core.hasFlag('__shops__')) core.setFlag('__shops__', {});
|
||||||
var shops = core.getFlag('__shops__');
|
var shops = core.getFlag('__shops__');
|
||||||
if (!shops[id]) shops[id] = {};
|
if (!shops[id]) shops[id] = {};
|
||||||
if (visited) shops[id].visited = true;
|
if (visited) shops[id].visited = true;
|
||||||
else delete shops[id].visited;
|
else delete shops[id].visited;
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 能否使用快捷商店
|
/// 能否使用快捷商店
|
||||||
function canUseQuickShop() {
|
export function canUseQuickShop() {
|
||||||
// 如果返回一个字符串,表示不能,字符串为不能使用的提示
|
// 如果返回一个字符串,表示不能,字符串为不能使用的提示
|
||||||
// 返回null代表可以使用
|
// 返回null代表可以使用
|
||||||
|
|
||||||
@ -64,14 +62,13 @@
|
|||||||
if (core.status.thisMap.canUseQuickShop === false)
|
if (core.status.thisMap.canUseQuickShop === false)
|
||||||
return '当前楼层不能使用快捷商店。';
|
return '当前楼层不能使用快捷商店。';
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.shop = {
|
core.plugin.shop = {
|
||||||
openShop,
|
openShop,
|
||||||
isShopVisited,
|
isShopVisited,
|
||||||
listShopIds,
|
listShopIds,
|
||||||
canOpenShop,
|
canOpenShop,
|
||||||
setShopVisited,
|
setShopVisited,
|
||||||
canUseQuickShop
|
canUseQuickShop
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,16 +1,14 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
/**
|
||||||
/**
|
|
||||||
* @type {number[]}
|
* @type {number[]}
|
||||||
*/
|
*/
|
||||||
let levels = [];
|
let levels = [];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @type {Record<Chapter, Skill[]>}
|
* @type {Record<Chapter, Skill[]>}
|
||||||
*/
|
*/
|
||||||
const skills = {
|
const skills = {
|
||||||
chapter1: [
|
chapter1: [
|
||||||
{
|
{
|
||||||
index: 0,
|
index: 0,
|
||||||
@ -195,26 +193,26 @@
|
|||||||
effect: ['每打一个怪,勇士造成的伤害增加1%']
|
effect: ['每打一个怪,勇士造成的伤害增加1%']
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
core.plugin.skills = skills;
|
core.plugin.skills = skills;
|
||||||
|
|
||||||
function getSkillFromIndex(index) {
|
export function getSkillFromIndex(index) {
|
||||||
for (const [, skill] of Object.entries(skills)) {
|
for (const [, skill] of Object.entries(skills)) {
|
||||||
const s = skill.find(v => v.index === index);
|
const s = skill.find(v => v.index === index);
|
||||||
if (s) return s;
|
if (s) return s;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 获取技能等级
|
* 获取技能等级
|
||||||
* @param {number} skill
|
* @param {number} skill
|
||||||
*/
|
*/
|
||||||
function getSkillLevel(skill) {
|
export function getSkillLevel(skill) {
|
||||||
return (levels[skill] ??= 0);
|
return (levels[skill] ??= 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
function getSkillConsume(skill) {
|
export function getSkillConsume(skill) {
|
||||||
return eval(
|
return eval(
|
||||||
this.getSkillFromIndex(skill).consume.replace(
|
this.getSkillFromIndex(skill).consume.replace(
|
||||||
/level(:\d+)?/g,
|
/level(:\d+)?/g,
|
||||||
@ -224,18 +222,18 @@
|
|||||||
}
|
}
|
||||||
)
|
)
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
function openTree() {
|
export function openTree() {
|
||||||
if (main.replayChecking) return;
|
if (main.replayChecking) return;
|
||||||
core.plugin.skillTreeOpened.value = true;
|
core.plugin.skillTreeOpened.value = true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 能否升级某个技能
|
* 能否升级某个技能
|
||||||
* @param {number} skill
|
* @param {number} skill
|
||||||
*/
|
*/
|
||||||
function canUpgrade(skill) {
|
export function canUpgrade(skill) {
|
||||||
const consume = core.plugin.skillTree.getSkillConsume(skill);
|
const consume = core.plugin.skillTree.getSkillConsume(skill);
|
||||||
if (consume > core.status.hero.mdef) return false;
|
if (consume > core.status.hero.mdef) return false;
|
||||||
const level = core.plugin.skillTree.getSkillLevel(skill);
|
const level = core.plugin.skillTree.getSkillLevel(skill);
|
||||||
@ -243,17 +241,16 @@
|
|||||||
if (level === s.max) return false;
|
if (level === s.max) return false;
|
||||||
const front = s.front;
|
const front = s.front;
|
||||||
for (const [skill, level] of front) {
|
for (const [skill, level] of front) {
|
||||||
if (core.plugin.skillTree.getSkillLevel(skill) < level)
|
if (core.plugin.skillTree.getSkillLevel(skill) < level) return false;
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* 实际升级效果
|
* 实际升级效果
|
||||||
* @param {number} skill
|
* @param {number} skill
|
||||||
*/
|
*/
|
||||||
function upgradeSkill(skill) {
|
export function upgradeSkill(skill) {
|
||||||
if (!canUpgrade(skill)) return false;
|
if (!canUpgrade(skill)) return false;
|
||||||
switch (skill) {
|
switch (skill) {
|
||||||
case 0: // 力量 +2攻击
|
case 0: // 力量 +2攻击
|
||||||
@ -298,17 +295,17 @@
|
|||||||
levels[skill]++;
|
levels[skill]++;
|
||||||
core.updateStatusBar();
|
core.updateStatusBar();
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function saveSkillTree() {
|
export function saveSkillTree() {
|
||||||
return levels.slice();
|
return levels.slice();
|
||||||
}
|
}
|
||||||
|
|
||||||
function loadSkillTree(data) {
|
export function loadSkillTree(data) {
|
||||||
levels = data ?? [];
|
levels = data ?? [];
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.skillTree = {
|
core.plugin.skillTree = {
|
||||||
getSkillConsume,
|
getSkillConsume,
|
||||||
getSkillFromIndex,
|
getSkillFromIndex,
|
||||||
getSkillLevel,
|
getSkillLevel,
|
||||||
@ -316,5 +313,4 @@
|
|||||||
loadSkillTree,
|
loadSkillTree,
|
||||||
upgradeSkill,
|
upgradeSkill,
|
||||||
openTree
|
openTree
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,9 +1,7 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
// 所有的主动技能效果
|
||||||
// 所有的主动技能效果
|
var ignoreInJump = {
|
||||||
var ignoreInJump = {
|
|
||||||
event: ['X20007', 'X20001', 'X20006', 'X20014', 'X20010', 'X20007'],
|
event: ['X20007', 'X20001', 'X20006', 'X20014', 'X20010', 'X20007'],
|
||||||
bg: [
|
bg: [
|
||||||
'X20037',
|
'X20037',
|
||||||
@ -19,12 +17,12 @@
|
|||||||
'X20075',
|
'X20075',
|
||||||
'X20076'
|
'X20076'
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
|
|
||||||
/** @type {FloorIds[]} */
|
/** @type {FloorIds[]} */
|
||||||
const jumpIgnoreFloor = ['MT31', 'snowTown'];
|
const jumpIgnoreFloor = ['MT31', 'snowTown'];
|
||||||
// 跳跃
|
// 跳跃
|
||||||
function jumpSkill() {
|
export function jumpSkill() {
|
||||||
if (core.status.floorId.startsWith('tower'))
|
if (core.status.floorId.startsWith('tower'))
|
||||||
return core.drawTip('当无法使用该技能');
|
return core.drawTip('当无法使用该技能');
|
||||||
if (jumpIgnoreFloor.includes(core.status.floorId) || flags.onChase) {
|
if (jumpIgnoreFloor.includes(core.status.floorId) || flags.onChase) {
|
||||||
@ -76,8 +74,8 @@
|
|||||||
var noPass = core.noPass(checkLoc.x, checkLoc.y);
|
var noPass = core.noPass(checkLoc.x, checkLoc.y);
|
||||||
var id = core.getBlockId(checkLoc.x, checkLoc.y) || '';
|
var id = core.getBlockId(checkLoc.x, checkLoc.y) || '';
|
||||||
var bgId =
|
var bgId =
|
||||||
core.getBlockByNumber(core.getBgNumber(checkLoc.x, checkLoc.y))
|
core.getBlockByNumber(core.getBgNumber(checkLoc.x, checkLoc.y)).event
|
||||||
.event.id || '';
|
.id || '';
|
||||||
// 可以通行
|
// 可以通行
|
||||||
if (
|
if (
|
||||||
!noPass ||
|
!noPass ||
|
||||||
@ -106,12 +104,7 @@
|
|||||||
}
|
}
|
||||||
// 是怪物
|
// 是怪物
|
||||||
if (cls == 'enemys' || cls == 'enemy48') {
|
if (cls == 'enemys' || cls == 'enemy48') {
|
||||||
var firstNoPass = checkNoPass(
|
var firstNoPass = checkNoPass(direction, checkLoc.x, checkLoc.y, false);
|
||||||
direction,
|
|
||||||
checkLoc.x,
|
|
||||||
checkLoc.y,
|
|
||||||
false
|
|
||||||
);
|
|
||||||
if (!firstNoPass) return;
|
if (!firstNoPass) return;
|
||||||
core.autosave();
|
core.autosave();
|
||||||
if (flags.chapter <= 1) core.status.hero.hp -= 200 * flags.hard;
|
if (flags.chapter <= 1) core.status.hero.hp -= 200 * flags.hard;
|
||||||
@ -160,8 +153,7 @@
|
|||||||
var id = core.getBlockId(x, y) || '';
|
var id = core.getBlockId(x, y) || '';
|
||||||
if (core.getBgNumber(x, y))
|
if (core.getBgNumber(x, y))
|
||||||
var bgId =
|
var bgId =
|
||||||
core.getBlockByNumber(core.getBgNumber(x, y)).event.id ||
|
core.getBlockByNumber(core.getBgNumber(x, y)).event.id || '';
|
||||||
'';
|
|
||||||
else var bgId = '';
|
else var bgId = '';
|
||||||
if (
|
if (
|
||||||
core.noPass(x, y) ||
|
core.noPass(x, y) ||
|
||||||
@ -174,9 +166,8 @@
|
|||||||
if (!startNo) return checkNoPass(direction, x, y, false);
|
if (!startNo) return checkNoPass(direction, x, y, false);
|
||||||
return { x: x, y: y };
|
return { x: x, y: y };
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.skillEffects = {
|
core.plugin.skillEffects = {
|
||||||
jumpSkill
|
jumpSkill
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,29 +1,27 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
// 负责勇士技能:学习
|
||||||
// 负责勇士技能:学习
|
const values = {
|
||||||
const values = {
|
|
||||||
1: ['crit'],
|
1: ['crit'],
|
||||||
6: ['n'],
|
6: ['n'],
|
||||||
7: ['hungry'],
|
7: ['hungry'],
|
||||||
8: ['together'],
|
8: ['together'],
|
||||||
10: ['courage'],
|
10: ['courage'],
|
||||||
11: ['charge']
|
11: ['charge']
|
||||||
};
|
};
|
||||||
|
|
||||||
const cannotStudy = [9, 12, 14, 15, 24];
|
const cannotStudy = [9, 12, 14, 15, 24];
|
||||||
|
|
||||||
function canStudySkill(number) {
|
export function canStudySkill(number) {
|
||||||
const s = (core.status.hero.special ??= { num: [], last: [] });
|
const s = (core.status.hero.special ??= { num: [], last: [] });
|
||||||
if (core.plugin.skillTree.getSkillLevel(11) === 0) return false;
|
if (core.plugin.skillTree.getSkillLevel(11) === 0) return false;
|
||||||
if (s.num.length >= 1) return false;
|
if (s.num.length >= 1) return false;
|
||||||
if (s.num.includes(number)) return false;
|
if (s.num.includes(number)) return false;
|
||||||
if (cannotStudy.includes(number)) return false;
|
if (cannotStudy.includes(number)) return false;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
function studySkill(enemy, number) {
|
export function studySkill(enemy, number) {
|
||||||
core.status.hero.special ??= { num: [], last: [] };
|
core.status.hero.special ??= { num: [], last: [] };
|
||||||
const s = core.status.hero.special;
|
const s = core.status.hero.special;
|
||||||
const specials = core.getSpecials();
|
const specials = core.getSpecials();
|
||||||
@ -41,9 +39,9 @@
|
|||||||
for (const key of value) {
|
for (const key of value) {
|
||||||
s[key] = enemy[key];
|
s[key] = enemy[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function forgetStudiedSkill(num, i) {
|
export function forgetStudiedSkill(num, i) {
|
||||||
const s = core.status.hero.special;
|
const s = core.status.hero.special;
|
||||||
const index = i !== void 0 && i !== null ? i : s.num.indexOf(num);
|
const index = i !== void 0 && i !== null ? i : s.num.indexOf(num);
|
||||||
if (index === -1) return;
|
if (index === -1) return;
|
||||||
@ -53,14 +51,14 @@
|
|||||||
for (const key of value) {
|
for (const key of value) {
|
||||||
delete s[key];
|
delete s[key];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function declineStudiedSkill() {
|
export function declineStudiedSkill() {
|
||||||
const s = (core.status.hero.special ??= { num: [], last: [] });
|
const s = (core.status.hero.special ??= { num: [], last: [] });
|
||||||
s.last = s.last.map(v => v - 1);
|
s.last = s.last.map(v => v - 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
function checkStudiedSkill() {
|
export function checkStudiedSkill() {
|
||||||
const s = core.status.hero.special;
|
const s = core.status.hero.special;
|
||||||
for (let i = 0; i < s.last.length; i++) {
|
for (let i = 0; i < s.last.length; i++) {
|
||||||
if (s.last[i] <= 0) {
|
if (s.last[i] <= 0) {
|
||||||
@ -68,13 +66,12 @@
|
|||||||
i--;
|
i--;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.study = {
|
core.plugin.study = {
|
||||||
canStudySkill,
|
canStudySkill,
|
||||||
studySkill,
|
studySkill,
|
||||||
forgetStudiedSkill,
|
forgetStudiedSkill,
|
||||||
declineStudiedSkill,
|
declineStudiedSkill,
|
||||||
checkStudiedSkill
|
checkStudiedSkill
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,18 +1,16 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
// 1000多行,改不动了
|
// 1000多行,改不动了,原来什么样就什么样吧
|
||||||
|
|
||||||
(function () {
|
// 智慧boss
|
||||||
// 智慧boss
|
// 变量们
|
||||||
// 变量们
|
var stage = 1,
|
||||||
var stage = 1,
|
|
||||||
hp = 10000,
|
hp = 10000,
|
||||||
seconds = 0,
|
seconds = 0,
|
||||||
boomLocs = [], // 随机轰炸
|
boomLocs = [], // 随机轰炸
|
||||||
heroHp;
|
heroHp;
|
||||||
// 初始化
|
// 初始化
|
||||||
function initTowerBoss() {
|
function initTowerBoss() {
|
||||||
stage = 1;
|
stage = 1;
|
||||||
hp = 10000;
|
hp = 10000;
|
||||||
seconds = 0;
|
seconds = 0;
|
||||||
@ -21,9 +19,9 @@
|
|||||||
autoFixRouteBoss(true);
|
autoFixRouteBoss(true);
|
||||||
core.insertAction([{ type: 'sleep', time: 1000, noSkip: true }]);
|
core.insertAction([{ type: 'sleep', time: 1000, noSkip: true }]);
|
||||||
setTimeout(bossCore, 1000);
|
setTimeout(bossCore, 1000);
|
||||||
}
|
}
|
||||||
// 录像自动修正
|
// 录像自动修正
|
||||||
function autoFixRouteBoss(isStart) {
|
export function autoFixRouteBoss(isStart) {
|
||||||
var route = core.status.route;
|
var route = core.status.route;
|
||||||
if (isStart) {
|
if (isStart) {
|
||||||
// 开始修正 记录当前录像长度
|
// 开始修正 记录当前录像长度
|
||||||
@ -34,9 +32,9 @@
|
|||||||
route.splice(flags.startFix);
|
route.splice(flags.startFix);
|
||||||
route.push('choices:0');
|
route.push('choices:0');
|
||||||
delete flags.startFix;
|
delete flags.startFix;
|
||||||
}
|
}
|
||||||
// 血条
|
// 血条
|
||||||
function healthBar(now, total) {
|
function healthBar(now, total) {
|
||||||
var nowLength = (now / total) * 476; // 当前血量下绘制长度
|
var nowLength = (now / total) * 476; // 当前血量下绘制长度
|
||||||
var color = [
|
var color = [
|
||||||
255 * 2 - (now / total) * 2 * 255,
|
255 * 2 - (now / total) * 2 * 255,
|
||||||
@ -79,9 +77,9 @@
|
|||||||
'#ffffff',
|
'#ffffff',
|
||||||
'16px normal'
|
'16px normal'
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
// 血量变化
|
// 血量变化
|
||||||
function dynamicChangeHp(from, to, total) {
|
function dynamicChangeHp(from, to, total) {
|
||||||
var frame = 0,
|
var frame = 0,
|
||||||
speed = (to - from) / 50,
|
speed = (to - from) / 50,
|
||||||
now = from;
|
now = from;
|
||||||
@ -94,15 +92,14 @@
|
|||||||
now += speed;
|
now += speed;
|
||||||
healthBar(now, total);
|
healthBar(now, total);
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
// boss说话跳字
|
// boss说话跳字
|
||||||
function skipWord(words, x, y, time) {
|
function skipWord(words, x, y, time) {
|
||||||
x = x || 0;
|
x = x || 0;
|
||||||
y = y || 16;
|
y = y || 16;
|
||||||
time = time || 3000;
|
time = time || 3000;
|
||||||
// 创建画布
|
// 创建画布
|
||||||
if (!core.dymCanvas.words)
|
if (!core.dymCanvas.words) core.createCanvas('words', x, y, 480, 24, 135);
|
||||||
core.createCanvas('words', x, y, 480, 24, 135);
|
|
||||||
else core.clearMap('words');
|
else core.clearMap('words');
|
||||||
if (flags.wordsTimeOut) clearTimeout(flags.wordsTimeOut);
|
if (flags.wordsTimeOut) clearTimeout(flags.wordsTimeOut);
|
||||||
dynamicCurtain(y, y + 24, time / 3);
|
dynamicCurtain(y, y + 24, time / 3);
|
||||||
@ -145,9 +142,9 @@
|
|||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 匀变速下降背景
|
// 匀变速下降背景
|
||||||
function dynamicCurtain(from, to, time, width) {
|
function dynamicCurtain(from, to, time, width) {
|
||||||
width = width || 480;
|
width = width || 480;
|
||||||
if (!core.dymCanvas.wordsBg)
|
if (!core.dymCanvas.wordsBg)
|
||||||
core.createCanvas('wordsBg', 0, from, width, 24, 130);
|
core.createCanvas('wordsBg', 0, from, width, 24, 130);
|
||||||
@ -166,14 +163,7 @@
|
|||||||
core.clearMap('wordsBg');
|
core.clearMap('wordsBg');
|
||||||
style.shadowBlur = 8;
|
style.shadowBlur = 8;
|
||||||
style.shadowOffsetY = 2;
|
style.shadowOffsetY = 2;
|
||||||
core.fillRect(
|
core.fillRect('wordsBg', 0, 0, width, ny - from, [180, 180, 180, 0.7]);
|
||||||
'wordsBg',
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
width,
|
|
||||||
ny - from,
|
|
||||||
[180, 180, 180, 0.7]
|
|
||||||
);
|
|
||||||
style.shadowBlur = 3;
|
style.shadowBlur = 3;
|
||||||
style.shadowOffsetY = 0;
|
style.shadowOffsetY = 0;
|
||||||
core.strokeRect(
|
core.strokeRect(
|
||||||
@ -211,9 +201,9 @@
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
// 攻击boss
|
// 攻击boss
|
||||||
function attackBoss() {
|
function attackBoss() {
|
||||||
// 每秒钟地面随机出现伤害图块 踩上去攻击boss 500血
|
// 每秒钟地面随机出现伤害图块 踩上去攻击boss 500血
|
||||||
if (flags.canAttack) return;
|
if (flags.canAttack) return;
|
||||||
if (Math.random() < 0.8) return;
|
if (Math.random() < 0.8) return;
|
||||||
@ -314,9 +304,9 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
// 核心函数
|
// 核心函数
|
||||||
function bossCore() {
|
function bossCore() {
|
||||||
var interval = window.setInterval(() => {
|
var interval = window.setInterval(() => {
|
||||||
if (stage == 1) {
|
if (stage == 1) {
|
||||||
if (seconds == 8) skipWord('智慧之神:果然,你和别人不一样。');
|
if (seconds == 8) skipWord('智慧之神:果然,你和别人不一样。');
|
||||||
@ -340,10 +330,8 @@
|
|||||||
}
|
}
|
||||||
if (stage == 2) {
|
if (stage == 2) {
|
||||||
if (seconds == 4) skipWord('智慧之神:你的确拥有智慧。');
|
if (seconds == 4) skipWord('智慧之神:你的确拥有智慧。');
|
||||||
if (seconds == 8)
|
if (seconds == 8) skipWord('智慧之神:或许你就是那个未来的救星。');
|
||||||
skipWord('智慧之神:或许你就是那个未来的救星。');
|
if (seconds == 12) skipWord('智慧之神:不过,这场战斗才刚刚开始');
|
||||||
if (seconds == 12)
|
|
||||||
skipWord('智慧之神:不过,这场战斗才刚刚开始');
|
|
||||||
if (seconds == 25) skipWord('提示:方形区域均为危险区域');
|
if (seconds == 25) skipWord('提示:方形区域均为危险区域');
|
||||||
if (seconds == 15)
|
if (seconds == 15)
|
||||||
setTimeout(() => {
|
setTimeout(() => {
|
||||||
@ -362,8 +350,7 @@
|
|||||||
}
|
}
|
||||||
if (stage >= 3) {
|
if (stage >= 3) {
|
||||||
if (seconds == 4) skipWord('智慧之神:拥有智慧就是不一样。');
|
if (seconds == 4) skipWord('智慧之神:拥有智慧就是不一样。');
|
||||||
if (seconds == 8)
|
if (seconds == 8) skipWord('智慧之神:不过,你还得再过我一关!');
|
||||||
skipWord('智慧之神:不过,你还得再过我一关!');
|
|
||||||
if (seconds == 12) startStage3();
|
if (seconds == 12) startStage3();
|
||||||
if (seconds == 15) {
|
if (seconds == 15) {
|
||||||
flags.booming = true;
|
flags.booming = true;
|
||||||
@ -419,10 +406,10 @@
|
|||||||
}
|
}
|
||||||
seconds++;
|
seconds++;
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
// ------ 第一阶段 10000~7000血 ------ //
|
// ------ 第一阶段 10000~7000血 ------ //
|
||||||
// 技能1 智慧之箭 1000伤害
|
// 技能1 智慧之箭 1000伤害
|
||||||
function intelligentArrow(fromSelf) {
|
function intelligentArrow(fromSelf) {
|
||||||
// 坐标
|
// 坐标
|
||||||
var loc = Math.floor(Math.random() * 13 + 1);
|
var loc = Math.floor(Math.random() * 13 + 1);
|
||||||
var direction = Math.random() > 0.5 ? 'horizon' : 'vertical';
|
var direction = Math.random() > 0.5 ? 'horizon' : 'vertical';
|
||||||
@ -469,14 +456,7 @@
|
|||||||
}
|
}
|
||||||
// 箭
|
// 箭
|
||||||
if (!core.dymCanvas['inteArrow' + loc + direction])
|
if (!core.dymCanvas['inteArrow' + loc + direction])
|
||||||
core.createCanvas(
|
core.createCanvas('inteArrow' + loc + direction, 0, 0, 544, 544, 65);
|
||||||
'inteArrow' + loc + direction,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
544,
|
|
||||||
544,
|
|
||||||
65
|
|
||||||
);
|
|
||||||
core.clearMap('inteArrow' + loc + direction);
|
core.clearMap('inteArrow' + loc + direction);
|
||||||
if (direction == 'horizon')
|
if (direction == 'horizon')
|
||||||
core.drawImage(
|
core.drawImage(
|
||||||
@ -514,8 +494,7 @@
|
|||||||
nloc += speed;
|
nloc += speed;
|
||||||
if (direction == 'horizon')
|
if (direction == 'horizon')
|
||||||
core.relocateCanvas('inteArrow' + loc + direction, nloc, 0);
|
core.relocateCanvas('inteArrow' + loc + direction, nloc, 0);
|
||||||
else
|
else core.relocateCanvas('inteArrow' + loc + direction, 0, nloc);
|
||||||
core.relocateCanvas('inteArrow' + loc + direction, 0, nloc);
|
|
||||||
if (nloc < -480) {
|
if (nloc < -480) {
|
||||||
core.deleteCanvas('inteArrow' + loc + direction);
|
core.deleteCanvas('inteArrow' + loc + direction);
|
||||||
clearInterval(skill1);
|
clearInterval(skill1);
|
||||||
@ -558,9 +537,9 @@
|
|||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
}, 3000);
|
}, 3000);
|
||||||
}
|
}
|
||||||
// 技能2 智慧之门 随机传送
|
// 技能2 智慧之门 随机传送
|
||||||
function intelligentDoor() {
|
function intelligentDoor() {
|
||||||
if (Math.random() < 0.5) return;
|
if (Math.random() < 0.5) return;
|
||||||
// 随机位置
|
// 随机位置
|
||||||
var toX = Math.floor(Math.random() * 13) + 1,
|
var toX = Math.floor(Math.random() * 13) + 1,
|
||||||
@ -618,9 +597,9 @@
|
|||||||
3
|
3
|
||||||
);
|
);
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
// 技能3 万冰之势 全屏随机转换滑冰 如果转换时在滑冰上造成5000点伤害
|
// 技能3 万冰之势 全屏随机转换滑冰 如果转换时在滑冰上造成5000点伤害
|
||||||
function icyMomentem() {
|
function icyMomentem() {
|
||||||
if (flags.haveIce) return;
|
if (flags.haveIce) return;
|
||||||
if (Math.random() < 0.5) return;
|
if (Math.random() < 0.5) return;
|
||||||
var times = Math.floor(Math.random() * 100);
|
var times = Math.floor(Math.random() * 100);
|
||||||
@ -705,10 +684,10 @@
|
|||||||
}
|
}
|
||||||
}, 50);
|
}, 50);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ------ 第二阶段 7000~3500 ------ //
|
// ------ 第二阶段 7000~3500 ------ //
|
||||||
// 开始第二阶段
|
// 开始第二阶段
|
||||||
function startStage2() {
|
function startStage2() {
|
||||||
// 闪烁
|
// 闪烁
|
||||||
core.createCanvas('flash', 0, 0, 480, 480, 160);
|
core.createCanvas('flash', 0, 0, 480, 480, 160);
|
||||||
var alpha = 0;
|
var alpha = 0;
|
||||||
@ -737,10 +716,10 @@
|
|||||||
// bgm
|
// bgm
|
||||||
core.playBgm('towerBoss2.mp3');
|
core.playBgm('towerBoss2.mp3');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----- 打雷相关 ----- //
|
// ----- 打雷相关 ----- //
|
||||||
// 随机打雷
|
// 随机打雷
|
||||||
function randomThunder() {
|
function randomThunder() {
|
||||||
var x = Math.floor(Math.random() * 13) + 1,
|
var x = Math.floor(Math.random() * 13) + 1,
|
||||||
y = Math.floor(Math.random() * 13) + 1,
|
y = Math.floor(Math.random() * 13) + 1,
|
||||||
power = Math.ceil(Math.random() * 6);
|
power = Math.ceil(Math.random() * 6);
|
||||||
@ -769,9 +748,9 @@
|
|||||||
core.deleteCanvas('thunderDanger');
|
core.deleteCanvas('thunderDanger');
|
||||||
drawThunder(x, y, power);
|
drawThunder(x, y, power);
|
||||||
}, 1000);
|
}, 1000);
|
||||||
}
|
}
|
||||||
// 绘制
|
// 绘制
|
||||||
function drawThunder(x, y, power) {
|
function drawThunder(x, y, power) {
|
||||||
var route = getThunderRoute(x * 32 + 16, y * 32 + 16, power);
|
var route = getThunderRoute(x * 32 + 16, y * 32 + 16, power);
|
||||||
// 开始绘制
|
// 开始绘制
|
||||||
if (!core.dymCanvas.thunder)
|
if (!core.dymCanvas.thunder)
|
||||||
@ -802,8 +781,7 @@
|
|||||||
// 闪一下
|
// 闪一下
|
||||||
var frame1 = 0,
|
var frame1 = 0,
|
||||||
alpha = 0.5;
|
alpha = 0.5;
|
||||||
if (!core.dymCanvas.flash)
|
if (!core.dymCanvas.flash) core.createCanvas('flash', 0, 0, 480, 480, 160);
|
||||||
core.createCanvas('flash', 0, 0, 480, 480, 160);
|
|
||||||
else core.clearMap('flash');
|
else core.clearMap('flash');
|
||||||
var thunderFlash = window.setInterval(() => {
|
var thunderFlash = window.setInterval(() => {
|
||||||
alpha -= 0.05;
|
alpha -= 0.05;
|
||||||
@ -819,9 +797,9 @@
|
|||||||
}, 700);
|
}, 700);
|
||||||
}
|
}
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
// 获得雷电路径
|
// 获得雷电路径
|
||||||
function getThunderRoute(x, y, power) {
|
function getThunderRoute(x, y, power) {
|
||||||
var route = [];
|
var route = [];
|
||||||
for (var num = 0; num < power; num++) {
|
for (var num = 0; num < power; num++) {
|
||||||
var nx = x,
|
var nx = x,
|
||||||
@ -839,9 +817,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
return route;
|
return route;
|
||||||
}
|
}
|
||||||
// 打雷伤害判定
|
// 打雷伤害判定
|
||||||
function getThunderDamage(x, y, power) {
|
function getThunderDamage(x, y, power) {
|
||||||
var hx = core.status.hero.loc.x,
|
var hx = core.status.hero.loc.x,
|
||||||
hy = core.status.hero.loc.y;
|
hy = core.status.hero.loc.y;
|
||||||
if (Math.abs(hx - x) <= 1 && Math.abs(hy - y) <= 1) {
|
if (Math.abs(hx - x) <= 1 && Math.abs(hy - y) <= 1) {
|
||||||
@ -855,10 +833,10 @@
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ----- 打雷 END ----- //
|
// ----- 打雷 END ----- //
|
||||||
// 球形闪电 横竖
|
// 球形闪电 横竖
|
||||||
function ballThunder() {
|
function ballThunder() {
|
||||||
// 随机数量
|
// 随机数量
|
||||||
var times = Math.ceil(Math.random() * 12) + 6;
|
var times = Math.ceil(Math.random() * 12) + 6;
|
||||||
var now = 0,
|
var now = 0,
|
||||||
@ -1002,12 +980,10 @@
|
|||||||
y = core.status.hero.loc.y;
|
y = core.status.hero.loc.y;
|
||||||
if (
|
if (
|
||||||
((Math.floor((nx - 16 - 4 * now) / 32) == x ||
|
((Math.floor((nx - 16 - 4 * now) / 32) == x ||
|
||||||
Math.floor((nx - 16 + 4 * now) / 32) ==
|
Math.floor((nx - 16 + 4 * now) / 32) == x) &&
|
||||||
x) &&
|
|
||||||
locs[i][1] == y) ||
|
locs[i][1] == y) ||
|
||||||
((Math.floor((ny - 16 - 4 * now) / 32) == y ||
|
((Math.floor((ny - 16 - 4 * now) / 32) == y ||
|
||||||
Math.floor((ny - 16 + 4 * now) / 32) ==
|
Math.floor((ny - 16 + 4 * now) / 32) == y) &&
|
||||||
y) &&
|
|
||||||
locs[i][0] == x)
|
locs[i][0] == x)
|
||||||
) {
|
) {
|
||||||
damaged[i] = true;
|
damaged[i] = true;
|
||||||
@ -1033,9 +1009,9 @@
|
|||||||
frame++;
|
frame++;
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// ------ 第三阶段 3500~0 ------ //
|
// ------ 第三阶段 3500~0 ------ //
|
||||||
function startStage3() {
|
function startStage3() {
|
||||||
// 闪烁
|
// 闪烁
|
||||||
core.createCanvas('flash', 0, 0, 480, 480, 160);
|
core.createCanvas('flash', 0, 0, 480, 480, 160);
|
||||||
var alpha = 0;
|
var alpha = 0;
|
||||||
@ -1076,18 +1052,7 @@
|
|||||||
}
|
}
|
||||||
core.createCanvas('tower7', 0, 0, 480, 480, 15);
|
core.createCanvas('tower7', 0, 0, 480, 480, 15);
|
||||||
// 画贴图
|
// 画贴图
|
||||||
core.drawImage(
|
core.drawImage('tower7', 'tower7.jpeg', 360, 0, 32, 480, 0, 0, 32, 480);
|
||||||
'tower7',
|
|
||||||
'tower7.jpeg',
|
|
||||||
360,
|
|
||||||
0,
|
|
||||||
32,
|
|
||||||
480,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
32,
|
|
||||||
480
|
|
||||||
);
|
|
||||||
core.drawImage(
|
core.drawImage(
|
||||||
'tower7',
|
'tower7',
|
||||||
'tower7.jpeg',
|
'tower7.jpeg',
|
||||||
@ -1127,9 +1092,9 @@
|
|||||||
core.setBlock('E557', 7, 2);
|
core.setBlock('E557', 7, 2);
|
||||||
core.playBgm('towerBoss3.mp3');
|
core.playBgm('towerBoss3.mp3');
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 进入第四阶段
|
// 进入第四阶段
|
||||||
function startStage4() {
|
function startStage4() {
|
||||||
// 闪烁
|
// 闪烁
|
||||||
core.createCanvas('flash', 0, 0, 480, 480, 160);
|
core.createCanvas('flash', 0, 0, 480, 480, 160);
|
||||||
var alpha = 0;
|
var alpha = 0;
|
||||||
@ -1170,18 +1135,7 @@
|
|||||||
}
|
}
|
||||||
core.createCanvas('tower7', 0, 0, 480, 480, 15);
|
core.createCanvas('tower7', 0, 0, 480, 480, 15);
|
||||||
// 画贴图
|
// 画贴图
|
||||||
core.drawImage(
|
core.drawImage('tower7', 'tower7.jpeg', 360, 0, 64, 480, 0, 0, 64, 480);
|
||||||
'tower7',
|
|
||||||
'tower7.jpeg',
|
|
||||||
360,
|
|
||||||
0,
|
|
||||||
64,
|
|
||||||
480,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
64,
|
|
||||||
480
|
|
||||||
);
|
|
||||||
core.drawImage(
|
core.drawImage(
|
||||||
'tower7',
|
'tower7',
|
||||||
'tower7.jpeg',
|
'tower7.jpeg',
|
||||||
@ -1220,9 +1174,9 @@
|
|||||||
);
|
);
|
||||||
core.setBlock('E557', 7, 3);
|
core.setBlock('E557', 7, 3);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 进入第五阶段
|
// 进入第五阶段
|
||||||
function startStage5() {
|
function startStage5() {
|
||||||
// 闪烁
|
// 闪烁
|
||||||
core.createCanvas('flash', 0, 0, 480, 480, 160);
|
core.createCanvas('flash', 0, 0, 480, 480, 160);
|
||||||
var alpha = 0;
|
var alpha = 0;
|
||||||
@ -1263,18 +1217,7 @@
|
|||||||
}
|
}
|
||||||
core.createCanvas('tower7', 0, 0, 480, 480, 15);
|
core.createCanvas('tower7', 0, 0, 480, 480, 15);
|
||||||
// 画贴图
|
// 画贴图
|
||||||
core.drawImage(
|
core.drawImage('tower7', 'tower7.jpeg', 360, 0, 96, 480, 0, 0, 96, 480);
|
||||||
'tower7',
|
|
||||||
'tower7.jpeg',
|
|
||||||
360,
|
|
||||||
0,
|
|
||||||
96,
|
|
||||||
480,
|
|
||||||
0,
|
|
||||||
0,
|
|
||||||
96,
|
|
||||||
480
|
|
||||||
);
|
|
||||||
core.drawImage(
|
core.drawImage(
|
||||||
'tower7',
|
'tower7',
|
||||||
'tower7.jpeg',
|
'tower7.jpeg',
|
||||||
@ -1313,9 +1256,9 @@
|
|||||||
);
|
);
|
||||||
core.setBlock('E557', 7, 4);
|
core.setBlock('E557', 7, 4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
// 链状闪电 随机连接 碰到勇士则受伤
|
// 链状闪电 随机连接 碰到勇士则受伤
|
||||||
function chainThunder() {
|
function chainThunder() {
|
||||||
// 随机次数
|
// 随机次数
|
||||||
var times = Math.ceil(Math.random() * 6) + 3;
|
var times = Math.ceil(Math.random() * 6) + 3;
|
||||||
// 画布
|
// 画布
|
||||||
@ -1360,13 +1303,12 @@
|
|||||||
}
|
}
|
||||||
now++;
|
now++;
|
||||||
}, 100);
|
}, 100);
|
||||||
}
|
}
|
||||||
// 链状闪电 动画
|
// 链状闪电 动画
|
||||||
function chainAnimate(route) {
|
function chainAnimate(route) {
|
||||||
if (!route) return chainThunder();
|
if (!route) return chainThunder();
|
||||||
// 画布
|
// 画布
|
||||||
if (!core.dymCanvas.chain)
|
if (!core.dymCanvas.chain) core.createCanvas('chain', 0, 0, 480, 480, 65);
|
||||||
core.createCanvas('chain', 0, 0, 480, 480, 65);
|
|
||||||
else core.clearMap('chain');
|
else core.clearMap('chain');
|
||||||
var style = core.dymCanvas.chain;
|
var style = core.dymCanvas.chain;
|
||||||
style.shadowBlur = 3;
|
style.shadowBlur = 3;
|
||||||
@ -1396,13 +1338,7 @@
|
|||||||
);
|
);
|
||||||
// 节点
|
// 节点
|
||||||
if (now == 0) {
|
if (now == 0) {
|
||||||
core.fillCircle(
|
core.fillCircle('chain', route[0][0], route[0][1], 7, '#ffffff');
|
||||||
'chain',
|
|
||||||
route[0][0],
|
|
||||||
route[0][1],
|
|
||||||
7,
|
|
||||||
'#ffffff'
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
if (
|
if (
|
||||||
(route[now + 1][0] - 16) % 32 == 0 &&
|
(route[now + 1][0] - 16) % 32 == 0 &&
|
||||||
@ -1426,9 +1362,9 @@
|
|||||||
);
|
);
|
||||||
now++;
|
now++;
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
// 链状闪电 获得闪电路径
|
// 链状闪电 获得闪电路径
|
||||||
function getChainRoute(locs) {
|
function getChainRoute(locs) {
|
||||||
// 照样用setInterval
|
// 照样用setInterval
|
||||||
var now = 0,
|
var now = 0,
|
||||||
routes = [];
|
routes = [];
|
||||||
@ -1449,10 +1385,7 @@
|
|||||||
nx += Math.random() * 50 * Math.cos(angle);
|
nx += Math.random() * 50 * Math.cos(angle);
|
||||||
ny += Math.random() * 50 * Math.sin(angle);
|
ny += Math.random() * 50 * Math.sin(angle);
|
||||||
routes.push([nx, ny]);
|
routes.push([nx, ny]);
|
||||||
if (
|
if (Math.sqrt(Math.pow(ny - ty, 2) + Math.pow(nx - tx, 2)) <= 100) {
|
||||||
Math.sqrt(Math.pow(ny - ty, 2) + Math.pow(nx - tx, 2)) <=
|
|
||||||
100
|
|
||||||
) {
|
|
||||||
routes.push([tx, ty]);
|
routes.push([tx, ty]);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@ -1468,9 +1401,9 @@
|
|||||||
chainAnimate(routes);
|
chainAnimate(routes);
|
||||||
}
|
}
|
||||||
}, 2);
|
}, 2);
|
||||||
}
|
}
|
||||||
// 随机轰炸
|
// 随机轰炸
|
||||||
function randomBoom() {
|
function randomBoom() {
|
||||||
// 停止轰炸
|
// 停止轰炸
|
||||||
if (!flags.booming) {
|
if (!flags.booming) {
|
||||||
clearInterval(flags.boom);
|
clearInterval(flags.boom);
|
||||||
@ -1498,9 +1431,9 @@
|
|||||||
}, boomTime);
|
}, boomTime);
|
||||||
// 动画要在这里调用
|
// 动画要在这里调用
|
||||||
boomingAnimate();
|
boomingAnimate();
|
||||||
}
|
}
|
||||||
// 随机轰炸 动画
|
// 随机轰炸 动画
|
||||||
function boomingAnimate() {
|
function boomingAnimate() {
|
||||||
// 直接setInterval
|
// 直接setInterval
|
||||||
if (!core.dymCanvas.boom) core.createCanvas('boom', 0, 0, 480, 480, 65);
|
if (!core.dymCanvas.boom) core.createCanvas('boom', 0, 0, 480, 480, 65);
|
||||||
else core.clearMap('boom');
|
else core.clearMap('boom');
|
||||||
@ -1525,14 +1458,7 @@
|
|||||||
var angle = (loc[2] * Math.PI) / 50;
|
var angle = (loc[2] * Math.PI) / 50;
|
||||||
// 开始绘制
|
// 开始绘制
|
||||||
core.fillCircle('boom', x, y, 3, [255, 50, 50, alpha]);
|
core.fillCircle('boom', x, y, 3, [255, 50, 50, alpha]);
|
||||||
core.strokeCircle(
|
core.strokeCircle('boom', x, y, radius, [255, 50, 50, alpha], 2);
|
||||||
'boom',
|
|
||||||
x,
|
|
||||||
y,
|
|
||||||
radius,
|
|
||||||
[255, 50, 50, alpha],
|
|
||||||
2
|
|
||||||
);
|
|
||||||
// 旋转的线
|
// 旋转的线
|
||||||
core.drawLine(
|
core.drawLine(
|
||||||
'boom',
|
'boom',
|
||||||
@ -1556,16 +1482,11 @@
|
|||||||
// 炸弹 下落
|
// 炸弹 下落
|
||||||
if (loc[2] > 70) {
|
if (loc[2] > 70) {
|
||||||
var h =
|
var h =
|
||||||
y -
|
y - (20 * (85 - loc[2]) + 2.8 * Math.pow(85 - loc[2], 2));
|
||||||
(20 * (85 - loc[2]) + 2.8 * Math.pow(85 - loc[2], 2));
|
|
||||||
core.drawImage('boom', 'boom.png', x - 18, h - 80, 36, 80);
|
core.drawImage('boom', 'boom.png', x - 18, h - 80, 36, 80);
|
||||||
}
|
}
|
||||||
if (loc[2] == 85) {
|
if (loc[2] == 85) {
|
||||||
core.drawAnimate(
|
core.drawAnimate('explosion1', (x - 16) / 32, (y - 16) / 32);
|
||||||
'explosion1',
|
|
||||||
(x - 16) / 32,
|
|
||||||
(y - 16) / 32
|
|
||||||
);
|
|
||||||
boomLocs.splice(index, 1);
|
boomLocs.splice(index, 1);
|
||||||
if (boomLocs.length == 0) core.deleteCanvas('boom');
|
if (boomLocs.length == 0) core.deleteCanvas('boom');
|
||||||
// 伤害判定
|
// 伤害判定
|
||||||
@ -1587,9 +1508,9 @@
|
|||||||
}
|
}
|
||||||
});
|
});
|
||||||
}, 20);
|
}, 20);
|
||||||
}
|
}
|
||||||
// 直线型伤害判定
|
// 直线型伤害判定
|
||||||
function lineDamage(x1, y1, x2, y2, damage) {
|
function lineDamage(x1, y1, x2, y2, damage) {
|
||||||
// 获得勇士坐标
|
// 获得勇士坐标
|
||||||
var x = core.status.hero.loc.x,
|
var x = core.status.hero.loc.x,
|
||||||
y = core.status.hero.loc.y;
|
y = core.status.hero.loc.y;
|
||||||
@ -1608,10 +1529,8 @@
|
|||||||
var loc1 = [x * 32 - 12, y * 32 + 16],
|
var loc1 = [x * 32 - 12, y * 32 + 16],
|
||||||
loc2 = [x * 32 + 12, y * 32 - 16];
|
loc2 = [x * 32 + 12, y * 32 - 16];
|
||||||
// 直线方程 y == (y2 - y1) / (x2 - x1) * (x - x1) + y1
|
// 直线方程 y == (y2 - y1) / (x2 - x1) * (x - x1) + y1
|
||||||
var n1 =
|
var n1 = ((y2 - y1) / (x2 - x1)) * (loc1[0] - x1) + y1 - loc1[1],
|
||||||
((y2 - y1) / (x2 - x1)) * (loc1[0] - x1) + y1 - loc1[1],
|
n2 = ((y2 - y1) / (x2 - x1)) * (loc2[0] - x1) + y1 - loc2[1];
|
||||||
n2 =
|
|
||||||
((y2 - y1) / (x2 - x1)) * (loc2[0] - x1) + y1 - loc2[1];
|
|
||||||
if (n1 * n2 <= 0) {
|
if (n1 * n2 <= 0) {
|
||||||
core.status.hero.hp -= damage;
|
core.status.hero.hp -= damage;
|
||||||
core.addPop(x * 32 + 16, y * 32 + 16, -damage);
|
core.addPop(x * 32 + 16, y * 32 + 16, -damage);
|
||||||
@ -1630,10 +1549,8 @@
|
|||||||
var loc1 = [x * 32 - 12, y * 32 - 16],
|
var loc1 = [x * 32 - 12, y * 32 - 16],
|
||||||
loc2 = [x * 32 + 12, y * 32 + 16];
|
loc2 = [x * 32 + 12, y * 32 + 16];
|
||||||
// 直线方程 y == (y2 - y1) / (x2 - x1) * (x - x1) + y1
|
// 直线方程 y == (y2 - y1) / (x2 - x1) * (x - x1) + y1
|
||||||
var n1 =
|
var n1 = ((y2 - y1) / (x2 - x1)) * (loc1[0] - x1) + y1 - loc1[1],
|
||||||
((y2 - y1) / (x2 - x1)) * (loc1[0] - x1) + y1 - loc1[1],
|
n2 = ((y2 - y1) / (x2 - x1)) * (loc2[0] - x1) + y1 - loc2[1];
|
||||||
n2 =
|
|
||||||
((y2 - y1) / (x2 - x1)) * (loc2[0] - x1) + y1 - loc2[1];
|
|
||||||
if (n1 * n2 <= 0) {
|
if (n1 * n2 <= 0) {
|
||||||
core.status.hero.hp -= damage;
|
core.status.hero.hp -= damage;
|
||||||
core.addPop(x * 32 + 16, y * 32 + 16, -damage);
|
core.addPop(x * 32 + 16, y * 32 + 16, -damage);
|
||||||
@ -1649,10 +1566,9 @@
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.towerBoss = {
|
core.plugin.towerBoss = {
|
||||||
initTowerBoss,
|
initTowerBoss,
|
||||||
autoFixRouteBoss
|
autoFixRouteBoss
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -1,5 +1,5 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
export {};
|
||||||
|
|
||||||
(function () {
|
(function () {
|
||||||
if (main.replayChecking) return (core.plugin.gameUi = {});
|
if (main.replayChecking) return (core.plugin.gameUi = {});
|
||||||
|
@ -1,13 +1,11 @@
|
|||||||
///<reference path="../../../src/types/core.d.ts" />
|
///<reference path="../../../src/types/core.d.ts" />
|
||||||
'use strict';
|
|
||||||
|
|
||||||
(function () {
|
/**
|
||||||
/**
|
|
||||||
* 滑动数组
|
* 滑动数组
|
||||||
* @param {any[]} arr
|
* @param {any[]} arr
|
||||||
* @param {number} delta
|
* @param {number} delta
|
||||||
*/
|
*/
|
||||||
function slide(arr, delta) {
|
export function slide(arr, delta) {
|
||||||
if (delta === 0) return arr;
|
if (delta === 0) return arr;
|
||||||
delta %= arr.length;
|
delta %= arr.length;
|
||||||
if (delta > 0) {
|
if (delta > 0) {
|
||||||
@ -18,22 +16,22 @@
|
|||||||
arr.push(...arr.splice(0, -delta));
|
arr.push(...arr.splice(0, -delta));
|
||||||
return arr;
|
return arr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
function backDir(dir) {
|
export function backDir(dir) {
|
||||||
return {
|
return {
|
||||||
up: 'down',
|
up: 'down',
|
||||||
down: 'up',
|
down: 'up',
|
||||||
left: 'right',
|
left: 'right',
|
||||||
right: 'left'
|
right: 'left'
|
||||||
}[dir];
|
}[dir];
|
||||||
}
|
}
|
||||||
|
|
||||||
function has(v) {
|
export function has(v) {
|
||||||
return v !== null && v !== void 0;
|
return v !== null && v !== void 0;
|
||||||
}
|
}
|
||||||
|
|
||||||
function maxGameScale(n = 0) {
|
export function maxGameScale(n = 0) {
|
||||||
const index = core.domStyle.availableScale.indexOf(core.domStyle.scale);
|
const index = core.domStyle.availableScale.indexOf(core.domStyle.scale);
|
||||||
core.control.setDisplayScale(
|
core.control.setDisplayScale(
|
||||||
core.domStyle.availableScale.length - 1 - index - n
|
core.domStyle.availableScale.length - 1 - index - n
|
||||||
@ -45,12 +43,11 @@
|
|||||||
);
|
);
|
||||||
core.resize();
|
core.resize();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
core.plugin.utils = {
|
core.plugin.utils = {
|
||||||
slide,
|
slide,
|
||||||
backDir,
|
backDir,
|
||||||
has,
|
has,
|
||||||
maxGameScale
|
maxGameScale
|
||||||
};
|
};
|
||||||
})();
|
|
||||||
|
@ -2,8 +2,8 @@ import fs from 'fs/promises';
|
|||||||
import fss from 'fs';
|
import fss from 'fs';
|
||||||
import fse from 'fs-extra';
|
import fse from 'fs-extra';
|
||||||
import Fontmin from 'fontmin';
|
import Fontmin from 'fontmin';
|
||||||
import { exec } from 'child_process';
|
|
||||||
import * as babel from '@babel/core';
|
import * as babel from '@babel/core';
|
||||||
|
import * as rollup from 'rollup';
|
||||||
|
|
||||||
(async function () {
|
(async function () {
|
||||||
// 1. 去除未使用的文件
|
// 1. 去除未使用的文件
|
||||||
@ -40,7 +40,7 @@ import * as babel from '@babel/core';
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
await fse.remove('./dist/maps/');
|
await fse.remove('./dist/maps/');
|
||||||
// 编辑器需要留着吗?
|
// 在线查看什么都看不到,这编辑器难道还需要留着吗?
|
||||||
} catch {}
|
} catch {}
|
||||||
|
|
||||||
// 2. 压缩字体
|
// 2. 压缩字体
|
||||||
@ -98,22 +98,23 @@ import * as babel from '@babel/core';
|
|||||||
|
|
||||||
// 3. 压缩js插件
|
// 3. 压缩js插件
|
||||||
try {
|
try {
|
||||||
exec(
|
const build = await rollup.rollup({
|
||||||
`babel ${data.main.plugin
|
input: 'public/project/plugin/index.js'
|
||||||
.map(v => `./dist/project/plugin/${v}.js`)
|
});
|
||||||
.join(' ')} --out-file ./dist/project/plugin.m.js`
|
const code = await build.generate({
|
||||||
).on('close', async () => {
|
format: 'iife',
|
||||||
|
name: 'CorePlugin'
|
||||||
|
});
|
||||||
|
const compressed = babel.transformSync(code.output[0].code)?.code!;
|
||||||
|
await fs.writeFile('./dist/project/plugin.m.js', compressed, 'utf-8');
|
||||||
|
|
||||||
const main = await fs.readFile('./dist/main.js', 'utf-8');
|
const main = await fs.readFile('./dist/main.js', 'utf-8');
|
||||||
await fs.writeFile(
|
|
||||||
'./dist/main.js',
|
|
||||||
main.replace(
|
main.replace(
|
||||||
/this.pluginUseCompress\s*=\s*false\;/,
|
/this.pluginUseCompress\s*=\s*false\;/,
|
||||||
'this.pluginUseCompress = true;'
|
'this.pluginUseCompress = true;'
|
||||||
)
|
|
||||||
);
|
);
|
||||||
await fse.remove('./dist/project/plugin/');
|
await fse.remove('./dist/project/plugin/');
|
||||||
});
|
} catch (e) {
|
||||||
} catch {
|
|
||||||
console.log('压缩插件失败');
|
console.log('压缩插件失败');
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -124,20 +125,8 @@ import * as babel from '@babel/core';
|
|||||||
const endIndex = main.indexOf('// >>>> body end');
|
const endIndex = main.indexOf('// >>>> body end');
|
||||||
const nonCompress = main.slice(0, endIndex);
|
const nonCompress = main.slice(0, endIndex);
|
||||||
const needCompress = main.slice(endIndex + 17);
|
const needCompress = main.slice(endIndex + 17);
|
||||||
await fs.writeFile('./dist/temp.js', needCompress, 'utf-8');
|
const compressed = babel.transformSync(needCompress)?.code;
|
||||||
await fs.rm('./dist/main.js');
|
await fs.writeFile('./dist/main.js', nonCompress + compressed, 'utf-8');
|
||||||
exec('babel ./dist/temp.js --out-file ./dist/main.js').on(
|
|
||||||
'close',
|
|
||||||
async () => {
|
|
||||||
const nowMain = await fs.readFile('./dist/main.js', 'utf-8');
|
|
||||||
await fs.writeFile(
|
|
||||||
'./dist/main.js',
|
|
||||||
nonCompress + nowMain,
|
|
||||||
'utf-8'
|
|
||||||
);
|
|
||||||
await fs.rm('./dist/temp.js');
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} catch {
|
} catch {
|
||||||
console.log('main.js压缩失败');
|
console.log('main.js压缩失败');
|
||||||
}
|
}
|
@ -1,5 +1,7 @@
|
|||||||
import { ref, watch } from 'vue';
|
import { ref, watch } from 'vue';
|
||||||
|
|
||||||
|
// todo 优化,可以考虑改成reactive
|
||||||
|
|
||||||
/** 打开和关闭ui时是否展示动画 */
|
/** 打开和关闭ui时是否展示动画 */
|
||||||
export const transition = ref(false);
|
export const transition = ref(false);
|
||||||
|
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
import { power } from 'mutate-animate';
|
import { hyper, power } from 'mutate-animate';
|
||||||
import { Polygon } from './polygon';
|
import { Polygon } from './polygon';
|
||||||
import {
|
import {
|
||||||
Light,
|
Light,
|
||||||
|
animateLight,
|
||||||
getAllLights,
|
getAllLights,
|
||||||
moveLight,
|
moveLight,
|
||||||
refreshLight,
|
refreshLight,
|
||||||
@ -27,7 +28,7 @@ export default function init() {
|
|||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
|
||||||
return { updateShadow, clearShadowCache, setCalShadow, testLight: test };
|
return { updateShadow, clearShadowCache, setCalShadow };
|
||||||
}
|
}
|
||||||
|
|
||||||
const shadowInfo: Partial<Record<FloorIds, Light[]>> = {
|
const shadowInfo: Partial<Record<FloorIds, Light[]>> = {
|
||||||
@ -35,11 +36,10 @@ const shadowInfo: Partial<Record<FloorIds, Light[]>> = {
|
|||||||
{
|
{
|
||||||
id: 'mt48_1',
|
id: 'mt48_1',
|
||||||
x: 0,
|
x: 0,
|
||||||
y: 0,
|
y: 48,
|
||||||
decay: 0,
|
decay: 0,
|
||||||
r: 300,
|
r: 300,
|
||||||
color: '#0000',
|
color: '#0000'
|
||||||
followHero: true
|
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
};
|
};
|
||||||
@ -153,7 +153,3 @@ export function setCalShadow(n: boolean) {
|
|||||||
calMapShadow = n;
|
calMapShadow = n;
|
||||||
updateShadow();
|
updateShadow();
|
||||||
}
|
}
|
||||||
|
|
||||||
function test() {
|
|
||||||
moveLight('mt48_1', 480, 48, 2000, power(4, 'in-out'));
|
|
||||||
}
|
|
||||||
|
Loading…
Reference in New Issue
Block a user