Page 1 of 1

[fixed]Helvault no cards exiled back

PostPosted: 31 Jul 2018, 10:48
by Aswan jaguar
Describe the Bug:
1- Helvault doesn't prompt for target after the menu you choose which ability to use. If you click on the target it works though.
2- Helvault doesn't return all cards exiled with it to the battlefield under their owners' control.
Which card did behave improperly?
Helvault

Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink dev 778ccb5 version - duel

What exactly should be the correct behavior/interaction?
1- Helvault prompt for target after the menu you choose which ability to use.
2- Helvault returns all cards exiled with it to the battlefield under their owners' control.

Are any other cards possibly affected by this bug?
-

Re: Helvault no target prompt & no cards exiled back

PostPosted: 20 Jul 2019, 10:46
by Aswan jaguar
Fixed the prompts in commit 6c6584a9. My efforts were unsuccessful so still the exiled cards don't return.
Code: Select all
int card_helvault(int player, int card, event_t event){
/*
Helvault |3
Legendary Artifact
{1}, {T}: Exile target creature you control.
{7}, {T}: Exile target creature you don't control.
When Helvault is put into a graveyard from the battlefield, return all cards exiled with it to the battlefield under their owners' control.
*/
   check_legend_rule(player, card, event);

   if( this_dies_trigger(player, card, event, RESOLVE_TRIGGER_MANDATORY) ){
      card_instance_t *instance = get_card_instance( player, card );
      int leg = 0;
      int idx = 0;
      int* loc;

      while ((loc = exiledby_find_any(player-2, instance->targets[1].card, &leg, &idx)) != NULL){
            int owner = (*loc & 0x80000000) ? 1 : 0;
            int iid = *loc & ~0x80000000;
            *loc = -1;
            int card_added = add_card_to_hand(owner, iid);
            put_into_play(player, card_added);
      }
   }

   target_definition_t td;
   default_target_definition(player, card, &td, TYPE_CREATURE);
   td.allowed_controller = player;
   td.preferred_controller = player;

   target_definition_t td2;
   default_target_definition(player, card, &td2, TYPE_CREATURE);
   td2.allowed_controller = player;
   td2.preferred_controller = player;
   if( player == AI ){
      td2.required_state = TARGET_STATE_DESTROYED;
   }

   target_definition_t td3;
   default_target_definition(player, card, &td3, TYPE_CREATURE);
   td3.allowed_controller = 1-player;
   td3.preferred_controller = 1-player;

   card_instance_t *instance = get_card_instance( player, card );

   enum{
      CHOICE_EXILE_YOURS = 1,
      CHOICE_EXILE_OPP,
      CHOICE_SHOW_EXILED
   };

   if( event == EVENT_CAN_ACTIVATE ){
      if( player == HUMAN &&
         generic_activated_ability(player, card, event, GAA_UNTAPPED | GAA_CAN_TARGET, MANACOST_X(1), 0, &td, NULL) )
      {
         return 1;
      }
      if( player == AI &&
         generic_activated_ability(player, card, event, GAA_UNTAPPED | GAA_CAN_TARGET | GAA_REGENERATION, MANACOST_X(1), 0, &td2, NULL) )
      {
         return 99;
      }
      if( generic_activated_ability(player, card, event, GAA_UNTAPPED |GAA_CAN_TARGET, MANACOST_X(7), 0, &td3, NULL) ){
         return 1;
      }
   }

   if( event == EVENT_ACTIVATE ){
      instance->info_slot = instance->number_of_targets = 0;
      int abils[4] = {
                  0,
                  0,
                  generic_activated_ability(player, card, EVENT_CAN_ACTIVATE, GAA_UNTAPPED |GAA_CAN_TARGET, MANACOST_X(7), 0,
                                    &td3, NULL),
                  player == HUMAN && exiledby_count(player, card, ANYBODY) ? 1 : 0
      };
      if( player == HUMAN ){
         abils[1] = generic_activated_ability(player, card, EVENT_CAN_ACTIVATE, GAA_UNTAPPED | GAA_CAN_TARGET, MANACOST_X(1), 0,
                                    &td, NULL);
      }
      else{
         abils[1] = generic_activated_ability(player, card, EVENT_CAN_ACTIVATE, GAA_UNTAPPED | GAA_CAN_TARGET | GAA_REGENERATION,
                                    MANACOST_X(1), 0, &td2, NULL);
      }
      int choice = DIALOG(player, card, event, DLG_RANDOM,
                     "Exile a creature you control",    abils[1], 5,
                     "Exile opponent's creature",       abils[2], 10,
                     "Show exiled creatures",          abils[3], 1);
      if( ! choice ){
         spell_fizzled = 1;
         return 0;
      }

      if( choice == CHOICE_EXILE_YOURS ){
         if( player == HUMAN ){
            return generic_activated_ability(player, card, event, GAA_UNTAPPED | GAA_CAN_TARGET | GAA_LITERAL_PROMPT, MANACOST_X(1), 0,
                                    &td, "Select target creature you control.");
         }
         else{
            generic_activated_ability(player, card, event, GAA_UNTAPPED | GAA_CAN_TARGET | GAA_REGENERATION, MANACOST_X(1), 0,
                                 &td2, NULL);
         }
      }
      if( choice == CHOICE_EXILE_OPP ){
         return generic_activated_ability(player, card, event, GAA_UNTAPPED |GAA_CAN_TARGET|GAA_LITERAL_PROMPT, MANACOST_X(7), 0,
                                 &td3, "Select target creature you don't control.");
      }
      if( choice == CHOICE_SHOW_EXILED ){
         exiledby_choose(player, card, CARD_ID_HELVAULT, EXBY_CHOOSE, 0, "Creature", 0);
         spell_fizzled = 1;
      }
   }

   if( event == EVENT_RESOLVE_ACTIVATION ){
      int good = 0;
      if( instance->info_slot == CHOICE_EXILE_YOURS && player == HUMAN && valid_target(&td) ){
         good = 1;
      }
      if( instance->info_slot == CHOICE_EXILE_YOURS && player == AI && valid_target(&td2) ){
         regenerate_target(instance->targets[0].player, instance->targets[0].card);
         good = 1;
      }
      if( instance->info_slot == CHOICE_EXILE_OPP && valid_target(&td3) ){
         good = 1;
      }
      if( good ){
         exile_card_and_remember_it_on_exiledby(instance->parent_controller, instance->parent_card,
                                       instance->targets[0].player, instance->targets[0].card);
      }
   }

   return 0;
}

Re: Helvault no cards exiled back

PostPosted: 23 Sep 2019, 16:07
by Aswan jaguar
Finally fixed in commit 7819922a.