Skip to content

Commit

Permalink
Merge branch 'release/1.1.13'
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Feb 17, 2024
2 parents d073446 + 25073c6 commit 440c0fc
Show file tree
Hide file tree
Showing 14 changed files with 1,649 additions and 969 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: npm

- run: npm install
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:

- uses: actions/setup-node@v3
with:
node-version: 18
node-version: 20
cache: npm

- run: npm install
Expand Down
12 changes: 12 additions & 0 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,18 @@
<link rel="icon" type="image/svg+xml" href="/img/icons/favicon.svg">
<link rel="apple-touch-icon" href="/img/icons/apple-touch-icon-180x180.png" sizes="180x180">
<link rel="mask-icon" href="/img/icons/maskable-icon-512x512.png" color="#fff">
<!-- Matomo Tracking: Cookie-less and GDPR-conformant -->
<script>
var _paq = window._paq = window._paq || [];
(function() {
var u="//matomo.brdgm.me/";
_paq.push(['setTrackerUrl', u+'matomo.php']);
_paq.push(['setSiteId', '2']);
var d=document, g=d.createElement('script'), s=d.getElementsByTagName('script')[0];
g.async=true; g.src=u+'matomo.js'; s.parentNode.insertBefore(g,s);
})();
</script>
<!-- End Matomo Code -->
</head>
<body>
<noscript>
Expand Down
2,475 changes: 1,569 additions & 906 deletions package-lock.json

Large diffs are not rendered by default.

43 changes: 23 additions & 20 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@brdgm/monumental-solo-helper",
"version": "1.1.12",
"version": "1.1.13",
"private": true,
"description": "Monumental Solo Helper",
"appDeployName": "monumental",
Expand All @@ -12,43 +12,46 @@
"test:unit": "vitest",
"test:coverage": "vitest run --coverage",
"lint": "eslint . --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts --fix --ignore-path .gitignore",
"lint:watch": "nodemon --exec \"npm run lint\" --ext .vue,.js,.jsx,.cjs,.mjs,.ts,.tsx,.cts,.mts",
"generate-pwa-assets": "pwa-assets-generator"
},
"dependencies": {
"@popperjs/core": "~2.11.8",
"bootstrap": "~5.3.2",
"brdgm-commons": "github:brdgm/brdgm-commons#1.3.1",
"core-js": "~3.34.0",
"brdgm-commons": "github:brdgm/brdgm-commons#1.6.1",
"core-js": "~3.36.0",
"lodash": "~4.17.21",
"vue": "~3.3.11",
"vue-i18n": "~9.8.0",
"vue": "~3.4.19",
"vue-i18n": "~9.9.1",
"vue-router": "~4.2.5",
"vuex": "~4.1.0"
},
"devDependencies": {
"@intlify/unplugin-vue-i18n": "^1.5.0",
"@intlify/unplugin-vue-i18n": "^2.0.0",
"@types/bootstrap": "^5.2.10",
"@types/chai": "^4.3.11",
"@types/jsdom": "^21.1.6",
"@types/lodash": "^4.14.202",
"@types/mocha": "^10.0.6",
"@typescript-eslint/eslint-plugin": "^6.14.0",
"@typescript-eslint/parser": "^6.14.0",
"@vite-pwa/assets-generator": "^0.1.0",
"@vitejs/plugin-legacy": "^5.2.0",
"@vitejs/plugin-vue": "^4.5.2",
"@vitest/coverage-istanbul": "^1.0.4",
"@typescript-eslint/eslint-plugin": "^7.0.1",
"@typescript-eslint/parser": "^7.0.1",
"@vite-pwa/assets-generator": "^0.2.4",
"@vitejs/plugin-legacy": "^5.3.0",
"@vitejs/plugin-vue": "^5.0.4",
"@vitest/coverage-istanbul": "^1.3.0",
"@vue/eslint-config-typescript": "^12.0.0",
"babel-plugin-istanbul": "^6.1.1",
"chai": "^4.3.10",
"eslint": "^8.55.0",
"eslint-plugin-vue": "^9.19.2",
"jsdom": "^23.0.1",
"sass": "^1.69.5",
"chai": "^5.1.0",
"eslint": "^8.56.0",
"eslint-plugin-vue": "^9.21.1",
"jsdom": "^24.0.0",
"nodemon": "^3.0.3",
"sass": "^1.71.0",
"source-map-support": "^0.5.21",
"ts-node": "^10.9.2",
"typescript": "~5.3.3",
"vite": "^5.0.8",
"vite-plugin-pwa": "^0.17.4",
"vitest": "^1.0.4"
"vite": "^5.1.3",
"vite-plugin-pwa": "^0.19.0",
"vitest": "^1.3.0"
}
}
6 changes: 3 additions & 3 deletions src/components/round/BotActions.vue
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@
</template>

