hurt indicator

This commit is contained in:
Alberto Xamin 2023-01-09 13:31:34 +00:00
parent 8a622def7a
commit e1fe906dbf
2 changed files with 13 additions and 0 deletions

View File

@ -1141,6 +1141,7 @@ class Player:
def take_damage_response(self): def take_damage_response(self):
self.lives -= 1 self.lives -= 1
self.sio.emit('hurt', room=self.sid, data=f'')
if self.lives > 0: if self.lives > 0:
if self.character.check(self.game, chars.BartCassidy): if self.character.check(self.game, chars.BartCassidy):
self.sio.emit('chat_message', room=self.game.name, self.sio.emit('chat_message', room=self.game.name,

View File

@ -70,6 +70,7 @@
:cards="notScrappedHand" :select="holydayScrapAdd" :cancel="() => {holydayScrap = false;scrapHand=[]}"/> :cards="notScrappedHand" :select="holydayScrapAdd" :cancel="() => {holydayScrap = false;scrapHand=[]}"/>
<Chooser v-if="holydayScrap && scrapHand.length == 2" :text="$t('card_against')" :cards="visiblePlayers" :select="holydayScrapBang" :cancel="() => {holydayScrap = false;scrapHand=[]}"/> <Chooser v-if="holydayScrap && scrapHand.length == 2" :text="$t('card_against')" :cards="visiblePlayers" :select="holydayScrapBang" :cancel="() => {holydayScrap = false;scrapHand=[]}"/>
<Chooser style="filter: grayscale(1);" v-if="emporioCards && emporioCards.cards && emporioCards.cards.length > 0 && (pending_action === 4 || pending_action === null)" :text="$t('emporio_others', [emporioCards.name])" :cards="emporioCards.cards"/> <Chooser style="filter: grayscale(1);" v-if="emporioCards && emporioCards.cards && emporioCards.cards.length > 0 && (pending_action === 4 || pending_action === null)" :text="$t('emporio_others', [emporioCards.name])" :cards="emporioCards.cards"/>
<div style="position: fixed;width: 100%;height: 100%;background: #ff000070;top: 0;left: 0;" v-if="hurt" class="hurt-notify"/>
</div> </div>
</template> </template>
@ -135,6 +136,7 @@ export default {
committed_suit_manette: null, committed_suit_manette: null,
gold_nuggets: 0, gold_nuggets: 0,
cantplaycard: false, cantplaycard: false,
hurt: false,
}), }),
sockets: { sockets: {
role(role) { role(role) {
@ -206,6 +208,12 @@ export default {
this.notifycard = null this.notifycard = null
}.bind(this), 4000) }.bind(this), 4000)
}, },
hurt() {
this.hurt = true
setTimeout(function(){
this.hurt = false
}.bind(this), 500)
},
cant_play_card() { cant_play_card() {
this.cantplaycard = true this.cantplaycard = true
setTimeout(function(){ setTimeout(function(){
@ -513,6 +521,10 @@ export default {
margin: 10pt 0pt; margin: 10pt 0pt;
overflow:auto; overflow:auto;
} }
.hurt-notify {
pointer-events: none;
animation: disappear 0.5s ease-in forwards;
}
.turn-notify { .turn-notify {
pointer-events: none; pointer-events: none;
animation: disappear 2s ease-in forwards; animation: disappear 2s ease-in forwards;