enhance(drop-and-fusion): sweets mode

This commit is contained in:
syuilo 2024-01-14 12:59:58 +09:00
parent 4846ab077b
commit 27dc0d3530
14 changed files with 586 additions and 65 deletions

Binary file not shown.

Before

Width:  |  Height:  |  Size: 3.0 KiB

After

Width:  |  Height:  |  Size: 4.4 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 25 KiB

After

Width:  |  Height:  |  Size: 25 KiB

Binary file not shown.

Before

Width:  |  Height:  |  Size: 15 KiB

After

Width:  |  Height:  |  Size: 16 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 525 B

Binary file not shown.

Before

Width:  |  Height:  |  Size: 522 B

After

Width:  |  Height:  |  Size: 511 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 568 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 554 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 582 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 547 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 499 B

Binary file not shown.

After

Width:  |  Height:  |  Size: 680 B

View File

@ -93,6 +93,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<div>SCORE: <MkNumber :value="score"/>{{ getScoreUnit(gameMode) }}</div> <div>SCORE: <MkNumber :value="score"/>{{ getScoreUnit(gameMode) }}</div>
<div>MAX CHAIN: <MkNumber :value="maxCombo"/></div> <div>MAX CHAIN: <MkNumber :value="maxCombo"/></div>
<div v-if="gameMode === 'yen'">TOTAL EARNINGS: <b><MkNumber :value="yenTotal ?? score"/></b></div> <div v-if="gameMode === 'yen'">TOTAL EARNINGS: <b><MkNumber :value="yenTotal ?? score"/></b></div>
<div v-if="gameMode === 'sweets'"><b>おにぎり<MkNumber :value="score / 130"/>個分</b></div>
</div> </div>
</div> </div>
<div v-if="replaying" :class="$style.replayIndicator"><span :class="$style.replayIndicatorText"><i class="ti ti-player-play"></i> {{ i18n.ts.replaying }}</span></div> <div v-if="replaying" :class="$style.replayIndicator"><span :class="$style.replayIndicatorText"><i class="ti ti-player-play"></i> {{ i18n.ts.replaying }}</span></div>
@ -152,6 +153,18 @@ SPDX-License-Identifier: AGPL-3.0-only
</div> </div>
</div> </div>
<div :class="$style.frame">
<div :class="$style.frameInner">
<div>FUSION RECIPE</div>
<div>
<div v-for="(mono, i) in game.monoDefinitions.sort((a, b) => a.level - b.level)" :key="mono.id" style="display: inline-block;">
<img :src="getTextureImageUrl(mono)" style="width: 32px; vertical-align: bottom;"/>
<div v-if="i < game.monoDefinitions.length - 1" style="display: inline-block; margin-left: 4px; vertical-align: bottom;"><i class="ti ti-arrow-big-right"></i></div>
</div>
</div>
</div>
</div>
<div :class="$style.frame"> <div :class="$style.frame">
<div :class="$style.frameInner"> <div :class="$style.frameInner">
<MkButton v-if="!isGameOver && !replaying" full danger @click="surrender">Surrender</MkButton> <MkButton v-if="!isGameOver && !replaying" full danger @click="surrender">Surrender</MkButton>
@ -416,70 +429,70 @@ const SWEETS_MONOS: FrontendMonoDefinition[] = [{
img: '/client-assets/drop-and-fusion/sweets_monos/shortcake_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/shortcake_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}, { }, {
id: 'f3468ef4-2e1e-4906-8795-f147f39f7e1f', id: 'f3468ef4-2e1e-4906-8795-f147f39f7e1f',
sfxPitch: 0.5, sfxPitch: 0.5,
img: '/client-assets/drop-and-fusion/sweets_monos/pancakes_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/pancakes_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}, { }, {
id: 'bcb41129-6f2d-44ee-89d3-86eb2df564ba', id: 'bcb41129-6f2d-44ee-89d3-86eb2df564ba',
sfxPitch: 0.75, sfxPitch: 0.75,
img: '/client-assets/drop-and-fusion/sweets_monos/shaved_ice_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/shaved_ice_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}, { }, {
id: 'f058e1ad-1981-409b-b3a7-302de0a43744', id: 'f058e1ad-1981-409b-b3a7-302de0a43744',
sfxPitch: 1, sfxPitch: 1,
img: '/client-assets/drop-and-fusion/sweets_monos/soft_ice_cream_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/soft_ice_cream_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}, { }, {
id: 'd22cfe38-5a3b-4b9c-a1a6-907930a3d732', id: 'd22cfe38-5a3b-4b9c-a1a6-907930a3d732',
sfxPitch: 1.5, sfxPitch: 1.5,
img: '/client-assets/drop-and-fusion/sweets_monos/doughnut_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/doughnut_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}, { }, {
id: '79867083-a073-427e-ae82-07a70d9f3b4f', id: '79867083-a073-427e-ae82-07a70d9f3b4f',
sfxPitch: 2, sfxPitch: 2,
img: '/client-assets/drop-and-fusion/sweets_monos/custard_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/custard_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}, { }, {
id: '2e152a12-a567-4100-b4d4-d15d81ba47b1', id: '2e152a12-a567-4100-b4d4-d15d81ba47b1',
sfxPitch: 2.5, sfxPitch: 2.5,
img: '/client-assets/drop-and-fusion/sweets_monos/chocolate_bar_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/chocolate_bar_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}, { }, {
id: '12250376-2258-4716-8eec-b3a7239461fc', id: '12250376-2258-4716-8eec-b3a7239461fc',
sfxPitch: 3, sfxPitch: 3,
img: '/client-assets/drop-and-fusion/sweets_monos/lollipop_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/lollipop_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}, { }, {
id: '4d4f2668-4be7-44a3-aa3a-856df6e25aa6', id: '4d4f2668-4be7-44a3-aa3a-856df6e25aa6',
sfxPitch: 3.5, sfxPitch: 3.5,
img: '/client-assets/drop-and-fusion/sweets_monos/candy_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/candy_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}, { }, {
id: 'c9984b40-4045-44c3-b260-d47b7b4625b2', id: 'c9984b40-4045-44c3-b260-d47b7b4625b2',
sfxPitch: 4, sfxPitch: 4,
img: '/client-assets/drop-and-fusion/sweets_monos/cookie_color.svg', img: '/client-assets/drop-and-fusion/sweets_monos/cookie_color.svg',
imgSizeX: 32, imgSizeX: 32,
imgSizeY: 32, imgSizeY: 32,
spriteScale: 1.12, spriteScale: 1,
}]; }];
const props = defineProps<{ const props = defineProps<{
@ -510,11 +523,13 @@ function getScoreUnit(gameMode: string) {
function getMonoRenderOptions(mono: Mono) { function getMonoRenderOptions(mono: Mono) {
const def = monoDefinitions.value.find(x => x.id === mono.id)!; const def = monoDefinitions.value.find(x => x.id === mono.id)!;
return { return {
sprite: { sprite: {
texture: def.img, texture: def.img,
xScale: (mono.sizeX / def.imgSizeX) * def.spriteScale, xScale: (mono.sizeX / def.imgSizeX) * def.spriteScale,
yScale: (mono.sizeY / def.imgSizeY) * def.spriteScale, yScale: (mono.sizeY / def.imgSizeY) * def.spriteScale,
}, },
}; };
} }
@ -1147,21 +1162,25 @@ onMounted(async () => {
} }
/* /*
const getVerticesFromSvg = async (path: string) => { const getVerticesFromSvg = async (path: string) => {
const svgDoc = await fetch(path) const svgDoc = await fetch(path)
.then((response) => response.text()) .then((response) => response.text())
.then((svgString) => { .then((svgString) => {
const parser = new DOMParser(); const parser = new DOMParser();
return parser.parseFromString(svgString, 'image/svg+xml'); return parser.parseFromString(svgString, 'image/svg+xml');
});
const pathDatas = svgDoc.querySelectorAll('path');
if (!pathDatas) return;
const vertices = Array.from(pathDatas).map((pathData) => {
return Matter.Svg.pathToVertices(pathData);
}); });
const pathDatas = svgDoc.querySelectorAll('path'); return vertices;
if (!pathDatas) return; };
const vertices = Array.from(pathDatas).map((pathData) => {
return Matter.Svg.pathToVertices(pathData); getVerticesFromSvg('/client-assets/drop-and-fusion/sweets_monos/verts/doughnut_color.svg').then((vertices) => {
console.log('doughnut_color', vertices);
}); });
return vertices; */
};
*/
await start(); await start();

View File

@ -27,7 +27,7 @@ SPDX-License-Identifier: AGPL-3.0-only
<option value="normal">NORMAL</option> <option value="normal">NORMAL</option>
<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>
</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>

View File

@ -14,6 +14,7 @@ export type Mono = {
sizeY: number; sizeY: number;
shape: 'circle' | 'rectangle' | 'custom'; shape: 'circle' | 'rectangle' | 'custom';
vertices?: Matter.Vector[][]; vertices?: Matter.Vector[][];
verticesSize?: number;
score: number; score: number;
dropCandidate: boolean; dropCandidate: boolean;
}; };
@ -280,47 +281,439 @@ const SQUARE_MONOS: Mono[] = [{
dropCandidate: true, dropCandidate: true,
}]; }];
const SWEETS_BASE_SIZE = 30; const SWEETS_BASE_SIZE = 40;
// TODO: custom shape vertices
const SWEETS_MONOS: Mono[] = [{ const SWEETS_MONOS: Mono[] = [{
id: '77f724c0-88be-4aeb-8e1a-a00ed18e3844', id: '77f724c0-88be-4aeb-8e1a-a00ed18e3844',
level: 10, level: 10,
sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'circle', shape: 'custom',
score: 512, vertices: [
[
{
'x': 14,
'y': 2,
},
{
'x': 2,
'y': 13,
},
{
'x': 2,
'y': 31,
},
{
'x': 30,
'y': 23,
},
{
'x': 30,
'y': 7,
},
{
'x': 29,
'y': 6,
},
{
'x': 20,
'y': 4,
},
{
'x': 17,
'y': 3,
},
{
'x': 16,
'y': 2,
},
],
],
verticesSize: 32,
score: 400,
dropCandidate: false, dropCandidate: false,
}, { }, {
id: 'f3468ef4-2e1e-4906-8795-f147f39f7e1f', id: 'f3468ef4-2e1e-4906-8795-f147f39f7e1f',
level: 9, level: 9,
sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'circle', shape: 'custom',
score: 256, vertices: [
[
{
'x': 15,
'y': 2,
},
{
'x': 14,
'y': 3,
},
{
'x': 8,
'y': 4,
},
{
'x': 6,
'y': 5,
},
{
'x': 4,
'y': 8,
},
{
'x': 4,
'y': 15,
},
{
'x': 2,
'y': 19,
},
{
'x': 2,
'y': 22.36,
},
{
'x': 3,
'y': 25,
},
{
'x': 5,
'y': 28,
},
{
'x': 10,
'y': 30,
},
{
'x': 22,
'y': 30,
},
{
'x': 27,
'y': 28,
},
{
'x': 29,
'y': 25,
},
{
'x': 30,
'y': 22,
},
{
'x': 30,
'y': 19,
},
{
'x': 28,
'y': 15,
},
{
'x': 28,
'y': 8,
},
{
'x': 26,
'y': 5,
},
{
'x': 24,
'y': 4,
},
{
'x': 18,
'y': 3,
},
{
'x': 17,
'y': 2,
},
],
],
verticesSize: 32,
score: 380,
dropCandidate: false, dropCandidate: false,
}, { }, {
id: 'bcb41129-6f2d-44ee-89d3-86eb2df564ba', id: 'bcb41129-6f2d-44ee-89d3-86eb2df564ba',
level: 8, level: 8,
sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'circle', shape: 'custom',
score: 128, vertices: [
[
{
'x': 15,
'y': 2,
},
{
'x': 11,
'y': 3,
},
{
'x': 8,
'y': 6,
},
{
'x': 7,
'y': 8,
},
{
'x': 6,
'y': 11,
},
{
'x': 6,
'y': 13,
},
{
'x': 7,
'y': 16,
},
{
'x': 8,
'y': 18,
},
{
'x': 15,
'y': 30,
},
{
'x': 17,
'y': 30,
},
{
'x': 24,
'y': 18,
},
{
'x': 25,
'y': 16,
},
{
'x': 26,
'y': 13,
},
{
'x': 26,
'y': 11,
},
{
'x': 25,
'y': 8,
},
{
'x': 24,
'y': 6,
},
{
'x': 21,
'y': 3,
},
{
'x': 17,
'y': 2,
},
],
],
verticesSize: 32,
score: 300,
dropCandidate: false, dropCandidate: false,
}, { }, {
id: 'f058e1ad-1981-409b-b3a7-302de0a43744', id: 'f058e1ad-1981-409b-b3a7-302de0a43744',
level: 7, level: 7,
sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'circle', shape: 'custom',
score: 64, vertices: [
[
{
'x': 17,
'y': 2.541,
},
{
'x': 14,
'y': 5.402,
},
{
'x': 10,
'y': 7,
},
{
'x': 10,
'y': 10.367,
},
{
'x': 8,
'y': 11,
},
{
'x': 8,
'y': 14,
},
{
'x': 5.781,
'y': 16.265,
},
{
'x': 6.594,
'y': 19.627,
},
{
'x': 9.414,
'y': 21,
},
{
'x': 12,
'y': 29.988,
},
{
'x': 21,
'y': 29.988,
},
{
'x': 22.016,
'y': 22.629,
},
{
'x': 23,
'y': 21.772,
},
{
'x': 23,
'y': 19.202,
},
{
'x': 25.783,
'y': 17.473,
},
{
'x': 25.783,
'y': 14.727,
},
{
'x': 24,
'y': 13.173,
},
{
'x': 24,
'y': 10.367,
},
{
'x': 22,
'y': 9.233,
},
{
'x': 22,
'y': 6.454,
},
{
'x': 18,
'y': 5,
},
],
],
verticesSize: 32,
score: 300,
dropCandidate: false, dropCandidate: false,
}, { }, {
id: 'd22cfe38-5a3b-4b9c-a1a6-907930a3d732', id: 'd22cfe38-5a3b-4b9c-a1a6-907930a3d732',
level: 6, level: 6,
sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25, sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25 * 1.25 * 1.25,
shape: 'circle', shape: 'custom',
score: 32, vertices: [
[
{
'x': 15,
'y': 2,
},
{
'x': 11,
'y': 3,
},
{
'x': 8,
'y': 5,
},
{
'x': 7,
'y': 6,
},
{
'x': 5,
'y': 9,
},
{
'x': 4,
'y': 12,
},
{
'x': 4,
'y': 20,
},
{
'x': 5,
'y': 23,
},
{
'x': 7,
'y': 26,
},
{
'x': 11,
'y': 29,
},
{
'x': 14,
'y': 30,
},
{
'x': 18,
'y': 30,
},
{
'x': 21,
'y': 29,
},
{
'x': 25,
'y': 26,
},
{
'x': 27,
'y': 23,
},
{
'x': 28,
'y': 20,
},
{
'x': 28,
'y': 12,
},
{
'x': 27,
'y': 9,
},
{
'x': 25,
'y': 6,
},
{
'x': 24,
'y': 5,
},
{
'x': 21,
'y': 3,
},
{
'x': 17,
'y': 2,
},
],
],
verticesSize: 32,
score: 250,
dropCandidate: false, dropCandidate: false,
}, { }, {
id: '79867083-a073-427e-ae82-07a70d9f3b4f', id: '79867083-a073-427e-ae82-07a70d9f3b4f',
@ -331,56 +724,163 @@ const SWEETS_MONOS: Mono[] = [{
vertices: [ vertices: [
[ [
{ {
'x': 8, 'x': 9,
'y': 15, 'y': 15,
}, },
{ {
'x': 24, 'x': 23,
'y': 15, 'y': 15,
}, },
{
'x': 26,
'y': 26,
},
{ {
'x': 30, 'x': 30,
'y': 26, 'y': 27,
}, },
{ {
'x': 24.7, 'x': 25.7,
'y': 30, 'y': 30,
}, },
{ {
'x': 7.34, 'x': 6.34,
'y': 30, 'y': 30,
}, },
{ {
'x': 2, 'x': 2,
'y': 26, 'y': 27,
},
{
'x': 6,
'y': 26,
}, },
], ],
], ],
score: 16, verticesSize: 32,
score: 200,
dropCandidate: true, dropCandidate: true,
}, { }, {
id: '2e152a12-a567-4100-b4d4-d15d81ba47b1', id: '2e152a12-a567-4100-b4d4-d15d81ba47b1',
level: 4, level: 4,
sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25, sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25,
sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25, sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25,
shape: 'circle', shape: 'custom',
score: 8, vertices: [
[
{
'x': 12,
'y': 2,
},
{
'x': 2,
'y': 12,
},
{
'x': 2,
'y': 14,
},
{
'x': 18,
'y': 30,
},
{
'x': 20,
'y': 30,
},
{
'x': 30,
'y': 20,
},
{
'x': 30,
'y': 18,
},
{
'x': 14,
'y': 2,
},
],
],
verticesSize: 32,
score: 200,
dropCandidate: true, dropCandidate: true,
}, { }, {
id: '12250376-2258-4716-8eec-b3a7239461fc', id: '12250376-2258-4716-8eec-b3a7239461fc',
level: 3, level: 3,
sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25, sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25,
sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25, sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25,
shape: 'circle', shape: 'custom',
score: 4, vertices: [
[
{
'x': 12,
'y': 2,
},
{
'x': 7,
'y': 3,
},
{
'x': 3,
'y': 7,
},
{
'x': 2,
'y': 12,
},
{
'x': 3,
'y': 16,
},
{
'x': 5,
'y': 19,
},
{
'x': 8,
'y': 21,
},
{
'x': 12,
'y': 22,
},
{
'x': 18,
'y': 21,
},
{
'x': 27,
'y': 30,
},
{
'x': 30,
'y': 30,
},
{
'x': 30,
'y': 27,
},
{
'x': 21,
'y': 18,
},
{
'x': 22,
'y': 14.25,
},
{
'x': 22,
'y': 11,
},
{
'x': 21,
'y': 8,
},
{
'x': 19,
'y': 5,
},
{
'x': 16.5,
'y': 3,
},
],
],
verticesSize: 32,
score: 120,
dropCandidate: true, dropCandidate: true,
}, { }, {
id: '4d4f2668-4be7-44a3-aa3a-856df6e25aa6', id: '4d4f2668-4be7-44a3-aa3a-856df6e25aa6',
@ -392,14 +892,14 @@ const SWEETS_MONOS: Mono[] = [{
[ [
{ {
'x': 12, 'x': 12,
'y': 1.9180000000000001, 'y': 1.9,
}, },
{ {
'x': 4, 'x': 4,
'y': 4, 'y': 4,
}, },
{ {
'x': 2.016, 'x': 2,
'y': 12, 'y': 12,
}, },
{ {
@ -419,7 +919,7 @@ const SWEETS_MONOS: Mono[] = [{
'y': 25.372, 'y': 25.372,
}, },
{ {
'x': 16.008, 'x': 16,
'y': 26, 'y': 26,
}, },
{ {
@ -455,7 +955,7 @@ const SWEETS_MONOS: Mono[] = [{
'y': 7, 'y': 7,
}, },
{ {
'x': 16.008, 'x': 16,
'y': 6, 'y': 6,
}, },
{ {
@ -464,7 +964,8 @@ const SWEETS_MONOS: Mono[] = [{
}, },
], ],
], ],
score: 2, verticesSize: 32,
score: 20,
dropCandidate: true, dropCandidate: true,
}, { }, {
id: 'c9984b40-4045-44c3-b260-d47b7b4625b2', id: 'c9984b40-4045-44c3-b260-d47b7b4625b2',
@ -472,7 +973,7 @@ const SWEETS_MONOS: Mono[] = [{
sizeX: SWEETS_BASE_SIZE, sizeX: SWEETS_BASE_SIZE,
sizeY: SWEETS_BASE_SIZE, sizeY: SWEETS_BASE_SIZE,
shape: 'circle', shape: 'circle',
score: 1, score: 30,
dropCandidate: true, dropCandidate: true,
}]; }];
@ -524,7 +1025,7 @@ export class DropAndFusionGame extends EventEmitter<{
private stock: { id: string; mono: Mono }[] = []; private stock: { id: string; mono: Mono }[] = [];
private holding: { id: string; mono: Mono } | null = null; private holding: { id: string; mono: Mono } | null = null;
private get monoDefinitions() { public get monoDefinitions() {
switch (this.gameMode) { switch (this.gameMode) {
case 'normal': return NORAML_MONOS; case 'normal': return NORAML_MONOS;
case 'yen': return YEN_MONOS; case 'yen': return YEN_MONOS;
@ -646,8 +1147,8 @@ export class DropAndFusionGame extends EventEmitter<{
return Matter.Bodies.rectangle(x, y, mono.sizeX, mono.sizeY, options); return Matter.Bodies.rectangle(x, y, mono.sizeX, mono.sizeY, options);
} else if (mono.shape === 'custom') { } else if (mono.shape === 'custom') {
return Matter.Bodies.fromVertices(x, y, mono.vertices!.map(i => i.map(j => ({ return Matter.Bodies.fromVertices(x, y, mono.vertices!.map(i => i.map(j => ({
x: (j.x / 32) * mono.sizeX, x: (j.x / mono.verticesSize!) * mono.sizeX,
y: (j.y / 32) * mono.sizeY, y: (j.y / mono.verticesSize!) * mono.sizeY,
}))), options); }))), options);
} else { } else {
throw new Error('unrecognized shape'); throw new Error('unrecognized shape');
@ -687,7 +1188,8 @@ export class DropAndFusionGame extends EventEmitter<{
this.emit('monoAdded', nextMono); this.emit('monoAdded', nextMono);
} }
const comboBonus = this.gameMode === 'yen' ? 1 : 1 + ((this.combo - 1) / 5); const hasComboBonus = this.gameMode !== 'yen' && this.gameMode !== 'sweets';
const comboBonus = hasComboBonus ? 1 + ((this.combo - 1) / 5) : 1;
const additionalScore = Math.round(currentMono.score * comboBonus); const additionalScore = Math.round(currentMono.score * comboBonus);
this.score += additionalScore; this.score += additionalScore;