add some effects on some actions

This commit is contained in:
Alberto Xamin 2023-04-09 21:08:14 +01:00
parent 95ca45b059
commit 25f5f5062e
No known key found for this signature in database
GPG Key ID: 5ABFCD8A22EA6F5D
2 changed files with 34 additions and 1 deletions

View File

@ -80,7 +80,7 @@ export default {
let desc_pos = -1
let params = msg.split('|')
let type = params.shift().substring(1)
if (["flipped", "respond", "play_card", "play_card_against", "play_card_for", "spilled_beer", "diligenza", "wellsfargo", "saloon", "special_calamity", "won", "choose_emporio", "died_role"].indexOf(type) !== -1) {
if (["flipped", "respond", "play_card", "purchase_card", "play_card_against", "play_card_for", "spilled_beer", "diligenza", "wellsfargo", "saloon", "special_calamity", "won", "choose_emporio", "died_role"].indexOf(type) !== -1) {
desc = this.$t(`cards.${params[1]}.desc`)
desc_pos = 3
params[1] = this.$t(`cards.${params[1]}.name`)

View File

@ -65,6 +65,7 @@
<div
v-for="p in playersTable"
v-bind:key="p.card.name"
:id="p.card.name"
style="position: relative"
class="player-in-table"
>
@ -570,6 +571,38 @@ export default {
this.cardsToAnimate = this.cardsToAnimate.filter((x) => x.key !== key);
}, 1800);
},
chat_message(msg) {
let params = msg.split('|')
let type = params.shift().substring(1)
let messageMap = {
prison_turn: '⛓️',
explode: '💥',
purchase_card: '🛒',
prison_free: '🆓',
snake_bit: '🐍',
beer_save: '🍺😇',
sheriff: '⭐',
spilled_beer: '🍺😭',
use_special: '🔝',
}
if (messageMap[type]) {
let key = Math.random();
for (let i = 0; i < 5; i++) {
setTimeout(() => {
this.fullScreenEffects.push({
key,
text: messageMap[type],
startPosition: cumulativeOffset(document.getElementById(params[0])),
});
}, 50 * i);
}
setTimeout(() => {
this.fullScreenEffects = this.fullScreenEffects.filter(
(x) => x.key !== key
);
}, 3000);
}
},
suggest_expansion(expansionName) {
if (this.expansions.includes(expansionName)) return;
let key = Math.random();