add Sacagaway

This commit is contained in:
Alberto Xamin 2023-03-05 17:14:52 +00:00
parent 5811821ccf
commit 9598a6f811
No known key found for this signature in database
GPG Key ID: 5ABFCD8A22EA6F5D
5 changed files with 32 additions and 14 deletions

View File

@ -1,4 +1,4 @@
from typing import List, Set, Dict, Tuple, Optional
from typing import List, Set, Dict, Tuple, Optional, TYPE_CHECKING
import random
import bang.cards as cs
import bang.expansions.fistful_of_cards.card_events as ce
@ -7,8 +7,10 @@ import bang.expansions.wild_west_show.card_events as cew
import bang.expansions.gold_rush.shop_cards as grc
from globals import G
if TYPE_CHECKING:
from bang.game import Game
class Deck:
def __init__(self, game):
def __init__(self, game: 'Game'):
super().__init__()
self.cards: List[cs.Card] = cs.get_starting_deck(game.expansions)
self.mancato_cards: List[str] = []
@ -58,6 +60,7 @@ class Deck:
if len(self.event_cards) > 0 and not (isinstance(self.event_cards[0], ce.PerUnPugnoDiCarte) or isinstance(self.event_cards[0], ceh.MezzogiornoDiFuoco)):
self.event_cards.append(self.event_cards.pop(0))
self.game.notify_event_card()
self.game.notify_all()
def fill_gold_rush_shop(self):
if not any((c is None for c in self.shop_cards)):

View File

@ -81,11 +81,11 @@ def get_all_events(rng=random):
cards = [
Camposanto(),
DarlingValentine(),
DorothyRage(),
# DorothyRage(),
HelenaZontero(),
LadyRosaDelTexas(),
MissSusanna(),
RegolamentoDiConti(),
# LadyRosaDelTexas(),
# MissSusanna(),
# RegolamentoDiConti(),
Sacagaway(),
]
rng.shuffle(cards)

View File

@ -895,9 +895,11 @@ class Game:
def notify_all(self):
if self.started and self.replay_speed > 0:
show_cards = self.check_event(cew.Sacagaway)
data = [{
'name': p.name,
'ncards': len(p.hand),
'hand_cards': [c.__dict__ for c in p.hand] if show_cards else [],
'equipment': [e.__dict__ for e in p.equipment],
'gold_rush_equipment': [e.__dict__ for e in p.gold_rush_equipment],
'lives': p.lives,

View File

@ -38,7 +38,7 @@
<Card :card="p.card" @click.native="drawFromPlayer(p.name)" :donotlocalize="true" :class="{is_my_turn:p.is_my_turn}"/>
<Card v-if="p.character" :card="p.character" class="character tiny-character" @click.native="selectedInfo = [p.character]"/>
<Card v-if="p.character && p.character.name !== p.real_character.name" style="transform:scale(0.5) translate(-90px, -50px);" :card="p.character" class="character tiny-character" @click.native="selectedInfo = [p.character]"/>
<tiny-hand :id="p.name+'-hand'" :ncards="p.ncards" @click.native="drawFromPlayer(p.name)" :ismyturn="p.pending_action === 2"/>
<tiny-hand :id="p.name+'-hand'" :ncards="p.ncards" :cards="p.hand_cards" @click.native="drawFromPlayer(p.name)" :ismyturn="p.pending_action === 2"/>
<span style="position:absolute;top:10pt;" class="center-stuff">{{getActionEmoji(p)}}</span>
<div class="tiny-equipment">
<Card v-for="(card, i) in p.equipment" v-bind:key="card.name+card.number"
@ -141,7 +141,7 @@ export default {
Status,
DeadRoleNotification,
AnimatedCard,
Card
Card
},
data: () => ({
username: '',

View File

@ -1,5 +1,6 @@
<template>
<div style="position:absolute;transform:scale(0.4);bottom:52pt;">
<div v-if="!(cards && cards.length >0)">
<div :class="{card:true, back:true, delay:ismyturn}" v-for="(n, i) in ncards"
:style="`position:absolute; transform:rotate(${(i-ncards/2)*2}deg) translate(${i*15}px,0); animation-delay:${0.1*i}s`"
v-bind:key="n" :alt="i">
@ -7,14 +8,23 @@
<div class="emoji" v-if="n==ncards">💥</div>
</div>
</div>
<div v-else>
<card :card="c" :key="c" v-for="(c, i) in cards"
:class="{delay:ismyturn, zoomable:true}"
:style="`position:absolute; transform:rotate(${(i-ncards/2)*5}deg) translate(${(i-ncards/3)*40}px,0); animation-delay:${0.1*i}s`"/>
</div>
</div>
</template>
<script>
import Card from './Card.vue'
export default {
components: { Card },
name: 'TinyHand',
props: {
ncards: Number,
ismyturn: Boolean
cards: Array,
ismyturn: Boolean,
},
}
</script>
@ -24,6 +34,9 @@ export default {
animation-duration: 2s;
animation-iteration-count: infinite;
}
.zoomable:hover {
z-index: 1;
}
@keyframes updown {
0% {
top: 0;