This commit is contained in:
syuilo
2024-02-01 20:34:05 +09:00
parent 10a112489d
commit c964c49c58
3 changed files with 59 additions and 7 deletions

View File

@@ -511,6 +511,24 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
await this.dahai(room, engine, myHouse, tile, riichi);
}
@bindThis
public async commit_ankan(roomId: MiMahjongGame['id'], user: MiUser, tile: string) {
const room = await this.getRoom(roomId);
if (room == null) return;
if (room.gameState == null) return;
const engine = new Mahjong.MasterGameEngine(room.gameState);
const myHouse = getHouseOfUserId(room, engine, user.id);
await this.clearTurnWaitingTimer(room.id);
const res = engine.commit_ankan(myHouse, tile);
this.globalEventService.publishMahjongRoomStream(room.id, 'ankanned', { });
this.waitForTurn(room, myHouse, engine);
}
@bindThis
public async commit_kakan(roomId: MiMahjongGame['id'], user: MiUser) {
const room = await this.getRoom(roomId);
@@ -599,7 +617,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
}
/**
* プレイヤーの行動(打牌、加槓、ツモ和了)を待つ
* プレイヤーの行動(打牌、加槓、暗槓、ツモ和了)を待つ
* 制限時間が過ぎたらツモ切り
* NOTE: 時間切れチェックが行われたときにタイミングによっては次のwaitingが始まっている場合があることを考慮し、Setに一意のIDを格納する構造としている
* @param room
@@ -642,7 +660,7 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
}
/**
* プレイヤーが行動(打牌、加槓、ツモ和了)したら呼ぶ
* プレイヤーが行動(打牌、加槓、暗槓、ツモ和了)したら呼ぶ
* @param roomId
*/
@bindThis