Skip to content

Commit

Permalink
Do not reset count of red/blue dots at end of the round (#11)
Browse files Browse the repository at this point in the history
and don't draw a new card already in the round start view
  • Loading branch information
stefanseifert authored Jan 8, 2025
1 parent b7dbbf6 commit 32f6405
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 10 deletions.
5 changes: 1 addition & 4 deletions src/util/NavigationState.ts
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ export default class NavigationState {
redDotCount = 0
}
// draw next card, count dots
if (this.player == Player.BOT) {
if (this.player == Player.BOT && route.name == 'TurnBot') {
const nextCard = this.cardDeck.draw()
this.blueDotCount = blueDotCount + nextCard.blueDotCount
this.redDotCount = redDotCount + nextCard.redDotCount
Expand Down Expand Up @@ -147,9 +147,6 @@ function getPreviousBotPersistence(state: State, round: number, turn: number) :
if (round > 1) {
const lastRoundBotPersistence = getPreviousBotPersistence(state, round - 1, MAX_TURN)
if (lastRoundBotPersistence) {
// reset dot counters for new round
lastRoundBotPersistence.blueDotCount = 0
lastRoundBotPersistence.redDotCount = 0
return lastRoundBotPersistence
}
}
Expand Down
5 changes: 1 addition & 4 deletions tests/unit/services/BotActions.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -99,10 +99,7 @@ describe('services/BotActions', () => {
const navigationState = new NavigationState(route, getState(DifficultyLevel.BEGINNER))

const botActions = new BotActions(Cards.get(13), navigationState)
expect(botActions.isReset).to.eq(false)
expect(botActions.items).to.eql([
{ action: Action.GAIN_VP, count: 4 }
])
expect(botActions.isReset).to.eq(true)
})

it('scoringActions-last-era-scoring-category', () => {
Expand Down
4 changes: 2 additions & 2 deletions tests/unit/util/NavigationState.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -103,8 +103,8 @@ describe('util/NavigationState', () => {
expect(navigationState.cardDeck.toPersistence()).to.eql({pile:[4],discard:[3,2,1]})
expect(navigationState.evolutionCount).to.eq(2)
expect(navigationState.prosperityCount).to.eq(1)
expect(navigationState.blueDotCount).to.eq(2) // card3.blueDotCount = 2
expect(navigationState.redDotCount).to.eq(1) // card3.redDotCount = 1
expect(navigationState.blueDotCount).to.eq(5) // taken over from last round
expect(navigationState.redDotCount).to.eq(2) // taken over from last round
expect(navigationState.actionRoll).to.greaterThanOrEqual(1)
})

Expand Down

0 comments on commit 32f6405

Please sign in to comment.