fix dalton
This commit is contained in:
		
							parent
							
								
									9777742e08
								
							
						
					
					
						commit
						9781770577
					
				| @ -228,6 +228,13 @@ def chat_message(sid, msg): | |||||||
|                     ses.character = [c for c in chs if c.name == ' '.join(cmd[1:])][0] |                     ses.character = [c for c in chs if c.name == ' '.join(cmd[1:])][0] | ||||||
|                     ses.real_character = ses.character |                     ses.real_character = ses.character | ||||||
|                     ses.notify_self() |                     ses.notify_self() | ||||||
|  |             elif '/setevent' in msg and ses.game and ses.game.deck: | ||||||
|  |                 cmd = msg.split() | ||||||
|  |                 if len(cmd) >= 3: | ||||||
|  |                     sio.emit('chat_message', room=ses.game.name, data={'color': f'red','text':f'🚨 {ses.name} is in debug mode and changed event'}) | ||||||
|  |                     chs = ses.game.deck.event_cards | ||||||
|  |                     ses.game.deck.event_cards.insert(int(cmd[1]), [c for c in chs if c!=None and c.name == ' '.join(cmd[2:])][0]) | ||||||
|  |                     ses.game.notify_event_card() | ||||||
|             elif '/removecard' in msg: |             elif '/removecard' in msg: | ||||||
|                 sio.emit('chat_message', room=ses.game.name, data={'color': f'red','text':f'🚨 {ses.name} is in debug mode and removed a card'}) |                 sio.emit('chat_message', room=ses.game.name, data={'color': f'red','text':f'🚨 {ses.name} is in debug mode and removed a card'}) | ||||||
|                 cmd = msg.split() |                 cmd = msg.split() | ||||||
|  | |||||||
| @ -264,6 +264,11 @@ class Game: | |||||||
|             if self.readyCount == self.waiting_for: |             if self.readyCount == self.waiting_for: | ||||||
|                 self.waiting_for = 0 |                 self.waiting_for = 0 | ||||||
|                 self.readyCount = 0 |                 self.readyCount = 0 | ||||||
|  |                 if self.dalton_on: | ||||||
|  |                     self.dalton_on = False | ||||||
|  |                     print(f'notifying {self.players[self.turn].name} about his turn') | ||||||
|  |                     self.players[self.turn].play_turn() | ||||||
|  |                 else: | ||||||
|                     self.players[self.turn].pending_action = pl.PendingAction.PLAY |                     self.players[self.turn].pending_action = pl.PendingAction.PLAY | ||||||
|                 self.players[self.turn].notify_self() |                 self.players[self.turn].notify_self() | ||||||
| 
 | 
 | ||||||
|  | |||||||
| @ -254,7 +254,7 @@ class Player: | |||||||
|                 for c in need_target: |                 for c in need_target: | ||||||
|                     _range = self.get_sight() if c.name == 'Bang!' or c.name == "Pepperbox" else c.range |                     _range = self.get_sight() if c.name == 'Bang!' or c.name == "Pepperbox" else c.range | ||||||
|                     others = [p for p in self.game.get_visible_players(self) if _range >= p['dist'] and not (isinstance(self.role, r.Vice) and p['is_sheriff']) and p['lives'] > 0 and not ((isinstance(c, cs.CatBalou) or isinstance(c, cs.Panico)) and p['cards'] == 0) and not (p['is_sheriff'] and isinstance(c, cs.Prigione))] |                     others = [p for p in self.game.get_visible_players(self) if _range >= p['dist'] and not (isinstance(self.role, r.Vice) and p['is_sheriff']) and p['lives'] > 0 and not ((isinstance(c, cs.CatBalou) or isinstance(c, cs.Panico)) and p['cards'] == 0) and not (p['is_sheriff'] and isinstance(c, cs.Prigione))] | ||||||
|                     if len(others) == 0: |                     if len(others) == 0 or c not in self.hand: | ||||||
|                         continue |                         continue | ||||||
|                     target = others[randrange(0, len(others))] |                     target = others[randrange(0, len(others))] | ||||||
|                     if target['is_sheriff'] and isinstance(self.role, r.Renegade): |                     if target['is_sheriff'] and isinstance(self.role, r.Renegade): | ||||||
| @ -751,7 +751,7 @@ class Player: | |||||||
|             if self.equipment[i].can_be_used_now: |             if self.equipment[i].can_be_used_now: | ||||||
|                 print('usable', self.equipment[i]) |                 print('usable', self.equipment[i]) | ||||||
|         if not self.game.is_competitive and len([c for c in self.equipment if isinstance(c, cs.Barile)]) == 0 and not self.character.check(self.game, chars.Jourdonnais)\ |         if not self.game.is_competitive and len([c for c in self.equipment if isinstance(c, cs.Barile)]) == 0 and not self.character.check(self.game, chars.Jourdonnais)\ | ||||||
|              and len([c for c in self.hand if isinstance(c, cs.Mancato) or (self.character.check(self.game, chars.CalamityJanet) and isinstance(c, cs.Bang)) or self.character.check(self.game, chd.ElenaFuente)]) == 0\ |              and len([c for c in self.hand if (isinstance(c, cs.Mancato) and c.can_be_used_now) or (self.character.check(self.game, chars.CalamityJanet) and isinstance(c, cs.Bang)) or self.character.check(self.game, chd.ElenaFuente)]) == 0\ | ||||||
|              and len([c for c in self.equipment if c.can_be_used_now and isinstance(c, cs.Mancato)]) == 0: |              and len([c for c in self.equipment if c.can_be_used_now and isinstance(c, cs.Mancato)]) == 0: | ||||||
|             print('Cant defend') |             print('Cant defend') | ||||||
|             if not no_dmg: |             if not no_dmg: | ||||||
|  | |||||||
		Loading…
	
		Reference in New Issue
	
	Block a user
	 Alberto Xamin
						Alberto Xamin