Re-add missing '/' separator in <pt> after b282df2e27 #4747
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Related Ticket(s)
Short roundup of the initial problem
In b282df2 (#4728) the logic for creating values was updated to avoid adding a final slash after an existing power value and missing toughness value. This works by setting the ptSeparator to an empty string when either the power or the toughness is undefined. However, due to the ptSeparator variable being scoped out of the
for
loop, this causes all remaining cards to have an empty string as a separator, ending up with values of e.g. 21 instead of 2/1.Moreover, the implementation from #4728 is ambiguous in the case of a card having a toughness value but no power value: in that situation, it creates a entry with the toughness value and no separator, which is not a good idea since it is not possible to know if 2 means power 2 and no toughness, or no power and toughness 2 (Cockatrice takes the first interpretation).
What will change with this Pull Request?
Oracle no longer generates incorrect values with a missing separator. The value is now one of the following:
Note that, as far as I can tell, Cockatrice seems to (incorrectly, IMO) ignore the initial slash if present in Player::parsePT, and treat /T as a power value. However that is a separate issue: this patch is concerned with Oracle and ensuring proper values in cards.xml, not with how Cockatrice interprets those values.