wip
This commit is contained in:
parent
d427d24ca4
commit
547b74c9b2
|
@ -226,6 +226,12 @@ export interface MahjongRoomEventTypes {
|
||||||
callee: Mahjong.Common.House;
|
callee: Mahjong.Common.House;
|
||||||
tile: Mahjong.Common.Tile;
|
tile: Mahjong.Common.Tile;
|
||||||
};
|
};
|
||||||
|
kanned: {
|
||||||
|
caller: Mahjong.Common.House;
|
||||||
|
callee: Mahjong.Common.House;
|
||||||
|
tile: Mahjong.Common.Tile;
|
||||||
|
rinsyan: Mahjong.Common.Tile;
|
||||||
|
};
|
||||||
ronned: {
|
ronned: {
|
||||||
};
|
};
|
||||||
hora: {
|
hora: {
|
||||||
|
|
|
@ -315,9 +315,20 @@ export class MahjongService implements OnApplicationShutdown, OnModuleInit {
|
||||||
const userId = engine.state.user1House === engine.state.turn ? room.user1Id : engine.state.user2House === engine.state.turn ? room.user2Id : engine.state.user3House === engine.state.turn ? room.user3Id : room.user4Id;
|
const userId = engine.state.user1House === engine.state.turn ? room.user1Id : engine.state.user2House === engine.state.turn ? room.user2Id : engine.state.user3House === engine.state.turn ? room.user3Id : room.user4Id;
|
||||||
this.waitForTurn(room, userId, engine);
|
this.waitForTurn(room, userId, engine);
|
||||||
} else if (res.type === 'kanned') {
|
} else if (res.type === 'kanned') {
|
||||||
// TODO
|
this.globalEventService.publishMahjongRoomStream(room.id, 'kanned', { caller: res.caller, callee: res.callee, tile: res.tile, rinsyan: res.rinsyan });
|
||||||
|
const userId = engine.state.user1House === engine.state.turn ? room.user1Id : engine.state.user2House === engine.state.turn ? room.user2Id : engine.state.user3House === engine.state.turn ? room.user3Id : room.user4Id;
|
||||||
|
this.waitForTurn(room, userId, engine);
|
||||||
} else if (res.type === 'ronned') {
|
} else if (res.type === 'ronned') {
|
||||||
this.globalEventService.publishMahjongRoomStream(room.id, 'ronned', { });
|
this.globalEventService.publishMahjongRoomStream(room.id, 'ronned', {
|
||||||
|
callers: res.callers,
|
||||||
|
callee: res.callee,
|
||||||
|
handTiles: {
|
||||||
|
e: engine.state.handTiles.e,
|
||||||
|
s: engine.state.handTiles.s,
|
||||||
|
w: engine.state.handTiles.w,
|
||||||
|
n: engine.state.handTiles.n,
|
||||||
|
},
|
||||||
|
});
|
||||||
this.endKyoku(room, engine);
|
this.endKyoku(room, engine);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -55,14 +55,13 @@ export type Huro = {
|
||||||
type: 'cii';
|
type: 'cii';
|
||||||
tiles: [Tile, Tile, Tile];
|
tiles: [Tile, Tile, Tile];
|
||||||
from: House;
|
from: House;
|
||||||
} | {
|
|
||||||
type: 'minkan';
|
|
||||||
tile: Tile;
|
|
||||||
from: House;
|
|
||||||
} | {
|
} | {
|
||||||
type: 'ankan';
|
type: 'ankan';
|
||||||
tile: Tile;
|
tile: Tile;
|
||||||
from: House;
|
} | {
|
||||||
|
type: 'minkan';
|
||||||
|
tile: Tile;
|
||||||
|
from: House | null; // null で加槓
|
||||||
};
|
};
|
||||||
|
|
||||||
export const yakuNames = [
|
export const yakuNames = [
|
||||||
|
|
|
@ -233,8 +233,6 @@ export class MasterGameEngine {
|
||||||
}
|
}
|
||||||
|
|
||||||
this.endKyoku();
|
this.endKyoku();
|
||||||
|
|
||||||
// TODO: 役情報を返す
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public commit_dahai(house: House, tile: Tile, riichi = false) {
|
public commit_dahai(house: House, tile: Tile, riichi = false) {
|
||||||
|
@ -381,12 +379,18 @@ export class MasterGameEngine {
|
||||||
};
|
};
|
||||||
|
|
||||||
if (this.state.ronAsking != null && answers.ron.length > 0) {
|
if (this.state.ronAsking != null && answers.ron.length > 0) {
|
||||||
|
const callers = this.state.ronAsking.callers;
|
||||||
|
const callee = this.state.ronAsking.callee;
|
||||||
|
|
||||||
this.ron(answers.ron, this.state.ronAsking.callee);
|
this.ron(answers.ron, this.state.ronAsking.callee);
|
||||||
return {
|
return {
|
||||||
type: 'ronned',
|
type: 'ronned',
|
||||||
|
callers,
|
||||||
|
callee,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// 大明槓
|
||||||
if (this.state.kanAsking != null && answers.kan) {
|
if (this.state.kanAsking != null && answers.kan) {
|
||||||
const caller = this.state.kanAsking.caller;
|
const caller = this.state.kanAsking.caller;
|
||||||
const callee = this.state.kanAsking.callee;
|
const callee = this.state.kanAsking.callee;
|
||||||
|
@ -394,10 +398,17 @@ export class MasterGameEngine {
|
||||||
const tile = this.state.hoTiles[callee].pop()!;
|
const tile = this.state.hoTiles[callee].pop()!;
|
||||||
this.state.huros[caller].push({ type: 'minkan', tile, from: callee });
|
this.state.huros[caller].push({ type: 'minkan', tile, from: callee });
|
||||||
|
|
||||||
|
const rinsyan = this.tsumo();
|
||||||
|
|
||||||
clearAsking();
|
clearAsking();
|
||||||
this.state.turn = caller;
|
this.state.turn = caller;
|
||||||
// TODO
|
return {
|
||||||
return;
|
type: 'kanned',
|
||||||
|
caller,
|
||||||
|
callee,
|
||||||
|
tile,
|
||||||
|
rinsyan,
|
||||||
|
};
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.state.ponAsking != null && answers.pon) {
|
if (this.state.ponAsking != null && answers.pon) {
|
||||||
|
|
Loading…
Reference in a new issue