diff --git a/packages/backend/src/core/MahjongService.ts b/packages/backend/src/core/MahjongService.ts
index e4abbe8076..9a6422340e 100644
--- a/packages/backend/src/core/MahjongService.ts
+++ b/packages/backend/src/core/MahjongService.ts
@@ -376,7 +376,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
}
@bindThis
- private async dahai(room: Room, engine: Mahjong.MasterGameEngine, house: Mahjong.House, tile: Mahjong.Tile, riichi = false) {
+ private async dahai(room: Room, engine: Mahjong.MasterGameEngine, house: Mahjong.House, tile: Mahjong.TileId, riichi = false) {
const res = engine.commit_dahai(house, tile, riichi);
room.gameState = engine.state;
await this.saveRoom(room);
@@ -384,8 +384,6 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
const aiHouses = [[1, room.user1Ai], [2, room.user2Ai], [3, room.user3Ai], [4, room.user4Ai]].filter(([id, ai]) => ai).map(([id, ai]) => engine.getHouse(id));
if (res.asking) {
- console.log('asking', res);
-
const answers: CallingAnswers = {
pon: null,
cii: null,
@@ -478,11 +476,10 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
}
@bindThis
- public async commit_dahai(roomId: MiMahjongGame['id'], user: MiUser, tile: string, riichi = false) {
+ public async commit_dahai(roomId: MiMahjongGame['id'], user: MiUser, tile: Mahjong.TileId, riichi = false) {
const room = await this.getRoom(roomId);
if (room == null) return;
if (room.gameState == null) return;
- if (!Mahjong.isTile(tile)) return;
const engine = new Mahjong.MasterGameEngine(room.gameState);
const myHouse = getHouseOfUserId(room, engine, user.id);
@@ -493,7 +490,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
}
@bindThis
- public async commit_ankan(roomId: MiMahjongGame['id'], user: MiUser, tile: string) {
+ public async commit_ankan(roomId: MiMahjongGame['id'], user: MiUser, tile: Mahjong.TileId) {
const room = await this.getRoom(roomId);
if (room == null) return;
if (room.gameState == null) return;
@@ -511,7 +508,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
}
@bindThis
- public async commit_kakan(roomId: MiMahjongGame['id'], user: MiUser, tile: string) {
+ public async commit_kakan(roomId: MiMahjongGame['id'], user: MiUser, tile: Mahjong.TileId) {
const room = await this.getRoom(roomId);
if (room == null) return;
if (room.gameState == null) return;
@@ -643,11 +640,10 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
if (engine.state.riichis[house]) {
// リーチ時はアガリ牌でない限りツモ切り
- const handTiles = engine.state.handTiles[house];
- const horaSets = Mahjong.getHoraSets(handTiles);
+ const horaSets = Mahjong.getHoraSets(engine.handTileTypes[house]);
if (horaSets.length === 0) {
setTimeout(() => {
- this.dahai(room, engine, house, handTiles.at(-1));
+ this.dahai(room, engine, house, engine.state.handTiles[house].at(-1));
}, 500);
return;
}
diff --git a/packages/backend/src/server/api/stream/channels/mahjong-room.ts b/packages/backend/src/server/api/stream/channels/mahjong-room.ts
index b2e2ccdb92..de7fc4f467 100644
--- a/packages/backend/src/server/api/stream/channels/mahjong-room.ts
+++ b/packages/backend/src/server/api/stream/channels/mahjong-room.ts
@@ -94,7 +94,7 @@ class MahjongRoomChannel extends Channel {
}
@bindThis
- private async dahai(tile: string, riichi = false) {
+ private async dahai(tile: number, riichi = false) {
if (this.user == null) return;
this.mahjongService.commit_dahai(this.roomId!, this.user, tile, riichi);
@@ -136,14 +136,14 @@ class MahjongRoomChannel extends Channel {
}
@bindThis
-private async ankan(tile: string) {
+private async ankan(tile: number) {
if (this.user == null) return;
this.mahjongService.commit_ankan(this.roomId!, this.user, tile);
}
@bindThis
- private async kakan(tile: string) {
+ private async kakan(tile: number) {
if (this.user == null) return;
this.mahjongService.commit_kakan(this.roomId!, this.user, tile);
diff --git a/packages/frontend/assets/mahjong/tiles/m5r.png b/packages/frontend/assets/mahjong/tiles/m5r.png
new file mode 100644
index 0000000000..7347fb14ba
Binary files /dev/null and b/packages/frontend/assets/mahjong/tiles/m5r.png differ
diff --git a/packages/frontend/assets/mahjong/tiles/p5r.png b/packages/frontend/assets/mahjong/tiles/p5r.png
new file mode 100644
index 0000000000..6454624dce
Binary files /dev/null and b/packages/frontend/assets/mahjong/tiles/p5r.png differ
diff --git a/packages/frontend/assets/mahjong/tiles/s5r.png b/packages/frontend/assets/mahjong/tiles/s5r.png
new file mode 100644
index 0000000000..09b1b884bf
Binary files /dev/null and b/packages/frontend/assets/mahjong/tiles/s5r.png differ
diff --git a/packages/frontend/src/pages/mahjong/huro.vue b/packages/frontend/src/pages/mahjong/huro.vue
index 10923f23b4..1c6da57efb 100644
--- a/packages/frontend/src/pages/mahjong/huro.vue
+++ b/packages/frontend/src/pages/mahjong/huro.vue
@@ -5,26 +5,26 @@ SPDX-License-Identifier: AGPL-3.0-only