噪声、新楼层

This commit is contained in:
unanmed 2023-05-15 22:38:24 +08:00
parent 16d8e35a81
commit fd8fb6a068
18 changed files with 449 additions and 95 deletions

Binary file not shown.

View File

@ -17,31 +17,6 @@ main.floors.MT48=
"eachArrive": [],
"parallelDo": "",
"events": {
"7,0": [
"本塔的第二章测试版已结束。",
"本章还剩余最后一个大区域约30层较为复杂请期待下次更新。",
"计分方式:血量/10+黄*2000+蓝*5000+红*10000",
{
"type": "setValue",
"name": "status:hp",
"operator": "/=",
"value": "10"
},
{
"type": "setValue",
"name": "status:hp",
"operator": "+=",
"value": "item:yellowKey*2000+item:blueKey*5000+item:redKey*10000"
},
{
"type": "function",
"function": "function(){\ncore.status.hero.hp = Math.ceil(core.status.hero.hp);\n}"
},
{
"type": "win",
"reason": "第二章测试"
}
],
"7,10": [
"\t[苍蓝之灵-虚,E647]\b[up,7,7]你来了,智慧之神看中的人。",
"\t[中级智人]\b[up,hero]你是什么人?",
@ -54,13 +29,110 @@ main.floors.MT48=
"\t[苍蓝之灵-虚,E647]\b[up,7,7]你现在还有很多疑虑吧,那里便有你想要找的答案。",
"\t[中级智人]\b[up,hero]那么我怎么过去?",
"\t[苍蓝之灵-虚,E647]\b[up,7,7]打败我,你便有资格进入。",
"\t[中级智人]\b[up,hero]为什么又是要打",
"\t[中级智人]\b[up,hero]为什么又是要打一场",
"\t[苍蓝之灵-虚,E647]\b[up,7,7]......",
"\t[苍蓝之灵-虚,E647]\b[up,7,7]之后,你会明白的。",
{
"type": "hide",
"remove": true
}
],
"7,0": [
{
"type": "if",
"condition": "(flag:pale1!==1)",
"true": [
{
"type": "setCurtain",
"color": [
0,
0,
0,
1
],
"time": 1500,
"keep": true
},
{
"type": "setText",
"text": [
0,
0,
0,
1
],
"background": "winskin3.png"
},
"人类简史——进化篇",
{
"type": "playSound",
"name": "paper.mp3"
},
"孤注一掷。",
{
"type": "playSound",
"name": "paper.mp3"
},
"为拯救自己,人类执行了苍蓝计划。",
{
"type": "playSound",
"name": "paper.mp3"
},
"硬币一旦抛出,又有谁能得知它的朝向呢?",
{
"type": "playSound",
"name": "paper.mp3"
},
"在它落地之前,前方,是毁灭,亦是重生。",
{
"type": "playSound",
"name": "paper.mp3"
},
"当他踏入宫殿的那一刻,硬币便已抛出。",
{
"type": "playSound",
"name": "paper.mp3"
},
"来自未来的“孤注一掷”。",
{
"type": "playSound",
"name": "paper.mp3"
},
{
"type": "setText",
"text": [
255,
255,
255,
1
],
"background": "winskin2.png"
},
{
"type": "changeFloor",
"floorId": "MT49",
"loc": [
7,
14
]
},
{
"type": "setCurtain",
"time": 1500
},
"\t[中级智人]\b[up,hero]",
"\t[中级智人]\b[up,hero]这,这是!",
"\t[中级智人]\b[up,hero]这就是未来人类的最后底牌了吗?",
"\t[中级智人]\b[up,hero]我一定要弄清楚这里面的东西。",
"\t[中级智人]\b[up,hero]前方,一定会有我所寻找的答案。",
{
"type": "setValue",
"name": "flag:pale1",
"value": "1"
}
],
"false": []
}
]
},
"changeFloor": {
@ -75,7 +147,7 @@ main.floors.MT48=
"beforeBattle": {},
"afterBattle": {
"7,7": [
"\t[中级智人]\b[up,hero]为什么,为什么一定要打架,决定胜负呢?",
"\t[中级智人]\b[up,hero]为什么,为什么一定要打一场,来决定胜负呢?",
{
"type": "openDoor",
"loc": [

View File

@ -1,7 +1,7 @@
main.floors.MT49=
{
"floorId": "MT49",
"title": "冰封高原",
"title": "苍蓝之殿-入",
"name": "49",
"width": 15,
"height": 15,
@ -16,7 +16,34 @@ main.floors.MT49=
"firstArrive": [],
"eachArrive": [],
"parallelDo": "",
"events": {},
"events": {
"6,10": [
"以万&定%$*#■◁"
],
"8,10": [
"行$天&*至^%?□▼"
],
"7,14": [
{
"type": "changeFloor",
"floorId": "MT48",
"loc": [
7,
0
]
}
],
"7,10": [
{
"type": "changeFloor",
"floorId": "MT50",
"loc": [
7,
14
]
}
]
},
"changeFloor": {},
"beforeBattle": {},
"afterBattle": {},
@ -26,6 +53,43 @@ main.floors.MT49=
"cannotMove": {},
"cannotMoveIn": {},
"map": [
[ 0, 0,80922,80923,80924,80925,80926,80927,81120,81121,81122,81123,81124, 0, 0],
[ 0, 0,80930,80931,80932,80933,80934,80935,81128,81129,81130,81131,81132, 0, 0],
[ 0, 0,80938,80939,80940,80941,80942,80943,81136,81137,81138,81139,81140, 0, 0],
[ 0, 0,80946,80947,80948,80949,80950,80951,81144,81145,81146,81147,81148, 0, 0],
[ 0, 0,80954,80955,80956,80957,80958,80959,81152,81153,81154,81155,81156, 0, 0],
[ 0, 0,80962,80963,80964,80965,80966,80967,81160,81161,81162,81163,81164, 0, 0],
[ 0, 0,80970,80971,80972,80973,80974,80975,81168,81169,81170,81171,81172, 0, 0],
[ 0, 0,80978,80979,80980,80981,80982,80983,81176,81177,81178,81179,81180, 0, 0],
[ 0, 0,80986,80987,80988,80989,80990,80991,81184,81185,81186,81187,81188, 0, 0],
[ 0, 0,80994,80995,80996,80997,80998,80999,81192,81193,81194,81195,81196, 0, 0],
[ 0, 0,81002,81003, 0,81005,129, 91,129,81201,81202,81203,81204, 0, 0],
[ 0, 0,81069,81070,81071, 0, 0, 0, 0, 0,81069,81070,81071, 0, 0],
[ 0, 0,81077,81078,81079, 0, 0, 0, 0, 0,81077,81078,81079, 0, 0],
[ 0,146,146,146,146, 0, 0, 0, 0, 0, 0, 0,146,146, 0],
[146,146,146,146,146,146, 0, 93, 0,146,146,146,146,146,146]
],
"bgmap": [
[70067,70067,70067,70067,70067,70067, 0, 0, 0,70067,70067,70067,70067,70067,70067],
[70067,70067,70067,70067,70067,70067, 0, 0, 0,70067,70067,70067,70067,70067,70067],
[70067,70067,70067,70067,70067,70067, 0, 0, 0,70067,70067,70067,70067,70067,70067],
[70067,70067,70067,70067,70067,70067, 0, 0, 0,70067,70067,70067,70067,70067,70067],
[70067,70067,70067,70067,70067,70067, 0, 0, 0,70067,70067,70067,70067,70067,70067],
[70067,70067,70067,70067,70067,70067, 0, 0, 0,70067,70067,70067,70067,70067,70067],
[70067,70067,70067,70067,70067,70067, 0, 0, 0,70067,70067,70067,70067,70067,70067],
[70067,70067,70067,70067,70067,70067, 0, 0, 0,70067,70067,70067,70067,70067,70067],
[70067,70067,70067,70067,70067,70067, 0, 0, 0,70067,70067,70067,70067,70067,70067],
[70067,70067,70048,70049,70049,70049,70056, 0,70058,70049,70049,70049,70050,70067,70067],
[70067,70067,70056, 0, 0, 0,70056, 0,70058, 0, 0, 0,70058,70067,70067],
[70049,70049,70051, 0, 0, 0,70056, 0,70058, 0, 0, 0,70052,70049,70049],
[ 0, 0, 0, 0, 0, 0,70056, 0,70058, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0,70056, 0,70058, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0,70056, 0,70058, 0, 0, 0, 0, 0, 0]
],
"fgmap": [
],
"bg2map": [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@ -37,9 +101,12 @@ main.floors.MT49=
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0,81085,81086,81087, 0, 0, 0, 0, 0,81085,81086,81087, 0, 0],
[ 0, 0,81093,81094,81095, 0, 0, 0, 0, 0,81093,81094,81095, 0, 0],
[ 0, 0,81101,81102,81103, 0, 0, 0, 0, 0,81101,81102,81103, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
"fg2map": [
]
}

View File

@ -1,7 +1,7 @@
main.floors.MT50=
{
"floorId": "MT50",
"title": "冰封高原",
"title": "苍蓝之殿-中",
"name": "50",
"width": 15,
"height": 15,
@ -11,12 +11,39 @@ main.floors.MT50=
"cannotViewMap": false,
"images": [],
"ratio": 8,
"defaultGround": "T580",
"bgm": "winter.mp3",
"defaultGround": "T650",
"bgm": [
"palaceSouth.mp3",
"winter.mp3"
],
"firstArrive": [],
"eachArrive": [],
"parallelDo": "",
"events": {},
"events": {
"7,14": [
{
"type": "changeFloor",
"floorId": "MT49",
"loc": [
7,
10
]
}
],
"5,13": [
"欢迎来到苍蓝之殿,这是本塔第二章里面最大的一个区,也是最复杂的一个区。整个苍蓝之殿分为四个部分:左下角、右下角、左上角、右上角,每个部分都有不一样的玩法,多多动脑哦。"
],
"9,13": [
"在你刚进入苍蓝之殿时,你只能先前往左下角部分(本地图的左面),右下角暂时不能前往。"
],
"5,1": [
"左边两个机关门在打完左下角区域的boss后开启右边同理。"
],
"9,1": [
"左下角和右下角两个区域打完之后必须要点开学习技能,不然会卡关。",
"本区域可以使用跳跃技能,不要忘记了。"
]
},
"changeFloor": {},
"beforeBattle": {},
"afterBattle": {},
@ -26,15 +53,32 @@ main.floors.MT50=
"cannotMove": {},
"cannotMoveIn": {},
"map": [
[648,648,648,648,648,648,648, 91,648,648,648,648,648,648,648],
[648, 0, 0, 0, 0,129, 0, 0, 0,129, 0, 0, 0, 0,648],
[648, 0, 0, 0, 0,648, 0, 0, 0,648, 0, 0, 0, 0,648],
[648, 0, 0, 0, 0,648, 0, 0, 0,648, 0, 0, 0, 0,648],
[648, 0, 0, 0,103,648, 0, 0, 0,648,103, 0, 0, 0,648],
[648, 85,648,648,648,648, 0, 0, 0,648,648,648,648, 85,648],
[648, 0, 0, 0, 0, 0,484, 0,484, 0, 0, 0, 0, 0,648],
[ 92, 0, 0, 0, 0, 0, 0, 23, 0, 0, 0, 0, 0, 0, 94],
[648, 0, 0, 0, 0, 0,484, 0,484, 0, 0, 0, 0, 0,648],
[648, 85,648,648,648,648, 0, 0, 0,648,648,648,648, 85,648],
[648, 0, 0, 0,103,648, 0, 0, 0,648,103, 0, 0, 0,648],
[648, 0, 0, 0, 0,648, 0, 0, 0,648, 0, 0, 0, 0,648],
[648, 0, 0, 0, 0,648, 0, 0, 0,648, 0, 0, 0, 0,648],
[648, 0, 0, 0, 0,129, 0, 0, 0,129, 0, 0, 0, 0,648],
[648,648,648,648,648,648,648, 93,648,648,648,648,648,648,648]
],
"bgmap": [
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0,50403,50404,50405, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0,50411,50412,50413, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0,50419,50420,50421, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
@ -42,4 +86,13 @@ main.floors.MT50=
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0],
[ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0]
],
"fgmap": [
],
"bg2map": [
],
"fg2map": [
]
}

View File

@ -145,7 +145,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = {
// ---------- 重绘新地图这一步将会设置core.status.floorId ---------- //
core.drawMap(floorId);
if (!main.replayChecking) core.updateShadow();
if (!main.replayChecking) {
core.updateShadow();
core.setCanvasFilterByFloorId(floorId);
}
// 切换楼层BGM
if (core.status.maps[floorId].bgm) {

View File

@ -126,7 +126,12 @@ var icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 =
"T627": 66,
"T628": 67,
"T629": 68,
"T640": 69
"T640": 69,
"T648": 70,
"T649": 71,
"T650": 72,
"T651": 73,
"T652": 74
},
"animates": {
"star": 0,

View File

@ -84,7 +84,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"94": {"cls":"animates","id":"rightPortal","canPass":true},
"101": {"cls":"animates","id":"crystalUp"},
"102": {"cls":"animates","id":"crystalBottom"},
"103": {"cls":"animates","id":"fire"},
"103": {"cls":"animates","id":"fire","canPass":true,"cannotIn":[]},
"104": {"cls":"animates","id":"switch"},
"105": {"cls":"animates","id":"steelDoor2","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
"106": {"cls":"animates","id":"steelDoor3","doorInfo":{"time":160,"openSound":"door.mp3","closeSound":"door.mp3","keys":{}},"animate":1,"trigger":"openDoor"},
@ -576,6 +576,11 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
"645": {"cls":"enemys","id":"E645"},
"646": {"cls":"enemys","id":"E646"},
"647": {"cls":"enemys","id":"E647"},
"648": {"cls":"terrains","id":"T648"},
"649": {"cls":"terrains","id":"T649"},
"650": {"cls":"terrains","id":"T650"},
"651": {"cls":"terrains","id":"T651"},
"652": {"cls":"terrains","id":"T652"},
"20032": {"cls":"tileset","id":"X20032","cannotOut":["up","left"],"cannotIn":["up","left"]},
"20033": {"cls":"tileset","id":"X20033","cannotOut":["up"],"cannotIn":["up"]},
"20034": {"cls":"tileset","id":"X20034","cannotOut":["up","right"],"cannotIn":["up","right"]},

Binary file not shown.

Before

Width:  |  Height:  |  Size: 58 KiB

After

Width:  |  Height:  |  Size: 62 KiB

View File

@ -16,6 +16,8 @@ import gameShadow from './plugin/shadow/gameShadow';
import achievement from './plugin/ui/achievement';
import completion, { floors } from './plugin/completion';
import path from './plugin/fx/path';
import gameCanvas from './plugin/fx/gameCanvas';
import noise from './plugin/fx/noise';
function forward() {
const toForward: any[] = [
@ -36,7 +38,9 @@ function forward() {
gameShadow(),
achievement(),
completion(),
path()
path(),
gameCanvas(),
noise()
];
// 初始化所有插件并转发到core上

View File

@ -0,0 +1,29 @@
export default function init() {
return {
setGameCanvasFilter,
getCanvasFilterByFloorId,
setCanvasFilterByFloorId
};
}
export function setGameCanvasFilter(filter: string) {
['bg', 'bg2', 'event', 'event2', 'fg', 'fg2', 'hero'].forEach(v => {
core.canvas[v].canvas.style.filter = filter;
});
}
const filterMap: [FloorIds[], string][] = [
[['MT50'], 'brightness(80%)contrast(120%)'] // 童心佬的滤镜(
];
export function getCanvasFilterByFloorId(
floorId: FloorIds = core.status.floorId
) {
return filterMap.find(v => v[0].includes(floorId))?.[1] ?? '';
}
export function setCanvasFilterByFloorId(
floorId: FloorIds = core.status.floorId
) {
setGameCanvasFilter(getCanvasFilterByFloorId(floorId));
}

54
src/plugin/fx/noise.ts Normal file
View File

@ -0,0 +1,54 @@
export default function init() {
return { createGaussNoise };
}
interface GaussNoiseConfig {
/** 分辨率最小为1最大为画布长宽的最大值默认为画布长宽最大值的一半过大可能会卡顿 */
resolution?: number;
/** 画布宽度 */
width?: number;
/** 画布高度 */
height?: number;
/** 噪声灰度的均值,范围 0 ~ 255 */
expectation: number;
/** 噪声灰度方差 */
deviation: number;
/** 目标画布,如果不指定会创建一个新的 */
canvas?: HTMLCanvasElement;
}
/**
*
* @param config
* @returns
*/
export function createGaussNoise(config: GaussNoiseConfig): HTMLCanvasElement {
const canvas = config.canvas ?? document.createElement('canvas');
canvas.width = config.width ?? core._PX_;
canvas.height = config.height ?? core._PY_;
canvas.style.imageRendering = 'pixelated';
const ctx = canvas.getContext('2d')!;
ctx.imageSmoothingEnabled = false;
const max = Math.max(canvas.width, canvas.height);
const resolution = Math.min(max, config.resolution ?? max / 2);
const step =
max === canvas.width
? canvas.width / resolution
: canvas.height / resolution;
for (let x = 0; x < canvas.width; x += step) {
for (let y = 0; y < canvas.height; y += step) {
const random =
Math.sqrt(Math.log(Math.random()) * -2) *
Math.sin(2 * Math.PI * Math.random());
const gray = 255 - random * config.deviation - config.expectation;
ctx.fillStyle = `rgba(${gray},${gray},${gray},${gray / 255})`;
ctx.fillRect(x, y, step, step);
}
}
return canvas;
}

View File

@ -60,6 +60,9 @@ export class EnemyCollection implements RangeCollection<DamageEnemy> {
this.floorId = floorId;
}
/**
*
*/
extract() {
core.extractBlocks(this.floorId);
core.status.maps[this.floorId].blocks.forEach(v => {

View File

@ -27,8 +27,9 @@ export {};
async function reloadFloor(data) {
// 如果被砍层了直接忽略
if (
core.status.maps[data].deleted ||
core.status.maps[data].forceDelete
core.status.maps &&
(core.status.maps[data].deleted ||
core.status.maps[data].forceDelete)
)
return;
// 首先重新加载main.floors对应的楼层

View File

@ -34,7 +34,9 @@ export const jumpIgnoreFloor = [
'MT45',
'MT46',
'MT47',
'MT48'
'MT48',
'MT49',
'MT50'
];
// 跳跃
export function jumpSkill() {

View File

@ -31,8 +31,49 @@ export default function init() {
return { updateShadow, clearShadowCache, setCalShadow };
}
const shadowInfo: Partial<Record<FloorIds, Light[]>> = {};
const backgroundInfo: Partial<Record<FloorIds, Color>> = {};
const shadowInfo: Partial<Record<FloorIds, Light[]>> = {
MT50: [
{
id: 'mt50_1',
x: 144,
y: 144,
decay: 20,
r: 150,
color: '#ee995333',
noShelter: true
},
{
id: 'mt50_2',
x: 336,
y: 144,
decay: 20,
r: 150,
color: '#ee995333',
noShelter: true
},
{
id: 'mt50_2',
x: 336,
y: 336,
decay: 20,
r: 150,
color: '#ee995333',
noShelter: true
},
{
id: 'mt50_2',
x: 144,
y: 336,
decay: 20,
r: 150,
color: '#ee995333',
noShelter: true
}
]
};
const backgroundInfo: Partial<Record<FloorIds, Color>> = {
MT50: '#0006'
};
const blurInfo: Partial<Record<FloorIds, number>> = {};
const immersionInfo: Partial<Record<FloorIds, number>> = {};
const shadowCache: Partial<Record<FloorIds, Polygon[]>> = {};

5
src/source/cls.d.ts vendored
View File

@ -575,6 +575,11 @@ interface IdToCls {
E645: 'enemys';
E646: 'enemys';
E647: 'enemys';
T648: 'terrains';
T649: 'terrains';
T650: 'terrains';
T651: 'terrains';
T652: 'terrains';
X20032: 'tileset';
X20033: 'tileset';
X20034: 'tileset';

10
src/source/maps.d.ts vendored
View File

@ -575,6 +575,11 @@ interface IdToNumber {
E645: 645;
E646: 646;
E647: 647;
T648: 648;
T649: 649;
T650: 650;
T651: 651;
T652: 652;
X20032: 20032;
X20033: 20033;
X20034: 20034;
@ -1235,6 +1240,11 @@ interface NumberToId {
645: 'E645';
646: 'E646';
647: 'E647';
648: 'T648';
649: 'T649';
650: 'T650';
651: 'T651';
652: 'T652';
20032: 'X20032';
20033: 'X20033';
20034: 'X20034';

View File

@ -26,7 +26,7 @@ export default defineConfig({
output: {
manualChunks: {
antdv: ['ant-design-vue', '@ant-design/icons-vue'],
common: ['lodash', 'axios', 'lz-string', 'chart.js', 'mutate-animate', 'three']
common: ['lodash-es', 'axios', 'lz-string', 'chart.js', 'mutate-animate', 'three']
}
}
}