It is currently 15 May 2025, 14:10
   
Text Size

[fixed]Reaper King casting cost doubled

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

[fixed]Reaper King casting cost doubled

Postby gnomefry » 28 May 2020, 19:36

Describe the Bug:

(I see Drool66 just finished working on the other bug with this card. Doh. I'm sorry for not getting this up here sooner. Thank you for all your work!)

Reaper King's casting cost is 2/W, 2/U, 2/B, 2/R, 2/G. Meaning that it's either one each of the colored mana or an optional 2 colorless substituted for any color.

When casting Reaper King the sytem asks for the 10 colorless and, once paid, brings up a selection menu with the various combination costs of colorless/colored mana. If you don't pay both times, the spell cancels. This amounts to double the casting cost.

Which card behaved improperly?

Reaper King

Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink 5-2020 10bda4ca0 - gauntlet

What exactly should be the correct behavior/interaction?

Casting cost is either 1 of each color or alternately 2 colorless in place of each/any color.

Are any other cards possibly affected by this bug?

No.
Attachments
reaperking2-mana.rar
(3.51 KiB) Downloaded 186 times
Last edited by Aswan jaguar on 21 Aug 2020, 17:07, edited 2 times in total.
Reason: fixed
User avatar
gnomefry
Tester
 
Posts: 288
Joined: 28 Dec 2018, 00:44
Has thanked: 25 times
Been thanked: 24 times

Re: [confirmed]Reaper King casting cost doubled

Postby Aswan jaguar » 29 May 2020, 14:05

Also if you can pay all cost by colored mana it is cast for free (at least that is if you haven't got any colorless mana - not tested).
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8129
Joined: 13 May 2010, 12:17
Has thanked: 748 times
Been thanked: 477 times

Re: [confirmed]Reaper King casting cost doubled

Postby FastEddie » 12 Aug 2020, 17:29

I was just experimenting with a new save game (the one provided crashed with a segmentation fault and I wasn't eager to find out what caused it). To cut a long story short, neither a combination of coloured and colourless mana nor the 10 colourless doubled the casting cost for me.

The only issue I had is that the box is too short for all possibilities and that the all coloured mana isn't listed (to be precise, it probably is, I just can't see it).

The environment was Version 6-2020 v3 a8bbff706, Duel.
Attachments
ReaperKing.zip
(3.87 KiB) Downloaded 168 times
---
Argivian Archaeologist in the Library of Leng studying the Spells of the Ancients
User avatar
FastEddie
 
Posts: 246
Joined: 24 Dec 2019, 10:59
Has thanked: 15 times
Been thanked: 19 times

Re: [confirmed]Reaper King casting cost doubled

Postby Aswan jaguar » 13 Aug 2020, 17:21

I can't replicate the double cost bug either but the bug I posted is still there.
1 way to replicate: Put in play 5 or more lands that produce only colored mana and can produce the full colored cost of Reaper King then if you go to cast it, it will not prompt for mana and will be cast for free.
FastEddie wrote:(the one provided crashed with a segmentation fault and I wasn't eager to find out what caused it).

Generally the rule is that savegames from older versions of the game don't work at all or correctly when loaded in newer versions as some things (do change) in between so it is never safe to assume that the bug is anything else than incompatible versions. In fact for that reason it is not safe sometimes to use a savegame even as a result of some change in a function you do to fix the bug in that savegame in same version. After you recompile it could crash (but not because you screwed things up ). Even if your code is good. If you test in a clean game the bug could be fixed and no longer be an issue.
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8129
Joined: 13 May 2010, 12:17
Has thanked: 748 times
Been thanked: 477 times

Re: [confirmed]Reaper King casting cost doubled

Postby FastEddie » 15 Aug 2020, 15:52

Ah, I didn't look into that. Put it on my list.

In fact for that reason it is not safe sometimes to use a savegame even as a result of some change in a function you do to fix the bug in that savegame in same version. After you recompile it could crash (but not because you screwed things up ).
Good that you say that. I had that effect quite often when fixing the Planeswalkers (so far at least, Propaganda is still open) and was wondering.

Something completely different: I do not always get mails when something new is posted. For example I didn't get mails regarding this thread (but got mails regarding others so this is no general issue). Any ideas what this is and how to fix it?
---
Argivian Archaeologist in the Library of Leng studying the Spells of the Ancients
User avatar
FastEddie
 
Posts: 246
Joined: 24 Dec 2019, 10:59
Has thanked: 15 times
Been thanked: 19 times

Re: [confirmed]Reaper King casting cost doubled

Postby Aswan jaguar » 15 Aug 2020, 16:09

I don't use the e-mail notification for posts only for pms so I don't know. I am here so often that the indication that new posts have been posted is enough for me.
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8129
Joined: 13 May 2010, 12:17
Has thanked: 748 times
Been thanked: 477 times

Re: [confirmed]Reaper King casting cost doubled

Postby FastEddie » 19 Aug 2020, 15:42

Well, that card definitly had some issues. It could be cast for free if you had less than 8 mana in play (a side effect of the implementation of the variable casting cost), only to hit you over the head with a dialog box that wouldn't show all possibilities if you had too much mana (say some coloured and 10 colourless).
As the code was hard to read and unfortunately not commented I couldn't figure out what the issue was or where the programmer went astray, so I rewrote it from scratch and plugged in a cascasde of dialog boxes, each showing 12 possible casting costs. A helper function that wasn't needed anymore was also removed.

I attached a couple of save games for testing. The only corner case not covered is BUGRW, the others are covered. BUGRW shouldn't be an issue, though, as the 7 mana case (which here has also only one possible casting cost) works.

Pls use the diff if possible as it also removes old code pieces and contains some comments to the card itself.

This is the relevant code piece:

Code: Select all
int casting_reaper_king(int player, int card, event_t event){
   int colorless, black, blue, green, red, white;
   // Reaper King has 2^5 = 32 possible casting cost variants of which not all might be available, we sort those out later
   int manaCless[32], manaBlack[32], manaBlue[32], manaGreen[32], manaRed[32], manaWhite[32];
   int manaIndex;

   // In case we mess anything up Reaper King will be cast for free
   for ( manaIndex = 0; manaIndex < 32; manaIndex++ ) {
      manaCless[manaIndex] = manaBlack[manaIndex] = manaBlue[manaIndex] = manaGreen[manaIndex] = manaRed[manaIndex] = manaWhite[manaIndex] = 0;
   }
   
   int castingCost = get_updated_casting_cost(player, card, -1, event, -1);
   
   // Generate all possible permutations and check whether sufficient mana exists
   manaIndex = 0;
   for (black = 1; black >= 0; black--) {
      for (blue = 1; blue >= 0; blue--) {
         for (green = 1; green >= 0; green--) {
            for (red = 1; red >= 0; red--) {
               for (white = 1; white >= 0; white--) {
                  colorless = castingCost - 2 * (black+blue+green+red+white);
                  if ( colorless >= 0 ) {
                     // Otherwise casting cost has been reduced, e.g. through Semblance Anvil
                     if ( has_mana_multi_a(player, colorless, black, blue, green, red, white) ) {
                        manaCless[manaIndex] = colorless;
                        manaBlack[manaIndex] = black;
                        manaBlue[manaIndex] = blue;
                        manaGreen[manaIndex] = green;
                        manaRed[manaIndex] = red;
                        manaWhite[manaIndex] = white;
                        manaIndex++;
                     }
                  }
               }
            }
         }
      }
   }
   
   // Put casting costs in a string manually, not by mana_into_string as we need more strings if one is too long for the dialog box
   const int bufferLen = 200;
   char castingCosts[3][bufferLen];
   int numDialogs = manaIndex / 12 + 1; // 12 choices per dialog, max. 3 dialogues
   int pos, maxPos[3];
   int i, dialog;
   
   for ( dialog = 0; dialog < numDialogs; dialog++ ) {
      pos = scnprintf(castingCosts[dialog], bufferLen, " Pay\n");
      maxPos[dialog] = 1;
      for ( i = dialog*12; i < MIN((dialog+1)*12, manaIndex); i++) {
         if( manaCless[i] != 0 ){
            pos +=scnprintf(castingCosts[dialog]+pos, bufferLen-pos, "%d", manaCless[i]);
         }
         if (manaBlack[i] != 0) {
            pos +=scnprintf(castingCosts[dialog]+pos, bufferLen-pos, "B");
         }
         if (manaBlue[i] != 0) {
            pos +=scnprintf(castingCosts[dialog]+pos, bufferLen-pos, "U");
         }
         if (manaGreen[i] != 0) {
            pos +=scnprintf(castingCosts[dialog]+pos, bufferLen-pos, "G");
         }
         if (manaRed[i] != 0) {
            pos +=scnprintf(castingCosts[dialog]+pos, bufferLen-pos, "R");
         }
         if (manaWhite[i] != 0) {
            pos +=scnprintf(castingCosts[dialog]+pos, bufferLen-pos, "W");
         }
         pos +=scnprintf(castingCosts[dialog]+pos, bufferLen-pos, "\n");
         maxPos[dialog]++;
      }
      if ( dialog == numDialogs-1 ) {
         pos +=scnprintf(castingCosts[dialog]+pos, bufferLen-pos, " Cancel\n");
      } else {
         pos +=scnprintf(castingCosts[dialog]+pos, bufferLen-pos, " Next\n");
      }
   }

   int choice;
   if( IS_AI(player) ) {
      manaIndex = 0; // variant with the lowest total casting cost
   } else {
      dialog = 0;
      while (1) {
         choice = do_dialog(player, player, card, -1, -1, castingCosts[dialog], 1);
         if ( choice == 0 ) {
            // "Pay"
            spell_fizzled = 1;
            return 0;
         }
         if ( choice < maxPos[dialog] ) {
            // Offset first line in dialog to get proper index (choice 1 == index 0 etc.)
            manaIndex = 12*dialog + choice - 1;
            break;
         }
         if (( dialog == numDialogs-1 ) ) {
            // "Cancel"
            spell_fizzled = 1;
            return 0;
         } else {
            // "Next" as this is not the last one
            dialog++;
         }
      }
   }

   charge_mana_multi_a(player, 0, \
      manaBlack[manaIndex], manaBlue[manaIndex], manaGreen[manaIndex], manaRed[manaIndex], manaWhite[manaIndex], manaCless[manaIndex]);
   if( spell_fizzled != 1 ){
      return 1;
   }

   return 0;
}
Attachments
shadowmoor.zip
(2.51 KiB) Downloaded 159 times
Reaper King.zip
(14.21 KiB) Downloaded 161 times
---
Argivian Archaeologist in the Library of Leng studying the Spells of the Ancients
User avatar
FastEddie
 
Posts: 246
Joined: 24 Dec 2019, 10:59
Has thanked: 15 times
Been thanked: 19 times

Re: [confirmed]Reaper King casting cost doubled

Postby Aswan jaguar » 21 Aug 2020, 17:07

Added the above fix in commit a1760f8. =D>
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8129
Joined: 13 May 2010, 12:17
Has thanked: 748 times
Been thanked: 477 times

Re: [fixed]Reaper King casting cost doubled

Postby FastEddie » 21 Aug 2020, 17:57

:D
---
Argivian Archaeologist in the Library of Leng studying the Spells of the Ancients
User avatar
FastEddie
 
Posts: 246
Joined: 24 Dec 2019, 10:59
Has thanked: 15 times
Been thanked: 19 times

Re: [fixed]Reaper King casting cost doubled

Postby gnomefry » 25 Aug 2020, 01:36

Hope it's okay to add to this if it's in Pending?

The original bug I began this thread with is fixed. Paying for Reaper King with 10 colorless doesn't lead to the system asking for a second payment. Thank you, FastEddie.

Casting Reaper King for colored mana still has an issue. Aswan Jaguar mentioned it earlier in this thread. If you can pay for Reaper King with colored mana, he gets cast for free.

If you can pay for a portion of RK's cost with colored mana but need to cover the rest of his cost with colorless mana (2 colorless in lieu of each color), only the colorless portion is properly charged. The colored portions are uncharged or remain in your mana pool. I mention the mana pool because in cases where a mixed payment of colorless/colored is necessary, I had to put the mana into the pool before the Reaper King card 'lit up' as cast-able.

2 savegames attached, one per each of these scenarios.

Tested with version 8-2020 a62926f - gauntlet
Attachments
reaperking_4_colored_mana_2_colorless.rar
4 colored mana available, plus 2 colorless available to cover the missing color
(2.29 KiB) Downloaded 181 times
reaperking_5_colored_mana.rar
5 mana of different colors available. Reaper King casts for free
(1.96 KiB) Downloaded 159 times
User avatar
gnomefry
Tester
 
Posts: 288
Joined: 28 Dec 2018, 00:44
Has thanked: 25 times
Been thanked: 24 times

Re: [fixed]Reaper King casting cost doubled

Postby Aswan jaguar » 25 Aug 2020, 05:44

What you say has already been fixed by the commit above but wasn't included in the August update which was released earlier.
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 8129
Joined: 13 May 2010, 12:17
Has thanked: 748 times
Been thanked: 477 times


Return to Archived Reports

Who is online

Users browsing this forum: No registered users and 27 guests


Who is online

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

Login Form