add valley of shadows under feature flag

This commit is contained in:
Alberto Xamin 2023-01-04 14:09:17 +00:00
parent f6e8d193af
commit 916d9af322
7 changed files with 177 additions and 9 deletions

View File

@ -17,6 +17,7 @@ class SerpenteASonagli(Card):
super().__init__(suit, 'SerpenteASonagli', number, is_equipment=True)
self.need_target = True
self.icon = '🐍️' # Ogni turno pesca se il seme picche -1hp
self.alt_text = "♠️=💔"
#TODO
class Shotgun(Card):
@ -78,9 +79,9 @@ class Sventagliata(Card):
class Salvo(Card):
def __init__(self, suit, number):
super().__init__(suit, 'Salvo!', number)
super().__init__(suit, 'Salvo', number)
self.icon = '😇️'
self.alt_text = "👤😇️" # spara al target e anche, a uno a distanza 1 dal target
self.alt_text = "👤😇️"
self.need_target = True
def play_card(self, player, against, _with=None):

View File

@ -30,7 +30,7 @@ class Game:
self.initial_players = 0
self.password = ''
self.expansions: List[str] = []
self.available_expansions = ['dodge_city', 'fistful_of_cards', 'high_noon', 'gold_rush', 'the_valley_of_shadows']
self.available_expansions = ['dodge_city', 'fistful_of_cards', 'high_noon', 'gold_rush']
self.shutting_down = False
self.is_competitive = False
self.disconnect_bot = True
@ -204,6 +204,10 @@ class Game:
self.disconnect_bot = not self.disconnect_bot
self.notify_room()
def feature_flags(self):
self.available_expansions.append('the_valley_of_shadows')
self.notify_room()
def add_player(self, player: pl.Player):
if player.is_bot and len(self.players) >= 8:
return
@ -213,6 +217,8 @@ class Game:
if 'dodge_city' not in self.expansions:
self.expansions.append('dodge_city')
player.join_game(self)
if player.is_admin():
self.feature_flags()
self.players.append(player)
print(f'{self.name}: Added player {player.name} to game')
self.notify_room()

View File

@ -55,6 +55,7 @@ class Player:
self.name = res['username']
self.discord_id = res['id']
if self.is_admin():
if self.game: self.game.feature_flags()
self.sio.emit('chat_message', room=self.sid, data={'color':'green', 'text':'(you are admin)'})
if self.game:
self.game.notify_room()

View File