<script lang="ts">
import * as _ from 'lodash'
import { groupBy, Dictionary } from 'lodash'
import { defineComponent, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useRoute } from 'vue-router'
Expand Down Expand Up @@ -162,12 +162,12 @@ export default defineComponent({
return '/round/' + (this.round+1) + '/player/1'
}
},
displayedActionsPerCard() : _.Dictionary<BotCardAction[]> {
displayedActionsPerCard() : Dictionary<BotCardAction[]> {
let actions = this.bot.actions;
if (this.nextActionIndex != undefined) {
actions = this.bot.actions.slice(0, this.nextActionIndex+1)
}
return _.groupBy(actions, action => action.cardNumber)
return groupBy(actions, action => action.cardNumber)
},
nextAction() : BotCardAction | undefined {
if (this.nextActionIndex != undefined) {
Expand Down
22 changes: 11 additions & 11 deletions src/components/scoring/CivilizationScoring.vue
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
</template>

<script lang="ts">
import * as _ from 'lodash'
import { fill, max } from 'lodash'
import { computed, defineComponent, ref } from 'vue'
import { useI18n } from 'vue-i18n'
import { useStore } from '@/store'
Expand Down Expand Up @@ -134,49 +134,49 @@ export default defineComponent({
}
const scoring = store.state.scoring
const knowledgeCardCount = ref(scoring?.knowledgeCardCount ?? _.fill(Array(playerCount+botCount),0))
const wonderCardCount = ref(scoring?.wonderCardCount ?? _.fill(Array(playerCount+botCount),0))
const culturalPolicyCount = ref([...scoring?.culturalPolicyCountPlayer ?? _.fill(Array(playerCount),0), ...botCulturalPolicies])
const provinceCount = ref(scoring?.provinceCount ?? _.fill(Array(playerCount+botCount),0))
const monsterCount = ref([...scoring?.monsterCountPlayer ?? _.fill(Array(playerCount),0), ..._.fill(Array(botCount),0)])
const knowledgeCardCount = ref(scoring?.knowledgeCardCount ?? fill(Array(playerCount+botCount),0))
const wonderCardCount = ref(scoring?.wonderCardCount ?? fill(Array(playerCount+botCount),0))
const culturalPolicyCount = ref([...scoring?.culturalPolicyCountPlayer ?? fill(Array(playerCount),0), ...botCulturalPolicies])
const provinceCount = ref(scoring?.provinceCount ?? fill(Array(playerCount+botCount),0))
const monsterCount = ref([...scoring?.monsterCountPlayer ?? fill(Array(playerCount),0), ...fill(Array(botCount),0)])
const knowledgeCardVP = computed({
get: () => knowledgeCardCount.value,
set: (v) => v
})
const knowledgeCardDominanceVP = computed({
get: () => knowledgeCardCount.value.map(c => c>0 && c==_.max(knowledgeCardCount.value) ? 3 : 0),
get: () => knowledgeCardCount.value.map(c => c>0 && c==max(knowledgeCardCount.value) ? 3 : 0),
set: (v) => v
})
const wonderCardVP = computed({
get: () => wonderCardCount.value.map(c => c*2),
set: (v) => v
})
const wonderCardDominanceVP = computed({
get: () => wonderCardCount.value.map(c => c>0 && c==_.max( wonderCardCount.value) ? 3 : 0),
get: () => wonderCardCount.value.map(c => c>0 && c==max( wonderCardCount.value) ? 3 : 0),
set: (v) => v
})
const culturalPolicyVP = computed({
get: () => culturalPolicyCount.value.map(c => c*2),
set: (v) => v
})
const culturalPolicyDominanceVP = computed({
get: () => culturalPolicyCount.value.map(c => c>0 && c==_.max(culturalPolicyCount.value) ? 3 : 0),
get: () => culturalPolicyCount.value.map(c => c>0 && c==max(culturalPolicyCount.value) ? 3 : 0),
set: (v) => v
})
const provinceVP = computed({
get: () => provinceCount.value,
set: (v) => v
})
const provinceDominanceVP = computed({
get: () => provinceCount.value.map(c => c>0 && c==_.max(provinceCount.value) ? 3 : 0),
get: () => provinceCount.value.map(c => c>0 && c==max(provinceCount.value) ? 3 : 0),
set: (v) => v
})
const monsterVP = computed({
get: () => monsterCount.value,
set: (v) => v
})
const goldVP = [..._.fill(Array(playerCount),0), ...botGold.map(gold => Math.floor(gold / 3))]
const goldVP = [...fill(Array(playerCount),0), ...botGold.map(gold => Math.floor(gold / 3))]
const totalVP = computed({
get: () => {
const result : number[] = []
Expand Down
6 changes: 3 additions & 3 deletions src/router/index.ts
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
import { RouteRecordRaw } from 'vue-router'
import createRouterMatomoTracking from 'brdgm-commons/src/util/router/createRouterMatomoTracking'
import { name, version, appDeployName } from '@/../package.json'
import AppHome from '@/views/AppHome.vue'
import SetupGameDifficulty from '@/views/SetupGameDifficulty.vue'
import SetupCivilization from '@/views/SetupCivilization.vue'
import RoundPlayer from '@/views/RoundPlayer.vue'
import RoundBot from '@/views/RoundBot.vue'
import EndGameScoring from '@/views/EndGameScoring.vue'
import NotFound from '@/views/NotFound.vue'
import createRouter from 'brdgm-commons/src/util/router/createRouter'
import { name } from '@/../package.json'

const LOCALSTORAGE_KEY = `${name}.route`

Expand Down Expand Up @@ -49,4 +49,4 @@ const routes: Array<RouteRecordRaw> = [
}
]

export default createRouter(routes, LOCALSTORAGE_KEY, 'AppHome')
export default createRouterMatomoTracking(routes, LOCALSTORAGE_KEY, appDeployName, version, 'AppHome')
6 changes: 3 additions & 3 deletions src/services/Bot.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash'
import { reduce } from 'lodash'
import { BotPersistence } from '@/store'
import CardDeck from './CardDeck'
import Civilization from './Civilization'
Expand Down Expand Up @@ -40,7 +40,7 @@ export default class Bot {

public get goldTotal() : number {
// initial gold + gold earned/payed in completed actions
return this._gold + _.reduce(this.actions.filter(action => action.completed),
return this._gold + reduce(this.actions.filter(action => action.completed),
(sum, action) => sum + action.gold, 0)
}

Expand Down Expand Up @@ -256,7 +256,7 @@ export default class Bot {
const civilization = Civilizations.get(persistence.civilization)
const cardDeck = CardDeck.fromPersistence(persistence.cardDeck)
// calculate new initial gold from previous actions and discard the actions
const gold = persistence.gold + _.reduce(persistence.actions, (sum, action) => sum + action.gold, 0)
const gold = persistence.gold + reduce(persistence.actions, (sum, action) => sum + action.gold, 0)
return new Bot(civilization, cardDeck,
gold, persistence.culturalPolicies, [], [], 0)
}
Expand Down
16 changes: 8 additions & 8 deletions src/services/CardDeck.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash'
import { shuffle, remove, random } from 'lodash'
import Card from './Card'
import Cards from './Cards'
import CivilizationName from './enum/CivilizationName'
Expand Down Expand Up @@ -54,7 +54,7 @@ export default class CardDeck {
public shuffleDiscardDrawPile() : void {
this._drawPile.push(...this._discardPile)
this._discardPile = []
this._drawPile = _.shuffle(this._drawPile)
this._drawPile = shuffle(this._drawPile)
}

/**
Expand Down Expand Up @@ -91,7 +91,7 @@ export default class CardDeck {
*/
public discardCard(card: Card) : void {
this._discardPile.push(card)
_.remove(this._openCards, c => c.name == card.name)
remove(this._openCards, c => c.name == card.name)
}

/**
Expand All @@ -100,17 +100,17 @@ export default class CardDeck {
*/
public moveToNexus(card: Card) : void {
this._nexusCards.push(card)
_.remove(this._openCards, c => c.name == card.name)
remove(this._openCards, c => c.name == card.name)
}

/**
* Removes a card from the game.
* @param card Card
*/
public removeCard(card: Card) : void {
_.remove(this._drawPile, c => c.name == card.name)
_.remove(this._discardPile, c => c.name == card.name)
_.remove(this._openCards, c => c.name == card.name)
remove(this._drawPile, c => c.name == card.name)
remove(this._discardPile, c => c.name == card.name)
remove(this._openCards, c => c.name == card.name)
}

/**
Expand Down Expand Up @@ -152,7 +152,7 @@ export default class CardDeck {
}
else {
while (advancedCards.length < numAdvancedCards) {
const randomIndex = _.random(allAdvancedCards.length - 1)
const randomIndex = random(allAdvancedCards.length - 1)
const advancedCard = allAdvancedCards[randomIndex]
if (!advancedCards.includes(advancedCard)) {
advancedCards.push(advancedCard)
Expand Down
4 changes: 2 additions & 2 deletions src/store/index.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import * as _ from 'lodash'
import {remove } from 'lodash'
import { InjectionKey } from 'vue'
import { createStore, useStore as baseUseStore, Store } from 'vuex'
import DifficultyLevel from '@/services/enum/DifficultyLevel'
Expand Down Expand Up @@ -134,7 +134,7 @@ export const store = createStore<State>({
},
roundResetTurn(state : State, data: RoundResetTurnPayload) {
// remove all rounds > the given round
_.remove(state.rounds, r => r.round > data.round)
remove(state.rounds, r => r.round > data.round)
const round = state.rounds.find(r => r.round==data.round)
if (round) {
// remove bot persistence from current and subsequent bots
Expand Down
4 changes: 2 additions & 2 deletions src/views/EndGameScoring.vue
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
</template>

<script lang="ts">
import * as _ from 'lodash'
import { reduce } from 'lodash'
import { defineComponent } from 'vue'
import { useI18n } from 'vue-i18n'
import { useStore } from '@/store'
Expand All @@ -25,7 +25,7 @@ export default defineComponent({
const store = useStore()
const botCount = store.state.setup.civilizations.botCivilization.length
const lastRound = _.reduce(store.state.rounds, (max, round) => Math.max(max, round.round), 0)
const lastRound = reduce(store.state.rounds, (max, round) => Math.max(max, round.round), 0)
return { t, botCount, lastRound }
},
Expand Down
1 change: 1 addition & 0 deletions tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
"types": [
"mocha",
"chai",
"vite/client",
"vite-plugin-pwa/client",
"@intlify/unplugin-vue-i18n/messages"
],
Expand Down
19 changes: 10 additions & 9 deletions vite.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,16 +15,17 @@ export default defineConfig({
registerType: 'prompt',
manifestFilename: 'manifest.json',
filename: 'service-worker.js',
// cache all asset imports
workbox: {
globPatterns: ["**/*"]
},
// include all static assets
includeAssets: [
'favicon.ico',
'img/icons/favicon.ico',
'img/icons/favicon.svg',
'img/icons/apple-touch-icon-60x60.png',
'img/icons/apple-touch-icon-76x76.png',
'img/icons/apple-touch-icon-120x120.png',
'img/icons/apple-touch-icon-152x152.png',
'img/icons/apple-touch-icon-180x180.png',
'img/icons/maskable-icon-512x512.png'
"**/*.ico",
"**/*.svg",
"**/*.png",
"**/*.jpg",
"**/*.webp"
],
manifest: {
name: description,
Expand Down

0 comments on commit 440c0fc

Please sign in to comment.