It is currently 25 Apr 2024, 00:15
   
Text Size

[fixed]Demonic consultation -> game hangs (plz confirm)

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

[fixed]Demonic consultation -> game hangs (plz confirm)

Postby travolter » 21 May 2019, 20:42

Im trying to cast Demonic Consultation and game hangs (seem to be waiting but nothing occur)
Attachments
AUTOSAVE.rar
(2.01 KiB) Downloaded 130 times
Last edited by Aswan jaguar on 19 Sep 2019, 16:02, edited 2 times in total.
Reason: fixed
travolter
 
Posts: 250
Joined: 26 Mar 2012, 17:56
Has thanked: 4 times
Been thanked: 8 times

Re: [confirmed]Demonic consultation -> game hangs (plz confi

Postby Aswan jaguar » 22 May 2019, 17:21

code | Open
Code: Select all
int card_demonic_consultation(int player, int card, event_t event){
/* Demonic Consultation   |B   0x20016C3
 * Instant
 * Name a card. Exile the top six cards of your library, then reveal cards from the top of your library until you reveal the named card.
 * Put that card into your hand and exile all other cards revealed this way. */

   if( event == EVENT_RESOLVE_SPELL ){
      test_definition_t test;
      default_test_definition(&test, TYPE_LAND);
      if( count_subtype(player, TYPE_LAND, -1) >= 4 ){
         test.type_flag = DOESNT_MATCH;
         test.cmc = count_subtype(player, TYPE_LAND, -1)+1;
         test.cmc_flag = F5_CMC_LESSER_THAN_VALUE;
      }
      int choice = ai_name_a_random_csvid( player, card, player, 0, &test);
      if( player == HUMAN ){
         if( ai_is_speculating != 1 ){
            choice = card_from_list(player, 3, TYPE_ANY, 0, 0, 0, 0, 0, 0, 0, -1, 0);
         }
      }

      // remove the top 6
      int i=0;
      for(i=0;i<6;i++){
         rfg_top_card_of_deck(player);
      }

      default_test_definition(&test, TYPE_ANY);
      test.id = choice;
      reveal_card_until_you_reveal_test(player, player, &test, RCUYRT_EXILE_REST | RCUYRT_ADD_TEST_TO_HAND);

      kill_card(player, card, KILL_DESTROY);
   }

   return generic_spell(player, card, event, 0, NULL, NULL, 0, NULL);
}
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8078
Joined: 13 May 2010, 12:17
Has thanked: 730 times
Been thanked: 458 times

Re: [confirmed]Demonic consultation -> game hangs (plz confi

Postby Aswan jaguar » 19 Sep 2019, 16:01

Fixed in commit 220eb269. I had to disable AI code as it went on a loop if AI had 4 =< lands. If it had less lands then AI correctly searched for land. Despite my efforts I wasn't able to make it work correctly and not go on a loop but instead search for non-land cards if AI already had 4 or more.
Current code:
Code: Select all
int card_demonic_consultation(int player, int card, event_t event){
/* Demonic Consultation   |B   0x20016C3
 * Instant
 * Name a card. Exile the top six cards of your library, then reveal cards from the top of your library until you reveal the named card.
 * Put that card into your hand and exile all other cards revealed this way. */

   if( event == EVENT_RESOLVE_SPELL ){
      // remove the top 6
      int i=0;
      for(i=0;i<6;i++){
         rfg_top_card_of_deck(player);
      }

      test_definition_t test;
      default_test_definition(&test, TYPE_ANY);
      int choice = -1;

      if( IS_AI(player) ){// AI code crashed if lands >= 4 so I disabled it.
           /*if( count_subtype(player, TYPE_LAND, -1) >= 4 ){
                test.type_flag = DOESNT_MATCH;
               test.cmc = count_subtype(player, TYPE_LAND, -1)+1;
               test.cmc_flag = F5_CMC_LESSER_THAN_VALUE;
          } */
           choice = ai_name_a_random_csvid( player, card, player, 0, &test);
      }
         else{
           choice = card_from_list(player, 3, TYPE_ANY, 0, 0, 0, 0, 0, 0, 0, -1, 0);
      }

        test_definition_t test1;
      default_test_definition(&test1, TYPE_ANY);
      test1.id = choice;
      reveal_card_until_you_reveal_test(player, player, &test1, RCUYRT_EXILE_REST | RCUYRT_ADD_TEST_TO_HAND);

      kill_card(player, card, KILL_DESTROY);
   }

   return generic_spell(player, card, event, 0, NULL, NULL, 0, NULL);
}
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8078
Joined: 13 May 2010, 12:17
Has thanked: 730 times
Been thanked: 458 times


Return to Archived Reports

Who is online

Users browsing this forum: No registered users and 70 guests


Who is online

In total there are 70 users online :: 0 registered, 0 hidden and 70 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: No registered users and 70 guests

Login Form