@ -546,6 +546,17 @@ def chat_message(sid, msg, pl=None):
for cn in card_names:
ses.hand.append([c for c in cards if c.name.lower() == cn.lower() or c.name[0:-1].lower() == cn.lower()][0])
ses.notify_self()
elif '/getset' in msg:
sio.emit('chat_message', room=ses.game.name, data={'color': f'red','text':f'🚨 {ses.name} is in debug mode and got a card'})
cmd = msg.split()
if len(cmd) >= 2:
from bang.expansions import DodgeCity, TheValleyOfShadows
if cmd[1] == 'dodgecity':
ses.hand = DodgeCity.get_cards()
ses.notify_self()
elif 'valley' in cmd[1].lower():
ses.hand = TheValleyOfShadows.get_cards()
ses.notify_self()
elif '/getnuggets' in msg:
sio.emit('chat_message', room=ses.game.name, data={'color': f'red','text':f'🚨 {ses.name} is in debug mode and got nuggets'})
import bang.cards as cs
@ -634,6 +645,17 @@ def get_goldrushcards(sid):
cards = [cards_dict[i] for i in cards_dict]
sio.emit('goldrushcards_info', room=sid, data=json.dumps(cards, default=lambda o: o.__dict__))
@sio.event
def get_valleyofshadowscards(sid):
import bang.expansions.the_valley_of_shadows.cards as tvos
cards = tvos.get_starting_deck()
cards_dict = {}
for ca in cards:
if ca.name not in cards_dict:
cards_dict[ca.name] = ca
cards = [cards_dict[i] for i in cards_dict]
sio.emit('valleyofshadows_info', room=sid, data=json.dumps(cards, default=lambda o: o.__dict__))
@sio.event
def discord_auth(sid, data):
res = requests.post('https://discord.com/api/oauth2/token', data={

View File

@ -108,6 +108,15 @@
</div>
</div>
</div>
<h2 id="valleyofshadowscards">{{$t('help.valleyofshadowscards')}}</h2>
<div class="flexy-cards-wrapper">
<div v-for="(c, i) in valleyofshadowscards" v-bind:key="c.name ? (c.name+c.number) : i" class="flexy-cards">
<Card :card="c" class="valley-of-shadows" @pointerenter.native="''" @pointerleave.native="''"/>
<div style="margin-left:6pt;">
<p>{{$t(`cards.${c.name}.desc`)}}</p>
</div>
</div>
</div>
</div>
</template>
<script>
@ -127,6 +136,7 @@ export default {
highnooncards: [],
foccards: [],
goldrushcards: [],
valleyofshadowscards: [],
}),
computed: {
endTurnCard() {
@ -161,6 +171,11 @@ export default {
...x,
}))
},
valleyofshadows_info(cardsJson) {
this.valleyofshadowscards = JSON.parse(cardsJson).map(x=>({
...x,
}))
},
},
mounted() {
this.$socket.emit('get_cards')
@ -168,6 +183,7 @@ export default {
this.$socket.emit('get_highnooncards')
this.$socket.emit('get_foccards')
this.$socket.emit('get_goldrushcards')
this.$socket.emit('get_valleyofshadowscards')
document.getElementById('help').scrollIntoView();
}
}

View File

