bartcassidy, calamity janet

This commit is contained in:
Alberto Xamin 2020-11-22 23:48:51 +01:00
parent 0599a98e7b
commit 9998da688a
No known key found for this signature in database
GPG Key ID: 4F026F48309500A2
2 changed files with 11 additions and 5 deletions

View File

@ -77,6 +77,8 @@ class Player:
if self.lives <= 0 and self.max_lives > 0: if self.lives <= 0 and self.max_lives > 0:
print('dying, attacker', self.attacker) print('dying, attacker', self.attacker)
self.game.player_death(self) self.game.player_death(self)
if isinstance(self.character, characters.CalamityJanet):
self.expected_response = [cards.Mancato(0,0).name, cards.Bang(0,0).name]
ser = self.__dict__.copy() ser = self.__dict__.copy()
ser.pop('game') ser.pop('game')
ser.pop('sio') ser.pop('sio')
@ -127,6 +129,8 @@ class Player:
if picked.suit == cards.Suit.SPADES and 2 <= picked.number <= 9 and pickable_cards == 0: if picked.suit == cards.Suit.SPADES and 2 <= picked.number <= 9 and pickable_cards == 0:
self.lives -= 3 self.lives -= 3
self.game.deck.scrap(self.equipment.pop(i)) self.game.deck.scrap(self.equipment.pop(i))
if isinstance(self.character, characters.BartCassidy):
self.hand.append(self.game.deck.draw())
self.sio.emit('chat_message', room=self.game.name, data=f'{self.name} ha fatto esplodere la dinamite.') self.sio.emit('chat_message', room=self.game.name, data=f'{self.name} ha fatto esplodere la dinamite.')
print(f'{self.name} Boom, -3 hp') print(f'{self.name} Boom, -3 hp')
else: else:
@ -299,7 +303,7 @@ class Player:
self.game.responders_did_respond() self.game.responders_did_respond()
else: else:
self.pending_action = PendingAction.RESPOND self.pending_action = PendingAction.RESPOND
self.expected_response = cards.Mancato(0,0).name self.expected_response = [cards.Mancato(0,0).name]
self.on_failed_response_cb = self.take_damage_response self.on_failed_response_cb = self.take_damage_response
self.notify_self() self.notify_self()
@ -317,7 +321,7 @@ class Player:
else: else:
print('has mancato') print('has mancato')
self.pending_action = PendingAction.RESPOND self.pending_action = PendingAction.RESPOND
self.expected_response = cards.Mancato(0,0).name self.expected_response = [cards.Mancato(0,0).name]
self.on_failed_response_cb = self.take_damage_response self.on_failed_response_cb = self.take_damage_response
self.notify_self() self.notify_self()
return True return True
@ -331,7 +335,7 @@ class Player:
else: else:
print('has bang') print('has bang')
self.pending_action = PendingAction.RESPOND self.pending_action = PendingAction.RESPOND
self.expected_response = cards.Bang(0,0).name self.expected_response = [cards.Bang(0,0).name]
self.event_type = 'indians' self.event_type = 'indians'
self.on_failed_response_cb = self.take_damage_response self.on_failed_response_cb = self.take_damage_response
self.notify_self() self.notify_self()
@ -346,7 +350,7 @@ class Player:
return False return False
else: else:
self.pending_action = PendingAction.RESPOND self.pending_action = PendingAction.RESPOND
self.expected_response = cards.Bang(0,0).name self.expected_response = [cards.Bang(0,0).name]
self.event_type = 'duel' self.event_type = 'duel'
self.on_failed_response_cb = self.take_damage_response self.on_failed_response_cb = self.take_damage_response
self.notify_self() self.notify_self()
@ -355,6 +359,8 @@ class Player:
def take_damage_response(self): def take_damage_response(self):
self.lives -= 1 self.lives -= 1
self.notify_self() self.notify_self()
if isinstance(self.character, characters.BartCassidy):
self.hand.append(self.game.deck.draw())
self.attacker = None self.attacker = None
def respond(self, hand_index): def respond(self, hand_index):

View File

@ -129,7 +129,7 @@ export default {
icon: '❌', icon: '❌',
is_equipment: true, is_equipment: true,
}] }]
this.hand.filter(x => x.name == this.expected_response).forEach(x=>{ this.hand.filter(x => this.expected_response.indexOf(x.name) !== -1).forEach(x=>{
cc.push(x) cc.push(x)
}) })
return cc return cc