Merge branch 'dev' into main

This commit is contained in:
Giulio 2022-03-31 23:29:56 +02:00
commit 433209f75b
4 changed files with 18 additions and 7 deletions

View File

@ -90,6 +90,7 @@ class Game:
for i in range(len(log)-1): for i in range(len(log)-1):
print('replay:', i, 'of', len(log)-3, '->', log[i]) print('replay:', i, 'of', len(log)-3, '->', log[i])
if (log[i] == "@@@"): if (log[i] == "@@@"):
eventlet.sleep(10)
if self.is_replay: if self.is_replay:
self.reset() self.reset()
return return

View File

@ -961,6 +961,7 @@ class Player:
def get_banged(self, attacker, double=False, no_dmg=False, card_index=None): def get_banged(self, attacker, double=False, no_dmg=False, card_index=None):
self.attacker = attacker self.attacker = attacker
print(f'attacker -> {attacker}')
self.mancato_needed = 1 if not double else 2 self.mancato_needed = 1 if not double else 2
if card_index != None: if card_index != None:
self.dmg_card_index = card_index self.dmg_card_index = card_index
@ -979,8 +980,9 @@ class Player:
self.take_no_damage_response() self.take_no_damage_response()
return False return False
else: else:
if (not self.game.check_event(ce.Lazo) and len([c for c in self.equipment if isinstance(c, cs.Barile)]) > 0) and not self.game.players[self.game.turn].character.check(self.game, chd.BelleStar)\ if ((not self.game.check_event(ce.Lazo) and len([c for c in self.equipment if isinstance(c, cs.Barile)]) > 0) \
or self.character.check(self.game, chars.Jourdonnais): and not (self.game.players[self.game.turn].character.check(self.game, chd.BelleStar) and isinstance(attacker, Player))) \
or self.character.check(self.game, chars.Jourdonnais): #se ho un barile e non c'è lazo e non mi sta attaccando Belle Star o se sono Jourdonnais
print('has barrel') print('has barrel')
self.pending_action = PendingAction.PICK self.pending_action = PendingAction.PICK
if not no_dmg: if not no_dmg:

View File

@ -524,7 +524,7 @@ def chat_message(sid, msg, pl=None):
cards = cs.get_starting_deck(ses.game.expansions) cards = cs.get_starting_deck(ses.game.expansions)
card_names = ' '.join(cmd[1:]).split(',') card_names = ' '.join(cmd[1:]).split(',')
for cn in card_names: for cn in card_names:
ses.hand.append([c for c in cards if c.name == cn][0]) 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() ses.notify_self()
elif '/getnuggets' in msg: 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'}) sio.emit('chat_message', room=ses.game.name, data={'color': f'red','text':f'🚨 {ses.name} is in debug mode and got nuggets'})

View File

@ -111,6 +111,7 @@ export default {
range: 1, range: 1,
sight: 1, sight: 1,
sight_extra: 1, sight_extra: 1,
norangecard: false,
can_target_sheriff: true, can_target_sheriff: true,
show_role: false, show_role: false,
attacker: undefined, attacker: undefined,
@ -240,8 +241,11 @@ export default {
if (!this.can_target_sheriff && x.is_sheriff) if (!this.can_target_sheriff && x.is_sheriff)
return false return false
else else
//console.log("aa" +(this.sight-1)) //console.log(x.name +" dist:" +x.dist +" range:" +this.range +" sight:" +this.sight +" sight_extra:" +this.sight_extra)
return x.dist <= this.range + this.sight_extra if (this.norangecard)
return x.dist <= this.range
else
return x.dist <= this.range + this.sight_extra
}).map(player => { }).map(player => {
return { return {
name: player.name, name: player.name,
@ -372,10 +376,13 @@ export default {
if (card.need_with && !this.card_with) { if (card.need_with && !this.card_with) {
this.card_with = card this.card_with = card
} else if ((card.need_target || calamity_special) && !((card.name == 'Bang!' || (calamity_special && card.name=='Mancato!')) && cant_play_bang)) { } else if ((card.need_target || calamity_special) && !((card.name == 'Bang!' || (calamity_special && card.name=='Mancato!')) && cant_play_bang)) {
if (card.name == 'Bang!' || card.name == "Pepperbox" || calamity_special) if (card.name == 'Bang!' || card.name == "Pepperbox" || calamity_special) {
this.range = this.sight this.range = this.sight
else this.norangecard = true
} else {
this.range = card.range this.range = card.range
this.norangecard = false
}
if (this.visiblePlayers.length == 0 && this.hand.length > this.lives) { if (this.visiblePlayers.length == 0 && this.hand.length > this.lives) {
this.really_play_card(card, null) this.really_play_card(card, null)
} }
@ -401,6 +408,7 @@ export default {
if (this.card_with.need_target) { if (this.card_with.need_target) {
this.card_against = this.card_with this.card_against = this.card_with
this.range = this.card_against.range this.range = this.card_against.range
this.norangecard = false
this.card_with = card this.card_with = card
} else { } else {
let card_data = { let card_data = {