mirror of
https://github.com/misskey-dev/misskey.git
synced 2025-01-15 01:31:14 +09:00
wip
This commit is contained in:
parent
366fade8d3
commit
1ea098f4b4
@ -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;
|
||||
}
|
||||
if (engine.isRiichiHouse(res.canCiiHouse)) {
|
||||
if (res.canCiiHouse != null && engine.isRiichiHouse(res.canCiiHouse)) {
|
||||
answers.cii = false;
|
||||
}
|
||||
if (engine.isRiichiHouse(res.canKanHouse)) {
|
||||
if (res.canKanHouse != null && engine.isRiichiHouse(res.canKanHouse)) {
|
||||
answers.kan = false;
|
||||
}
|
||||
|
||||
|
@ -118,13 +118,30 @@ const isMyTurn = 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(() => {
|
||||
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([
|
||||
'm3',
|
||||
|
@ -233,3 +233,12 @@ export function getHoraTiles(handTiles: Tile[]): Tile[] {
|
||||
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;
|
||||
});
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user