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

[confirmed]Wolf of Devil's Breach partial payment

Report wrong Card behavior to get it fixed.
PLEASE ADD SAVEGAMES TO YOUR TOPIC !

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

[confirmed]Wolf of Devil's Breach partial payment

Postby Korath » 17 Sep 2020, 16:13

Describe the Bug:
If, during resolution of Wolf of Devil's Breach, you have a card in hand before mana payment but no longer do afterward before the discard, the mana is still charged and not refunded to your pool. This can be verified by having another card with a trigger with a mana cost that happens at the same time.

Handy cards to test with: Skirge Familiar, Frenzied Goblin

Also, the prompt is broken.

Which card behaved improperly?
Wolf of Devil's Breach.

Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
e9c9e7228 - (master) [SA] [drawcardlib] +cards

What exactly should be the correct behavior/interaction?
118.3. A player can't pay a cost without having the necessary resources to pay it fully. For example, a player with only 1 life can't pay a cost of 2 life, and a permanent that's already tapped can't be tapped to pay a cost. See rule 202, "Mana Cost and Color," and rule 602, "Activating Activated Abilities."

So you can either pay {1} {R} and discard, or neither, but not just one or the other. Here, if I tapped the Mountain and activated the Skirge Familiar, then the discard for the Wolf failed, I should have {B} {R} in my pool when the Frenzied Goblin's trigger resolves.

Are any other cards possibly affected by this bug?
I don't think so, at least not for triggers. I'd hope that activation costs that look like this (Mental Discipline, for example) deal with it properly.

I first tried testing this with Simian Spirit Guide (and no other cards in hand) instead of Skirge Familiar, but wasn't prompted to resolve the trigger. That would be good, except I suspect it's because the Guide isn't declaring any mana available and so I wouldn't get prompted even if I did have other cards.
Attachments
wolf-of-devils-breach.jpg
Last edited by Aswan jaguar on 19 Sep 2020, 12:24, edited 1 time in total.
Reason: confirmed
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [confirmed]Wolf of Devil's Breach partial payment

Postby Aswan jaguar » 19 Sep 2020, 19:23

Korath wrote:I first tried testing this with Simian Spirit Guide (and no other cards in hand) instead of Skirge Familiar, but wasn't prompted to resolve the trigger. That would be good, except I suspect it's because the Guide isn't declaring any mana available and so I wouldn't get prompted even if I did have other cards.
I made Simian Spirit Guide to declare available mana and will be seen by red spells tested with Lightning Bolt and Lightning Axe.
Still Wolf of Devil's Breach didn't check that available mana as the function it uses has_mana_multi() and I believe also same issue applies to has_mana_multi_a()
doesn't check Rules Engine or something so Wolf of Devil's Breach doesn't trigger. I changed Wolf of Devil's Breach to use has_mana() once for any color and once for red mana and then it triggered.

As Simian Spirit Guide can be activated through rules engine you don't get the issue with Wolf of Devil's Breach. As when it triggers you can activate Simian Spirit Guide to produce mana only before Wolf of Devil's Breach prompts you for mana as later rules engine won't highlight. As a result Simian Spirit Guide has already been exiled and so no prompt and no issue.

For Skirge Familiar and Frenzied Goblin the issue is there although you can use them to make mana when Wolf of Devil's Breach triggers exploiting the trigger used for changing targets if I remember correctly so before it prompts for mana and so then it won't prompt as there will not be a card to discard.
---
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]Wolf of Devil's Breach partial payment

Postby Aswan jaguar » 20 Sep 2020, 09:26

Fixed Simian Spirit Guide & Elvish Spirit Guide not declaring mana in commit b763a90.
Anyone has any idea what's wrong with has_mana_multi() and doesn't check the mana that can be produced by above cards:
Aswan jaguar wrote:Still Wolf of Devil's Breach didn't check that available mana as the function it uses has_mana_multi() and I believe also same issue applies to has_mana_multi_a()
doesn't check Rules Engine or something so Wolf of Devil's Breach doesn't trigger. I changed Wolf of Devil's Breach to use has_mana() once for any color and once for red mana and then it triggered.
---
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]Wolf of Devil's Breach partial payment

