-
-
Notifications
You must be signed in to change notification settings - Fork 431
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Fixed ptSeparation oracle issue #4728
Merged
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
ZeldaZach
reviewed
Jan 8, 2023
Elarnon
added a commit
to Elarnon/Cockatrice
that referenced
this pull request
Feb 8, 2023
In b282df2 (Cockatrice#4728) the logic for creating <pt> 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 <pt> values of e.g. 21 instead of 2/1. Moreover, the implementation from Cockatrice#4728 is ambiguous in the case of a card having a toughness value but no power value: in that situation, it creates a <pt> entry with the toughness value and no separator, which is not a good idea since it is not possible to know if <pt>2</pt> means power 2 and no toughness, or no power and toughness 2 (Cockatrice takes the first interpretation). To avoid ambiguities, the <pt> value is now one of: 1. A regular P/T value when the card has power and toughness 2. A simplified P value when the card has power but no toughness 3. A simplified /T value when the card has toughness but no power 4. Absent when the card has neither power nor toughness 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.
Elarnon
added a commit
to Elarnon/Cockatrice
that referenced
this pull request
Feb 8, 2023
In b282df2 (Cockatrice#4728) the logic for creating <pt> 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 <pt> values of e.g. 21 instead of 2/1. Moreover, the implementation from Cockatrice#4728 is ambiguous in the case of a card having a toughness value but no power value: in that situation, it creates a <pt> entry with the toughness value and no separator, which is not a good idea since it is not possible to know if <pt>2</pt> means power 2 and no toughness, or no power and toughness 2 (Cockatrice takes the first interpretation). To avoid ambiguities, the <pt> value is now one of: 1. A regular P/T value when the card has power and toughness 2. A simplified P value when the card has power but no toughness 3. A simplified /T value when the card has toughness but no power 4. Absent when the card has neither power nor toughness 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.
ebbit1q
pushed a commit
that referenced
this pull request
Feb 8, 2023
In b282df2 (#4728) the logic for creating <pt> 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 <pt> 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 <pt> entry with the toughness value and no separator, which is not a good idea since it is not possible to know if <pt>2</pt> means power 2 and no toughness, or no power and toughness 2 (Cockatrice takes the first interpretation). To avoid ambiguities, the <pt> value is now one of: 1. A regular P/T value when the card has power and toughness 2. A simplified P value when the card has power but no toughness 3. A simplified /T value when the card has toughness but no power 4. Absent when the card has neither power nor toughness 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.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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
ptSeparation oracle issue is an issue which causes cards from JSON file to have a '/' symbol between its power and an unexisting toughness value.
What will change with this Pull Request?
Screenshots
The issue examle: