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
@@ -349,6 +349,7 @@ struct processor {
|
||||
uint16_t script_index{ 0xffff };
|
||||
uint8_t phase{ 0 };
|
||||
uint8_t chain_link{ 0 };
|
||||
uint64_t category{ 0 };
|
||||
};
|
||||
std::vector<ygol_running_effect> ygol_running;
|
||||
uint8_t shuffle_check_disabled{ FALSE };
|
||||
|
||||
@@ -492,6 +492,9 @@ OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid,
|
||||
card* handler = running.empty() ? nullptr : running.back().handler;
|
||||
if(handler && !pd->cards.count(handler))
|
||||
handler = nullptr;
|
||||
const auto& units = pd->game_field->core.units;
|
||||
const bool announce = !units.empty() && units.front().type == PROCESSOR_ANNOUNCE_NUMBER;
|
||||
const bool announce_level = announce && (units.front().arg1 >> 16) == 1; // Duel.AnnounceLevel passes playerid + 0x10000
|
||||
byte* ptr = out;
|
||||
buffer_write<uint8_t>(ptr, 1);
|
||||
if(!handler) {
|
||||
@@ -505,6 +508,7 @@ OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid,
|
||||
buffer_write<uint16_t>(ptr, 0xffff);
|
||||
buffer_write<uint8_t>(ptr, 0);
|
||||
buffer_write<uint8_t>(ptr, 0);
|
||||
buffer_write<uint8_t>(ptr, announce_level ? 1 : 0);
|
||||
return (int32_t)(ptr - out);
|
||||
}
|
||||
const auto& top = running.back();
|
||||
@@ -519,6 +523,7 @@ OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid,
|
||||
buffer_write<uint16_t>(ptr, visible ? top.script_index : 0xffff);
|
||||
buffer_write<uint8_t>(ptr, top.phase);
|
||||
buffer_write<uint8_t>(ptr, top.chain_link);
|
||||
buffer_write<uint8_t>(ptr, announce_level ? 1 : (announce && visible && (top.category & CATEGORY_DICE)) ? 2 : 0);
|
||||
return (int32_t)(ptr - out);
|
||||
}
|
||||
OCGCORE_API int32_t get_registry_value(intptr_t pduel, const char* key, byte* out_buf) {
|
||||
|
||||
+4
-3
@@ -88,12 +88,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
|
||||
|
||||
@@ -744,6 +744,7 @@ void ygol_push_running(field* pfield, effect* peffect, uint8_t phase) {
|
||||
running.description = peffect->description;
|
||||
running.script_index = peffect->ygol_script_index;
|
||||
running.phase = phase;
|
||||
running.category = peffect->category;
|
||||
auto& chain = pfield->core.current_chain;
|
||||
for(auto it = chain.rbegin(); it != chain.rend(); ++it) {
|
||||
if(it->triggering_effect == peffect) {
|
||||
|
||||
Reference in new issue
Block a user