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):
print('replay:', i, 'of', len(log)-3, '->', log[i])
if (log[i] == "@@@"):
eventlet.sleep(10)
if self.is_replay:
self.reset()
return

View File

@ -961,6 +961,7 @@ class Player:
def get_banged(self, attacker, double=False, no_dmg=False, card_index=None):
self.attacker = attacker
print(f'attacker -> {attacker}')
self.mancato_needed = 1 if not double else 2
if card_index != None:
self.dmg_card_index = card_index
@ -979,8 +980,9 @@ class Player:
self.take_no_damage_response()
return False
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)\
or self.character.check(self.game, chars.Jourdonnais):
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) 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')
self.pending_action = PendingAction.PICK
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)
card_names = ' '.join(cmd[1:]).split(',')
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()
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'})

View File

@ -111,6 +111,7 @@ export default {
range: 1,
sight: 1,
sight_extra: 1,
norangecard: false,
can_target_sheriff: true,
show_role: false,
attacker: undefined,
@ -240,7 +241,10 @@ export default {
if (!this.can_target_sheriff && x.is_sheriff)
return false
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)
if (this.norangecard)
return x.dist <= this.range
else
return x.dist <= this.range + this.sight_extra
}).map(player => {
return {
@ -372,10 +376,13 @@ export default {
if (card.need_with && !this.card_with) {
this.card_with = card
} 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
else
this.norangecard = true
} else {
this.range = card.range
this.norangecard = false
}
if (this.visiblePlayers.length == 0 && this.hand.length > this.lives) {
this.really_play_card(card, null)
}
@ -401,6 +408,7 @@ export default {
if (this.card_with.need_target) {
this.card_against = this.card_with
this.range = this.card_against.range
this.norangecard = false
this.card_with = card
} else {
let card_data = {