Skip to content
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 2 commits into from
Jan 16, 2023
Merged

Conversation

PakhomCh
Copy link
Contributor

@PakhomCh PakhomCh commented Jan 8, 2023

Related Ticket(s)

  • Fixes p

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?

  • Additional check will be added to see, if ptSeparator is ever needed.

Screenshots

The issue examle:
image

@ZeldaZach ZeldaZach merged commit b282df2 into Cockatrice:master Jan 16, 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
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants