u8 announce_kind after chain_link, set only while MSG_ANNOUNCE_NUMBER is
open: 1 when the script called Duel.AnnounceLevel (it passes playerid +
0x10000 to the unit), else 2 when the asking effect has CATEGORY_DICE and is
visible to the answering player, else 0. Contract, changelog, binding
PromptContext.AnnounceKind + AnnouncePlain / Level / Dice, codec 24 bytes,
probe: plain 0, AnnounceLevel 1, a dice effect's AnnounceNumber 2.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The core's own "use this effect?" prompts carry the asked effect in their
PROCESSOR_SELECT_EFFECTYN / SELECT_YESNO unit (optional trigger, lone quick
trigger 221, activation 94, replacements 218 / 219 / 220, Scrap Chimera), and
the unit pushes it on core.ygol_running as phase 4 while the prompt is open.
Contract row, changelog, binding PromptContext.PhaseAsk, probe check: an
optional End Phase trigger is asked with that card, index 2, phase 4.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Contract: the export row (22 bytes, the stable index, the hidden rule), the
0x44 message row (23 bytes), bit 0x8000, protocol 12, binding rows. README
export counts. Probe: Single, a second Single duel with another deck order
and an opponent without the bit, Tag: a card asks in cost, target and
operation, a Fusion's material procedure asks inside that operation and the
outer context comes back, then the card hides in the deck and asks both
players.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The suite plays a pair-present and a pair-absent Tag room: a Summon of the
waiting partner's monster, the partner value across a move, and the replay
played back through the library. The contract states that bit 0x100000 stays
unused.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
Single and Tag rooms advertise the bit; TagDuel::Capability answers a client whose
capability lacks it with ERRMSG_VERERROR and closes the connection. Binding:
FeatureFlags.TagTwoFields (in All), Capability.ProtocolVersion 10, tests pinned.
Probe: the tag two Field slots rooms (placement on turns 1, 3 and 5 with the core's
own view reported by the Probe Field's script, the Tag refusal, the Single room that
keeps an old client); the capability pins move to 10 / 0x37FF. Contract: the 0x1000
row, the v1.5.0 behaviour row, the Lua note; CHANGELOG v1.5.0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
After every engine batch, beside FlushDeckLists, TagDuel::FlushTagPartnerCards
queries ygol_query_tag_cards per side and broadcasts STOC_TAG_PARTNER_CARDS
0x5F when the bytes differ from the last broadcast for that side. Every
broadcast (start, swap, change) records its bytes, so a swap is never sent
twice; a resync to one player does not record. Same id and payload, no new
capability bit, protocol 9. Probe: the TICKET-415 room checks that the Summon
out of the waiting partner's Extra Deck gives side 1's seats exactly one
fresh 0x5F with an empty Extra Deck, and the other team none.
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The Editor crashed in a Tag duel at a turn change: field::remove_card
erased list_extra past its end (memcpy off the vector) from move_to_field.
Reproduced outside Unity with the four real decks: Zane's Time Fusion
(810000954) picks a Fusion from the Extra Deck on his turn and Summons it
"during your next Standby Phase"; by then the partners have swapped, the
Fusion sits in tag_list_extra (still LOCATION_EXTRA, sequence into THAT
list), and remove_card erased the ACTIVE Extra Deck at that sequence:
Adrian's is empty, so the erase ran past the end. With a longer active
list it silently dropped the wrong card. The core is upstream's here; the
fork's swap order (core patch 0015) only decides which turn it lands on.
- field::tag_list_holding(card*): the tag_list_main / hand / extra of the
card's controller that holds it, else null (Tag duels only).
- remove_card: such a card is erased from that list, the list's sequences
are renumbered, STATUS_TO_HAND_WITHOUT_CONFIRM and tag_extra_p_count are
kept honest; move_card never treats it as a same-location reorder, so
it goes through remove_card + add_card like any other move.
- Probe: tag_across_swap_suite hosts a Tag room where seat 3's "Probe Time
Fusion" (a workspace script) picks its Fusion on turn 4 and seat 2, with
an empty Extra Deck, reaches its Standby Phase on turn 6: the Fusion is
Summoned, the duel plays on, no MSG_RETRY, and turn 8's MSG_TAG_SWAP
brings seat 3 back with an empty Extra Deck. The shipped v1.4.0 engine
dies in this case.
- CHANGELOG v1.4.1 row; contract note on MSG_TAG_SWAP (the next swap lists
one card fewer; MSG_MOVE's from-sequence counts into the waiting list).
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The room's "Life Points - Side B" field had nowhere to go: the host string
carries ONE start LP and the server gave it to both duel players. Now the
setup pair ygol.side.b.lp=<n> gives seat side B (seat 1; Tag seats 2 and 3)
its own start LP while side A keeps slot 8; absent, both sides start at
slot 8 exactly as before.
- SideBStartLp(fallback) reads the pair (positive integer, else fallback).
- single_duel / tag_duel keep player_lp[2] in DUEL PLAYER order, so the
side that goes first keeps its own LP through the first-turn swap, in
every duel of a Match: set_player_info per player, MSG_START at the
start and in the late-watcher snapshot carry lp[0], lp[1].
- Replay flag REPLAY_YGOL_SIDE_LP 0x20000000: set only when the two
differ; i32 lp[0], i32 lp[1] follow opt, before the decks. The binding
gets ReplayFlags { SetupPairs, SideLp } for the readers.
- Probe: two more setup-pair rooms (Single and Tag) check MSG_START on
every seat in duel player order and the replay's flag + values; every
other room's replay must have no such flag.
- Contract: slot 8 row, the behaviour table, the Replay section, the
server-read pairs table (three now), the binding row; CHANGELOG v1.4.0.
No new export or capability bit: exports 335 / 856 / 850, protocol 9,
capabilities 0x27FF.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
SendTagPartnerCards also sends to every observer under SpectatorsSeeAll(), so the
start and every MSG_TAG_SWAP reach the audience; an observer's field resync and the
late-watcher snapshot carry both sides after the deck lists. Hidden rooms and seated
duelists are unchanged. Same id, same payload, no new capability bit.
Contract row 0x5F + join snapshot + MSG_TAG_SWAP note, a behaviour row; the probe's
tag partner room runs twice (see all: the watcher gets both sides at every send
point, its resync and a late snapshot; hidden: never); CHANGELOG v1.3.0.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Core: ygol_query_tag_cards(pduel, playerid, out) reads the waiting tag
partner's tag_list_hand / tag_list_extra (bit 31 = face-up, like
MSG_TAG_SWAP) and tag_list_main sorted ascending; returns the byte length,
0 when not a tag duel. Read only.
Server: STOC_TAG_PARTNER_CARDS 0x5F = u8 side + those bytes, no stamp, to
that side's two seats only (never the other team, never an observer):
after start_duel, after every MSG_TAG_SWAP, and in a seated duelist's
field resync. FEATURE_TAG_PARTNER_CARDS 0x2000 advertised by single_duel
and tag_duel; FEATURE_PROTOCOL 8 -> 9. 0x800 / 0x1000 stay reserved for
proposals 44 / 45.
Binding: StocMessage.TagPartnerCards, FeatureFlags.TagPartnerCards, the
TagPartnerCards record + StocCodecs.TagPartnerCards,
EngineApi.ygol_query_tag_cards, Capability.ProtocolVersion 9, tests.
Contract rows, CHANGELOG v1.2.0, the probe's tag partner cards room, the
export gates 334 / 855 / 849 -> 335 / 856 / 850.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
The official Tag Duel rules: duelists 1A, 2A and 1B cannot enter their Battle
Phase; 2B (turn 4) is the first who can. The core blocked turn 1 only, so team
B's first duelist could attack on turn 2. One helper,
field::is_opening_turn_without_bp, now decides for the idle command and for
Duel.IsAbleToEnterBP: turns 1-3 in DUEL_TAG_MODE, turn 1 otherwise,
DUEL_ATTACK_FIRST_TURN still lifts it. Rules only; no contract change.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Namespace YGOLegacy.Engine in binding/YGOLegacy.Engine:
- EngineApi: one DllImport("ygol-engine", Cdecl) extern per export of contract/ocgapi.h (45),
C names kept, types by the contract's type rule; delegates ScriptReader, CardReader,
MessageHandler beside it.
- MessageScan: MsgInfo, Scan, Blank, BlankPileCodes, PromptName moved from the Unity bot host
(LocalDuelHost), public, bodies unchanged (+ the private FieldOffset helper and the five
constants they read).
- GameMessage: enum : byte, one member per #define MSG_* in core/common.h (84), PascalCase names.
- EngineBinding: const Version generated at build from the EngineVersion property into
obj/EngineBindingVersion.cs (local by default); CheckNative() compares it with
ygol_engine_version() and throws InvalidOperationException naming both.
Tests: EngineApiParityTests (header names vs extern names, both ways; public, Cdecl, no
CharSet.Unicode, no overloads) and GameMessageParityTests (missing, extra, renumbered).
114 -> 122 tests, green.
contract/engine-contract.md: five parts; "(e) C# binding" with the 45-row extern table, the type
rule and the version rule; engine.json's binding key documented. CHANGELOG.md: Unreleased ->
v1.1.0 with the TICKET-397 and TICKET-398 rows. README.md: the Binding section names the four
types and CheckNative().
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DJUFwdiGCHipsxLkgxssSR
TICKET-388. Four sections, one table each, every fact read from the source (ocgapi.h, serverapi.h, network.h, netserver.cpp, single_duel.cpp, common.h, gframe.cpp): (a) every export with its signature and the patch / ticket that added it, plus the host string slots and the three dead DllImports in the Unity client; (b) every fork CTOS / STOC id 0x40-0x43, 0x50-0x5E with payload layout, sender stamp, who may send, what happens otherwise, capability bit and protocol number, plus the bits table, the no-message behaviour changes and the replay flag; (c) the MSG_* table as LocalDuelHost.Scan reads it, the fork's only effect (0015) marked; (d) the setup pairs the server reads and the ones the client sends, and the generated Lua reference. Also defines engine.json.
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01DJUFwdiGCHipsxLkgxssSR