Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(game-playground): game playground basic structure #180

Merged
merged 8 commits into from
Feb 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/workflows/release-creation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -269,7 +269,7 @@ jobs:
outputs:
CUCUMBER_SCENARIOS_COUNT: ${{ steps.outputs.outputs.CUCUMBER_SCENARIOS_COUNT }}
needs:
- build
- install
steps:
- name: Checkout GitHub repository 📡
uses: actions/checkout@v4
Expand Down Expand Up @@ -444,4 +444,4 @@ jobs:
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
8 changes: 8 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,13 @@
# 🐺 Werewolves Assistant Web Versioning Changelog

## [1.7.1](https://github.com/antoinezanardi/werewolves-assistant-web-next/compare/v1.7.0...v1.7.1) (2024-2-24)


### 🔁 CI

* **badges:** generate badges on release creation ([#177](https://github.com/antoinezanardi/werewolves-assistant-web-next/issues/177)) ([4af228d](https://github.com/antoinezanardi/werewolves-assistant-web-next/commit/4af228df939c097d322d526be115011a22b0d748)), closes [#134](https://github.com/antoinezanardi/werewolves-assistant-web-next/issues/134)
* **reports:** checkout directly to github pages branch ([#175](https://github.com/antoinezanardi/werewolves-assistant-web-next/issues/175)) ([3111da5](https://github.com/antoinezanardi/werewolves-assistant-web-next/commit/3111da588cb2b5745b52606fab698264ffd996a8))

## [1.7.0](https://github.com/antoinezanardi/werewolves-assistant-web-next/compare/v1.6.0...v1.7.0) (2024-2-24)


Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ This is the **next** version of the current **[Werewolves Assistant Web](https:/

## <a name="available-roles">🃏 Available roles</a>

| <img src="https://github.com/antoinezanardi/werewolves-assistant-web-next/blob/main/public/assets/images/roles/werewolf/werewolf-small.jpeg?raw=true" width="40"/><br/>**Werewolf** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/big-bad-wolf/big-bad-wolf-small.jpeg?raw=true" width="40"/><br/>**Big Bad Wolf** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/accursed-wolf-father/accursed-wolf-father-small.jpeg?raw=true" width="40"/><br/>**Accursed Wolf-Father** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/white-werewolf/white-werewolf-small.jpeg?raw=true" width="40"/><br/>**White Werewolf** |
| <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/werewolf/werewolf-small.jpeg?raw=true" width="40"/><br/>**Werewolf** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/big-bad-wolf/big-bad-wolf-small.jpeg?raw=true" width="40"/><br/>**Big Bad Wolf** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/accursed-wolf-father/accursed-wolf-father-small.jpeg?raw=true" width="40"/><br/>**Accursed Wolf-Father** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/white-werewolf/white-werewolf-small.jpeg?raw=true" width="40"/><br/>**White Werewolf** |
|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|:-----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------:|
| <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/villager/villager-small.jpeg?raw=true" width="40"/><br/>**Villager** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/villager/villager-small.jpeg?raw=true" width="40"/><br/> **Villager-Villager** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/seer/seer-small.jpeg?raw=true" width="40"/><br/>**Seer** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/cupid/cupid-small.jpeg?raw=true" width="40"/><br/>**Cupid** |
| <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/witch/witch-small.jpeg?raw=true" width="40"/><br/>**Witch** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/hunter/hunter-small.jpeg?raw=true" width="40"/><br/>**Hunter** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/little-girl/little-girl-small.jpeg?raw=true" width="40"/><br/>**Little Girl** | <img src="https://github.com/antoinezanardi/werewolves-assistant-api-next/blob/main/public/assets/images/roles/defender/defender-small.jpeg?raw=true" width="40"/><br/>**Defender** |
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<template>
<div
id="game-playground"
class="d-flex flex-column h-100"
>
<GamePlaygroundHeader/>

<GamePlaygroundContent class="d-flex flex-grow-1 h-100"/>

<GamePlaygroundFooter/>
</div>
</template>

<script setup lang="ts">
import GamePlaygroundContent from "~/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundContent/GamePlaygroundContent.vue";
import GamePlaygroundFooter from "~/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundFooter/GamePlaygroundFooter.vue";
import GamePlaygroundHeader from "~/components/pages/game/GamePlaying/GamePlayground/GamePlaygroundHeader/GamePlaygroundHeader.vue";
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div id="game-playground-content">
GAME PLAYGROUND CONTENT
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div id="game-playground-footer">
GAME PLAYGROUND FOOTER
</div>
</template>
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
<template>
<div id="game-playground-header">
GAME PLAYGROUND HEADER
</div>
</template>
19 changes: 16 additions & 3 deletions components/pages/game/GamePlaying/GamePlaying.vue
Original file line number Diff line number Diff line change
@@ -1,5 +1,18 @@
<template>
<div id="game-playing">
GAME PLAYING
<div
id="game-playing"
class="d-flex"
>
<GameTeamSide :side="RoleSides.VILLAGERS"/>

<GamePlayground class="d-flex flex-grow-1"/>

<GameTeamSide :side="RoleSides.WEREWOLVES"/>
</div>
</template>
</template>

<script setup lang="ts">
import GamePlayground from "~/components/pages/game/GamePlaying/GamePlayground/GamePlayground.vue";
import GameTeamSide from "~/components/pages/game/GamePlaying/GameTeamSide/GameTeamSide.vue";
import { RoleSides } from "~/composables/api/role/enums/role.enums";
</script>
25 changes: 25 additions & 0 deletions components/pages/game/GamePlaying/GameTeamSide/GameTeamSide.vue
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<template>
<div id="game-playground-team-side">
<GameTeamSidePlayer
v-for="player in teamPlayers"
:key="player._id"
:player="player"
/>
</div>
</template>

<script lang="ts" setup>
import { storeToRefs } from "pinia";

import type { GameTeamSideProps } from "~/components/pages/game/GamePlaying/GameTeamSide/game-team-side.types";
import GameTeamSidePlayer from "~/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/GameTeamSidePlayer.vue";
import type { Player } from "~/composables/api/game/types/players/player.class";
import { useGameStore } from "~/stores/game/useGameStore";

const props = defineProps<GameTeamSideProps>();

const gameStore = useGameStore();
const { game } = storeToRefs(gameStore);

const teamPlayers = computed<Player[]>(() => game.value.players.filter(player => player.side.current === props.side));
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<template>
<div id="game-team-side-player">
{{ player.name }}
</div>
</template>

<script lang="ts" setup>
import type { GameTeamSidePlayerProps } from "~/components/pages/game/GamePlaying/GameTeamSide/GameTeamSidePlayer/game-team-side-player.types";

defineProps<GameTeamSidePlayerProps>();
</script>
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { Player } from "~/composables/api/game/types/players/player.class";

type GameTeamSidePlayerProps = {
player: Player;
};

export type { GameTeamSidePlayerProps };
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
import type { RoleSides } from "~/composables/api/role/enums/role.enums";

type GameTeamSideProps = {
side: RoleSides;
};

export type { GameTeamSideProps };
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
import { Expose, plainToInstance } from "class-transformer";

import { RoleNames } from "~/composables/api/role/enums/role.enums";
import { DEFAULT_PLAIN_TO_INSTANCE_OPTIONS } from "~/utils/constants/class-transformer.constants";

class PlayerRole {
@Expose()
public original: RoleNames;

@Expose()
public current: RoleNames;

@Expose()
public isRevealed: boolean;

public static create(role: Partial<PlayerRole>): PlayerRole {
return plainToInstance(PlayerRole, role, DEFAULT_PLAIN_TO_INSTANCE_OPTIONS);
}
}

export { PlayerRole };
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
import { Expose, plainToInstance } from "class-transformer";

import { RoleSides } from "~/composables/api/role/enums/role.enums";
import { DEFAULT_PLAIN_TO_INSTANCE_OPTIONS } from "~/utils/constants/class-transformer.constants";

class PlayerSide {
@Expose()
public original: RoleSides;

@Expose()
public current: RoleSides;

public static create(side: Partial<PlayerSide>): PlayerSide {
return plainToInstance(PlayerSide, side, DEFAULT_PLAIN_TO_INSTANCE_OPTIONS);
}
}

export { PlayerSide };
15 changes: 14 additions & 1 deletion composables/api/game/types/players/player.class.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
import { Expose, plainToInstance } from "class-transformer";
import { Expose, plainToInstance, Type } from "class-transformer";

import { PlayerRole } from "~/composables/api/game/types/players/player-role/player-role.class";
import { PlayerSide } from "~/composables/api/game/types/players/player-role/player-side.class";
import { DEFAULT_PLAIN_TO_INSTANCE_OPTIONS } from "~/utils/constants/class-transformer.constants";

class Player {
Expand All @@ -9,6 +11,17 @@ class Player {
@Expose()
public name: string;

@Expose()
@Type(() => PlayerRole)
public role: PlayerRole;

@Expose()
@Type(() => PlayerSide)
public side: PlayerSide;

@Expose()
public isAlive: boolean;

public static create(player: Player): Player {
return plainToInstance(Player, player, DEFAULT_PLAIN_TO_INSTANCE_OPTIONS);
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "werewolves-assistant-web-next",
"version": "1.7.0",
"version": "1.7.1",
"description": "Werewolves Assistant Web is a Nuxt Web App using the Werewolves Assistant API. It helps you, the game master, to manage your games of Werewolves Of Millers Hollow.",
"readme": "README.md",
"type": "module",
Expand Down
Loading
Loading