Page 1 of 1

[fixed/closed]Jeweled Bird copies itself

PostPosted: 26 Sep 2015, 08:31
by BAgate
Describe the Bug:
Jeweled Bird is not placed in ante, so it can be used over and over, putting copies of itself into ante and then into gy.

Which card did behave improperly ?
Jeweled Bird

Which update are you using?(date,name)Which type(Duel,Gauntlet,Sealed Deck)
Manalink 2015/3/25: Fate Reforged,duel

What exactly should be the correct behavior/interaction ?
Should go to ante when used.

Are any other cards possibly affected by this bug ?
-

Re: Jeweled Bird copies itself

PostPosted: 26 Sep 2015, 14:45
by Korath
It's trying to put the activation card into ante.

This is my bug - I can tell from the indentation style in card_jeweled_bird() - but Manalink doesn't compile for me, so I can't test the fix, and so I'm not comfortable committing it.
Completely untested | Open
Code: Select all
diff --git a/src/cards/arabian_nights.c b/src/cards/arabian_nights.c
index 71a2b3b..733a0e4 100644
--- a/src/cards/arabian_nights.c
+++ b/src/cards/arabian_nights.c
@@ -1224,21 +1224,26 @@ int card_jeweled_bird(int player, int card, event_t event)
    * Remove ~ from your deck before playing if you're not playing for ante.
    * |T: Put ~ into the ante. If you do, put all other cards you own from the ante into your graveyard, then draw a card. */

-  if (event == EVENT_RESOLVE_ACTIVATION && in_play(player, card))
+  if (event == EVENT_RESOLVE_ACTIVATION)
     {
-      card_instance_t* instance = get_card_instance(player, card);
+      card_instance_t* activation = get_card_instance(player, card);
+      int p = activation->parent_card_controller, c = activation->parent_card;
+      card_instance_t* instance = in_play(p, c);
+      if (!instance)
+        return 0;
+
       int oid = instance->original_internal_card_id;
-      if (is_token(player, card))
+      if (is_token(p, c))
         oid = -1;

       if (ante_cards[player][1] != -1   // anteing at least two cards
           || (ante_cards[player][0] != -1   // anteing at least one card, and...
-              && (is_token(player, card)    // It'll successfully go to ante, then disappear.
+              && (is_token(p, c)   // It'll successfully go to ante, then disappear.
                   // From the exe version.  I don't know whether expansion_rarity is meaningful anymore, but enh.
                   || cards_ptr[oid]->expansion_rarity <= cards_ptr[cards_data[ante_cards[player][0]].id]->expansion_rarity)))
         ai_modifier += player == AI ? 48 : -48;

-      obliterate_card(player, card);
+      obliterate_card(p, c);

       int i, prev_ante[16];
       for (i = 0; i < 16; ++i)

Re: [confirmed]Jeweled Bird copies itself

PostPosted: 24 Nov 2015, 06:32
by Korath
Fixed 0930dbe.