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
@@ -727,6 +727,28 @@ uint32_t field::process() {
|
||||
#ifdef _MSC_VER
|
||||
#pragma warning(pop)
|
||||
#endif
|
||||
// [YGOL] v1.7.0 prompt context: remember which effect function runs, so ygol_query_prompt_context can name it at a prompt
|
||||
static void ygol_push_running(field* pfield, effect* peffect, uint8_t phase) {
|
||||
processor::ygol_running_effect running;
|
||||
running.handler = peffect->get_handler();
|
||||
if(!running.handler)
|
||||
running.handler = peffect->owner;
|
||||
running.description = peffect->description;
|
||||
running.script_index = peffect->ygol_script_index;
|
||||
running.phase = phase;
|
||||
auto& chain = pfield->core.current_chain;
|
||||
for(auto it = chain.rbegin(); it != chain.rend(); ++it) {
|
||||
if(it->triggering_effect == peffect) {
|
||||
running.chain_link = it->chain_count;
|
||||
break;
|
||||
}
|
||||
}
|
||||
pfield->core.ygol_running.push_back(running);
|
||||
}
|
||||
static void ygol_pop_running(field* pfield) {
|
||||
if(!pfield->core.ygol_running.empty())
|
||||
pfield->core.ygol_running.pop_back();
|
||||
}
|
||||
int32_t field::execute_cost(uint16_t step, effect * triggering_effect, uint8_t triggering_player) {
|
||||
if(!triggering_effect->cost) {
|
||||
core.solving_event.splice(core.solving_event.begin(), core.sub_solving_event);
|
||||
@@ -754,6 +776,7 @@ int32_t field::execute_cost(uint16_t step, effect * triggering_effect, uint8_t t
|
||||
core.units.begin()->arg2 = core.shuffle_check_disabled;
|
||||
core.shuffle_check_disabled = FALSE;
|
||||
++core.check_level;
|
||||
ygol_push_running(this, triggering_effect, 1);
|
||||
}
|
||||
core.reason_effect = triggering_effect;
|
||||
core.reason_player = triggering_player;
|
||||
@@ -765,6 +788,7 @@ int32_t field::execute_cost(uint16_t step, effect * triggering_effect, uint8_t t
|
||||
core.reason_effect = 0;
|
||||
core.reason_player = PLAYER_NONE;
|
||||
--core.check_level;
|
||||
ygol_pop_running(this);
|
||||
if(core.check_level == 0) {
|
||||
if(core.shuffle_hand_check[0])
|
||||
shuffle(0, LOCATION_HAND);
|
||||
@@ -806,6 +830,7 @@ int32_t field::execute_operation(uint16_t step, effect * triggering_effect, uint
|
||||
core.units.begin()->arg2 = core.shuffle_check_disabled;
|
||||
core.shuffle_check_disabled = FALSE;
|
||||
++core.check_level;
|
||||
ygol_push_running(this, triggering_effect, 3);
|
||||
}
|
||||
core.reason_effect = triggering_effect;
|
||||
core.reason_player = triggering_player;
|
||||
@@ -817,6 +842,7 @@ int32_t field::execute_operation(uint16_t step, effect * triggering_effect, uint
|
||||
core.reason_effect = 0;
|
||||
core.reason_player = PLAYER_NONE;
|
||||
--core.check_level;
|
||||
ygol_pop_running(this);
|
||||
if(core.check_level == 0) {
|
||||
if(core.shuffle_hand_check[0])
|
||||
shuffle(0, LOCATION_HAND);
|
||||
@@ -863,6 +889,7 @@ int32_t field::execute_target(uint16_t step, effect * triggering_effect, uint8_t
|
||||
core.units.begin()->arg2 = core.shuffle_check_disabled;
|
||||
core.shuffle_check_disabled = FALSE;
|
||||
++core.check_level;
|
||||
ygol_push_running(this, triggering_effect, 2);
|
||||
}
|
||||
core.reason_effect = triggering_effect;
|
||||
core.reason_player = triggering_player;
|
||||
@@ -874,6 +901,7 @@ int32_t field::execute_target(uint16_t step, effect * triggering_effect, uint8_t
|
||||
core.reason_effect = 0;
|
||||
core.reason_player = PLAYER_NONE;
|
||||
--core.check_level;
|
||||
ygol_pop_running(this);
|
||||
if(core.check_level == 0) {
|
||||
if(core.shuffle_hand_check[0])
|
||||
shuffle(0, LOCATION_HAND);
|
||||
|
||||
Reference in new issue
Block a user