add all cards with scrap
This commit is contained in:
parent
3772d3cbf9
commit
67abec99ba
@ -21,7 +21,6 @@ class Pugno(Card):
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if against != None:
|
||||
import bang.characters as chars
|
||||
super().play_card(player, against=against)
|
||||
player.game.attack(player, against)
|
||||
return True
|
||||
@ -56,6 +55,68 @@ class RagTime(Panico):
|
||||
return True
|
||||
return False
|
||||
|
||||
class Rissa(Gatling):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, number)
|
||||
self.name = 'Rissa'
|
||||
self.icon = '🥊'
|
||||
self.need_with = True
|
||||
|
||||
def play_card(self, player, against, _with):
|
||||
if _with != None:
|
||||
player.game.deck.scrap(_with)
|
||||
super().play_card(player, against=against)
|
||||
return True
|
||||
return False
|
||||
|
||||
class SpringField(Card):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, 'Springfield', number)
|
||||
self.icon = '🌵'
|
||||
self.desc = "Spara a un giocatore"
|
||||
self.need_target = True
|
||||
self.need_with = True
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if against != None and _with != None:
|
||||
player.game.deck.scrap(_with)
|
||||
super().play_card(player, against=against)
|
||||
player.game.attack(player, against)
|
||||
return True
|
||||
return False
|
||||
|
||||
class Tequila(Card):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, 'Tequila', number)
|
||||
self.icon = '🍹'
|
||||
self.desc = "Fai recuperare 1 vita a un giocatore"
|
||||
self.need_target = True
|
||||
self.need_with = True
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if against != None and _with != None:
|
||||
player.game.deck.scrap(_with)
|
||||
player.game.get_player_named(against).lives = min(player.game.get_player_named(against).lives+1, player.game.get_player_named(against).max_lives)
|
||||
player.game.get_player_named(against).notify_self()
|
||||
return True
|
||||
return False
|
||||
|
||||
class Whisky(Card):
|
||||
def __init__(self, suit, number):
|
||||
super().__init__(suit, 'Whisky', number)
|
||||
self.icon = '🥃'
|
||||
self.desc = "Recupera 2 vite"
|
||||
self.need_with = True
|
||||
|
||||
def play_card(self, player, against, _with=None):
|
||||
if _with != None:
|
||||
player.game.deck.scrap(_with)
|
||||
player.lives = min(player.lives+2, player.max_lives)
|
||||
player.notify_self()
|
||||
return True
|
||||
return False
|
||||
|
||||
|
||||
def get_starting_deck() -> List[Card]:
|
||||
return [
|
||||
#TODO: aggiungere anche le carte normalmente presenti https://bang.dvgiochi.com/cardslist.php?id=3
|
||||
@ -80,5 +141,9 @@ def get_starting_deck() -> List[Card]:
|
||||
Pugno(Suit.SPADES, 10),
|
||||
Schivata(Suit.DIAMONDS, 7),
|
||||
Schivata(Suit.HEARTS, 'K'),
|
||||
RagTime(Suit.HEARTS, 9)
|
||||
RagTime(Suit.HEARTS, 9),
|
||||
Rissa(Suit.SPADES, 'J'),
|
||||
SpringField(Suit.SPADES, 'K'),
|
||||
Tequila(Suit.CLUBS, 9),
|
||||
Whisky(Suit.HEARTS, 'Q'),
|
||||
]
|
||||
|
@ -254,7 +254,7 @@ class Player:
|
||||
return
|
||||
card: cs.Card = self.hand.pop(hand_index)
|
||||
withCard: cs.Card = None
|
||||
if _with:
|
||||
if _with != None:
|
||||
withCard = self.hand.pop(_with) if hand_index > _with else self.hand.pop(_with - 1)
|
||||
print(self.name, 'is playing ', card, ' against:', against, ' with:', _with)
|
||||
did_play_card = card.play_card(self, against, withCard)
|
||||
|
@ -124,6 +124,9 @@ export default {
|
||||
},
|
||||
notify_card(mess) {
|
||||
this.notifycard = mess
|
||||
setTimeout(function(){
|
||||
this.notifycard = null
|
||||
}.bind(this), 4000)
|
||||
}
|
||||
},
|
||||
computed:{
|
||||
@ -222,8 +225,18 @@ export default {
|
||||
this.card_against = null
|
||||
},
|
||||
selectWith(card) {
|
||||
this.card_against = this.card_with
|
||||
this.card_with = card
|
||||
if (this.card_with.need_target) {
|
||||
this.card_against = this.card_with
|
||||
this.card_with = card
|
||||
} else {
|
||||
let card_data = {
|
||||
index: this.hand.indexOf(this.card_with),
|
||||
against: null,
|
||||
with: this.hand.indexOf(card),
|
||||
}
|
||||
this.card_with = null
|
||||
this.$socket.emit('play_card', card_data)
|
||||
}
|
||||
},
|
||||
cancelCardAgainst() {
|
||||
this.card_against = null
|
||||
@ -233,7 +246,7 @@ export default {
|
||||
let card_data = {
|
||||
index: this.hand.indexOf(card),
|
||||
against: against,
|
||||
with: this.hand.indexOf(this.card_with),
|
||||
with: this.hand.indexOf(this.card_with) > -1 ? this.hand.indexOf(this.card_with):null,
|
||||
}
|
||||
this.card_with = null
|
||||
console.log(card_data)
|
||||
|
Loading…
Reference in New Issue
Block a user