@ -674,6 +674,66 @@
"Simeon Picos": {
"name": "Simeon Picos",
"desc": "He gets 1 gold nugget every time he loses 1 hp."
},
"Fantasma": {
"name": "Ghost",
"desc": "Play on any eliminated player: That player is back in the game, but can't gain nor lose life points."
},
"Lemat": {
"name": "Lemat",
"desc": "During your turn you can use any card as BANG!."
},
"SerpenteASonagli": {
"name": "Serpente a Sonagli",
"desc": "Play on any player. At the beginning of his turn. if that player draws on Spades, he loses I life point."
},
"Shotgun": {
"name": "Shotgun",
"desc": "Every time you wound a player, they must discard a card from their hand."
},
"Taglia": {
"name": "Bounty",
"desc": "Play on anyone. If that player is hit by BANG!, the person who shot gets a card from the deck."
},
"Mira": {
"name": "Aim",
"desc": "Play this card along with a BANG! card. If the target is hit, they lose 2 life points."
},
"RitornoDiFiamma": {
"name": "Backfire",
"desc": "Counts as a Missed! card. The player who shot is the target of a BANG!."
},
"Bandidos": {
"name": "Bandidos",
"desc": "Each player chooses to discard 2 cards from their hand (or 1 if they only have 1) or lose 1 life point."
},
"Fuga": {
"name": "Escape",
"desc": "Can be played out of turn. Avoids the effect of a brown (not BANG!) card you are a target of."
},
"Sventagliata": {
"name": "Fanning",
"desc": "Counts as the only BANG! of the turn. A player of your choice at distance 1 from the target (if any, excluding yourself) is also a target of a BANG.."
},
"UltimoGiro": {
"name": "Last Call",
"desc": "Recovers 1 life point"
},
"Poker": {
"name": "Poker",
"desc": "All other players discard a card from their hand, at the same time. If there are no Aces, draw up to 2 of those cards."
},
"Salvo": {
"name": "Saved!",
"desc": "Can be played out of turn. Prevents another player from losing 1 life point. If they survive, they draw 2 cards from their hand or deck (your choice)."
},
"Tomahawk": {
"name": "Tomahawk",
"desc": "Attacks a player up to distance 2."
},
"Tornado": {
"name": "Tornado",
"desc": "Everyone discards a card from their hand (if possible), then draws 2 cards from the deck."
}
},
"help": {
@ -724,7 +784,8 @@
"gotogoldrush": "Jump to Gold Rush",
"highnooncards": "High Noon - Event Cards",
"foccards": "Fistful of Cards - Event Cards",
"goldrushcards": "Gold Rush Cards"
"goldrushcards": "Gold Rush Cards",
"valleyofshadowscards": "The Valley of Shadows Cards"
},
"theme": {
"sepia": "Sepia",

View File

@ -674,6 +674,66 @@
"Simeon Picos": {
"name": "Simeon Picos",
"desc": "Ogni volta che viene ferito, prende una pepita"
},
"Fantasma": {
"name": "Fantasma",
"desc": "Gioca su un giocatore eliminato. Quel giocatore torna in gioco, ma non può guadagnare né perdere punti vita."
},
"Lemat": {
"name": "Lemat",
"desc": "Puoi usare ogni carta in mano come BANG!."
},
"SerpenteASonagli": {
"name": "Serpente a Sonagli",
"desc": "Gioca su chiunque. All'inizio del turno, quel giocatore estrae una carta, e se è Picche, perde 1 punto vita."
},
"Shotgun": {
"name": "Shotgun",
"desc": "Ogni volta che ferisci un giocatore, deve scartare una carta a dalla sua mano."
},
"Taglia": {
"name": "Taglia",
"desc": "Gioca su chiunque. Se quel giocatore è colpito da BANG!, chi ha sparato ottiene una carta dal mazzo."
},
"Mira": {
"name": "Mira",
"desc": "Gioca questa carta assieme a una carta BANG!. Se il bersaglio viene colpito, perde 2 punti vita."
},
"RitornoDiFiamma": {
"name": "Ritorno di Fiamma",
"desc": "Vale una carta Mancato! Il giocatore che ha sparato è bersaglio di un BANG!."
},
"Bandidos": {
"name": "Bandidos",
"desc": "Ogni giocatore sceglie se scartare 2 carte dalla mano (o 1 se ne ha solo 1) o perdere 1 punto vita."
},
"Fuga": {
"name": "Fuga",
"desc": "Può essere giocata fuori turno. Evita l'effetto di una carta marrone (non BANG!) di cui sei uno dei bersagli."
},
"Sventagliata": {
"name": "Sventagliata",
"desc": "Conta come l'unico BANGI del turno. Anche un giocatore a tua scelta a distanza 1 dal bersaglio (se ce, te escluso) è bersaglio di un BANG.."
},
"UltimoGiro": {
"name": "Ultimo Giro",
"desc": "Recupera 1 vita"
},
"Poker": {
"name": "Poker",
"desc": "Tutti gli altri scartano una carta dalla mano, allo stesso tempo. Se non c'è alcun Asso, pesca fino a 2 di quelle carte."
},
"Salvo": {
"name": "Salvo!",
"desc": "Può essere giocata fuori turno. Previeni la perdita di 1 punto vita di un altro giocatore. Se sopravvive, pesca 2 carte dalla sua mano o dal mazzo (scegli)."
},
"Tomahawk": {
"name": "Tomahawk",
"desc": "Attacca un giocatore fino a distanza 2."
},
"Tornado": {
"name": "Tornado",
"desc": "Tutti scartano una carta dalla mano (se possibile), poi ottengono 2 carte dal mazzo."
}
},
"help": {
@ -724,7 +784,8 @@
"allcharacters": "Tutti i personaggi",
"highnooncards": "Carte Evento High Noon",
"foccards": "Carte Evento Fistful of Cards",
"goldrushcards": "Carte Gold Rush"
"goldrushcards": "Carte Gold Rush",
"valleyofshadowscards": "Carte The Valley of Shadows"
},
"theme": {
"sepia": "Seppia",