Skip to content

update forced in MSG_SELECT_CHAIN#2797

Merged
mercury233 merged 2 commits into
Fluorohydride:masterfrom
mercury233:patch-select-chain-forced
Jun 29, 2025
Merged

update forced in MSG_SELECT_CHAIN#2797
mercury233 merged 2 commits into
Fluorohydride:masterfrom
mercury233:patch-select-chain-forced

Conversation

@mercury233

@mercury233 mercury233 commented May 18, 2025

Copy link
Copy Markdown
Collaborator

Problem:

In the Standby phase, Dark Contract with the Witch can select among 2 effects, ① is optional, ③ is forced.

But the client didn't know which is forced. If chkAutoChain is enabled, the first effect will be selected to activate.

Solution:

Update MSG_SELECT_CHAIN, set forced to each chain options.

require Fluorohydride/ygopro-core#753

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull Request Overview

This PR updates the handling of MSG_SELECT_CHAIN to include a per‐option “forced” flag and adjusts buffer offsets and client logic accordingly. Key changes include:

  • Adjust buffer skip calculations in various Analyze methods to match the new message layout.
  • Extend flag handling to treat EDESC_OPERATION and EDESC_RESET as bitmasks, and add a forced‐flag bit into the high byte.
  • Update auto‐chain logic to detect and auto‐select the forced option.

Reviewed Changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
gframe/tag_duel.cpp Updated buffer skip for MSG_SELECT_CHAIN
gframe/single_mode.cpp Mirrored buffer skip change in single‐player mode
gframe/single_duel.cpp Mirrored buffer skip change in duel analysis
gframe/replay_mode.cpp Mirrored buffer skip change in replay analysis
gframe/event_handler.cpp Switched comparisons to bitmask checks for desc flags
gframe/duelclient.cpp Refactored parsing to read per‐option forced flag, updated auto‐chain logic
Comments suppressed due to low confidence (1)

gframe/duelclient.cpp:1765

  • Add a unit or integration test to verify that when a forced option is present, chkAutoChain correctly selects the forced index and ignores other settings.
if(mainGame->chkAutoChain->isChecked() && mainGame->dField.chain_forced && !(mainGame->always_chain || mainGame->chain_when_avail)) {

Comment thread gframe/tag_duel.cpp
Comment thread gframe/single_mode.cpp
Comment thread gframe/single_duel.cpp
Comment thread gframe/replay_mode.cpp
Comment thread gframe/duelclient.cpp
for (int i = 0; i < count; ++i) {
int flag = BufferIO::ReadUInt8(pbuf);
int forced = BufferIO::ReadUInt8(pbuf);
flag |= forced << 8;

Copilot AI May 18, 2025

Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] It may help future readers to document that the high byte of flag now carries the forced‐option bit (e.g. define an EDESC_FORCED mask), rather than using a raw shift.

Suggested change
flag |= forced << 8;
flag |= (forced * EDESC_FORCED);

Copilot uses AI. Check for mistakes.
@mercury233 mercury233 added this to the Version 0x1362 milestone May 20, 2025
@mercury233 mercury233 marked this pull request as ready for review June 19, 2025 03:49
@mercury233 mercury233 merged commit e7ebb75 into Fluorohydride:master Jun 29, 2025
8 checks passed
@mercury233 mercury233 deleted the patch-select-chain-forced branch June 29, 2025 09:40
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.

2 participants