core: ygol_query_prompt_context names the effect that asks a prompt (TICKET-451, v1.7.0)
field::execute_cost / execute_target / execute_operation push the running effect (handler, description, stable index, phase 1 / 2 / 3, chain link) on core.ygol_running at step 0 and pop it when the function finishes; the innermost entry is the effect that asks. effect::ygol_script_index is stamped in card::add_effect while the card loads (initial_effect.size()), 0xffff otherwise. The export writes 22 bytes; a handler the asking player does not control and that is not face-up answers code 0, index 0xffff, description 0. Export gates 335 / 856 / 850 -> 336 / 857 / 851. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
4cd908d7af
commit
b6ef8a31bc
10 files changed
+109
-10
No files matched your search
@@ -482,6 +482,45 @@ OCGCORE_API int32_t ygol_query_tag_cards(intptr_t pduel, uint8_t playerid, uint8
|
||||
buffer_write<uint32_t>(ptr, code);
|
||||
return (int32_t)(ptr - out);
|
||||
}
|
||||
// [YGOL] v1.7.0 (prompt context) -- see ocgapi.h. Reads field::core.ygol_running, the cost / target / operation
|
||||
// functions running now (processor.cpp); the innermost one is the effect that asks.
|
||||
OCGCORE_API int32_t ygol_query_prompt_context(intptr_t pduel, uint8_t playerid, uint8_t* out) {
|
||||
duel* pd = (duel*)pduel;
|
||||
if(!pd || !out || !duel_set.count(pd) || !pd->game_field || !check_playerid(playerid))
|
||||
return 0;
|
||||
const auto& running = pd->game_field->core.ygol_running;
|
||||
card* handler = running.empty() ? nullptr : running.back().handler;
|
||||
if(handler && !pd->cards.count(handler))
|
||||
handler = nullptr;
|
||||
byte* ptr = out;
|
||||
buffer_write<uint8_t>(ptr, 1);
|
||||
if(!handler) {
|
||||
buffer_write<uint8_t>(ptr, 0);
|
||||
buffer_write<uint32_t>(ptr, 0);
|
||||
buffer_write<uint8_t>(ptr, 0);
|
||||
buffer_write<uint8_t>(ptr, 0);
|
||||
buffer_write<uint8_t>(ptr, 0);
|
||||
buffer_write<uint8_t>(ptr, 0);
|
||||
buffer_write<uint64_t>(ptr, 0);
|
||||
buffer_write<uint16_t>(ptr, 0xffff);
|
||||
buffer_write<uint8_t>(ptr, 0);
|
||||
buffer_write<uint8_t>(ptr, 0);
|
||||
return (int32_t)(ptr - out);
|
||||
}
|
||||
const auto& top = running.back();
|
||||
const bool visible = handler->current.controler == playerid || handler->is_position(POS_FACEUP);
|
||||
buffer_write<uint8_t>(ptr, 1);
|
||||
buffer_write<uint32_t>(ptr, visible ? handler->get_code() : 0);
|
||||
buffer_write<uint8_t>(ptr, handler->current.controler);
|
||||
buffer_write<uint8_t>(ptr, handler->current.location);
|
||||
buffer_write<uint8_t>(ptr, handler->current.sequence);
|
||||
buffer_write<uint8_t>(ptr, handler->current.position);
|
||||
buffer_write<uint64_t>(ptr, visible ? top.description : 0);
|
||||
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);
|
||||
return (int32_t)(ptr - out);
|
||||
}
|
||||
OCGCORE_API int32_t get_registry_value(intptr_t pduel, const char* key, byte* out_buf) {
|
||||
if (!pduel || !key || !out_buf) return -1;
|
||||
|
||||
|
||||
Reference in new issue
Block a user