Spaces:
Sleeping
Sleeping
reorder day
Browse files
convex/aiTown/gameCycle.ts
CHANGED
|
@@ -11,8 +11,7 @@ import { parseLLMVotingResult } from './voting';
|
|
| 11 |
import { LLmvotingCallWerewolf } from './voting';
|
| 12 |
import { GameId } from './ids';
|
| 13 |
import { Player } from './player';
|
| 14 |
-
export type CycleState = 'Day' | '
|
| 15 |
-
|
| 16 |
const stateDurations: { [key in CycleState]: number } = {
|
| 17 |
Day: DAY_DURATION,
|
| 18 |
Night: NIGHT_DURATION,
|
|
@@ -24,9 +23,9 @@ const stateDurations: { [key in CycleState]: number } = {
|
|
| 24 |
|
| 25 |
const normalCycle: CycleState[] = [
|
| 26 |
'Day',
|
|
|
|
| 27 |
'Night',
|
| 28 |
'PlayerKillVoting',
|
| 29 |
-
'WerewolfVoting',
|
| 30 |
];
|
| 31 |
|
| 32 |
|
|
@@ -88,7 +87,6 @@ const onStateChange = (prevState: CycleState, newState: CycleState, game: Game,
|
|
| 88 |
console.log(`state changed: ${ prevState } -> ${ newState }`);
|
| 89 |
console.log("newState is :",newState)
|
| 90 |
if(newState ==="WerewolfVoting"){
|
| 91 |
-
console.log('players are : ', game.playerDescriptions);
|
| 92 |
const allVillagers = [...game.world.players.values()]
|
| 93 |
const villagers = [...game.playerDescriptions.values()].filter(player =>
|
| 94 |
player.type === 'villager'
|
|
@@ -102,6 +100,7 @@ const onStateChange = (prevState: CycleState, newState: CycleState, game: Game,
|
|
| 102 |
})
|
| 103 |
};
|
| 104 |
|
|
|
|
| 105 |
if(newState ==="PlayerKillVoting"){
|
| 106 |
const werewolves = [...game.world.players.values()].filter((were) => {
|
| 107 |
game.playerDescriptions.get(were.id)?.type === 'werewolf'
|
|
|
|
| 11 |
import { LLmvotingCallWerewolf } from './voting';
|
| 12 |
import { GameId } from './ids';
|
| 13 |
import { Player } from './player';
|
| 14 |
+
export type CycleState = 'Day' | 'WerewolfVoting' | 'Night' | 'PlayerKillVoting' | 'EndGame' | 'LobbyState'
|
|
|
|
| 15 |
const stateDurations: { [key in CycleState]: number } = {
|
| 16 |
Day: DAY_DURATION,
|
| 17 |
Night: NIGHT_DURATION,
|
|
|
|
| 23 |
|
| 24 |
const normalCycle: CycleState[] = [
|
| 25 |
'Day',
|
| 26 |
+
'WerewolfVoting',
|
| 27 |
'Night',
|
| 28 |
'PlayerKillVoting',
|
|
|
|
| 29 |
];
|
| 30 |
|
| 31 |
|
|
|
|
| 87 |
console.log(`state changed: ${ prevState } -> ${ newState }`);
|
| 88 |
console.log("newState is :",newState)
|
| 89 |
if(newState ==="WerewolfVoting"){
|
|
|
|
| 90 |
const allVillagers = [...game.world.players.values()]
|
| 91 |
const villagers = [...game.playerDescriptions.values()].filter(player =>
|
| 92 |
player.type === 'villager'
|
|
|
|
| 100 |
})
|
| 101 |
};
|
| 102 |
|
| 103 |
+
|
| 104 |
if(newState ==="PlayerKillVoting"){
|
| 105 |
const werewolves = [...game.world.players.values()].filter((were) => {
|
| 106 |
game.playerDescriptions.get(were.id)?.type === 'werewolf'
|