ProjectIgnis / CardScripts

Project Ignis card script libraries and canonical card scripts for EDOPro. Send bug reports through Discord only!
86 stars 60 forks source link

Activation conditions in the GY [EFFECT_FLAG2_CHECK_SIMULTANEOUS-related update] #38

Open kevinlul opened 4 years ago

kevinlul commented 4 years ago

This bug is also in YGOPro Percy.

If a monster has a Trigger Effect in the GY, it needs to be in the GY to "see" when its condition is met (as per the TCG reminder text on cards such as Darkest Diabolos). Amongst others, the following cards/situations violate this rule:

This is because they are not already in the GY when their condition happens, they happen at the same time by the rules of the game (but sequentially in terms of actual actions taken, and hence in YGOPro).

Of note, the above cards should activate in the following scenarios (and currently do):

This is because there is a gap (i.e. a Duel.BreakEffect() or adjust) in between them being sent to the GY and their conditions being met.

As an additional note for Sacred Arch-Airknight Parshath, because Divine Wrath both activates a Counter Trap Card and negates an activation, it triggers Parshath twice. Once by the same bug as Horn of Heaven, once legitimately. See Puzzle 38 or this replay from Percy.

The bug in Percy is reported as being able to activate Parshath twice, but in Edopro you are offered two choices of activation - one legal and one bugged - to choose between.

See Puzzle 38-2 for Tindangle Intruder.

AlphaKretin commented 4 years ago

This may be related to the first checkbox in #18, about Tindangle Intruder. As such I am assigning it the same priority level. Perhaps that bug can be included in this issue, and this issue can be generalised to "Graveyard Trigger effect activation conditions".

As far as actually fixing it, it's unclear to me if the issue does indeed lie in the script. I have tried a solution for Intruder following the same logic as Spell Counters - Spell Counter cards need to have resolved, and Intruder needs to be in the GY, to "see" that their activation condition has been met, so we use aux.chainreg to apply a flag effect recording that fact, and in the activation of the actual effect we check if that flag effect is registered. However, in my testing Intruder still activating incorrectly.

NaimSantos commented 4 years ago

I tested Parshath in puzzle 38 and in Lan Mode:

AlphaKretin commented 4 years ago

That lines up with previous testing of this report, as far as I remember, and is congruent with the description of the issue. Sorry if I didn't make it clear with the "choose between" wording.

AlphaKretin commented 4 years ago

Seeing this issue's history, I mentioned in the past that I'm unsure if it's a script or a core issue. As such I'd like @edo9300's opinion.

kevinlul commented 4 years ago

38: the double prompt exists in other simulators. Horn of Heaven can't be tested any more: in EDOPro, clicking a zone does nothing, whereas in other simulators it tells you that both zones aren't allowed after choosing them.

38-2: Bugs reproduced in other simulators. @edo9300

kevinlul commented 4 years ago

38: If I replace DUEL_TEST_MODE with DUEL_SIMPLE_AI, clicking "Special Summon" for Junk Warrior results in a core-level crash:

Thread 16 Crashed:
0   libocgcore.dylib                0x00000001067abb37 scriptlib::group_select_unselect(lua_State*)::$_2::__invoke(lua_State*, int, long) + 39
1   libocgcore.dylib                0x0000000106826a5f lua_resume(lua_State*, lua_State*, int) + 367
2   libocgcore.dylib                0x00000001067800eb interpreter::call_coroutine(int, unsigned int, unsigned int*, unsigned short) + 1611
3   libocgcore.dylib                0x0000000106817cdd field::execute_target(unsigned short, effect*, unsigned char) + 509
4   libocgcore.dylib                0x00000001067efc8f field::process() + 3919
5   libocgcore.dylib                0x00000001067aca3c OCG_DuelProcess + 44
6   io.github.edo9300.ygoprodll     0x00000001013eee1f ygo::SingleMode::SinglePlayThread() + 5631
7   io.github.edo9300.ygoprodll     0x0000000101298967 decltype(std::__1::forward<int (*)()>(fp)()) std::__1::__invoke<int (*)()>(int (*&&)()) + 23
8   io.github.edo9300.ygoprodll     0x00000001012988d5 void std::__1::__thread_execute<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, int (*)()>(std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, int (*)()>&, std::__1::__tuple_indices<>) + 37
9   io.github.edo9300.ygoprodll     0x0000000101298166 void* std::__1::__thread_proxy<std::__1::tuple<std::__1::unique_ptr<std::__1::__thread_struct, std::__1::default_delete<std::__1::__thread_struct> >, int (*)()> >(void*) + 118
10  libsystem_pthread.dylib         0x00007fff7d4822eb _pthread_body + 126
11  libsystem_pthread.dylib         0x00007fff7d485249 _pthread_start + 66
12  libsystem_pthread.dylib         0x00007fff7d48140d thread_start + 13
kevinlul commented 4 years ago

Specifically, the above described crash is an out-of-bounds access: In scriptlib::group_select_unselect from libgroup.cpp:335, pduel->game_field->return_cards.list[0] is accessed but the size of this vector is zero.

kevinlul commented 4 years ago

I would guess that not being able to click the EMZ as the other player and the empty SelectUnselect list are related.

kevinlul commented 4 years ago

Crash fixed edo9300/ygopro-core@56cb13e8435c74f8721de0a6692374875f87caa4

38: As a general puzzle mode note, you can only Synchro Summon Junk Warrior in TEST_MODE with automatic monster zone placement. Without auto zone placement, clicking on either EMZ does nothing. Without TEST_MODE (SIMPLE_AI), clicking on the Special Summon button does nothing.

In any case, this reconfirms Naim's original findings of both behaviours being incorrect.

AlphaKretin commented 4 years ago

The interaction with Horn of Heaven is correct? Naim reported that it triggered once, whereas it should not trigger at all.

kevinlul commented 4 years ago

With autozone placement to test the Horn of Heaven behaviour in other simulators, it actually causes an infinite loop of ineligible zone so no further useful information can be gleaned.

NaimSantos commented 4 years ago

Adding to this Rokket Tracer destroying Dillingerous Dragon, which currently triggers, when it should not.