Feat: drop-and-fusion update

This commit is contained in:
mattyatea 2024-01-17 06:57:32 +09:00
parent 35361f933e
commit 5cfa86e85e
3 changed files with 376 additions and 5 deletions

View File

@ -220,7 +220,7 @@ const NORAML_MONOS: FrontendMonoDefinition[] = [{
img: '/client-assets/drop-and-fusion/normal_monos/face_with_symbols_on_mouth.png', img: '/client-assets/drop-and-fusion/normal_monos/face_with_symbols_on_mouth.png',
imgSizeX: 256, imgSizeX: 256,
imgSizeY: 256, imgSizeY: 256,
spriteScale: 1.12, spriteScale: 1.0,
}, { }, {
id: 'beb30459-b064-4888-926b-f572e4e72e0c', id: 'beb30459-b064-4888-926b-f572e4e72e0c',
sfxPitch: 0.75, sfxPitch: 0.75,
@ -494,9 +494,81 @@ const SWEETS_MONOS: FrontendMonoDefinition[] = [{
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1, spriteScale: 1,
}]; }];
const PRISMISSKEY_MONOS: FrontendMonoDefinition[] = [{
id: 'f75fd0ba-d3d4-40a4-9712-b470e45b0525',
sfxPitch: 0.25,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2Fc4c7e430-bd92-415a-a7d3-031ddb7f0641.apng',
imgSizeX: 3400,
imgSizeY: 3400,
spriteScale: 2.3,
}, {
id: '7b70f4af-1c01-45fd-af72-61b1f01e03d1',
sfxPitch: 0.5,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2F5ba71ab2-1673-4eb0-bd3b-b44e063365ba.apng',
imgSizeX: 2000,
imgSizeY: 2000,
spriteScale: 1.65,
}, {
id: '41607ef3-b6d6-4829-95b6-3737bf8bb956',
sfxPitch: 0.75,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2Fd6fe438b-c550-484f-95d1-1739a2b5173d.apng',
imgSizeX: 2000,
imgSizeY: 2000,
spriteScale: 1.8,
}, {
id: '8a8310d2-0374-460f-bb50-ca9cd3ee3416',
sfxPitch: 1,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2F8226211b-58e2-46ba-be20-4ea635d614ab.webp',
imgSizeX: 500,
imgSizeY: 501,
spriteScale: 1.0,
}, {
id: '1092e069-fe1a-450b-be97-b5d477ec398c',
sfxPitch: 1.5,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2Fde30a66c-5c98-4c2e-a425-4d1f73d96899.png',
imgSizeX: 340,
imgSizeY: 351,
spriteScale: 0.98,
}, {
id: '2294734d-7bb8-4781-bb7b-ef3820abf3d0',
sfxPitch: 2,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2Fdc8d893a-6d1f-4a86-847e-a30e56270249.png',
imgSizeX: 1023,
imgSizeY: 1000,
spriteScale: 1.0,
}, {
id: 'ea8a61af-e350-45f7-ba6a-366fcd65692a',
sfxPitch: 2.5,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2F56a303b9-4385-44bb-a4d4-2453450eef01.png',
imgSizeX: 256,
imgSizeY: 256,
spriteScale: 0.4,
}, {
id: 'd0c74815-fc1c-4fbe-9953-c92e4b20f919',
sfxPitch: 3,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2F96a87c60-543d-4e83-a24d-c2a3247eb2ea.webp',
imgSizeX: 630,
imgSizeY: 620,
spriteScale: 0.6,
}, {
id: 'd8fbd70e-611d-402d-87da-1a7fd8cd2c8d',
sfxPitch: 3.5,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2Fdff2812b-2c80-4ecf-b5f1-b2874048899e.webp',
imgSizeX: 1500,
imgSizeY: 1500,
spriteScale: 1.15,
}, {
id: '35e476ee-44bd-4711-ad42-87be245d3efd',
sfxPitch: 4,
img: '/proxy/image.webp?url=https%3A%2F%2Ffiles.prismisskey.space%2Fmisskey%2Fc4448bf6-d95f-49e5-844d-b6b9530e82cc.png',
imgSizeX: 200,
imgSizeY: 200,
spriteScale: 1.5,
}];
const props = defineProps<{ const props = defineProps<{
gameMode: 'normal' | 'square' | 'yen' | 'sweets'; gameMode: 'normal' | 'square' | 'yen' | 'sweets' | 'prismisskey';
mute: boolean; mute: boolean;
}>(); }>();
@ -509,6 +581,7 @@ const monoDefinitions = computed(() => {
props.gameMode === 'square' ? SQUARE_MONOS : props.gameMode === 'square' ? SQUARE_MONOS :
props.gameMode === 'yen' ? YEN_MONOS : props.gameMode === 'yen' ? YEN_MONOS :
props.gameMode === 'sweets' ? SWEETS_MONOS : props.gameMode === 'sweets' ? SWEETS_MONOS :
props.gameMode === 'prismisskey' ? PRISMISSKEY_MONOS :
[] as never; [] as never;
}); });
@ -517,6 +590,7 @@ function getScoreUnit(gameMode: string) {
gameMode === 'square' ? 'pt' : gameMode === 'square' ? 'pt' :
gameMode === 'yen' ? '円' : gameMode === 'yen' ? '円' :
gameMode === 'sweets' ? 'kcal' : gameMode === 'sweets' ? 'kcal' :
gameMode === 'prismisskey' ? 'pt' :
'' as never; '' as never;
} }

