This commit is contained in:
syuilo 2024-01-28 20:34:45 +09:00
parent 366fade8d3
commit 1ea098f4b4
3 changed files with 31 additions and 5 deletions

View File

@ -359,13 +359,13 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
}; };
// リーチ中はポン、チー、カンできない // リーチ中はポン、チー、カンできない
if (engine.isRiichiHouse(res.canPonHouse)) { if (res.canPonHouse != null && engine.isRiichiHouse(res.canPonHouse)) {
answers.pon = false; answers.pon = false;
} }
if (engine.isRiichiHouse(res.canCiiHouse)) { if (res.canCiiHouse != null && engine.isRiichiHouse(res.canCiiHouse)) {
answers.cii = false; answers.cii = false;
} }
if (engine.isRiichiHouse(res.canKanHouse)) { if (res.canKanHouse != null && engine.isRiichiHouse(res.canKanHouse)) {
answers.kan = false; answers.kan = false;
} }

View File

@ -118,13 +118,30 @@ const isMyTurn = computed(() => {
}); });
const canRiichi = computed(() => { const canRiichi = computed(() => {
return Mahjong.Utils.getHoraTiles(engine.value.myHandTiles).length > 0; return Mahjong.Utils.getTilesForRiichi(engine.value.myHandTiles).length > 0;
}); });
const canHora = computed(() => { const canHora = computed(() => {
return Mahjong.Utils.getHoraSets(engine.value.myHandTiles).length > 0; return Mahjong.Utils.getHoraSets(engine.value.myHandTiles).length > 0;
}); });
/*
console.log(Mahjong.Utils.getTilesForRiichi([
'm1',
'm2',
'm2',
'm3',
'm3',
'm5',
'm6',
'p4',
'p5',
'p6',
's6',
's7',
's8',
'm7',
]));
*/
/* /*
console.log(Mahjong.Utils.getHoraSets([ console.log(Mahjong.Utils.getHoraSets([
'm3', 'm3',

View File

@ -233,3 +233,12 @@ export function getHoraTiles(handTiles: Tile[]): Tile[] {
return horaSets.length > 0; return horaSets.length > 0;
}); });
} }
export function getTilesForRiichi(handTiles: Tile[]): Tile[] {
return handTiles.filter(tile => {
const tempHandTiles = [...handTiles];
tempHandTiles.splice(tempHandTiles.indexOf(tile), 1);
const horaTiles = getHoraTiles(tempHandTiles);
return horaTiles.length > 0;
});
}