It is currently 27 Apr 2024, 21:41
   
Text Size

[fixed]Karn Liberated adds a Swamp to battlefield

Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins

[fixed]Karn Liberated adds a Swamp to battlefield

Postby Konatsu » 28 Feb 2022, 01:51

Whenever I use Karn Liberated's -14 ability, one Swamp will be put.
-The first card that is exiled by him seems to turn into a Swamp.
Last edited by drool66 on 21 Mar 2022, 23:34, edited 4 times in total.
Reason: fixed
Konatsu
 
Posts: 92
Joined: 14 Feb 2022, 18:39
Has thanked: 0 time
Been thanked: 1 time

Re: Karn Liberated

Postby Korath » 28 Feb 2022, 08:41

It dumped when I tried it in dev, though it seems unrelated.
Code: Select all
Thread 15 hit Breakpoint 1, show_backtrace (title=title@entry=0x26abbfa <words+538> "bad parameters", header=header@entry=0x1b51f230 "get_card_instance(0, -1)") at functions/show_backtrace.c:16
16      {
(gdb) bt
#0  show_backtrace (title=title@entry=0x26abbfa <words+538> "bad parameters", header=header@entry=0x1b51f230 "get_card_instance(0, -1)") at functions/show_backtrace.c:16
#1  0x02611462 in get_card_instance (player=0, card=-1) at functions/deck.c:322
#2  0x0262a24c in clear_all_traps (player=player@entry=0) at functions/rules_engine.c:3881
#3  0x0223f271 in card_karn_liberated (player=0, card=14, event=EVENT_RESOLVE_ACTIVATION) at cards/new_phyrexia.c:1143
#4  0x0264e8b5 in call_card_fn_impl () from .\ManalinkEh.dll
#5  0x025d99fc in call_card_fn (address=0x2003752 <CodeSectionEx+10060>, instance=0x4f05a8 <sub_4E9564+28740>, player=player@entry=0, card=card@entry=14, event=event@entry=EVENT_RESOLVE_ACTIVATION) at functions/events.c:51
#6  0x0260dd85 in fx_activation_906 (player=0, card=14, event=EVENT_RESOLVE_ACTIVATION) at functions/engine.c:3276
#7  0x0264e8b5 in call_card_fn_impl () from .\ManalinkEh.dll
#8  0x025d99fc in call_card_fn (address=0x2011d70 <CodeSectionEx+68970>, instance=0x4f05a8 <sub_4E9564+28740>, player=player@entry=0, card=card@entry=14, event=event@entry=EVENT_RESOLVE_ACTIVATION) at functions/events.c:51
#9  0x025da1c9 in call_card_function_i (event=EVENT_RESOLVE_ACTIVATION, card=14, player=0, instance=<optimized out>) at functions/events.c:30
#10 dispatch_event_to_single_card (player=0, card=14, event=EVENT_RESOLVE_ACTIVATION, new_attacking_card_controller=1, new_attacking_card=-1) at functions/events.c:276
#11 0x004368c6 in resolve_top_card_on_stack () at Magic2.asm:41793
#12 0x0260de87 in finalize_activation (player=0, card=7) at functions/engine.c:3317
#13 0x0043c200 in main_phase () at Magic2.asm:45732
#14 0x004399bd in run_turn () at Magic2.asm:44078
#15 0x0047902c in start_duel () at Magic2.asm:76779
#16 0x004946e9 in start_duel_thread () at Magic2.asm:89827
#17 0x7641fa29 in KERNEL32!BaseThreadInitThunk () from C:\WINDOWS\SysWOW64\kernel32.dll
#18 0x77b97a9e in ntdll!RtlGetAppContainerNamedObjectPath () from C:\WINDOWS\SysWOW64\ntdll.dll
#19 0x77b97a6e in ntdll!RtlGetAppContainerNamedObjectPath () from C:\WINDOWS\SysWOW64\ntdll.dll
#20 0x00000000 in ?? ()
I did get a Swamp when I continued, but it was in addition to the exiled permanents, not instead of one, both when there was a non-permanent exiled and when only permanents were.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [confirmed]Karn Liberated adds a Swamp to battlefield

Postby drool66 » 28 Feb 2022, 18:18

Also irrespective of whose permanents or cards in hand had been exiled; and it only creates one spurious swamp, whether or not one or both players had cards in exile to return.
EDIT: Also, I don't think there's any need to limit it to 18 cards.
The dump looks like it tried to get the rules engine instance in clear_all_traps() when there was no rules engine - either it was incorrectly obliterated by Karn or there wasn't one to begin with, right? I think I can do the startup better by running game_startup() instead and get rid of clear_all_traps().
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: [confirmed]Karn Liberated adds a Swamp to battlefield

Postby Korath » 01 Mar 2022, 10:23

No, there wasn't a rules engine to start with. Karn doesn't force one, and the default deck I use for testing doesn't have any other cards that do.

Each exiledby effect card can store 36 owner/iid pairs, and it'll transparently create new effects as needed if you try to add more, so no, the only thing limiting it to 18 per player is the array size in Karn Liberated's EVENT_RESOLVE_ACTIVATION handler.

The problem with the original bug is that you're calling reset_subtypes() on all calls, including effect cards and in particular the effect card that the exiledby subsystem uses to record exiled iids, in recalculate_all_cards_in_play(). This changes the effect's targets[15].player from -1 (no iid recorded) to 0 (Swamp); and exiledby_find_any() dutifully returns that.

You might also be calling reset_subtypes() or add_force_subtype_impl() on the effect card from other places. I haven't checked. Both should do nothing for effect cards.

It also looks, at a glance, like Karn will only restore cards exiled by its current controller. Merits testing.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [confirmed]Karn Liberated adds a Swamp to battlefield

Postby drool66 » 02 Mar 2022, 02:57

The problem with the original bug is that you're calling reset_subtypes() on all calls, including effect cards...
Aha, thank you. Fixed.
It also looks, at a glance, like Karn will only restore cards exiled by its current controller. Merits testing.
I don't see that in practice, but I could be missing something.
Fixed the swamp bug and currently doing what I can to make this ability more robust, and work properly with all the possible uses in an EDH game; then moving on to Conspiracies and other Vanguard cards and whatever else I can think of.
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: [confirmed]Karn Liberated adds a Swamp to battlefield

Postby drool66 » 21 Mar 2022, 23:34

Fixed swamp bug in 0648a16
Improved "restart the game" in 24dc139
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times


Return to Archived Reports

Who is online

Users browsing this forum: Google [Bot] and 30 guests


Who is online

In total there are 31 users online :: 1 registered, 0 hidden and 30 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: Google [Bot] and 30 guests

Login Form