Postby Korath » 20 Sep 2020, 17:50

has_mana_multi() sees legally-declared mana just fine; you never do so. count_mana() only iterates over cards that are in_play() (and cards that would be in_play() if they weren't set STATE_INVISIBLE); and furthermore only to Gloom, untapped Sunglasses of Urza, and untapped cards flagged EA_MANA_SOURCE. Your EVENT_COUNT_MANA handler is never executed.

The "easy" way out is to declare mana for Elvish Spirit Guide and Simian Spirit Guide from the Rules Engine instead, and flag it EA_MANA_SOURCE.

The actually-easy way is to rewrite count_mana() at 0x472400. It's the equivalent of:
Code: Select all
static inline card_instance_t*
in_play_or_in_play_and_invisible(int player, int card)
{
  card_instance_t* inst = get_card_instance(player, card);
  if (inst->internal_card_id != -1
      && (inst->state & (STATE_OUBLIETTED|STATE_IN_PLAY)) == STATE_IN_PLAY)
    return inst;
  else
    return NULL;
  /* Neither the check against -1 instead of >= 0 or allowing STATE_INVISIBLE is meaningful in practice, so better to use
   * in_play() instead */
}

int
count_mana(void)
{
  for (color_t c = COLOR_COLORLESS; c <= COLOR_ANY; ++c)
    {
      global_cost_mod[c] = 0;
      raw_mana_available[0][c] = raw_mana_available[1][c] = 0;
    }

  raw_mana_available_hex[0][0] = raw_mana_available_hex[1][0] = -1;

  raw_mana_may_be_spent_as_color[0][0] = raw_mana_may_be_spent_as_color[1][0] = -1;

  for (int player = 0; player <= 1; ++player)
    for (int card = 0; card < active_cards_count[player]; ++card)
      if (card_instance_t* inst = in_play_or_in_play_and_invisible(player, card))
        {
          if ((cards_data[inst->internal_card_id].extra_ability & EA_MANA_SOURCE)
              && !(inst->state & STATE_TAPPED))
            dispatch_event(player, card, EVENT_COUNT_MANA);

          if (cards_data[inst->internal_card_id].id == CARD_ID_SUNGLASSES_OF_URZA
              && !(inst->state & STATE_TAPPED))
            dispatch_event_to_single_card(player, card, EVENT_COUNT_MANA, -1, -1);

          if (cards_data[inst->internal_card_id].id == CARD_ID_GLOOM)
            dispatch_event_to_single_card(player, card, EVENT_COUNT_MANA, -1, -1);
        }

  // no cards still have code_pointer 0x413c80 or 0x422360, so the rest of this does nada
  if (event_flags & EA_FELLWAR_STONE)
    for (int player = 0; player <= 1; ++player)
      for (int card = 0; card < active_cards_count[player]; ++card)
        {
          card_instance_t* inst = get_card_instance(player, card);
          if (inst->internal_card_id != -1
              && (cards_data[inst->internal_card_id].code_pointer == 0x413c80   // asm_card_star_compass()
                  || cards_data[inst->internal_card_id].code_pointer == 0x422360)       // asm_card_fellwar_stone()
              && in_play_or_in_play_and_invisible(player, card)
              && !(inst->state & STATE_TAPPED))
            dispatch_event_to_single_card(player, card, EVENT_VARIABLE_MANA_SRC, -1, -1);
        }
}
And add special cases for mana sources that can activate from off the battlefield.

It's still called from Magic.exe in reassess_all_cards()@0x472260, so you'll need to replace the executable version too, not just the one called from C.
User avatar
Korath
DEVELOPER
 
Posts: 3707
Joined: 02 Jun 2013, 05:57
Has thanked: 496 times
Been thanked: 1106 times

Re: [confirmed]Wolf of Devil's Breach partial payment

Postby drool66 » 26 Sep 2020, 17:20

The Elvish/Simian Spirit Guide issue is cleared up and count_mana() taken out of exe. See here.
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times


Return to Bug Reports

Who is online

Users browsing this forum: No registered users and 35 guests


Who is online

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

Login Form