Page 1 of 1

[fixed]Iridescent Drake stolen aura no return to owner gy

PostPosted: 06 Aug 2016, 13:45
by Aswan jaguar
Describe the Bug:
I cast Iridescent Drake only AI had an aura in graveyard- Armadillo Cloak and chose that of course.On AI's turn AI cast Tragic Arrogance.For creature selected my Iridescent Drake,it went to my graveyard together with Armadillo Cloak which is owned by AI however.

Which card did behave improperly ?
Iridescent Drake probably

Which update are you using?(date,name)Which type(Duel,Gauntlet,Sealed Deck)
Manalink 2016/01/15: Battle For Zendikar v2,duel

What exactly should be the correct behavior/interaction ?
If you steal from opponent's graveyard an aura with Iridescent Drake if Iridescent Drake dies the stolen aura has to return to it's owner's graveyard.

Are any other cards possibly affected by this bug ?
-
*Savegame is one turn late as I saw Armadillo Cloak being on my grave on my turn.if you still want it let me know.

Re: Iridescent Drake stolen aura doesn't return to owner gy

PostPosted: 06 Aug 2016, 18:30
by Korath
Fixed in ee9905e, though what business Iridescent Drake has moving the aura to the battlefield itself instead of going through reanimate_permanent() like it should, I can't begin to guess. That's going to cause plenty more problems in the future.

Re: [???]Iridescent Drake stolen aura doesn't return to owne

PostPosted: 08 Aug 2016, 20:38
by BAgate
Works, but an interface request: could there be a cancel button when selecting an aura, or at least a back. If you select one player you should be able to back out and look at the other gy.

Re: [???]Iridescent Drake stolen aura doesn't return to owne

PostPosted: 14 Sep 2016, 16:07
by Gargaroz
Modified with the suggestion of both Korath and BAgate in 75d6fe2

Re: still bug]Iridescent Drake stolen aura no return to owne

PostPosted: 16 Apr 2018, 12:39
by Aswan jaguar
1- You still can't change graveyard if you have picked one.
2- Also you are not obliged as you should to get an aura. If you hit done in menu it enters without targeting an aura.
Ruling: 4/10/2004 You must pick an Aura even if there are only undesirable ones in the graveyard.

Re: still bug]Iridescent Drake stolen aura no return to owne

PostPosted: 12 Jan 2021, 14:12
by Aswan jaguar
Fixed in commit 7c4eb4a. Now if you don't choose an aura from the graveyard you chose first (and both have auras of the wanted subtype)you can re-choose graveyard once. Be careful not to choose the one you picked the first time as it will prompt for any graveyard and not the one you didn't choose the first time.

Re: [fixed]Iridescent Drake stolen aura no return to owner g

PostPosted: 26 Jan 2021, 07:44
by drool66
Aswan jaguar, care to try this out? I think it addresses all the issues above, selection is compulsory, and you can switch graveyards as many times as you want:
Code: Select all
int card_iridescent_drake(int player, int card, event_t event){

   /* Iridescent Drake   |3|U
    * Creature - Drake 2/2
    * Flying
    * When ~ enters the battlefield, put target Aura card from a graveyard onto the battlefield under your control attached to ~. */

   etb_ability(player, card, event, RESOLVE_TRIGGER_MANDATORY);

   if( event == EVENT_ETB_ABILITY ){
      test_definition_t this_test;
      default_test_definition(&this_test, TYPE_ENCHANTMENT);
      this_test.subtype = SUBTYPE_AURA_CREATURE;
      this_test.sub2 = SUBTYPE_AURA_PERMANENT;
      this_test.subtype_flag = F2_MULTISUBTYPE;

      if( select_target_from_either_grave(player, card, SFG_CANNOT_CANCEL, AI_MAX_CMC, AI_MAX_CMC, &this_test, 0, 1) != -1){
         card_instance_t* instance = get_card_instance(player, card);
         int selected = validate_target_from_grave_source(player, card, instance->targets[0].player, 1);
         if( selected != -1 ){
            reanimate_permanent(player, card, instance->targets[0].player, selected, REANIMATE_ATTACH_AS_AURA);
         }
      }
   }

   return 0;
}

