Skip to content

Commit

Permalink
terrain priority
Browse files Browse the repository at this point in the history
  • Loading branch information
stefanseifert committed Oct 20, 2024
1 parent 6de7f27 commit 1437374
Show file tree
Hide file tree
Showing 23 changed files with 377 additions and 171 deletions.
39 changes: 39 additions & 0 deletions src/components/turn/ActionBox.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<template>
<div class="actionBox col" @click="showInstructions">
<slot name="action"></slot>
</div>

<ModalDialog :id="modalId" :title="instructionTitle">
<template #body>
<slot name="instruction"></slot>
</template>
</ModalDialog>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import ModalDialog from '@brdgm/brdgm-commons/src/components/structure/ModalDialog.vue'
import showModal from '@brdgm/brdgm-commons/src/util/modal/showModal';
export default defineComponent({
name: 'ActionBox',
components: {
ModalDialog
},
setup() {
const modalId = `modal-${crypto.randomUUID()}`
return { modalId }
},
props: {
instructionTitle: {
type: String,
required: true
}
},
methods: {
showInstructions() {
showModal(this.modalId)
}
}
})
</script>
95 changes: 95 additions & 0 deletions src/components/turn/TerritoryPriority.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
<template>
<div class="mt-3" v-if="!show">
<button class="btn btn-sm btn-secondary" @click.stop="determineTerritory">Determine Territory</button>
</div>
<template v-if="show">
<div class="priority">
<template v-for="(territory,index) of territoryPriority" :key="territory">
<div v-if="index > 0" class="next">►</div>
<div class="territory">
<AppIcon type="territory" :name="territory" class="icon"/><br/>
{{t(`territory.${territory}`)}}
</div>
</template>
</div>
<div class="priority">
<template v-for="(beacon,index) of beaconPriority" :key="beacon">
<div v-if="index > 0" class="next">►</div>
<div class="beacon">
<AppIcon type="beacon" :name="beacon" class="icon" :class="{[`beacon-${beacon}`]:true}"/>
</div>
</template>
</div>
</template>
</template>

<script lang="ts">
import { defineComponent } from 'vue'
import { useI18n } from 'vue-i18n'
import AppIcon from '../structure/AppIcon.vue'
import Territory from '@/services/enum/Territory'
import getTerritoryPriority from '@/util/getTerritoryPriority'
import getBeaconPriority from '@/util/getBeaconPriority'
import Beacon from '@/services/enum/Beacon'
import rollDice from '@brdgm/brdgm-commons/src/util/random/rollDice'
export default defineComponent({
name: 'TerritoryPriority',
components: {
AppIcon
},
setup() {
const { t } = useI18n()
return { t }
},
data() {
return {
show: false
}
},
computed: {
territoryPriority() : Territory[] {
const territoryRoll = rollDice(6)
return getTerritoryPriority(territoryRoll)
},
beaconPriority() : Beacon[] {
const beaconRoll = rollDice(6)
return getBeaconPriority(beaconRoll)
}
},
methods: {
determineTerritory() : void {
this.show = true
}
}
})
</script>

<style lang="scss" scoped>
.priority {
display: flex;
flex-wrap: wrap;
align-content: center;
margin-top: 1rem;
}
.territory {
text-align: center;
font-size: 0.65rem;
margin-top: 0.2rem;
.icon {
height: 1.5rem;
}
}
.beacon {
.icon {
height: 1.25rem;
&.beacon-3 {
height: 1.9rem;
}
}
}
.next {
margin-left: 0.2rem;
margin-right: 0.2rem;
}
</style>
27 changes: 13 additions & 14 deletions src/components/turn/action/AdvanceFavor.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
<template>
<div class="actionBox col" data-bs-toggle="modal" data-bs-target="#modalAdvanceFavor">
<div class="action">
<div class="plus">+</div>
<div class="value">1</div>
<AppIcon type="action" name="advance-favor" class="icon"/>
</div>
</div>

<ModalDialog id="modalAdvanceFavor" :title="t('rules.action.advanceFavor.title')">
<template #body>
<ActionBox :instructionTitle="t('rules.action.advanceFavor.title')">
<template #action>
<div class="action">
<div class="plus">+</div>
<div class="value">1</div>
<AppIcon type="action" name="advance-favor" class="icon"/>
</div>
</template>
<template #instruction>
<p v-html="t('rules.action.advanceFavor.instruction')"></p>
</template>
</ModalDialog>
</ActionBox>
</template>

