prompt context: announce kind byte, record 23 bytes, STOC 0x44 24 bytes (TICKET-451, v1.7.0)
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>
This commit is contained in:
1 parent
3f84b0b50b
commit
954fbfc65b
12 files changed
+70
-40
No files matched your search
@@ -111,7 +111,7 @@ The host string is space-separated tokens, in this order (`server/gframe/gframe.
|
||||
| `default_script_reader` | `byte* default_script_reader(const char* script_name, int* len)` | Upstream |
|
||||
| `ygol_preview_attack` | `int32_t ygol_preview_attack(intptr_t pduel, uint8_t playerid, uint8_t location, uint8_t sequence, uint8_t target_location, uint8_t target_sequence, uint8_t* out)` | Patch 0022 (TICKET-374) + 0024 (TICKET-379), 2026-10-13. A read-only dry run of the damage step. Returns 1 answered, 0 refused (bad pointer, no such card, attacker not a face-up monster on `playerid`'s field, target not a monster on the other field); a refusal writes nothing. `target_location` `0xFF` = direct. `out` is 24 bytes: version (1), flags (bit 0 direct, bit 1 unknown, bit 2 attacker destroyed, bit 3 target destroyed, bit 4 pierce, bit 5 illegal), 2 pad bytes, then five `int32`: attacker value, target value, damage to player 0, damage to player 1, reserved 0. A face-down target answers unknown with every number 0. A pair the battle menu (`field::get_attack_target`) would not offer answers illegal alone with every number 0. Call it only while the engine is parked on a prompt; the duel is byte-identical afterwards. |
|
||||
| `ygol_query_tag_cards` | `int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out)` | v1.2.0 (TICKET-405), 2026-10-15. The waiting tag partner's cards of `playerid`'s side, read only. Returns the byte length written, 0 refused (bad pointer, bad player, not a tag duel); a refusal writes nothing. `out`: `u8 version` (1), `u8 hand_count`, `u8 extra_count`, `u8 pad` (0), `u16 deck_count`, then `u32 hand[hand_count]`, `u32 extra[extra_count]` (bit 31 = face-up, as in `MSG_TAG_SWAP`), `u32 deck[deck_count]` sorted ascending (the order stays secret). At most 7 + 4 x (255 + 255 + 250) bytes in practice; size the buffer for your deck limits. The duel is byte-identical afterwards. |
|
||||
| `ygol_query_prompt_context` | `int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out)` | v1.7.0 (TICKET-451), 2026-11-08. Which effect asks the prompt the engine is parked on, read only; `playerid` is the answering player. Returns 22 (the bytes written), 0 refused (bad pointer, bad player); a refusal writes nothing. `out` (22 bytes, little-endian): `u8 version` (1), `u8 has_effect`, `u32 code` (the handler's `get_code()` now), `u8 controller`, `u8 location`, `u8 sequence`, `u8 position` (the handler now), `u64 description` (the effect's, 0 when none), `u16 effect_index`, `u8 phase` (1 cost, 2 target, 3 operation, 4 ask), `u8 chain_link` (the newest chain link whose effect it is, 0 when none). The effect is the innermost frame on `core.ygol_running`: a cost / target / operation function running (`field::execute_cost` / `execute_target` / `execute_operation`, the core's only coroutine calls; phases 1 / 2 / 3), or an effect the core itself asks about (phase 4, "ask"): the frame lives while that `MSG_SELECT_EFFECTYN` / `MSG_SELECT_YESNO` is open, at the optional trigger (`processor.cpp`, desc 0), the lone quick trigger (desc 221), the cost-time activation ask (desc 94), the three replacement asks (`operations.cpp`, desc 218 / 220 / 219) and Scrap Chimera's material ask (its own description). Other prompts the core builds itself either list several effects (`MSG_SELECT_CHAIN`, `IDLECMD`, `BATTLECMD`, the `SELECT_OPTION` among replacement effects or activation ways) or ask about no effect (attack, desc 31; the Pendulum / Spell-zone redirect, desc 97; Tribute and material prompts): they push nothing and show whatever runs around them. None running (battle and idle commands, chain prompts, a Summon without an effect) = `has_effect` 0, every other byte 0 and `effect_index` `0xFFFF`. **`effect_index`** is the order the card's script registered the effect while the card loaded (`card::add_effect` under `STATUS_INITIALIZING` stamps `initial_effect.size()`): the same in every duel and on every machine for that card's script; an effect registered at any other time (a clone, a copy, a grant, an effect made during the duel) is `0xFFFF`. **Hidden**: when the handler is not controlled by `playerid` and is not face-up (`is_position(POS_FACEUP)`: a face-down card, the other player's hand, Deck or face-down Extra Deck), `code` is 0, `effect_index` `0xFFFF` and `description` 0; the other fields stay. The duel is byte-identical afterwards. |
|
||||
| `ygol_query_prompt_context` | `int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out)` | v1.7.0 (TICKET-451), 2026-11-08. Which effect asks the prompt the engine is parked on, read only; `playerid` is the answering player. Returns 23 (the bytes written), 0 refused (bad pointer, bad player); a refusal writes nothing. `out` (23 bytes, little-endian): `u8 version` (1), `u8 has_effect`, `u32 code` (the handler's `get_code()` now), `u8 controller`, `u8 location`, `u8 sequence`, `u8 position` (the handler now), `u64 description` (the effect's, 0 when none), `u16 effect_index`, `u8 phase` (1 cost, 2 target, 3 operation, 4 ask), `u8 chain_link` (the newest chain link whose effect it is, 0 when none), `u8 announce_kind` (only while a `MSG_ANNOUNCE_NUMBER` is open: 1 the script called `Duel.AnnounceLevel`, which passes `playerid + 0x10000` to the unit; else 2 when the asking effect has `CATEGORY_DICE` and is visible to `playerid`; else 0; always 0 for any other prompt). The effect is the innermost frame on `core.ygol_running`: a cost / target / operation function running (`field::execute_cost` / `execute_target` / `execute_operation`, the core's only coroutine calls; phases 1 / 2 / 3), or an effect the core itself asks about (phase 4, "ask"): the frame lives while that `MSG_SELECT_EFFECTYN` / `MSG_SELECT_YESNO` is open, at the optional trigger (`processor.cpp`, desc 0), the lone quick trigger (desc 221), the cost-time activation ask (desc 94), the three replacement asks (`operations.cpp`, desc 218 / 220 / 219) and Scrap Chimera's material ask (its own description). Other prompts the core builds itself either list several effects (`MSG_SELECT_CHAIN`, `IDLECMD`, `BATTLECMD`, the `SELECT_OPTION` among replacement effects or activation ways) or ask about no effect (attack, desc 31; the Pendulum / Spell-zone redirect, desc 97; Tribute and material prompts): they push nothing and show whatever runs around them. None running (battle and idle commands, chain prompts, a Summon without an effect) = `has_effect` 0, every other byte 0 but `announce_kind`, and `effect_index` `0xFFFF`. **`effect_index`** is the order the card's script registered the effect while the card loaded (`card::add_effect` under `STATUS_INITIALIZING` stamps `initial_effect.size()`): the same in every duel and on every machine for that card's script; an effect registered at any other time (a clone, a copy, a grant, an effect made during the duel) is `0xFFFF`. **Hidden**: when the handler is not controlled by `playerid` and is not face-up (`is_position(POS_FACEUP)`: a face-down card, the other player's hand, Deck or face-down Extra Deck), `code` is 0, `effect_index` `0xFFFF` and `description` 0; the other fields stay. The duel is byte-identical afterwards. |
|
||||
| `get_registry_value` | `int32_t get_registry_value(intptr_t pduel, const char* key, byte* out_buf)` | Upstream (koishi) |
|
||||
| `set_registry_value` | `void set_registry_value(intptr_t pduel, const char* key, const char* value)` | Upstream (koishi). The server writes every setup pair here before `special.lua` (patch 0009). |
|
||||
| `get_registry_keys` | `int32_t get_registry_keys(intptr_t pduel, byte* out_buf)` | Upstream (koishi) |
|
||||
@@ -207,7 +207,7 @@ duelist's own side (v1.2.0), both sides for an observer when spectators see all
|
||||
| `0x41` | `STOC_APPEARANCE` | `u16 sender` + `CTOS_Appearance` (354) | Yes | Everyone; stored per seat, replayed to joiners, dropped when the seat empties or moves to the watchers | `0x1` | 1 | 0006 |
|
||||
| `0x42` | `STOC_DIALOGUE` | `u16 sender` + `CTOS_Dialogue` (206) | Yes | Everyone | `0x2` | 1 | 0006 |
|
||||
| `0x43` | `STOC_SETUP_PAIRS` | `u16 0xFF`, `u16 count`, then per pair `u16 length` + `key=value` bytes (no terminator) | Yes (`0xFF`) | Every joiner, in the snapshot | `0x4` | 1 | 0009 |
|
||||
| `0x44` | `STOC_PROMPT_CONTEXT` | The 22 `ygol_query_prompt_context` bytes (section (a)) + `u8 prompt` (the `MSG_*` id of the prompt it belongs to); 23 bytes | No | The seat that answers the prompt (Tag: the team's current hand), and only when its `CTOS_CAPABILITY` had `0x8000`; the packet right before that prompt's `STOC_GAME_MSG`. Sent before every prompt the server relays but `MSG_ROCK_PAPER_SCISSORS`: `MSG_SELECT_BATTLECMD`, `IDLECMD`, `EFFECTYN`, `YESNO`, `OPTION`, `CARD`, `TRIBUTE`, `UNSELECT_CARD`, `CHAIN`, `PLACE`, `DISFIELD`, `POSITION`, `COUNTER`, `SUM`, `MSG_SORT_CARD`, `MSG_ANNOUNCE_RACE`, `ATTRIB`, `CARD`, `NUMBER`. A prompt with no effect running gets `has_effect` 0, so a client never keeps a stale context. Never to observers, the waiting Tag partner or the server-mode recorders, never in a replay; a `MSG_RETRY` re-ask gets none (the context still stands) | `0x8000` | 12 | v1.7.0 |
|
||||
| `0x44` | `STOC_PROMPT_CONTEXT` | The 23 `ygol_query_prompt_context` bytes (section (a)) + `u8 prompt` (the `MSG_*` id of the prompt it belongs to); 24 bytes | No | The seat that answers the prompt (Tag: the team's current hand), and only when its `CTOS_CAPABILITY` had `0x8000`; the packet right before that prompt's `STOC_GAME_MSG`. Sent before every prompt the server relays but `MSG_ROCK_PAPER_SCISSORS`: `MSG_SELECT_BATTLECMD`, `IDLECMD`, `EFFECTYN`, `YESNO`, `OPTION`, `CARD`, `TRIBUTE`, `UNSELECT_CARD`, `CHAIN`, `PLACE`, `DISFIELD`, `POSITION`, `COUNTER`, `SUM`, `MSG_SORT_CARD`, `MSG_ANNOUNCE_RACE`, `ATTRIB`, `CARD`, `NUMBER`. A prompt with no effect running gets `has_effect` 0, so a client never keeps a stale context. Never to observers, the waiting Tag partner or the server-mode recorders, never in a replay; a `MSG_RETRY` re-ask gets none (the context still stands) | `0x8000` | 12 | v1.7.0 |
|
||||
| `0x50` | `STOC_SEAT_PLAN` | `u16 0xFF` + `STOC_SeatPlan` (23): `u8 restart_id[16]`, `u16 revision`, `u8 seat_count`, `u8 kind[4]` (25 total; no token on the wire) | Yes (`0xFF`) | Everyone after a plan, swap or move; joiners in the snapshot | `0x8` | 2 | 0011 |
|
||||
| `0x54` | `STOC_ROOM_RESTARTING` | `u16 0xFF` + `STOC_RoomRestarting` (38): `u8 phase` (1 Prepare, 2 Commit, 3 Abort), `u8 restart_id[16]`, `u8 seat`, `u8 token[16]`, `u32 timeout_ms` | Yes (`0xFF`) | Each participant, with ITS OWN seat and token only | `0x10` | 2 | 0012 |
|
||||
| `0x56` | `STOC_RESTART_STATUS` | `u16 0xFF` + `STOC_RestartStatus` (21): `u8 phase`, `u8 restart_id[16]`, `u8 acked`, `u8 expected`, `u8 complete`, `u8 reason` (0 none, 1 incompatible, 2 ack timeout, 3 not lobby, 4 not host, 5 busy, 6 bad request) | Yes (`0xFF`) | The host only | `0x10` | 2 | 0012 |
|
||||
@@ -458,7 +458,7 @@ Namespaces:
|
||||
|
||||
| Namespace | What |
|
||||
|---|---|
|
||||
| `YGOLegacy.Protocol.{Contracts, Codecs, Framing, Routing}` | Section (b) in C#: the message ids and payload records, the CTOS / STOC codecs, the frame codec and the STOC router. Unchanged from the Unity repo (TICKET-397); v1.2.0 adds `StocMessage.TagPartnerCards`, `FeatureFlags.TagPartnerCards`, the `TagPartnerCards` record and `StocCodecs.TagPartnerCards`, and `Capability.ProtocolVersion` is 9; v1.4.0 adds `ReplayFlags` (`SetupPairs` = `0x40000000`, `SideLp` = `0x20000000`); v1.5.0 adds `FeatureFlags.TagTwoFields` (`0x1000`, in `All`) and `Capability.ProtocolVersion` is 10; v1.6.0 adds `FeatureFlags.TagSharedExtra` (`0x4000`, in `All`) and `Capability.ProtocolVersion` is 11; v1.7.0 adds `StocMessage.PromptContext` (`0x44`), `FeatureFlags.PromptContext` (`0x8000`, in `All`), the `PromptContext` record (`HasEffect`, `Code`, `Controller`, `Location`, `Sequence`, `Position`, `Description`, `EffectIndex`, `Phase`, `ChainLink`, `Prompt`, `IsHidden`, `None(prompt)`, `UnknownIndex` `0xFFFF`, `PhaseCost` / `PhaseTarget` / `PhaseOperation` 1 / 2 / 3) and `StocCodecs.PromptContext` (`PromptContextCodec`, 23 bytes), and `Capability.ProtocolVersion` is 12. |
|
||||
| `YGOLegacy.Protocol.{Contracts, Codecs, Framing, Routing}` | Section (b) in C#: the message ids and payload records, the CTOS / STOC codecs, the frame codec and the STOC router. Unchanged from the Unity repo (TICKET-397); v1.2.0 adds `StocMessage.TagPartnerCards`, `FeatureFlags.TagPartnerCards`, the `TagPartnerCards` record and `StocCodecs.TagPartnerCards`, and `Capability.ProtocolVersion` is 9; v1.4.0 adds `ReplayFlags` (`SetupPairs` = `0x40000000`, `SideLp` = `0x20000000`); v1.5.0 adds `FeatureFlags.TagTwoFields` (`0x1000`, in `All`) and `Capability.ProtocolVersion` is 10; v1.6.0 adds `FeatureFlags.TagSharedExtra` (`0x4000`, in `All`) and `Capability.ProtocolVersion` is 11; v1.7.0 adds `StocMessage.PromptContext` (`0x44`), `FeatureFlags.PromptContext` (`0x8000`, in `All`), the `PromptContext` record (`HasEffect`, `Code`, `Controller`, `Location`, `Sequence`, `Position`, `Description`, `EffectIndex`, `Phase`, `ChainLink`, `AnnounceKind`, `Prompt`, `IsHidden`, `None(prompt)`, `UnknownIndex` `0xFFFF`, `PhaseCost` / `PhaseTarget` / `PhaseOperation` / `PhaseAsk` 1 / 2 / 3 / 4, `AnnouncePlain` / `AnnounceLevel` / `AnnounceDice` 0 / 1 / 2) and `StocCodecs.PromptContext` (`PromptContextCodec`, 24 bytes), and `Capability.ProtocolVersion` is 12. |
|
||||
| `YGOLegacy.Engine` | The four types below (TICKET-398). |
|
||||
|
||||
| Type | What |
|
||||
|
||||
+4
-3
@@ -91,12 +91,13 @@ OCGCORE_API int32_t ygol_preview_attack(intptr_t pduel, uint8_t playerid, uint8_
|
||||
OCGCORE_API int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
||||
|
||||
// [YGOL] v1.7.0 (prompt context, TICKET-451): which effect asks the prompt the engine is parked on, read only.
|
||||
// playerid = the answering player. out (22 bytes): version (1), has_effect, uint32 code (the handler's current
|
||||
// playerid = the answering player. out (23 bytes): version (1), has_effect, uint32 code (the handler's current
|
||||
// code), controller, location, sequence, position, uint64 description, uint16 effect_index (the order the
|
||||
// card's script registered the effect in initial_effect; 0xffff unknown), phase (1 cost, 2 target, 3 operation, 4 the core asks whether to use the effect),
|
||||
// chain link (0 none). has_effect 0 = no effect function runs: every other byte 0, effect_index 0xffff. A
|
||||
// chain link (0 none), announce kind (MSG_ANNOUNCE_NUMBER only: 1 Duel.AnnounceLevel, 2 the effect has
|
||||
// CATEGORY_DICE and is visible, else 0). has_effect 0 = no effect runs: every other byte 0 but announce kind, effect_index 0xffff. A
|
||||
// handler playerid does not control and that is not face-up writes code 0, effect_index 0xffff, description 0.
|
||||
// Returns 22, 0 refused (bad pointer, bad player); a refusal writes nothing.
|
||||
// Returns 23, 0 refused (bad pointer, bad player); a refusal writes nothing.
|
||||
OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out);
|
||||
|
||||
// koishi specific
|
||||
|
||||
@@ -178,10 +178,11 @@
|
||||
# that never run, then an Activate that asks a yes/no in its cost, an option in its target and a yes/no in its
|
||||
# operation, runs a Fusion Monster's material procedure (which asks) inside that operation and asks again, shuffles
|
||||
# itself into the deck and asks the opponent, then its controller. Every prompt a seat with
|
||||
# 0x8000 gets comes right after one 23-byte PROMPT_CONTEXT (0x44) naming that prompt: idle, chain and battle
|
||||
# 0x8000 gets comes right after one 24-byte PROMPT_CONTEXT (0x44) naming that prompt: idle, chain and battle
|
||||
# prompts say no effect; cost / target / operation say Probe Ask, phase 1 / 2 / 3, effect index 2, its
|
||||
# description, chain link 1; the nested procedure names the Fusion (index 1, chain link 0) and the operation's
|
||||
# next prompt names Probe Ask again; the Fusion's optional End Phase trigger is asked with phase 4 (ask), index 2;
|
||||
# next prompt names Probe Ask again; an announce says kind 0 (plain), 1 (Duel.AnnounceLevel) or 2 (a dice effect);
|
||||
# the Fusion's optional End Phase trigger is asked with phase 4 (ask), index 2;
|
||||
# the opponent's yes/no names the card in the deck as hidden (code 0, index 0xFFFF,
|
||||
# description 0) while its controller's next one still names it. A watcher with 0x8000, a seat without it and
|
||||
# the waiting Tag partners get none; a second duel with another deck order reports the same indexes.
|
||||
@@ -3633,6 +3634,7 @@ NAMES.update({0x44: "PROMPT_CONTEXT"})
|
||||
PROBE_ASK = PROBE_CARD + 1000
|
||||
PROBE_ASK_FUSION = PROBE_CARD + 1001
|
||||
LOCATION_DECK = 0x01
|
||||
MSG_ANNOUNCE_NUMBER = 143
|
||||
PROMPT_MSGS = {10, 11, 12, 13, 14, 15, 16, 18, 19, 20, 22, 23, 24, 25, 26, 140, 141, 142, 143}
|
||||
ASK_LUA = """--Probe Ask (TICKET-451): two effects that never run, then an Activate that asks in its cost, target and operation,
|
||||
--runs Probe Ask Fusion's material procedure (which asks too) and asks again, shuffles itself into the deck and asks
|
||||
@@ -3650,6 +3652,7 @@ function s.initial_effect(c)
|
||||
c:RegisterEffect(e1)
|
||||
local e2=Effect.CreateEffect(c)
|
||||
e2:SetDescription(id*16+1)
|
||||
e2:SetCategory(CATEGORY_DICE)
|
||||
e2:SetType(EFFECT_TYPE_ACTIVATE)
|
||||
e2:SetCode(EVENT_FREE_CHAIN)
|
||||
e2:SetCost(s.cost)
|
||||
@@ -3671,6 +3674,8 @@ function s.activate(e,tp,eg,ep,ev,re,r,rp)
|
||||
local fc=Duel.GetFirstMatchingCard(Card.IsCode,tp,LOCATION_EXTRA,0,nil,id+1)
|
||||
if fc then Duel.SelectFusionMaterial(tp,fc,Duel.GetFieldGroup(tp,LOCATION_HAND,0)) end
|
||||
Duel.SelectYesNo(tp,id*16+8)
|
||||
Duel.AnnounceLevel(tp,1,12)
|
||||
Duel.AnnounceNumber(tp,1,2,3,4,5,6)
|
||||
c:CancelToGrave()
|
||||
Duel.SendtoDeck(c,nil,0,REASON_EFFECT)
|
||||
Duel.SelectYesNo(1-tp,id*16+6)
|
||||
@@ -3717,6 +3722,7 @@ function s.fcon(e,g,gc,chkf)
|
||||
end
|
||||
function s.fop(e,tp,eg,ep,ev,re,r,rp,gc,chkf)
|
||||
Duel.SelectYesNo(tp,id*16+2)
|
||||
Duel.AnnounceNumber(tp,7,8)
|
||||
Duel.SetFusionMaterial(Group.CreateGroup())
|
||||
end
|
||||
"""
|
||||
@@ -3725,10 +3731,10 @@ ASK_TRIGGER_INDEX = 2
|
||||
|
||||
|
||||
def prompt_context(d):
|
||||
# 22-byte record + the prompt's MSG id: version, has effect, u32 code, controller, location, sequence, position,
|
||||
# u64 description, u16 effect index, phase, chain link, prompt
|
||||
keys = ("version", "has", "code", "controller", "location", "sequence", "position", "description", "index", "phase", "chain", "prompt")
|
||||
return dict(zip(keys, struct.unpack("<BBIBBBBQHBBB", d)))
|
||||
# 23-byte record + the prompt's MSG id: version, has effect, u32 code, controller, location, sequence, position,
|
||||
# u64 description, u16 effect index, phase, chain link, announce kind, prompt
|
||||
keys = ("version", "has", "code", "controller", "location", "sequence", "position", "description", "index", "phase", "chain", "announce", "prompt")
|
||||
return dict(zip(keys, struct.unpack("<BBIBBBBQHBBBB", d)))
|
||||
|
||||
|
||||
def prompts_with_context(c):
|
||||
@@ -3737,7 +3743,7 @@ def prompts_with_context(c):
|
||||
for i, (p, d) in enumerate(c.log):
|
||||
if p == 0x01 and d and d[0] in PROMPT_MSGS:
|
||||
prev = c.log[i - 1] if i else (None, b"")
|
||||
ctx = prompt_context(prev[1]) if prev[0] == STOC_PROMPT_CONTEXT and len(prev[1]) == 23 else None
|
||||
ctx = prompt_context(prev[1]) if prev[0] == STOC_PROMPT_CONTEXT and len(prev[1]) == 24 else None
|
||||
out.append((d[0], d, ctx))
|
||||
return out
|
||||
|
||||
@@ -3748,7 +3754,7 @@ def contexts_of(c):
|
||||
|
||||
def is_none_context(ctx, prompt):
|
||||
return ctx == {"version": 1, "has": 0, "code": 0, "controller": 0, "location": 0, "sequence": 0, "position": 0,
|
||||
"description": 0, "index": 0xFFFF, "phase": 0, "chain": 0, "prompt": prompt}
|
||||
"description": 0, "index": 0xFFFF, "phase": 0, "chain": 0, "announce": 0, "prompt": prompt}
|
||||
|
||||
|
||||
def prompt_context_room(dll_path, port, label, mode, opponent_bit=True, fusion_first=False):
|
||||
@@ -3841,7 +3847,7 @@ def prompt_context_room(dll_path, port, label, mode, opponent_bit=True, fusion_f
|
||||
answer(c, first_free_zone(d))
|
||||
elif t in (MSG_SELECT_EFFECTYN, MSG_SELECT_YESNO):
|
||||
answer(c, struct.pack("<i", 1))
|
||||
elif t == MSG_SELECT_OPTION:
|
||||
elif t in (MSG_SELECT_OPTION, MSG_ANNOUNCE_NUMBER):
|
||||
answer(c, struct.pack("<i", 0))
|
||||
if state["done"]:
|
||||
return True
|
||||
@@ -3861,7 +3867,7 @@ def prompt_context_room(dll_path, port, label, mode, opponent_bit=True, fusion_f
|
||||
check(not contexts_of(c), "%s: %s advertised no 0x8000 and got no PROMPT_CONTEXT (%d)" % (label, c.name, len(contexts_of(c))))
|
||||
continue
|
||||
missing = [hex(t) for t, _, ctx in got if ctx is None or ctx["prompt"] != t]
|
||||
check(not missing, "%s: %s: each of its %d prompts came right after a 23-byte PROMPT_CONTEXT naming that prompt (missing: %s)" % (label, c.name, len(got), missing))
|
||||
check(not missing, "%s: %s: each of its %d prompts came right after a 24-byte PROMPT_CONTEXT naming that prompt (missing: %s)" % (label, c.name, len(got), missing))
|
||||
check(len(contexts_of(c)) == len(got), "%s: %s: one PROMPT_CONTEXT per prompt, none on its own (%d contexts, %d prompts)" % (label, c.name, len(contexts_of(c)), len(got)))
|
||||
check(not contexts_of(w), "%s: the watcher advertised 0x8000 and got no PROMPT_CONTEXT (%d)" % (label, len(contexts_of(w))))
|
||||
|
||||
@@ -3896,6 +3902,11 @@ def prompt_context_room(dll_path, port, label, mode, opponent_bit=True, fusion_f
|
||||
"%s: the End Phase \"use this effect?\" for the optional trigger names Probe Ask Fusion in the Extra Deck, effect index 2, its description, phase 4 (ask), chain link 0 (%s)" % (label, optional))
|
||||
if optional:
|
||||
seen["index"] = seen.get("index", []) + [optional[0]["index"]]
|
||||
announces = [(ctx["code"], ctx["phase"], ctx["announce"]) for t, d, ctx in mine if t == MSG_ANNOUNCE_NUMBER]
|
||||
check(announces == [(PROBE_ASK_FUSION, 3, 0), (PROBE_ASK, 3, 1), (PROBE_ASK, 3, 2)],
|
||||
"%s: announce kind: the Fusion's plain Duel.AnnounceNumber says 0, Probe Ask's Duel.AnnounceLevel 1 (level wins over dice), its dice effect's Duel.AnnounceNumber 2 (%s)" % (label, announces))
|
||||
others = [ctx["announce"] for c in seated for t, d, ctx in prompts_with_context(c) if ctx and t != MSG_ANNOUNCE_NUMBER]
|
||||
check(others and not any(others), "%s: every other prompt's context has announce kind 0 (%d prompts)" % (label, len(others)))
|
||||
opponent = [c for c in seated if c is not a and any(t == MSG_SELECT_YESNO for t, _, _ in prompts_with_context(c))]
|
||||
check(len(opponent) == 1, "%s: exactly one other seat answered the operation's yes/no (%s)" % (label, [c.name for c in opponent]))
|
||||
if opponent and opponent[0] not in bitless:
|
||||
|
||||
Reference in new issue
Block a user