refactor special abilities
This commit is contained in:
parent
293b458529
commit
564c5d6821
@ -456,29 +456,9 @@ def scrap(sid, card_index):
|
|||||||
ses.scrap(card_index)
|
ses.scrap(card_index)
|
||||||
|
|
||||||
@sio.event
|
@sio.event
|
||||||
def chuck_lose_hp_draw(sid):
|
def special(sid, data):
|
||||||
ses: Player = sio.get_session(sid)
|
ses: Player = sio.get_session(sid)
|
||||||
ses.chuck_lose_hp_draw()
|
ses.special(data)
|
||||||
|
|
||||||
@sio.event
|
|
||||||
def holyday_special(sid, data):
|
|
||||||
ses: Player = sio.get_session(sid)
|
|
||||||
ses.holyday_special(data)
|
|
||||||
|
|
||||||
@sio.event
|
|
||||||
def murieta_special(sid):
|
|
||||||
ses: Player = sio.get_session(sid)
|
|
||||||
ses.murieta_special()
|
|
||||||
|
|
||||||
@sio.event
|
|
||||||
def cloud_special(sid):
|
|
||||||
ses: Player = sio.get_session(sid)
|
|
||||||
ses.cloud_special()
|
|
||||||
|
|
||||||
@sio.event
|
|
||||||
def snake_special(sid):
|
|
||||||
ses: Player = sio.get_session(sid)
|
|
||||||
ses.snake_special()
|
|
||||||
|
|
||||||
@sio.event
|
@sio.event
|
||||||
def buy_gold_rush_card(sid, data:int):
|
def buy_gold_rush_card(sid, data:int):
|
||||||
|
@ -20,6 +20,13 @@ class Character(ABC):
|
|||||||
return False
|
return False
|
||||||
return isinstance(self, character)
|
return isinstance(self, character)
|
||||||
|
|
||||||
|
def special(self, player, data):
|
||||||
|
import bang.expansions.high_noon.card_events as ceh
|
||||||
|
if player.game.check_event(ceh.Sbornia):
|
||||||
|
return False
|
||||||
|
player.sio.emit('chat_message', room=player.game.name, data=f'_use_special|{player.name}|{self.name}')
|
||||||
|
return True
|
||||||
|
|
||||||
class BartCassidy(Character):
|
class BartCassidy(Character):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("Bart Cassidy", max_lives=4)
|
super().__init__("Bart Cassidy", max_lives=4)
|
||||||
|
@ -85,6 +85,19 @@ class ChuckWengam(Character):
|
|||||||
# self.desc_eng = "On his turn he may decide to lose 1 HP to draw 2 cards from the deck."
|
# self.desc_eng = "On his turn he may decide to lose 1 HP to draw 2 cards from the deck."
|
||||||
self.icon = '💰'
|
self.icon = '💰'
|
||||||
|
|
||||||
|
def special(self, player, data):
|
||||||
|
if super().special(player, data):
|
||||||
|
if player.lives > 1 and player.is_my_turn:
|
||||||
|
import bang.expansions.gold_rush.shop_cards as grc
|
||||||
|
player.lives -= 1
|
||||||
|
if len([c for c in player.gold_rush_equipment if isinstance(c, grc.Talismano)]) > 0:
|
||||||
|
player.gold_nuggets += 1
|
||||||
|
if len([c for c in player.gold_rush_equipment if isinstance(c, grc.Stivali)]) > 0:
|
||||||
|
player.hand.append(player.game.deck.draw())
|
||||||
|
player.hand.append(player.game.deck.draw(True))
|
||||||
|
player.hand.append(player.game.deck.draw(True))
|
||||||
|
player.notify_self()
|
||||||
|
|
||||||
class PatBrennan(Character):
|
class PatBrennan(Character):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("Pat Brennan", max_lives=4)
|
super().__init__("Pat Brennan", max_lives=4)
|
||||||
@ -106,6 +119,17 @@ class DocHolyday(Character):
|
|||||||
# self.desc_eng = "He can discard 2 cards to play a bang."
|
# self.desc_eng = "He can discard 2 cards to play a bang."
|
||||||
self.icon = '✌🏻'
|
self.icon = '✌🏻'
|
||||||
|
|
||||||
|
def special(self, player, data):
|
||||||
|
if super().special(player, data):
|
||||||
|
from bang.players import PendingAction
|
||||||
|
if player.special_use_count < 1 and player.pending_action == PendingAction.PLAY:
|
||||||
|
player.special_use_count += 1
|
||||||
|
cards = sorted(data['cards'], reverse=True)
|
||||||
|
for c in cards:
|
||||||
|
player.game.deck.scrap(player.hand.pop(c), True)
|
||||||
|
player.notify_self()
|
||||||
|
player.game.attack(player, data['against'])
|
||||||
|
|
||||||
def all_characters() -> List[Character]:
|
def all_characters() -> List[Character]:
|
||||||
cards = [
|
cards = [
|
||||||
PixiePete(),
|
PixiePete(),
|
||||||
|
@ -19,12 +19,29 @@ class JackyMurieta(Character):
|
|||||||
# puo pagare 2 pepite per sparare 1 bang extra
|
# puo pagare 2 pepite per sparare 1 bang extra
|
||||||
self.icon = '💆♂️️'
|
self.icon = '💆♂️️'
|
||||||
|
|
||||||
|
def special(self, player, data):
|
||||||
|
if super().special(player, data):
|
||||||
|
if player.gold_nuggets >= 2 and player.is_my_turn:
|
||||||
|
player.gold_nuggets -= 2
|
||||||
|
player.has_played_bang = False
|
||||||
|
player.bang_used -= 1
|
||||||
|
player.notify_self()
|
||||||
|
|
||||||
class JoshMcCloud(Character):
|
class JoshMcCloud(Character):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("Josh McCloud", max_lives=4)
|
super().__init__("Josh McCloud", max_lives=4)
|
||||||
# puo pagare 2 pepite per pescare il primo equipaggiamento dalla pila gold rush
|
# puo pagare 2 pepite per pescare il primo equipaggiamento dalla pila gold rush
|
||||||
self.icon = '⛅️'
|
self.icon = '⛅️'
|
||||||
|
|
||||||
|
def special(self, player, data):
|
||||||
|
if super().special(player, data):
|
||||||
|
if player.gold_nuggets >= 2 and player.is_my_turn:
|
||||||
|
player.gold_nuggets -= 2
|
||||||
|
card = player.game.deck.shop_deck.pop(0)
|
||||||
|
if card.play_card(player):
|
||||||
|
player.game.deck.shop_deck.append(card)
|
||||||
|
player.notify_self()
|
||||||
|
|
||||||
class MadamYto(Character):
|
class MadamYto(Character):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("Madam Yto", max_lives=4)
|
super().__init__("Madam Yto", max_lives=4)
|
||||||
@ -43,6 +60,14 @@ class RaddieSnake(Character):
|
|||||||
# può scartare 1 pepita per pescare 1 carta (2 volte per turno)
|
# può scartare 1 pepita per pescare 1 carta (2 volte per turno)
|
||||||
self.icon = '🐍️'
|
self.icon = '🐍️'
|
||||||
|
|
||||||
|
def special(self, player, data):
|
||||||
|
if super().special(player, data):
|
||||||
|
if player.gold_nuggets >= 1 and player.is_my_turn and player.special_use_count < 2:
|
||||||
|
player.gold_nuggets -= 1
|
||||||
|
player.special_use_count += 1
|
||||||
|
player.hand.append(player.game.deck.draw(True))
|
||||||
|
player.notify_self()
|
||||||
|
|
||||||
class SimeonPicos(Character):
|
class SimeonPicos(Character):
|
||||||
def __init__(self):
|
def __init__(self):
|
||||||
super().__init__("Simeon Picos", max_lives=4)
|
super().__init__("Simeon Picos", max_lives=4)
|
||||||
|
@ -1074,47 +1074,8 @@ class Player:
|
|||||||
self.game.deck.scrap(card)
|
self.game.deck.scrap(card)
|
||||||
self.notify_self()
|
self.notify_self()
|
||||||
|
|
||||||
def holyday_special(self, data):
|
def special(self, data):
|
||||||
if self.character.check(self.game, chd.DocHolyday) and self.special_use_count < 1 and self.pending_action == PendingAction.PLAY:
|
self.character.special(self, data)
|
||||||
self.special_use_count += 1
|
|
||||||
cards = sorted(data['cards'], reverse=True)
|
|
||||||
for c in cards:
|
|
||||||
self.game.deck.scrap(self.hand.pop(c), True)
|
|
||||||
self.notify_self()
|
|
||||||
self.game.attack(self, data['against'])
|
|
||||||
|
|
||||||
def chuck_lose_hp_draw(self):
|
|
||||||
if self.character.check(self.game, chd.ChuckWengam) and self.lives > 1 and self.is_my_turn:
|
|
||||||
self.lives -= 1
|
|
||||||
if len([c for c in self.gold_rush_equipment if isinstance(c, grc.Talismano)]) > 0:
|
|
||||||
self.gold_nuggets += 1
|
|
||||||
if len([c for c in self.gold_rush_equipment if isinstance(c, grc.Stivali)]) > 0:
|
|
||||||
self.hand.append(self.game.deck.draw())
|
|
||||||
self.hand.append(self.game.deck.draw(True))
|
|
||||||
self.hand.append(self.game.deck.draw(True))
|
|
||||||
self.notify_self()
|
|
||||||
|
|
||||||
def murieta_special(self):
|
|
||||||
if self.character.check(self.game, grch.JackyMurieta) and self.gold_nuggets >= 2 and self.is_my_turn:
|
|
||||||
self.gold_nuggets -= 2
|
|
||||||
self.has_played_bang = False
|
|
||||||
self.bang_used -= 1
|
|
||||||
self.notify_self()
|
|
||||||
|
|
||||||
def cloud_special(self):
|
|
||||||
if self.character.check(self.game, grch.JoshMcCloud) and self.gold_nuggets >= 2 and self.is_my_turn:
|
|
||||||
self.gold_nuggets -= 2
|
|
||||||
card = self.game.deck.shop_deck.pop(0)
|
|
||||||
if card.play_card(self):
|
|
||||||
self.game.deck.shop_deck.append(card)
|
|
||||||
self.notify_self()
|
|
||||||
|
|
||||||
def snake_special(self):
|
|
||||||
if self.character.check(self.game, grch.RaddieSnake) and self.gold_nuggets >= 1 and self.is_my_turn and self.special_use_count < 2:
|
|
||||||
self.gold_nuggets -= 1
|
|
||||||
self.special_use_count += 1
|
|
||||||
self.hand.append(self.game.deck.draw(True))
|
|
||||||
self.notify_self()
|
|
||||||
|
|
||||||
def buy_gold_rush_card(self, index):
|
def buy_gold_rush_card(self, index):
|
||||||
print(f'{self.name} wants to buy gr-card index {index} in room {self.game.name}')
|
print(f'{self.name} wants to buy gr-card index {index} in room {self.game.name}')
|
||||||
|
@ -62,7 +62,7 @@
|
|||||||
:card="card" @click.native="selectedInfo = p.gold_rush_equipment"
|
:card="card" @click.native="selectedInfo = p.gold_rush_equipment"
|
||||||
:style="`margin-top: ${i+p.equipment.length<1?10:-(Math.min((p.equipment.length+p.gold_rush_equipment.length+1)*12,80))}pt`"/>
|
:style="`margin-top: ${i+p.equipment.length<1?10:-(Math.min((p.equipment.length+p.gold_rush_equipment.length+1)*12,80))}pt`"/>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="p.is_bot" style="position:absolute;bottom:57%;" class="center-stuff">
|
<div v-if="p.is_bot" style="position:absolute;bottom:57%;width:20pt;" class="center-stuff">
|
||||||
<span>🤖</span>
|
<span>🤖</span>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
@ -22,12 +22,12 @@
|
|||||||
</transition>
|
</transition>
|
||||||
<div style="margin-bottom:6pt;margin-bottom: 6pt;display: flex;flex-direction: column;">
|
<div style="margin-bottom:6pt;margin-bottom: 6pt;display: flex;flex-direction: column;">
|
||||||
<button class="btn" v-if="is_my_turn && character.name === 'Sid Ketchum' && lives < max_lives && hand.length > 1" @click="sidWantsScrapForHealth=true">{{$t('special_ability')}}</button>
|
<button class="btn" v-if="is_my_turn && character.name === 'Sid Ketchum' && lives < max_lives && hand.length > 1" @click="sidWantsScrapForHealth=true">{{$t('special_ability')}}</button>
|
||||||
<button class="btn" v-if="is_my_turn && character.name === 'Chuck Wengam' && lives > 1" @click="chuckSpecial">{{$t('special_ability')}}</button>
|
<button class="btn" v-if="is_my_turn && character.name === 'Chuck Wengam' && lives > 1" @click="()=>{$socket.emit('special', {})}">{{$t('special_ability')}}</button>
|
||||||
<button class="btn" v-if="is_my_turn && character.name === 'José Delgado' && special_use_count < 2 && hand.filter(x => x.is_equipment).length > 0" @click="joseScrap=true">{{$t('special_ability')}}</button>
|
<button class="btn" v-if="is_my_turn && character.name === 'José Delgado' && special_use_count < 2 && hand.filter(x => x.is_equipment).length > 0" @click="joseScrap=true">{{$t('special_ability')}}</button>
|
||||||
<button class="btn" v-if="is_my_turn && character.name === 'Doc Holyday' && special_use_count < 1 && hand.length > 1 && pending_action == 2" @click="holydayScrap=true">{{$t('special_ability')}}</button>
|
<button class="btn" v-if="is_my_turn && character.name === 'Doc Holyday' && special_use_count < 1 && hand.length > 1 && pending_action == 2" @click="holydayScrap=true">{{$t('special_ability')}}</button>
|
||||||
<button class="btn" v-if="is_my_turn && character.name === 'Jacky Murieta' && gold_nuggets >=2 && pending_action == 2" @click="()=>{$socket.emit('murieta_special')}">{{$t('special_ability')}}</button>
|
<button class="btn" v-if="is_my_turn && character.name === 'Jacky Murieta' && gold_nuggets >=2 && pending_action == 2" @click="()=>{$socket.emit('special', {})}">{{$t('special_ability')}}</button>
|
||||||
<button class="btn" v-if="is_my_turn && character.name === 'Josh McCloud' && gold_nuggets >=2 && pending_action == 2" @click="()=>{$socket.emit('cloud_special')}">{{$t('special_ability')}}</button>
|
<button class="btn" v-if="is_my_turn && character.name === 'Josh McCloud' && gold_nuggets >=2 && pending_action == 2" @click="()=>{$socket.emit('special', {})}">{{$t('special_ability')}}</button>
|
||||||
<button class="btn" v-if="is_my_turn && character.name === 'Raddie Snake' && special_use_count < 2 && gold_nuggets >=1 && pending_action == 2" @click="()=>{$socket.emit('snake_special')}">{{$t('special_ability')}}</button>
|
<button class="btn" v-if="is_my_turn && character.name === 'Raddie Snake' && special_use_count < 2 && gold_nuggets >=1 && pending_action == 2" @click="()=>{$socket.emit('special', {})}">{{$t('special_ability')}}</button>
|
||||||
</div>
|
</div>
|
||||||
<div v-if="lives > 0 || is_ghost" style="position:relative">
|
<div v-if="lives > 0 || is_ghost" style="position:relative">
|
||||||
<span id="hand_text">{{$t('hand')}}</span>
|
<span id="hand_text">{{$t('hand')}}</span>
|
||||||
@ -326,16 +326,13 @@ export default {
|
|||||||
this.scrapHand.push(this.hand.indexOf(c))
|
this.scrapHand.push(this.hand.indexOf(c))
|
||||||
},
|
},
|
||||||
holydayScrapBang(other) {
|
holydayScrapBang(other) {
|
||||||
this.$socket.emit('holyday_special', {
|
this.$socket.emit('special', {
|
||||||
cards : [this.scrapHand[0], this.scrapHand[1]],
|
cards : [this.scrapHand[0], this.scrapHand[1]],
|
||||||
against: other.name
|
against: other.name
|
||||||
})
|
})
|
||||||
this.scrapHand = []
|
this.scrapHand = []
|
||||||
this.holydayScrap = false
|
this.holydayScrap = false
|
||||||
},
|
},
|
||||||
chuckSpecial(){
|
|
||||||
this.$socket.emit('chuck_lose_hp_draw')
|
|
||||||
},
|
|
||||||
end_turn(){
|
end_turn(){
|
||||||
// console.log('ending turn')
|
// console.log('ending turn')
|
||||||
this.cancelEndingTurn()
|
this.cancelEndingTurn()
|
||||||
|
@ -112,7 +112,8 @@
|
|||||||
"prison_turn": "{0} stayed in prison this turn",
|
"prison_turn": "{0} stayed in prison this turn",
|
||||||
"flip_event": "🎴 EVENT: {0} 🎴",
|
"flip_event": "🎴 EVENT: {0} 🎴",
|
||||||
"choose_manette": "{0} committed to play only cards of suit {1} in this turn.",
|
"choose_manette": "{0} committed to play only cards of suit {1} in this turn.",
|
||||||
"UnionPacific": "{0} played Union Pacific and draws 4 cards from the deck"
|
"UnionPacific": "{0} played Union Pacific and draws 4 cards from the deck",
|
||||||
|
"use_special": "{0} used the special ability of their character ({1})"
|
||||||
},
|
},
|
||||||
"foc": {
|
"foc": {
|
||||||
"leggedelwest": "He must play this card on this turn if possible."
|
"leggedelwest": "He must play this card on this turn if possible."
|
||||||
|
@ -112,7 +112,8 @@
|
|||||||
"prison_turn": "{0} rimane in prigione questo turno",
|
"prison_turn": "{0} rimane in prigione questo turno",
|
||||||
"flip_event": "🎴 EVENTO: {0} 🎴",
|
"flip_event": "🎴 EVENTO: {0} 🎴",
|
||||||
"choose_manette": "{0} si è impegnato ad usare solo carte di seme {1} in questo turno.",
|
"choose_manette": "{0} si è impegnato ad usare solo carte di seme {1} in questo turno.",
|
||||||
"UnionPacific": "{0} ha giocato Union Pacific e ha pescato 4 carte"
|
"UnionPacific": "{0} ha giocato Union Pacific e ha pescato 4 carte",
|
||||||
|
"use_special": "{0} ha usato l'abilità speciale del suo personaggio ({1})"
|
||||||
},
|
},
|
||||||
"foc": {
|
"foc": {
|
||||||
"leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"
|
"leggedelwest": "Ed è obbligato a usarla nel suo turno, se possibile"
|
||||||
|
Loading…
Reference in New Issue
Block a user