Re: [fixed]Iridescent Drake stolen aura no return to owner g

PostPosted: 26 Jan 2021, 15:26
by Aswan jaguar
drool66 wrote:selection is compulsory, and you can switch graveyards as many times as you want
Selection is compulsory but you can't switch even once as SFG_CANNOT_CANCEL doesn't let you rechoose grave. If that gets fixed it will just need the proper prompts the other code uses.

Re: [fixed]Iridescent Drake stolen aura no return to owner g

PostPosted: 26 Jan 2021, 16:04
by drool66
The user can change graveyards here :D :
Screenshot (61).png


The prompt can be done by using:
Code: Select all
new_default_test_definition(&this_test, TYPE_ENCHANTMENT, "Select target aura card with enchant creature or permanent");

Re: [fixed]Iridescent Drake stolen aura no return to owner g

PostPosted: 26 Jan 2021, 16:19
by Aswan jaguar
In your photo I can see the rechoose button like I can see in mine but if I click on it and I think you, too it doesn't go to the other grave.

Re: [fixed]Iridescent Drake stolen aura no return to owner g

PostPosted: 26 Jan 2021, 16:45
by drool66
Huh, that's an oversight in select_target_from_either_grave(). Can be fixed like this ( deck.c -> select_target_from_either_grave() ):
Code: Select all
  int temp_mode = mode;
  if (p0 && p1){
     hack_override_show_deck_done_button_label = "Rechoose graveyard";
     temp_mode &= ~SFG_CANNOT_CANCEL;
   }
  int rval = select_target_from_grave_source(player, card, tgt_gy.player, temp_mode,
                                  tgt_gy.player == player ? ai_mode_own_graveyard : ai_mode_opponent_graveyard,
                                  test, ret_location_card);
  hack_override_show_deck_done_button_label = NULL;
Retested working ok.

Re: [fixed]Iridescent Drake stolen aura no return to owner g

PostPosted: 28 Jan 2021, 23:38
by Korath
drool66 wrote:The user can change graveyards here :D :
Probably my fault, but that "rechoose graveyard" text is being stored in a 12-character-long buffer in the midend. It's overwriting the stack and corrupting memory; that it seems to work in the short term instead of crashing immediately is entirely accidental.

Re: [fixed]Iridescent Drake stolen aura no return to owner g

PostPosted: 29 Jan 2021, 04:21
by drool66
Oh interesting. So would it be best to increase the buffer size, change the prompt, or something else? "Rechoose GY" is 11 chars.

Re: [fixed]Iridescent Drake stolen aura no return to owner g

PostPosted: 06 Feb 2021, 14:38
by Korath
While changing the buffer is feasible, it's more effort than it's worth. It's part of a local struct in show_deck_back_end() at 0x46c4a0 (a short, seemingly easily-rewriteable function) which is passed by address to dlgproc_show_deck() at 0x46c8f0 (a much more complex one). Changing the layout of that struct in any nontrivial way means you have to rewrite dlgproc_show_deck to match it. I eventually had to do that in Shandalar - see the show_deck section in shandalar/ui.cpp - but what made it worthwhile wasn't increasing that string's max size, it was increasing the 500-card limit in the same struct. On the other hand, the buffer looks like it's at the end of the struct, so you might be able to get away with just lengthening it; there's no way I'd trust that without analyzing the assembly manually, though.

TLDR: Go with "Rechoose GY" or "Other GY" or similar.

Re: [fixed]Iridescent Drake stolen aura no return to owner g

PostPosted: 07 Feb 2021, 18:44
by drool66
Thank you, Korath!
Committed changes to select_target_from_either_grave() in 3323517

Updated code for Iridescent Drake as above in f151cb8
Aswan jaguar, I know you put a lot of work into your code and this is "your" bugfix, so feel free to edit or revert if you see reason to.