feat: 自动设置光源

This commit is contained in:
unanmed 2024-04-27 14:23:41 +08:00
parent c5492e1e77
commit 8dba57e222
3 changed files with 132 additions and 32 deletions

View File

@ -27,27 +27,101 @@ main.floors.MT52=
} }
}, },
"beforeBattle": {}, "beforeBattle": {},
"afterBattle": {}, "afterBattle": {
"12,1": [
{
"type": "setValue",
"name": "flag:door_MT52_11_2",
"operator": "+=",
"value": "1"
}
],
"12,3": [
{
"type": "setValue",
"name": "flag:door_MT52_11_2",
"operator": "+=",
"value": "1"
}
],
"9,1": [
{
"type": "setValue",
"name": "flag:door_MT52_8_2",
"operator": "+=",
"value": "1"
}
],
"9,3": [
{
"type": "setValue",
"name": "flag:door_MT52_8_2",
"operator": "+=",
"value": "1"
}
]
},
"afterGetItem": {}, "afterGetItem": {},
"afterOpenDoor": {}, "afterOpenDoor": {},
"autoEvent": {}, "autoEvent": {
"11,2": {
"0": {
"condition": "flag:door_MT52_11_2==2",
"currentFloor": true,
"priority": 0,
"delayExecute": false,
"multiExecute": false,
"data": [
{
"type": "openDoor"
},
{
"type": "setValue",
"name": "flag:door_MT52_11_2",
"operator": "=",
"value": "null"
}
]
}
},
"8,2": {
"0": {
"condition": "flag:door_MT52_8_2==2",
"currentFloor": true,
"priority": 0,
"delayExecute": false,
"multiExecute": false,
"data": [
{
"type": "openDoor"
},
{
"type": "setValue",
"name": "flag:door_MT52_8_2",
"operator": "=",
"value": "null"
}
]
}
}
},
"cannotMove": {}, "cannotMove": {},
"cannotMoveIn": {}, "cannotMoveIn": {},
"map": [ "map": [
[648,648,648,648, 91,648,648,648,648,648,648,648,648,648,648], [648,648,648,648, 91,648,648,648,648,648,648,648,648,648,648],
[648, 0, 0,648, 0,648,376,491,648,249,376,648,578, 0,648], [648, 27, 0,648, 0,648,376,491,648,249,376,648,578, 0,648],
[648, 0, 0,648,243,648, 22,403, 85,403,491, 85, 0, 0,648], [648, 0,482,648,243,497, 22,403, 85,403,491, 85, 0,484,648],
[648, 0, 0,220, 0,648,378,491,648,249,378,648,578, 0,648], [648, 28, 0,220, 0,648,378,491,648,249,378,648,578, 0,648],
[648,648,648,648, 0,648,648,648,648,648,648,648,648, 0,648], [648,648,648,648, 0,648,648,648,648,648,648,648,648, 0,648],
[648, 0, 0,648, 0,648, 0, 0,648, 0, 0,648, 0, 0,648], [648, 33, 0,648,482,648, 29, 0,648,381, 0,648, 28, 0,648],
[648, 0, 0,492, 0,648, 0, 0, 0, 0, 0, 0, 0, 0,648], [648, 0,381,492, 0,648, 0, 27,539, 0, 34,596, 0,103,648],
[648, 0, 0,648, 0,648,648,219,648,648,648,648,648,648,648], [648, 33, 0,648, 0,648,648,219,648,648,648,648,648,648,648],
[648,601,648,648,656, 0, 0, 0, 0, 0, 0, 0, 0, 0, 94], [648,596,648,648,656, 0, 0, 0, 0,482, 0, 0, 0, 0, 94],
[648, 0, 0,648,648,648,648,494,648,648,648,648,497,648,648], [648,376, 0,648,648,648,648,494,648,648,648,648,497,648,648],
[648, 0, 0,648, 0,539, 0, 0, 0,648, 0, 0, 0, 0,648], [648, 33,381,492,482,539, 33, 0, 28,494,376,381, 22,378,648],
[648,596,648,648,648,648,648,243,648,648,648, 0,648,648,648], [648,601,648,648,648,648,648,243,648,648,648,240,648,648,648],
[648, 0, 0,648, 0, 0,648, 0, 0,648, 0, 0, 0, 0,648], [648, 34, 0,648, 34, 0,648, 0, 29, 27,648,484,396,484,648],
[648, 0, 0, 0, 0, 0, 0, 0, 0,240, 0, 0, 0, 0,648], [648,103, 27,596, 0, 33,220, 0, 33, 28,249,403, 21,390,648],
[648,648,648,648,648,648,648,648,648,648,648,648,648,648,648] [648,648,648,648,648,648,648,648,648,648,648,648,648,648,648]
], ],
"bgmap": [ "bgmap": [

View File

@ -28,6 +28,7 @@ export function setCanvasFilterByFloorId(
Mota.require('var', 'loading').once('coreInit', () => { Mota.require('var', 'loading').once('coreInit', () => {
filterMap.push( filterMap.push(
[core.floorIds.slice(60), 'brightness(80%)contrast(120%)'] // 童心佬的滤镜( [['MT50'], 'brightness(80%)contrast(120%)'], // 童心佬的滤镜(
[core.floorIds.slice(61), 'brightness(90%)contrast(120%)'] // 童心佬的滤镜(
); );
}); });

View File

@ -85,26 +85,22 @@ const shadowInfo: Partial<Record<FloorIds, Light[]>> = {
noShelter: true noShelter: true
} }
], ],
MT51: [
{
id: 'mt51_hero',
x: 0,
y: 0,
decay: 50,
r: 250,
color: 'transparent',
followHero: true
}
],
MT52: [ MT52: [
{ {
id: 'mt52_hero', id: 'mt51_1',
x: 0, x: 13 * 32 + 16,
y: 0, y: 6 * 32 + 16,
decay: 50, decay: 20,
r: 250, r: 250,
color: 'transparent', color: pColor('#e953')
followHero: true },
{
id: 'mt51_2',
x: 1 * 32 + 16,
y: 13 * 32 + 16,
decay: 20,
r: 350,
color: pColor('#e953')
} }
] ]
}; };
@ -119,6 +115,35 @@ const shadowCache: Partial<Record<FloorIds, Polygon[]>> = {};
let calMapShadow = true; let calMapShadow = true;
Mota.require('var', 'loading').once('coreInit', () => {
core.floorIds.slice(61).forEach(v => {
shadowInfo[v] ??= [];
shadowInfo[v]?.push({
id: `${v}_hero`,
x: 0,
y: 0,
decay: 50,
r: 300,
color: 'transparent',
followHero: true
});
core.floors[v].map.forEach((arr, y) => {
arr.forEach((num, x) => {
if (num === 103) {
shadowInfo[v]?.push({
id: `${v}_${x}_${y}`,
x: x * 32 + 16,
y: y * 32 + 16,
decay: 20,
r: 350,
color: pColor('#e953')
});
}
});
});
});
});
export function updateShadow(nocache: boolean = false) { export function updateShadow(nocache: boolean = false) {
// todo: 需要优化优化成bfs // todo: 需要优化优化成bfs
const floor = core.status.floorId; const floor = core.status.floorId;