Hello (again) !!
I am facing a "conception" problem.
In the card game "Riftforce" one of the 3 phases is "Activation" :
What I do in JS
if he clicks on a card that will propose to heal some other self card, it may happens that a same card can be activated and healed
One solution could be to disable all activable cards as soon as one is clicked. But this behaviour implies "no missclick" by the players (or create another button to cancel).
Another one is to rework the activation phase with button to validate the selected card, but as you can activate up to 3 cards, that is a lot of button
Or maybe a button only for the healing activation ?
For example, the 2 images below show
- 7 of Air is discarded, so 7 of Thunderbolrt (left one) and 7 of Light (right one) can be activated (purple outlined) https://imgur.com/a/9VULEdH
- 7 of Light have been clicked, as this Guild (Light) can heal 1 damage, the possible target is the 7 Thunderbolt https://imgur.com/a/vjwK2bU
But the 7 Thunderbolt have 2 events listeners
- Self Activation
- Light Target
is there a "clean" way/advise to deal with this ? Even if this means rework part of the implementation
I am facing a "conception" problem.
In the card game "Riftforce" one of the 3 phases is "Activation" :
- You discard one card from your hand in order to activate 1 to 3 card.
- The possible "activatable" cards depend on the value and/or the guild (4 for each players) of the discarded card
- The activated card uses its own guild special power ability
What I do in JS
- Depending on the discarded card, I add a class "card-possible-activation" for each card matching the value and/or guild. This class is associated with a CSS class that "purple outline" the cards available for activation.
- Then, when I click on a card, some triggers right away the power (because the target is by design the first opponent card) but some have to target some other cards. I highlight these other cards with a "orange outline"
- Everything is, for the moment, working (don't worry you will have all the time during alpha to find bugs
) but I face a problem when I have to heal a card
- select a hand card
- validate by clicking on a button ==> then JS highlight in purple the available cards
- click on a board card
if he clicks on a card that will propose to heal some other self card, it may happens that a same card can be activated and healed
One solution could be to disable all activable cards as soon as one is clicked. But this behaviour implies "no missclick" by the players (or create another button to cancel).
Another one is to rework the activation phase with button to validate the selected card, but as you can activate up to 3 cards, that is a lot of button
Or maybe a button only for the healing activation ?
For example, the 2 images below show
- 7 of Air is discarded, so 7 of Thunderbolrt (left one) and 7 of Light (right one) can be activated (purple outlined) https://imgur.com/a/9VULEdH
- 7 of Light have been clicked, as this Guild (Light) can heal 1 damage, the possible target is the 7 Thunderbolt https://imgur.com/a/vjwK2bU
But the 7 Thunderbolt have 2 events listeners
- Self Activation
- Light Target
is there a "clean" way/advise to deal with this ? Even if this means rework part of the implementation