Gudradain / spirit-island-template

A set of templates to help create fan made content for the board game Spirit Island.
MIT License
16 stars 22 forks source link

Energy with Reclaim One on Energy Track #26

Closed LordMotas closed 2 years ago

LordMotas commented 3 years ago

When using a command like "5+reclaim-one" forces the circle of the element track to push everything upwards.

It should be a simple CSS fix to allow the text to not be block-esque.

LordMotas commented 3 years ago

To add. I don't think it actually works. I think it's missing in the parseEnergyTrack method. It spits out "5, reclaim-one" instead of "5, Reclaim One"

LokiMidgard commented 3 years ago

I think your correct, only if there is one element the value will be further processed.

If there are two or more values, the first and the second one will be used as is (besides maken the first char upper case).

https://github.com/Gudradain/spirit-island-template/blob/3191346b60390e6f80fe27a784507ae1c2e690e9/_global/js/board_front.js#L288-L323

This should probably refactored out other wise it would be repeated 4 times. twice for energy track and twice for card track

I would propose a function that gets one element of splitOptions as input and returns a json object with text and icon member.

member description
text will contain the text between the subtext tags
icon will contain the html for the icon

e.g. for the number 2 icon will contain <value>2</value>, for move-presence(3) it will be <card-play-special><icon class="move-presence-3"></icon></card-play-special>.

Another alternative is to just return one string, everything that's currently between the <energy-track> tag.

There is still a special case not handled, that is when <energy-track-ring> is used instead of <energy-track>. That's the case for options that do not have the background of the energy, like reclaim one.

An additional member could be added to the return type to signal this. The Card track would ignore this member since it does not have a background icon. Using css would be more elegant, but I think there is no pseudo class that matches an element that has an specific child.

For multiple options instead of having <energy-top> and <element-combination><element-top> this should be able to archive using one tag. It should be enough to have a selector top > value to make adjustments to energy and distinct between energy, element and element element.