View File

@ -28,6 +28,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="square">SQUARE</option> <option value="square">SQUARE</option>
<option value="yen">YEN</option> <option value="yen">YEN</option>
<option value="sweets">SWEETS</option> <option value="sweets">SWEETS</option>
<option value="prismisskey">PRISMISSKEY</option>
</MkSelect> </MkSelect>
<MkButton primary gradate large rounded inline @click="start">{{ i18n.ts.start }}</MkButton> <MkButton primary gradate large rounded inline @click="start">{{ i18n.ts.start }}</MkButton>
</div> </div>
@ -94,7 +95,7 @@ import MkSelect from '@/components/MkSelect.vue';
import MkSwitch from '@/components/MkSwitch.vue'; import MkSwitch from '@/components/MkSwitch.vue';
import { misskeyApiGet } from '@/scripts/misskey-api.js'; import { misskeyApiGet } from '@/scripts/misskey-api.js';
const gameMode = ref<'normal' | 'square' | 'yen' | 'sweets'>('normal'); const gameMode = ref<'normal' | 'square' | 'yen' | 'sweets' | 'prismisskey'>('normal');
const gameStarted = ref(false); const gameStarted = ref(false);
const mute = ref(false); const mute = ref(false);
const ranking = ref(null); const ranking = ref(null);
@ -108,6 +109,7 @@ function getScoreUnit(gameMode: string) {
gameMode === 'square' ? 'pt' : gameMode === 'square' ? 'pt' :
gameMode === 'yen' ? '円' : gameMode === 'yen' ? '円' :
gameMode === 'sweets' ? 'kcal' : gameMode === 'sweets' ? 'kcal' :
gameMode === 'prismisskey' ? 'pt' :
'' as never; '' as never;
} }

View File

