add doc holyday
This commit is contained in:
parent
f864dc03bf
commit
ecd3857963
@ -280,5 +280,10 @@ def chuck_lose_hp_draw(sid):
|
||||
ses: Player = sio.get_session(sid)
|
||||
ses.chuck_lose_hp_draw()
|
||||
|
||||
@sio.event
|
||||
def holyday_special(sid, data):
|
||||
ses: Player = sio.get_session(sid)
|
||||
ses.holyday_special(data)
|
||||
|
||||
if __name__ == '__main__':
|
||||
eventlet.wsgi.server(eventlet.listen(('', 5001)), app)
|
||||
|
@ -122,7 +122,7 @@ def all_characters() -> List[Character]:
|
||||
ChuckWengam(),
|
||||
PatBrennan(),
|
||||
JoseDelgrado(),
|
||||
# DocHolyday(),
|
||||
DocHolyday(),
|
||||
]
|
||||
|
||||
#Apache Kid: il suo effetto non conta nei duelli
|
||||
|
@ -51,6 +51,7 @@ class Player:
|
||||
self.mancato_needed = 0
|
||||
self.molly_discarded_cards = 0
|
||||
self.is_bot = bot
|
||||
self.special_use_count = 0
|
||||
|
||||
def reset(self):
|
||||
self.hand: cs.Card = []
|
||||
@ -73,6 +74,7 @@ class Player:
|
||||
self.attacker: Player = None
|
||||
self.target_p: str = None
|
||||
self.is_drawing = False
|
||||
self.special_use_count = 0
|
||||
try:
|
||||
del self.win_status
|
||||
except:
|
||||
@ -293,6 +295,7 @@ class Player:
|
||||
self.is_my_turn = True
|
||||
self.is_waiting_for_action = True
|
||||
self.has_played_bang = False
|
||||
self.special_use_count = 0
|
||||
if not self.game.check_event(ce.Lazo) and any([isinstance(c, cs.Dinamite) or isinstance(c, cs.Prigione) for c in self.equipment]):
|
||||
self.pending_action = PendingAction.PICK
|
||||
else:
|
||||
@ -681,12 +684,22 @@ class Player:
|
||||
if isinstance(self.character, chars.SidKetchum) and self.scrapped_cards == 2:
|
||||
self.scrapped_cards = 0
|
||||
self.lives = min(self.lives+1, self.max_lives)
|
||||
elif isinstance(self.character, chd.JoseDelgrado) and card.is_equipment:
|
||||
elif isinstance(self.character, chd.JoseDelgrado) and card.is_equipment and self.special_use_count < 2:
|
||||
self.hand.append(self.game.deck.draw())
|
||||
self.hand.append(self.game.deck.draw())
|
||||
self.special_use_count += 1
|
||||
self.game.deck.scrap(card)
|
||||
self.notify_self()
|
||||
|
||||
def holyday_special(self, data):
|
||||
if isinstance(self.character, chd.DocHolyday) and self.special_use_count < 1:
|
||||
self.special_use_count += 1
|
||||
cards = sorted(data['cards'], reverse=True)
|
||||
for c in cards:
|
||||
self.game.deck.scrap(self.hand.pop(c))
|
||||
self.notify_self()
|
||||
self.game.attack(self, data['against'])
|
||||
|
||||
def chuck_lose_hp_draw(self):
|
||||
if isinstance(self.character, chd.ChuckWengam) and self.lives > 1 and self.is_my_turn:
|
||||
self.lives -= 1
|
||||
|
@ -22,7 +22,8 @@
|
||||
</transition>
|
||||
<button v-if="is_my_turn && character.name === 'Sid Ketchum' && lives < max_lives && hand.length > 1" @click="sidWantsScrapForHealth=true">{{$t('special_ability')}}</button>
|
||||
<button v-if="is_my_turn && character.name === 'Chuck Wengam' && lives > 1" @click="chuckSpecial">{{$t('special_ability')}}</button>
|
||||
<button v-if="is_my_turn && character.name === 'José Delgrado' && hand.filter(x => x.is_equipment).length > 0" @click="joseScrap=true">{{$t('special_ability')}}</button>
|
||||
<button v-if="is_my_turn && character.name === 'José Delgrado' && special_use_count < 2 && hand.filter(x => x.is_equipment).length > 0" @click="joseScrap=true">{{$t('special_ability')}}</button>
|
||||
<button v-if="is_my_turn && character.name === 'Doc Holyday' && special_use_count < 1 && hand.length > 1" @click="holydayScrap=true">{{$t('special_ability')}}</button>
|
||||
<div v-if="lives > 0" style="position:relative">
|
||||
<span id="hand_text">{{$t('hand')}}</span>
|
||||
<transition-group name="list" tag="div" class="hand">
|
||||
@ -47,10 +48,13 @@
|
||||
<Chooser v-if="hasToPickResponse" :text="`${$t('pick_a_card')} ${attacker?($t('to_defend_from')+' '+attacker):''}`" :key="hasToPickResponse" class="turn-notify" />
|
||||
<Chooser v-if="!card_against && card_with" :text="`${$t('choose_scarp_card_to')} ${card_with.name.toUpperCase()}`" :cards="hand.filter(x => x !== card_with)" :select="selectWith" :cancel="()=>{card_with = null}"/>
|
||||
<Chooser v-if="showScrapScreen" :text="`${$t('discard')} ${hand.length}/${lives}`" :cards="hand" :select="scrap" :cancel="cancelEndingTurn"/>
|
||||
<Chooser v-if="sidWantsScrapForHealth && sidScrapForHealth.length < 2" :text="`${$t('discard')} ${2 - sidScrapForHealth.length} ${$t('to_regain_1_hp')}`"
|
||||
:cards="sidScrapHand" :select="sidScrap" :cancel="() => {sidWantsScrapForHealth = false;sidScrapForHealth=[]}"/>
|
||||
<Chooser v-if="sidWantsScrapForHealth && scrapHand.length < 2" :text="`${$t('discard')} ${2 - scrapHand.length} ${$t('to_regain_1_hp')}`"
|
||||
:cards="notScrappedHand" :select="sidScrap" :cancel="() => {sidWantsScrapForHealth = false;scrapHand=[]}"/>
|
||||
<Chooser v-if="joseScrap" :text="`${$t('discard')}`"
|
||||
:cards="hand.filter(x => x.is_equipment)" :select="(card) => {joseScrap=false;scrap(card)}" :cancel="() => {joseScrap=false}"/>
|
||||
<Chooser v-if="holydayScrap && scrapHand.length < 2" :text="`${$t('discard')} ${2 - scrapHand.length}`"
|
||||
:cards="notScrappedHand" :select="holydayScrapAdd" :cancel="() => {holydayScrap = false;scrapHand=[]}"/>
|
||||
<Chooser v-if="holydayScrap && scrapHand.length == 2" :text="$t('card_against')" :cards="otherPlayers" :select="holydayScrapBang" :cancel="() => {holydayScrap = false;scrapHand=[]}"/>
|
||||
</div>
|
||||
</template>
|
||||
|
||||
@ -95,9 +99,11 @@ export default {
|
||||
attacker: undefined,
|
||||
notifycard: null,
|
||||
desc: '',
|
||||
sidScrapForHealth: [],
|
||||
scrapHand: [],
|
||||
sidWantsScrapForHealth: false,
|
||||
joseScrap:false,
|
||||
joseScrap: false,
|
||||
holydayScrap: false,
|
||||
special_use_count: 0,
|
||||
mancato_needed: 0,
|
||||
name: '',
|
||||
}),
|
||||
@ -121,6 +127,7 @@ export default {
|
||||
this.lives = self.lives
|
||||
this.max_lives = self.max_lives
|
||||
this.has_played_bang = self.has_played_bang
|
||||
this.special_use_count = self.special_use_count
|
||||
this.is_my_turn = self.is_my_turn
|
||||
if (this.is_my_turn) document.title = this.$t('your_turn')+' | PewPew!'
|
||||
else if (this.pending_action == 3) document.title = this.$t('your_response')+' | PewPew!'
|
||||
@ -157,8 +164,20 @@ export default {
|
||||
showScrapScreen() {
|
||||
return this.isEndingTurn && !this.canEndTurn && this.is_my_turn;
|
||||
},
|
||||
sidScrapHand() {
|
||||
return this.hand.filter((x, i) => (this.sidScrapForHealth.indexOf(i) === -1))
|
||||
notScrappedHand() {
|
||||
return this.hand.filter((x, i) => (this.scrapHand.indexOf(i) === -1))
|
||||
},
|
||||
otherPlayers() {
|
||||
let vis = this.playersDistances.filter(x => {
|
||||
return x.name !== this.name
|
||||
}).map(player => {
|
||||
return {
|
||||
name: player.name,
|
||||
number: player.dist !== undefined ? `${player.dist}⛰` : '',
|
||||
icon: player.is_sheriff ? '⭐' : '🤠',
|
||||
is_character: true,
|
||||
}})
|
||||
return vis
|
||||
},
|
||||
visiblePlayers() {
|
||||
this.range;
|
||||
@ -217,14 +236,25 @@ export default {
|
||||
this.$socket.emit('set_character', char.name)
|
||||
},
|
||||
sidScrap(c) {
|
||||
this.sidScrapForHealth.push(this.hand.indexOf(c))
|
||||
if (this.sidScrapForHealth.length == 2) {
|
||||
this.$socket.emit('scrap', this.hand.indexOf(this.sidScrapForHealth[0]))
|
||||
this.$socket.emit('scrap', this.hand.indexOf(this.sidScrapForHealth[1]))
|
||||
this.sidScrapForHealth = []
|
||||
this.scrapHand.push(this.hand.indexOf(c))
|
||||
if (this.scrapHand.length == 2) {
|
||||
this.$socket.emit('scrap', this.hand.indexOf(this.scrapHand[0]))
|
||||
this.$socket.emit('scrap', this.hand.indexOf(this.scrapHand[1]))
|
||||
this.scrapHand = []
|
||||
this.sidWantsScrapForHealth = false
|
||||
}
|
||||
},
|
||||
holydayScrapAdd(c) {
|
||||
this.scrapHand.push(this.hand.indexOf(c))
|
||||
},
|
||||
holydayScrapBang(other) {
|
||||
this.$socket.emit('holyday_special', {
|
||||
cards : [this.hand.indexOf(this.scrapHand[0]), this.hand.indexOf(this.scrapHand[1])],
|
||||
against: other.name
|
||||
})
|
||||
this.scrapHand = []
|
||||
this.holydayScrap = false
|
||||
},
|
||||
chuckSpecial(){
|
||||
this.$socket.emit('chuck_lose_hp_draw')
|
||||
},
|
||||
|
Loading…
Reference in New Issue
Block a user