spacemandev-git / fvtt-card-support

Adds programmatic deck support to FoundryVTT
MIT License
10 stars 10 forks source link

Feature Request: Card Rotation / Reversal #41

Open sdsalyer opened 4 years ago

sdsalyer commented 4 years ago

Hi there!

It appears card images always appear "upright" (ie. as they are actually oriented in the image). Some types of cards, however, may have a different meaning or purpose depending on if they are presented upright or "reversed" (ie. rotated 180 degrees), for example: Tarot cards.

Thus, this feature request is for support of an option to allow cards to be "reversed" during shuffling at the least, so that their orientation is randomized when they are drawn into use. Additional options might be to allow manual orientation change of individual cards, and other orientations besides "upright" and "reversed" (e.g. rotate 90 or 270 degrees, or some arbitrary value -- such as MTG cards which can become "tapped" and are turned 90 degrees to signify this).

Thanks for listening and looking forward to support of something along these lines! I think as a workaround, I will duplicate some or all of the cards in my deck into "reversed" orientation, though I'm not sure statistically how "realistic" that would be in their distribution -- or perhaps change the yaml file periodically to reverse a different number of cards.

sdsalyer commented 4 years ago

I looked at the code a bit today to see if I could implement this, but unfortunately I'm not very familiar with node. I think it might make sense to:

  1. add an optional rotation numeric property to the Card class (or, just a simple reversed boolean toggle if we only care about upright or reversed orientation)
  2. add another button to the tile menu for "Shuffle with Rotation" 3.add a shuffleWithRotation method to the Deck class (and/or an optional parameter on the existing shuffle method) that sets the Card.rotation to 180 (or flips the reversed toggle) on a Math.random() > 0.5
  3. not entirely sure where all to reflect the rotation on the UI, but presumable could add a CSS .rotate-180 class in the appropriate location(s) and check for whether or not to apply the class in the template (s)

I'm new with Foundry and haven't checked their developer documentation yet, but I may give it a try if I can make the time for it.

spacemandev-git commented 4 years ago

Hi sdsalyer, this is definitely something I want to tackle for the next major release of card support, but unfortunately I don't think that's going to be for a couple weeks atleast

TheKillingJay commented 4 years ago

I came here to suggest the same! Glad to hear its something you're considering, looking forward to it :D