@ -976,7 +976,301 @@ const SWEETS_MONOS: Mono[] = [{
score: 30, score: 30,
dropCandidate: true, dropCandidate: true,
}]; }];
const PRISMISSKEY_BASE_SIZE = 28;
const PRISMISSKEY_MONOS: Mono[] = [{
id: 'f75fd0ba-d3d4-40a4-9712-b470e45b0525',
level: 10,
sizeX: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'custom',
vertices: [[
{ 'x': 1680, 'y': 270 },
{ 'x': 2150, 'y': 560 },
{ 'x': 2600, 'y': 910 },
{ 'x': 3279, 'y': 650 },
{ 'x': 3130, 'y': 1100 },
{ 'x': 2750, 'y': 1250 },
{ 'x': 2800, 'y': 1860 },
{ 'x': 1760, 'y': 1980 },
{ 'x': 1500, 'y': 1840 },
{ 'x': 989, 'y': 1800 },
{ 'x': 888, 'y': 1900 },
{ 'x': 688, 'y': 1540 },
{ 'x': 783, 'y': 1250 },
{ 'x': 660, 'y': 1190 },
{ 'x': 600, 'y': 800 },
{ 'x': 722, 'y': 382 },
{ 'x': 1100, 'y': 835 },
{ 'x': 1400, 'y': 670 },
]],
verticesSize: 1800,
score: 512,
dropCandidate: false,
}, {
id: '7b70f4af-1c01-45fd-af72-61b1f01e03d1',
level: 9,
sizeX: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'custom',
vertices: [
[
{ 'x': 1023, 'y': 266 },
{ 'x': 1476, 'y': 474 },
{ 'x': 1595, 'y': 362 },
{ 'x': 1747, 'y': 359 },
{ 'x': 1939, 'y': 481 },
{ 'x': 1769, 'y': 700 },
{ 'x': 1666, 'y': 690 },
{ 'x': 1711, 'y': 982 },
{ 'x': 1638, 'y': 1227 },
{ 'x': 1494, 'y': 1300 },
{ 'x': 1037, 'y': 1300 },
{ 'x': 914, 'y': 1183 },
{ 'x': 447, 'y': 1200 },
{ 'x': 290, 'y': 1300 },
{ 'x': 204, 'y': 1280 },
{ 'x': 170, 'y': 835 },
{ 'x': 321, 'y': 523 },
{ 'x': 647, 'y': 323 },
{ 'x': 857, 'y': 277 },
],
],
verticesSize: 1300,
score: 256,
dropCandidate: false,
}, {
id: '41607ef3-b6d6-4829-95b6-3737bf8bb956',
level: 8,
sizeX: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'custom',
vertices: [
[
{ 'x': 1177, 'y': 85 },
{ 'x': 1498, 'y': 404 },
{ 'x': 1370, 'y': 374 },
{ 'x': 1737, 'y': 619 },
{ 'x': 1946, 'y': 721 },
{ 'x': 1764, 'y': 975 },
{ 'x': 1674, 'y': 949 },
{ 'x': 1715, 'y': 1183 },
{ 'x': 1641, 'y': 1498 },
{ 'x': 1479, 'y': 1555 },
{ 'x': 1008, 'y': 1566 },
{ 'x': 912, 'y': 1447 },
{ 'x': 456, 'y': 1453 },
{ 'x': 298, 'y': 1561 },
{ 'x': 240, 'y': 1551 },
{ 'x': 187, 'y': 1017 },
{ 'x': 283, 'y': 825 },
{ 'x': 517, 'y': 609 },
{ 'x': 187, 'y': 1017 },
{ 'x': 352, 'y': 521 },
{ 'x': 821, 'y': 333 },
],
],
verticesSize: 1300,
score: 128,
dropCandidate: false,
}, {
id: '8a8310d2-0374-460f-bb50-ca9cd3ee3416',
level: 7,
sizeX: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'circle',
score: 64,
dropCandidate: false,
}, {
id: '1092e069-fe1a-450b-be97-b5d477ec398c',
level: 6,
sizeX: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'circle',
score: 32,
dropCandidate: false,
}, {
id: '2294734d-7bb8-4781-bb7b-ef3820abf3d0',
level: 5,
sizeX: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'custom',
vertices: [
[
{
'x': 410,
'y': 14,
},
{
'x': 741,
'y': 160,
},
{
'x': 834,
'y': 346,
},
{
'x': 853,
'y': 637,
},
{
'x': 768,
'y': 760,
},
{
'x': 422,
'y': 813,
}, {
'x': 66,
'y': 748,
},
{
'x': 27,
'y': 702,
},
{
'x': 7,
'y': 543,
}, {
'x': 63,
'y': 263,
}, {
'x': 170,
'y': 108,
},
{
'x': 310,
'y': 26,
},
],
],
verticesSize: 1024,
score: 16,
dropCandidate: true,
}, {
id: 'ea8a61af-e350-45f7-ba6a-366fcd65692a',
level: 4,
sizeX: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25,
sizeY: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25 * 1.25,
shape: 'rectangle',
score: 8,
dropCandidate: true,
}, {
id: 'd0c74815-fc1c-4fbe-9953-c92e4b20f919',
level: 3,
sizeX: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25,
sizeY: PRISMISSKEY_BASE_SIZE * 1.25 * 1.25,
shape: 'custom',
vertices: [
[
{
'x': 87,
'y': 6,
},
{
'x': 169,
'y': 53,
},
{
'x': 169,
'y': 147,
},
{
'x': 87,
'y': 195,
},
{
'x': 6,
'y': 147,
},
{
'x': 6,
'y': 53,
},
],
],
verticesSize: 128,
score: 4,
dropCandidate: true,
}, {
id: 'd8fbd70e-611d-402d-87da-1a7fd8cd2c8d',
level: 2,
sizeX: PRISMISSKEY_BASE_SIZE * 1.25,
sizeY: PRISMISSKEY_BASE_SIZE * 1.25,
shape: 'custom',
vertices: [
[
{
'x': 749,
'y': 12,
},
{
'x': 1386,
'y': 379,
},
{
'x': 1387,
'y': 1116,
},
{
'x': 749,
'y': 1484,
},
{
'x': 111,
'y': 1116,
},
{
'x': 111,
'y': 380,
},
],
],
verticesSize: 1536,
score: 2,
dropCandidate: true,
}, {
id: '35e476ee-44bd-4711-ad42-87be245d3efd',
level: 1,
sizeX: PRISMISSKEY_BASE_SIZE,
sizeY: PRISMISSKEY_BASE_SIZE,
shape: 'custom',
vertices: [
[
{
'x': 87,
'y': 6,
},
{
'x': 169,
'y': 53,
},
{
'x': 169,
'y': 147,
},
{
'x': 87,
'y': 195,
},
{
'x': 6,
'y': 147,
},
{
'x': 6,
'y': 53,
},
],
],
verticesSize: 128,
score: 1,
dropCandidate: true,
}];
export class DropAndFusionGame extends EventEmitter<{ export class DropAndFusionGame extends EventEmitter<{
changeScore: (newScore: number) => void; changeScore: (newScore: number) => void;
changeCombo: (newCombo: number) => void; changeCombo: (newCombo: number) => void;
@ -1003,7 +1297,7 @@ export class DropAndFusionGame extends EventEmitter<{
private tickCallbackQueue: { frame: number; callback: () => void; }[] = []; private tickCallbackQueue: { frame: number; callback: () => void; }[] = [];
private overflowCollider: Matter.Body; private overflowCollider: Matter.Body;
private isGameOver = false; private isGameOver = false;
private gameMode: 'normal' | 'yen' | 'square' | 'sweets'; private gameMode: 'normal' | 'yen' | 'square' | 'sweets' | 'prismisskey';
private rng: () => number; private rng: () => number;
private logs: Log[] = []; private logs: Log[] = [];
@ -1031,6 +1325,7 @@ export class DropAndFusionGame extends EventEmitter<{
case 'yen': return YEN_MONOS; case 'yen': return YEN_MONOS;
case 'square': return SQUARE_MONOS; case 'square': return SQUARE_MONOS;
case 'sweets': return SWEETS_MONOS; case 'sweets': return SWEETS_MONOS;
case 'prismisskey': return PRISMISSKEY_MONOS;
} }
} }
@ -1268,7 +1563,7 @@ export class DropAndFusionGame extends EventEmitter<{
for (let i = 0; i < this.STOCK_MAX; i++) { for (let i = 0; i < this.STOCK_MAX; i++) {
this.stock.push({ this.stock.push({
id: this.rng().toString(), id: this.rng().toString(),
mono: this.monoDefinitions.filter(x => x.dropCandidate)[Math.floor(this.rng() * this.monoDefinitions.filter(x => x.dropCandidate).length)], mono: this.monoDefinitions[7],
}); });
} }
this.emit('changeStock', this.stock); this.emit('changeStock', this.stock);