Compare commits
11 Commits
fix-sventa
...
main
Author | SHA1 | Date | |
---|---|---|---|
![]() |
4d2a222f93 | ||
![]() |
61fa295f8d | ||
![]() |
0a2bbce2da | ||
![]() |
6bc10f1bff | ||
![]() |
123e569010 | ||
![]() |
b45d04bf30 | ||
![]() |
b2b9eac1cd | ||
![]() |
345e04ef06 | ||
![]() |
2af8e5ec54 | ||
![]() |
3642c0dbb5 | ||
![]() |
86441f92c8 |
66
.github/workflows/docker-image.yml
vendored
66
.github/workflows/docker-image.yml
vendored
@ -4,20 +4,23 @@ on:
|
||||
branches: main
|
||||
|
||||
jobs:
|
||||
buildx:
|
||||
build-platform:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
platform: [linux/amd64, linux/arm/v7, linux/arm64/v8]
|
||||
|
||||
steps:
|
||||
-
|
||||
name: Checkout
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v4
|
||||
-
|
||||
name: Set up QEMU
|
||||
|
||||
- name: Set up QEMU
|
||||
uses: docker/setup-qemu-action@v3
|
||||
-
|
||||
name: Set up Docker Buildx
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
-
|
||||
name: Cache Docker layers
|
||||
|
||||
- name: Cache Docker layers
|
||||
uses: actions/cache@v4
|
||||
id: cache
|
||||
with:
|
||||
@ -25,27 +28,44 @@ jobs:
|
||||
key: ${{ runner.os }}-buildx-${{ github.sha }}
|
||||
restore-keys: |
|
||||
${{ runner.os }}-buildx-
|
||||
-
|
||||
name: Login to DockerHub
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
- name: Build and push
|
||||
|
||||
- name: Prepare Platform Tag
|
||||
id: platform_tag
|
||||
run: echo "platform_tag=$(echo ${{ matrix.platform }} | sed 's|/|-|g')" >> $GITHUB_ENV
|
||||
|
||||
- name: Build and push platform-specific image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
platforms: linux/arm/v7,linux/amd64
|
||||
platforms: ${{ matrix.platform }}
|
||||
push: true
|
||||
tags: albertoxamin/bang:latest
|
||||
cache-from: type=registry,ref=user/app:latest
|
||||
tags: albertoxamin/bang:${{ env.platform_tag }}
|
||||
cache-from: type=registry,ref=albertoxamin/bang:${{ env.platform_tag }}
|
||||
cache-to: type=inline
|
||||
|
||||
- name: Notify discord
|
||||
uses: th0th/notify-discord@v0.4.1
|
||||
if: ${{ always() }}
|
||||
env:
|
||||
DISCORD_WEBHOOK_URL: ${{ secrets.DISCORD_WEBHOOK_URL }}
|
||||
GITHUB_ACTOR: ${{ github.actor }}
|
||||
GITHUB_JOB_NAME: "Docker image main :latest"
|
||||
GITHUB_JOB_STATUS: ${{ job.status }}
|
||||
create-manifest:
|
||||
runs-on: ubuntu-latest
|
||||
needs: build-platform
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v3
|
||||
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
username: ${{ secrets.DOCKER_USERNAME }}
|
||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||
|
||||
- name: Create and push multi-arch manifest
|
||||
run: |
|
||||
docker buildx imagetools create \
|
||||
--tag albertoxamin/bang:latest \
|
||||
albertoxamin/bang:linux-amd64 \
|
||||
albertoxamin/bang:linux-arm-v7 \
|
||||
albertoxamin/bang:linux-arm64-v8
|
||||
|
@ -178,7 +178,7 @@ class Sventagliata(
|
||||
player.available_cards = [
|
||||
dict(p, **{"original_target": against})
|
||||
for p in player.game.get_visible_players(t)
|
||||
if p["name"] != player.name and p["name"] != t.name and p["dist"] == 1
|
||||
if p["name"] != player.name and p["name"] != t.name and p["dist"]
|
||||
]
|
||||
if len(player.available_cards) > 0:
|
||||
player.pending_action = PendingAction.CHOOSE
|
||||
|
@ -122,6 +122,7 @@ class Game:
|
||||
self.rpc_log = []
|
||||
self.is_replay = False
|
||||
self.replay_speed = 1
|
||||
self.owner: str | None = None
|
||||
|
||||
def shuffle_players(self):
|
||||
if not self.started:
|
||||
@ -254,6 +255,7 @@ class Game:
|
||||
"available_expansions": self.available_expansions,
|
||||
"is_replay": self.is_replay,
|
||||
"characters_to_distribute": self.characters_to_distribute,
|
||||
"owner": self.owner,
|
||||
},
|
||||
)
|
||||
G.sio.emit("debug", room=self.name, data=self.debug)
|
||||
@ -308,6 +310,8 @@ class Game:
|
||||
if player.is_admin():
|
||||
self.feature_flags()
|
||||
self.players.append(player)
|
||||
if len(self.players) == 1:
|
||||
self.owner = player.name
|
||||
if len(self.players) > 7:
|
||||
if "dodge_city" not in self.expansions:
|
||||
self.expansions.append("dodge_city")
|
||||
@ -474,6 +478,10 @@ class Game:
|
||||
if p.get_discarded(attacker=attacker, card_name=card_name):
|
||||
self.waiting_for += 1
|
||||
p.notify_self()
|
||||
elif card_name == "Tornado" and len(p.hand) == 0:
|
||||
self.deck.draw(player=p)
|
||||
self.deck.draw(player=p)
|
||||
p.notify_self()
|
||||
if self.waiting_for == 0:
|
||||
attacker.pending_action = PendingAction.PLAY
|
||||
attacker.notify_self()
|
||||
@ -985,6 +993,8 @@ class Game:
|
||||
self.deck = None
|
||||
return True
|
||||
else:
|
||||
self.owner = next((p.name for p in self.players if not p.is_bot), None)
|
||||
self.notify_room()
|
||||
return False
|
||||
|
||||
def player_death(self, player: pl.Player, disconnected=False):
|
||||
|
@ -1574,6 +1574,10 @@ class Player:
|
||||
self.game.deck.scrap(self.hand.pop(card_index), player=self)
|
||||
self.mancato_needed -= 1
|
||||
else:
|
||||
if self.attacker and "gold_rush" in self.game.expansions and not self.is_ghost:
|
||||
if isinstance(self.attacker, Player):
|
||||
self.attacker.gold_nuggets += 1
|
||||
self.attacker.notify_self()
|
||||
self.lives -= 1
|
||||
self.mancato_needed = 0
|
||||
if self.mancato_needed <= 0:
|
||||
@ -1868,7 +1872,8 @@ class Player:
|
||||
):
|
||||
self.expected_response.append(cs.Bang(0, 0).name)
|
||||
if self.character.check(self.game, chw.BigSpencer):
|
||||
self.expected_response = []
|
||||
self.expected_response = self.game.deck.mancato_cards.copy()
|
||||
self.expected_response.remove(cs.Mancato(0, 0).name)
|
||||
if any((isinstance(c, trt.Caboose) for c in self.equipment)):
|
||||
self.expected_response.append([c.name for c in self.equipment if not c.usable_next_turn])
|
||||
self.on_failed_response_cb = self.take_damage_response
|
||||
@ -1942,6 +1947,7 @@ class Player:
|
||||
self.choose_text = "choose_poker"
|
||||
if card_name == "Bandidos":
|
||||
self.choose_text = "choose_bandidos"
|
||||
self.attacker = attacker
|
||||
self.mancato_needed = min(2, len(self.hand))
|
||||
self.available_cards.append(
|
||||
{"name": "-1hp", "icon": "💔", "noDesc": True}
|
||||
|
@ -226,6 +226,29 @@ def test_bandidos():
|
||||
assert p1.pending_action == PendingAction.WAIT
|
||||
assert p.pending_action == PendingAction.PLAY
|
||||
|
||||
def test_bandidos_with_gold_rush():
|
||||
g = Game('test')
|
||||
g.expansions = ['gold_rush']
|
||||
ps = [Player(f'p{i}', f'p{i}') for i in range(2)]
|
||||
for p in ps:
|
||||
g.add_player(p)
|
||||
g.start_game()
|
||||
for p in ps:
|
||||
p.available_characters = [Character('test_char', 4)]
|
||||
p.set_character(p.available_characters[0].name)
|
||||
p = g.players[g.turn]
|
||||
p1 = g.players[(g.turn+1)%3]
|
||||
p.draw('')
|
||||
p.hand = [Bandidos(0,0), Bandidos(0,0)]
|
||||
p.play_card(0)
|
||||
assert len(p.hand) == 1
|
||||
assert p.pending_action == PendingAction.WAIT
|
||||
assert p1.pending_action == PendingAction.CHOOSE
|
||||
p1.choose(len(p1.hand))
|
||||
assert p1.lives == 3
|
||||
assert p.pending_action == PendingAction.PLAY
|
||||
assert p.gold_nuggets == 1
|
||||
|
||||
# test Poker
|
||||
def test_poker():
|
||||
g = Game('test')
|
||||
@ -330,12 +353,6 @@ def test_sventagliata():
|
||||
assert p.pending_action == PendingAction.PLAY
|
||||
assert len(p.hand) == 1
|
||||
|
||||
# Ensure the secondary target is at a distance from the first target
|
||||
assert any(
|
||||
target["name"] == secondary_target and target["dist"] > 1
|
||||
for target in g.get_visible_players(p1)
|
||||
)
|
||||
|
||||
|
||||
def test_mira():
|
||||
g = started_game(['the_valley_of_shadows'])
|
||||
|
@ -483,6 +483,7 @@ export default {
|
||||
fullScreenEffects: [],
|
||||
showPopup: false,
|
||||
selectedExpansionInfo: {},
|
||||
owner: undefined,
|
||||
}),
|
||||
sockets: {
|
||||
expansion_info(data) {
|
||||
@ -503,6 +504,7 @@ export default {
|
||||
this.togglable_expansions = data.available_expansions;
|
||||
this.expansions = data.expansions;
|
||||
this.is_replay = data.is_replay;
|
||||
this.owner = data.owner;
|
||||
this.characters_to_distribute = data.characters_to_distribute;
|
||||
this.players = data.players.map((x) => {
|
||||
return {
|
||||
@ -729,11 +731,7 @@ export default {
|
||||
return "";
|
||||
},
|
||||
isRoomOwner() {
|
||||
if (this.players.length > 0) {
|
||||
let pls = this.players.filter((x) => !x.is_bot);
|
||||
return pls.length > 0 && pls[0].name == this.username;
|
||||
}
|
||||
return false;
|
||||
return this.owner === this.username;
|
||||
},
|
||||
startGameCard() {
|
||||
if (!this.started && this.players.length > 2 && this.isRoomOwner) {
|
||||
|
@ -542,7 +542,7 @@
|
||||
},
|
||||
"Fratelli Di Sangue": {
|
||||
"name": "Blood Brothers",
|
||||
"desc": "At the begin of their turn, payers can lose 1 hp (except the last one) to give it to another player"
|
||||
"desc": "At the begin of their turn, players can lose 1 hp (except the last one) to give it to another player"
|
||||
},
|
||||
"I Dalton": {
|
||||
"name": "The Daltons",
|
||||
|
Loading…
Reference in New Issue
Block a user