It is currently 18 Apr 2024, 23:56
   
Text Size

[fixed]Oath of Nissa puts the cards back on top of library

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

[fixed]Oath of Nissa puts the cards back on top of library

Postby Aswan jaguar » 06 Oct 2016, 05:16

Describe the Bug:
Oath of Nissa puts the cards not selected back on top of your library.

Which card did behave improperly ?
Oath of Nissa

Which update are you using?(date,name)Which type(Duel,Gauntlet,Sealed Deck)
Manalink 2016/08/27: Eldritch Moon v2, duel

What exactly should be the correct behavior/interaction ?
Oath of Nissa puts the cards not selected on the bottom of your library in any order.

Are any other cards possibly affected by this bug ?
-
Attachments
oarh of nissa no botto lib order.rar
(2.22 KiB) Downloaded 152 times
Last edited by Aswan jaguar on 30 Aug 2019, 14:13, edited 3 times in total.
Reason: fixed
---
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: [confirm]Oath of Nissa puts the cards back on top of lib

Postby Aswan jaguar » 21 Jan 2019, 14:00

Fixed that it didn't put cards on the bottom of library in 8f3ee429.
I can't make it reveal the chosen card however and I tried very hard. I would appreciate if you see what I am missing.
| Open
Code: Select all
int card_oath_of_nissa(int player, int card, event_t event){
   /* Oath of Nissa   |G   0x200e693
    * Legendary Enchantment
    * When ~ enters the battlefield, look at the top three cards of your library. You may reveal a creature, land, or planeswalker card
    * from among them and put it into your hand. Put the rest on the bottom of your library in any order.
    * You may spend mana as though it were mana of any color to cast planeswalker spells. */

   check_legend_rule(player, card, event);

   etb_ability(player, card, event, RESOLVE_TRIGGER_MANDATORY);
   
   if( event == EVENT_ETB_ABILITY ){
      int to_reveal = count_deck(player);
       to_reveal = MIN(3, to_reveal);
      if( to_reveal > 0 ){
      test_definition_t test;            
      new_default_test_definition(&test, TYPE_ANY, "Select a a creature, land, or planeswalker card.");
      test.special_selection_function = &is_creature_land_or_pwalker;
      test.create_minideck = to_reveal;
      test.no_shuffle = 1;
         
      int card_added = new_global_tutor(player, player, TUTOR_DECK, TUTOR_HAND, 0, AI_MAX_VALUE, &test);
      if (card_added != -1)
        --to_reveal;
      if( to_reveal > 0 ){
        put_top_x_on_bottom(player, player, to_reveal);
         }
       }
   }

   if( event == EVENT_CAN_ACTIVATE ){
      int i;
      for(i=0; i<active_cards_count[player]; i++){
         if( in_hand(player, i) && is_planeswalker(player, i) ){
            int amount = get_updated_casting_cost(player, i, -1, event, -1);
            amount+=cards_ptr[get_id(player, i)]->req_black;
            amount+=cards_ptr[get_id(player, i)]->req_blue;
            amount+=cards_ptr[get_id(player, i)]->req_green;
            amount+=cards_ptr[get_id(player, i)]->req_red;
            amount+=cards_ptr[get_id(player, i)]->req_white;
            if( has_mana(player, COLOR_COLORLESS, amount) ){
               if( is_what(player, i, TYPE_INSTANT) || can_sorcery_be_played(player, event) ){
                  return 1;
               }
            }
         }
      }
   }

   if( event == EVENT_ACTIVATE ){
      int playable[3][hand_count[player]];
      int pc = 0;
      int i;
      for(i=0; i<active_cards_count[player]; i++){
         if( in_hand(player, i) && is_planeswalker(player, i) ){
            int amount = get_updated_casting_cost(player, i, -1, event, -1);
            amount+=cards_ptr[get_id(player, i)]->req_black;
            amount+=cards_ptr[get_id(player, i)]->req_blue;
            amount+=cards_ptr[get_id(player, i)]->req_green;
            amount+=cards_ptr[get_id(player, i)]->req_red;
            amount+=cards_ptr[get_id(player, i)]->req_white;
            if( has_mana(player, COLOR_COLORLESS, amount) ){
               if( is_what(player, i, TYPE_INSTANT) || can_sorcery_be_played(player, event) ){
                  playable[0][pc] = get_card_instance(player, i)->internal_card_id;
                  playable[1][pc] = i;
                  playable[2][pc] = amount;
                  pc++;
               }
            }
         }
      }

      test_definition_t this_test;
      new_default_test_definition(&this_test, TYPE_ANY, "Select a planeswalker to play.");
      this_test.subtype = SUBTYPE_PLANESWALKER;

      int selected = select_card_from_zone(player, player, playable[0], pc, 0, AI_MAX_VALUE, -1, &this_test);
      if( selected != -1 ){
         if( charge_mana(player, COLOR_COLORLESS, playable[2][selected])  ){
            play_card_in_hand_for_free(player, playable[1][selected]);
            cant_be_responded_to = 1;   // The spell will be respondable to, but this (fake) activation won't
         }
         else{
            spell_fizzled = 1;
            return 0;
         }
      }
      else{
         spell_fizzled = 1;
         return 0;
      }
   }

   return global_enchantment(player, card, event);
}
---
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: [confirm]Oath of Nissa puts the cards back on top of lib

Postby Korath » 21 Jan 2019, 20:42

new_global_tutor() is, charitably, a clusterfuck. It doesn't let you specify whether the searched-for card is to be revealed or not; it decides for itself whether to reveal, based on very incomplete checks of whether there's any restrictions on the searched-for card and on where the card's to be placed. The checks on restrictions are different for each place the card can end up, and none of them are anywhere close to being complete.

For a destination of TUTOR_DECK, the check is
Code: Select all
if( test_type != 0 && this_test->type > 0 && this_test->type != TYPE_ANY && player == AI ){
at around line 477 of tutors.c. So while the real solution is to explicitly tell new_global_tutor() whether to reveal based on what the card actually says, or at least to treat any non-NULL test_definition_t* as non-empty, you can work around it here by passing TYPE_NONEFFECT or TYPE_PERMANENT instead of TYPE_ANY.

Also, there's a typo in the prompt, the card shouldn't have an activated ability, and very likely it won't work properly with cost modifiers or casting restrictions.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [confirm]Oath of Nissa puts the cards back on top of lib

Postby Aswan jaguar » 30 Aug 2019, 13:35

I tried the TYPE_ANY -> TYPE_NONEFFECT approach with no luck. Still AI doesn't reveal the card chosen although AI puts it on it's hand(AI like human should be able not to reveal the card but also not put it in it's hand). It shows a menu that AI(player) "processes" which I suppose is the menu that would reveal the card but no reveal happens.

Fixed the no reveal chosen card and the typo in prompt using the reveal_top_cards_of_library_and_choose_type() function in commit 02dfcc88.
Last edited by Aswan jaguar on 30 Aug 2019, 14:12, edited 1 time in total.
Reason: fix
---
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 62 guests


Who is online

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

Login Form