terraforming-mars / terraforming-mars

Terraforming Mars Boardgame
GNU General Public License v3.0
743 stars 333 forks source link

Event cards science & earth tags are not counted #7110

Closed avbhandaru closed 4 hours ago

avbhandaru commented 19 hours ago

1. A clear and concise description of the bug.

Event cards are not having their tags properly counted. In my most recent game, I played 3 event cards that also had science tags. However, these science tags were not counted in my total science tags, preventing me from playing other cards that had tag count requirements.

The same happened for event cards played by opponent that had an earth tag.

We assume that there is some issue with either:

  1. The card registry/definitions having missing tags for certain cards/types of cards
  2. Event card tagging

2. Clear steps to reproduce, and the expected behavior.

To reproduce, play another game, play an event card with a science tag or an earth tag and then note the tag count on the summary panel. The expected behavior is that the science/earth tag count should have increased by 1, but in actuality it remains as it was.

3. Any screenshots

Below are screenshots showing my summary panel and all of my cards played by the end of the game.

Screenshot 2024-11-30 at 10 39 01 PM Screenshot 2024-11-30 at 10 38 23 PM

4. Any information from the Bug Report Dialog

Player URL: https://terraforming-mars.herokuapp.com/player?id=paf1f3d610bc6&noredirect

{
  "url": "https://terraforming-mars.herokuapp.com/spectator?id=sa5ab475195d0#cards",
  "color": "green",
  "step": 65,
  "version": "0fbd830",
  "builtAt": "Sat, 30 Nov 2024 18:21:11 GMT",
  "browser": "Chrome 131",
  "language": "en",
  "experimental_ui": false
}
avbhandaru commented 19 hours ago

I took a look at the code for one of the event cards Martian Survey:

  1. Card name
  2. Card definition

Looks like this event card has a science tag, so I assume there is some issue with event cards and tagging specifically, rather than an issue with the tags being present or not.

avbhandaru commented 18 hours ago

Actually, I think I found the issue:

  1. tags: server model
  2. getPlayedEventsCount method
  3. countAllTags method
  4. COUNTED_TAGS constant

From what I can tell, COUNTED_TAGS filters out CLONE and EVENT cards, while countAllTags has special logic for EVENT cards. This should only affect counting the EVENT tagged cards, and not science/earth/etc.

Looking deeper at the Tag::count code, I can see that includeEvents is only set to true if the corporation is ODYSSEY and the Tag::rawCount method will thus filter out tags for event cards as a result.

I think the required change would be to update the includeEvents definition, but I am not familiar enough with the rules to know for certain whether:

kberg commented 4 hours ago

This is working as intended. https://github.com/terraforming-mars/terraforming-mars/wiki/FAQ#why-arent-tags-on-my-event-card-taken-into-consideration

On Sat, Nov 30, 2024, 11:05 PM Akhil Bhandaru @.***> wrote:

Actually, I think I found the issue:

  1. tags: server model https://github.com/terraforming-mars/terraforming-mars/blob/26de57622320ac44a48801cd542dee7258d79e68/src/server/models/ServerModel.ts#L242
  2. getPlayedEventsCount method https://github.com/terraforming-mars/terraforming-mars/blob/26de57622320ac44a48801cd542dee7258d79e68/src/server/Player.ts#L518-L521
  3. countAllTags method https://github.com/terraforming-mars/terraforming-mars/blob/main/src/server/player/Tags.ts#L55-L61
  4. COUNTED_TAGS constant https://github.com/terraforming-mars/terraforming-mars/blob/main/src/server/player/Tags.ts#L43

From what I can tell, COUNTED_TAGS filters out CLONE and EVENT cards, while countAllTags has special logic for EVENT cards. This should only affect counting the EVENT tagged cards, and not science/earth/etc.

Looking deeper at the Tag::count code https://github.com/terraforming-mars/terraforming-mars/blob/main/src/server/player/Tags.ts#L66-L107, I can see that includeEvents is only set to true if the corporation is ODYSSEY and the Tag::rawCount method https://github.com/terraforming-mars/terraforming-mars/blob/main/src/server/player/Tags.ts#L149 will thus filter out tags for event cards as a result.

I think the required change would be to update the includeEvents definition, but I am not familiar enough with the rules to know for certain whether:

  • ODYSSEY is the only corporation where this matters
  • If we can safely always include event cards when computing tag counts

— Reply to this email directly, view it on GitHub https://github.com/terraforming-mars/terraforming-mars/issues/7110#issuecomment-2509558896, or unsubscribe https://github.com/notifications/unsubscribe-auth/AADE6KOUQESEIASXNT53LQ32DKDH5AVCNFSM6AAAAABSZGLCMCVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDKMBZGU2TQOBZGY . You are receiving this because you are subscribed to this thread.Message ID: @.*** com>

kberg commented 4 hours ago

Thanks for your bug report. I think the correct next step is to close the bug. If you still disagree, let me know by adding a new comment.

kberg commented 4 hours ago

Thanks for your bug report. I think the correct next step is to close the bug. If you still disagree, let me know by adding a new comment.

avbhandaru commented 2 hours ago

Appreciate the speedy response. Didn't realize this was a rule! Ty