From 27dc0d353095f1f961ccec18d994960af367cb75 Mon Sep 17 00:00:00 2001 From: syuilo Date: Sun, 14 Jan 2024 12:59:58 +0900 Subject: [PATCH] enhance(drop-and-fusion): sweets mode --- .../sweets_monos/custard_color.svg | 67 +- .../sweets_monos/pancakes_color.svg | 347 +++-------- .../sweets_monos/shortcake_color.svg | 165 ++--- .../verts/chocolate_bar_color.svg | 5 + .../sweets_monos/verts/custard_color.svg | 2 +- .../sweets_monos/verts/doughnut_color.svg | 5 + .../sweets_monos/verts/lollipop_color.svg | 5 + .../sweets_monos/verts/pancakes_color.svg | 5 + .../sweets_monos/verts/shaved_ice_color.svg | 5 + .../sweets_monos/verts/shortcake_color.svg | 5 + .../verts/soft_ice_cream_color.svg | 5 + .../src/pages/drop-and-fusion.game.vue | 65 +- .../frontend/src/pages/drop-and-fusion.vue | 2 +- .../src/scripts/drop-and-fusion-engine.ts | 584 ++++++++++++++++-- 14 files changed, 781 insertions(+), 486 deletions(-) create mode 100644 packages/frontend/assets/drop-and-fusion/sweets_monos/verts/chocolate_bar_color.svg create mode 100644 packages/frontend/assets/drop-and-fusion/sweets_monos/verts/doughnut_color.svg create mode 100644 packages/frontend/assets/drop-and-fusion/sweets_monos/verts/lollipop_color.svg create mode 100644 packages/frontend/assets/drop-and-fusion/sweets_monos/verts/pancakes_color.svg create mode 100644 packages/frontend/assets/drop-and-fusion/sweets_monos/verts/shaved_ice_color.svg create mode 100644 packages/frontend/assets/drop-and-fusion/sweets_monos/verts/shortcake_color.svg create mode 100644 packages/frontend/assets/drop-and-fusion/sweets_monos/verts/soft_ice_cream_color.svg diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/custard_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/custard_color.svg index c76b3335e5..d967fec7fe 100644 --- a/packages/frontend/assets/drop-and-fusion/sweets_monos/custard_color.svg +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/custard_color.svg @@ -1,47 +1,22 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/pancakes_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/pancakes_color.svg index 69ad069cc2..94b2ab69b5 100644 --- a/packages/frontend/assets/drop-and-fusion/sweets_monos/pancakes_color.svg +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/pancakes_color.svg @@ -1,257 +1,92 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/shortcake_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/shortcake_color.svg index 75143105d2..66e8f91f19 100644 --- a/packages/frontend/assets/drop-and-fusion/sweets_monos/shortcake_color.svg +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/shortcake_color.svg @@ -1,119 +1,48 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/chocolate_bar_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/chocolate_bar_color.svg new file mode 100644 index 0000000000..5cd39cc9e3 --- /dev/null +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/chocolate_bar_color.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/custard_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/custard_color.svg index db547a5cfc..dd4870dd7d 100644 --- a/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/custard_color.svg +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/custard_color.svg @@ -1,5 +1,5 @@ - + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/doughnut_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/doughnut_color.svg new file mode 100644 index 0000000000..a8d5557f5c --- /dev/null +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/doughnut_color.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/lollipop_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/lollipop_color.svg new file mode 100644 index 0000000000..d3778737a9 --- /dev/null +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/lollipop_color.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/pancakes_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/pancakes_color.svg new file mode 100644 index 0000000000..b1a1a322e0 --- /dev/null +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/pancakes_color.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/shaved_ice_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/shaved_ice_color.svg new file mode 100644 index 0000000000..00872c7a0c --- /dev/null +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/shaved_ice_color.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/shortcake_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/shortcake_color.svg new file mode 100644 index 0000000000..e6ed1fbbf9 --- /dev/null +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/shortcake_color.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/soft_ice_cream_color.svg b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/soft_ice_cream_color.svg new file mode 100644 index 0000000000..b77e0c3655 --- /dev/null +++ b/packages/frontend/assets/drop-and-fusion/sweets_monos/verts/soft_ice_cream_color.svg @@ -0,0 +1,5 @@ + + + + + diff --git a/packages/frontend/src/pages/drop-and-fusion.game.vue b/packages/frontend/src/pages/drop-and-fusion.game.vue index f14f5dbff6..a8fa953c38 100644 --- a/packages/frontend/src/pages/drop-and-fusion.game.vue +++ b/packages/frontend/src/pages/drop-and-fusion.game.vue @@ -93,6 +93,7 @@ SPDX-License-Identifier: AGPL-3.0-only
SCORE: {{ getScoreUnit(gameMode) }}
MAX CHAIN:
TOTAL EARNINGS:
+
おにぎり個分
{{ i18n.ts.replaying }}
@@ -152,6 +153,18 @@ SPDX-License-Identifier: AGPL-3.0-only +
+
+
FUSION RECIPE
+
+
+ +
+
+
+
+
+
Surrender @@ -416,70 +429,70 @@ const SWEETS_MONOS: FrontendMonoDefinition[] = [{ img: '/client-assets/drop-and-fusion/sweets_monos/shortcake_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }, { id: 'f3468ef4-2e1e-4906-8795-f147f39f7e1f', sfxPitch: 0.5, img: '/client-assets/drop-and-fusion/sweets_monos/pancakes_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }, { id: 'bcb41129-6f2d-44ee-89d3-86eb2df564ba', sfxPitch: 0.75, img: '/client-assets/drop-and-fusion/sweets_monos/shaved_ice_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }, { id: 'f058e1ad-1981-409b-b3a7-302de0a43744', sfxPitch: 1, img: '/client-assets/drop-and-fusion/sweets_monos/soft_ice_cream_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }, { id: 'd22cfe38-5a3b-4b9c-a1a6-907930a3d732', sfxPitch: 1.5, img: '/client-assets/drop-and-fusion/sweets_monos/doughnut_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }, { id: '79867083-a073-427e-ae82-07a70d9f3b4f', sfxPitch: 2, img: '/client-assets/drop-and-fusion/sweets_monos/custard_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }, { id: '2e152a12-a567-4100-b4d4-d15d81ba47b1', sfxPitch: 2.5, img: '/client-assets/drop-and-fusion/sweets_monos/chocolate_bar_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }, { id: '12250376-2258-4716-8eec-b3a7239461fc', sfxPitch: 3, img: '/client-assets/drop-and-fusion/sweets_monos/lollipop_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }, { id: '4d4f2668-4be7-44a3-aa3a-856df6e25aa6', sfxPitch: 3.5, img: '/client-assets/drop-and-fusion/sweets_monos/candy_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }, { id: 'c9984b40-4045-44c3-b260-d47b7b4625b2', sfxPitch: 4, img: '/client-assets/drop-and-fusion/sweets_monos/cookie_color.svg', imgSizeX: 32, imgSizeY: 32, - spriteScale: 1.12, + spriteScale: 1, }]; const props = defineProps<{ @@ -510,11 +523,13 @@ function getScoreUnit(gameMode: string) { function getMonoRenderOptions(mono: Mono) { const def = monoDefinitions.value.find(x => x.id === mono.id)!; return { + sprite: { texture: def.img, xScale: (mono.sizeX / def.imgSizeX) * def.spriteScale, yScale: (mono.sizeY / def.imgSizeY) * def.spriteScale, }, + }; } @@ -1147,21 +1162,25 @@ onMounted(async () => { } /* -const getVerticesFromSvg = async (path: string) => { - const svgDoc = await fetch(path) - .then((response) => response.text()) - .then((svgString) => { - const parser = new DOMParser(); - return parser.parseFromString(svgString, 'image/svg+xml'); + const getVerticesFromSvg = async (path: string) => { + const svgDoc = await fetch(path) + .then((response) => response.text()) + .then((svgString) => { + const parser = new DOMParser(); + 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'); - if (!pathDatas) return; - const vertices = Array.from(pathDatas).map((pathData) => { - return Matter.Svg.pathToVertices(pathData); + return vertices; + }; + + getVerticesFromSvg('/client-assets/drop-and-fusion/sweets_monos/verts/doughnut_color.svg').then((vertices) => { + console.log('doughnut_color', vertices); }); - return vertices; -}; -*/ + */ await start(); diff --git a/packages/frontend/src/pages/drop-and-fusion.vue b/packages/frontend/src/pages/drop-and-fusion.vue index 5fc71f7001..18d3f56ca2 100644 --- a/packages/frontend/src/pages/drop-and-fusion.vue +++ b/packages/frontend/src/pages/drop-and-fusion.vue @@ -27,7 +27,7 @@ SPDX-License-Identifier: AGPL-3.0-only - + {{ i18n.ts.start }}
diff --git a/packages/frontend/src/scripts/drop-and-fusion-engine.ts b/packages/frontend/src/scripts/drop-and-fusion-engine.ts index 06668743e3..7c75822a20 100644 --- a/packages/frontend/src/scripts/drop-and-fusion-engine.ts +++ b/packages/frontend/src/scripts/drop-and-fusion-engine.ts @@ -14,6 +14,7 @@ export type Mono = { sizeY: number; shape: 'circle' | 'rectangle' | 'custom'; vertices?: Matter.Vector[][]; + verticesSize?: number; score: number; dropCandidate: boolean; }; @@ -280,47 +281,439 @@ const SQUARE_MONOS: Mono[] = [{ dropCandidate: true, }]; -const SWEETS_BASE_SIZE = 30; -// TODO: custom shape vertices +const SWEETS_BASE_SIZE = 40; const SWEETS_MONOS: Mono[] = [{ id: '77f724c0-88be-4aeb-8e1a-a00ed18e3844', level: 10, 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, - shape: 'circle', - score: 512, + shape: 'custom', + 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, }, { id: 'f3468ef4-2e1e-4906-8795-f147f39f7e1f', level: 9, 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, - shape: 'circle', - score: 256, + shape: 'custom', + 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, }, { id: 'bcb41129-6f2d-44ee-89d3-86eb2df564ba', level: 8, 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, - shape: 'circle', - score: 128, + shape: 'custom', + 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, }, { id: 'f058e1ad-1981-409b-b3a7-302de0a43744', level: 7, 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, - shape: 'circle', - score: 64, + shape: 'custom', + 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, }, { id: 'd22cfe38-5a3b-4b9c-a1a6-907930a3d732', level: 6, 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, - shape: 'circle', - score: 32, + shape: 'custom', + 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, }, { id: '79867083-a073-427e-ae82-07a70d9f3b4f', @@ -331,56 +724,163 @@ const SWEETS_MONOS: Mono[] = [{ vertices: [ [ { - 'x': 8, + 'x': 9, 'y': 15, }, { - 'x': 24, + 'x': 23, 'y': 15, }, - { - 'x': 26, - 'y': 26, - }, { 'x': 30, - 'y': 26, + 'y': 27, }, { - 'x': 24.7, + 'x': 25.7, 'y': 30, }, { - 'x': 7.34, + 'x': 6.34, 'y': 30, }, { 'x': 2, - 'y': 26, - }, - { - 'x': 6, - 'y': 26, + 'y': 27, }, ], ], - score: 16, + verticesSize: 32, + score: 200, dropCandidate: true, }, { id: '2e152a12-a567-4100-b4d4-d15d81ba47b1', level: 4, sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25, sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25 * 1.25, - shape: 'circle', - score: 8, + shape: 'custom', + 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, }, { id: '12250376-2258-4716-8eec-b3a7239461fc', level: 3, sizeX: SWEETS_BASE_SIZE * 1.25 * 1.25, sizeY: SWEETS_BASE_SIZE * 1.25 * 1.25, - shape: 'circle', - score: 4, + shape: 'custom', + 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, }, { id: '4d4f2668-4be7-44a3-aa3a-856df6e25aa6', @@ -392,14 +892,14 @@ const SWEETS_MONOS: Mono[] = [{ [ { 'x': 12, - 'y': 1.9180000000000001, + 'y': 1.9, }, { 'x': 4, 'y': 4, }, { - 'x': 2.016, + 'x': 2, 'y': 12, }, { @@ -419,7 +919,7 @@ const SWEETS_MONOS: Mono[] = [{ 'y': 25.372, }, { - 'x': 16.008, + 'x': 16, 'y': 26, }, { @@ -455,7 +955,7 @@ const SWEETS_MONOS: Mono[] = [{ 'y': 7, }, { - 'x': 16.008, + 'x': 16, 'y': 6, }, { @@ -464,7 +964,8 @@ const SWEETS_MONOS: Mono[] = [{ }, ], ], - score: 2, + verticesSize: 32, + score: 20, dropCandidate: true, }, { id: 'c9984b40-4045-44c3-b260-d47b7b4625b2', @@ -472,7 +973,7 @@ const SWEETS_MONOS: Mono[] = [{ sizeX: SWEETS_BASE_SIZE, sizeY: SWEETS_BASE_SIZE, shape: 'circle', - score: 1, + score: 30, dropCandidate: true, }]; @@ -524,7 +1025,7 @@ export class DropAndFusionGame extends EventEmitter<{ private stock: { id: string; mono: Mono }[] = []; private holding: { id: string; mono: Mono } | null = null; - private get monoDefinitions() { + public get monoDefinitions() { switch (this.gameMode) { case 'normal': return NORAML_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); } else if (mono.shape === 'custom') { return Matter.Bodies.fromVertices(x, y, mono.vertices!.map(i => i.map(j => ({ - x: (j.x / 32) * mono.sizeX, - y: (j.y / 32) * mono.sizeY, + x: (j.x / mono.verticesSize!) * mono.sizeX, + y: (j.y / mono.verticesSize!) * mono.sizeY, }))), options); } else { throw new Error('unrecognized shape'); @@ -687,7 +1188,8 @@ export class DropAndFusionGame extends EventEmitter<{ 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); this.score += additionalScore;