<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { useI18n } from 'vue-i18n'
import { ActionItem } from '@/services/BotActions'
import ActionBox from '../ActionBox.vue'
import AppIcon from '../../structure/AppIcon.vue'
import ModalDialog from '@brdgm/brdgm-commons/src/components/structure/ModalDialog.vue'
export default defineComponent({
name: 'AdvanceFavor',
components: {
AppIcon,
ModalDialog
ActionBox,
AppIcon
},
setup() {
const { t } = useI18n()
Expand Down
27 changes: 13 additions & 14 deletions src/components/turn/action/AdvanceScoringCategory.vue
Original file line number Diff line number Diff line change
@@ -1,33 +1,32 @@
<template>
<div class="actionBox col" data-bs-toggle="modal" data-bs-target="#modalAdvanceScoringCategory">
<div class="action">
<div class="plus">+</div>
<div class="value">{{actionItem.count}}</div>
<AppIcon v-if="actionItem.scoringCategory" type="advance-track" :name="actionItem.scoringCategory" class="icon"/>
</div>
</div>

<ModalDialog id="modalAdvanceScoringCategory" :title="t('rules.action.advanceScoringCategory.title')">
<template #body>
<ActionBox :instructionTitle="t('rules.action.advanceScoringCategory.title')">
<template #action>
<div class="action">
<div class="plus">+</div>
<div class="value">{{actionItem.count}}</div>
<AppIcon v-if="actionItem.scoringCategory" type="advance-track" :name="actionItem.scoringCategory" class="icon"/>
</div>
</template>
<template #instruction>
<p v-html="t('rules.action.advanceScoringCategory.instruction')"></p>
<p v-html="t('rules.action.advanceScoringCategory.threshold')"></p>
<p v-html="t('rules.action.advanceScoringCategory.exceedTrack')"></p>
</template>
</ModalDialog>
</ActionBox>
</template>

<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { useI18n } from 'vue-i18n'
import { ActionItem } from '@/services/BotActions'
import ActionBox from '../ActionBox.vue'
import AppIcon from '../../structure/AppIcon.vue'
import ModalDialog from '@brdgm/brdgm-commons/src/components/structure/ModalDialog.vue'
export default defineComponent({
name: 'AdvanceScoringCategory',
components: {
AppIcon,
ModalDialog
ActionBox,
AppIcon
},
setup() {
const { t } = useI18n()
Expand Down
27 changes: 13 additions & 14 deletions src/components/turn/action/GainActivationDie.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
<template>
<div class="actionBox col" data-bs-toggle="modal" data-bs-target="#modalGainActivationDie">
<div class="action">
<div class="plus">+</div>
<div class="value">1</div>
<AppIcon type="action" name="gain-activation-die" class="icon"/>
</div>
</div>

<ModalDialog id="modalGainActivationDie" :title="t('rules.action.gainActivationDie.title')">
<template #body>
<ActionBox :instructionTitle="t('rules.action.gainActivationDie.title')">
<template #action>
<div class="action">
<div class="plus">+</div>
<div class="value">1</div>
<AppIcon type="action" name="gain-activation-die" class="icon"/>
</div>
</template>
<template #instruction>
<p v-html="t('rules.action.gainActivationDie.instruction')"></p>
</template>
</ModalDialog>
</ActionBox>
</template>

<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { useI18n } from 'vue-i18n'
import { ActionItem } from '@/services/BotActions'
import ActionBox from '../ActionBox.vue'
import AppIcon from '../../structure/AppIcon.vue'
import ModalDialog from '@brdgm/brdgm-commons/src/components/structure/ModalDialog.vue'
export default defineComponent({
name: 'GainActivationDie',
components: {
AppIcon,
ModalDialog
ActionBox,
AppIcon
},
setup() {
const { t } = useI18n()
Expand Down
27 changes: 13 additions & 14 deletions src/components/turn/action/GainFateDie.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
<template>
<div class="actionBox col" data-bs-toggle="modal" data-bs-target="#modalGainFateDie">
<div class="action">
<div class="plus">+</div>
<div class="value">1</div>
<AppIcon type="action" name="gain-fate-die" class="icon"/>
</div>
</div>

<ModalDialog id="modalGainFateDie" :title="t('rules.action.gainFateDie.title')">
<template #body>
<ActionBox :instructionTitle="t('rules.action.gainFateDie.title')">
<template #action>
<div class="action">
<div class="plus">+</div>
<div class="value">1</div>
<AppIcon type="action" name="gain-fate-die" class="icon"/>
</div>
</template>
<template #instruction>
<p v-html="t('rules.action.gainFateDie.instruction')"></p>
</template>
</ModalDialog>
</ActionBox>
</template>

<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { useI18n } from 'vue-i18n'
import { ActionItem } from '@/services/BotActions'
import ActionBox from '../ActionBox.vue'
import AppIcon from '../../structure/AppIcon.vue'
import ModalDialog from '@brdgm/brdgm-commons/src/components/structure/ModalDialog.vue'
export default defineComponent({
name: 'GainFateDie',
components: {
AppIcon,
ModalDialog
ActionBox,
AppIcon
},
setup() {
const { t } = useI18n()
Expand Down
27 changes: 13 additions & 14 deletions src/components/turn/action/GainVp.vue
Original file line number Diff line number Diff line change
@@ -1,31 +1,30 @@
<template>
<div class="actionBox col" data-bs-toggle="modal" data-bs-target="#modalGainVp">
<div class="action">
<AppIcon type="action" name="gain-vp" class="icon"/>
<div class="plus">+</div>
<div class="value">{{actionItem.count}}</div>
</div>
</div>

<ModalDialog id="modalGainVp" :title="t('rules.action.gainVp.title')">
<template #body>
<ActionBox :instructionTitle="t('rules.action.gainVp.title')">
<template #action>
<div class="action">
<AppIcon type="action" name="gain-vp" class="icon"/>
<div class="plus">+</div>
<div class="value">{{actionItem.count}}</div>
</div>
</template>
<template #instruction>
<p v-html="t('rules.action.gainVp.instruction')"></p>
</template>
</ModalDialog>
</ActionBox>
</template>

<script lang="ts">
import { defineComponent, PropType } from 'vue'
import { useI18n } from 'vue-i18n'
import { ActionItem } from '@/services/BotActions'
import ActionBox from '../ActionBox.vue'
import AppIcon from '../../structure/AppIcon.vue'
import ModalDialog from '@brdgm/brdgm-commons/src/components/structure/ModalDialog.vue'
export default defineComponent({
name: 'GainVp',
components: {
AppIcon,
ModalDialog
ActionBox,
AppIcon
},
setup() {
const { t } = useI18n()
Expand Down
Loading

0 comments on commit 1437374

Please sign in to comment.