It is currently 14 May 2025, 03:35
   
Text Size

[fixed]Attacking opponent with several Planeswalkers

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

[fixed]Attacking opponent with several Planeswalkers

Postby FastEddie » 16 May 2020, 10:18

Describe the Bug:
I attack an opponent with 4 Planeswalkers in play. I get asked whether to attack the opponent or a Planeswalker. If I want to attack the opponent I have to click/press Enter 4 times instead of once. This doesn't happen when attacking Planeswalkers.
The mechanics work. This is merely an issue of the user interface.

Which card behaved improperly?
All attacking creatures.

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

What exactly should be the correct behavior/interaction?
When attacking an opponent with 4 Planeswalkers in play I should click/press Enter only once to attack the opponent.

Are any other cards possibly affected by this bug?
NA
Attachments
AttackPlaneswalkers.zip
(3.71 KiB) Downloaded 191 times
Last edited by Aswan jaguar on 16 Aug 2020, 12:14, edited 2 times in total.
Reason: fixed
---
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]Attacking opponent with several Planeswalkers

Postby Aswan jaguar » 16 May 2020, 15:21

Yes, when choosing to attack a player it prompts as many times as the planeswalkers opponent has.
---
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]Attacking opponent with several Planeswalkers

Postby FastEddie » 14 Aug 2020, 17:57

The issue is that every Planeswalker catches the message that the attack phase began and every Planeswalker reacts to that (i.e. letting the player choose whom to attack) without telling the other Planeswalkers about doing so. This fixes it, I used targets[8] as storage. It is set when a creature attacks and reset once the choice for the attacking creature is fixed. Then set again for the next attacking creature and so on.

This is the relevant code piece:

Code: Select all
   // when creatures attack, prompt for who they attack
   if( trigger_condition == TRIGGER_PAY_TO_ATTACK && current_phase == PHASE_DECLARE_ATTACKERS && current_turn == 1-player){
      if( affect_me( trigger_cause_controller, trigger_cause ) && reason_for_trigger_controller == affected_card_controller ){
         if( ! check_special_flags(trigger_cause_controller, trigger_cause, SF_ATTACKING_PWALKER) ){
            if(event == EVENT_TRIGGER ){
               event_result |= RESOLVE_TRIGGER_MANDATORY;
            }
            else if(event == EVENT_RESOLVE_TRIGGER){
// new code starts here
               if ( (instance->targets[8].player == -1) && (instance->targets[8].card == -1) ) {
                  // Inform other Planeswalkers that we chose the attacker
                  int count;
                  card_instance_t* otherPlaneswalker;
                  for (count = 0; count < active_cards_count[player]; ++count){
                     if( in_play(player, count) && is_planeswalker(player, count) ){
                        // Don't affect yourself
                        if (count != card) {
                           otherPlaneswalker = get_card_instance(player, count);
                           otherPlaneswalker->targets[8].player = player;
                           otherPlaneswalker->targets[8].card = card;
                        }
                     }
                  }
// original function call                  
                 choose_who_attack(affected_card_controller, affected_card);
               } else {
                  instance->targets[8].player = instance->targets[8].card = -1;
               }
// new code ends here
            }
         }
      }
   }
Attachments
planeswalker.zip
(656 Bytes) Downloaded 180 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]Attacking opponent with several Planeswalkers

Postby Aswan jaguar » 15 Aug 2020, 11:21

I ran few tests and this seems fine. I will commit it in few hours. Nice job FastEddie. I looked if I could find a way so this piece of code can honor "can't attack you" effects like Propaganda paid costs and non paid ones:
viewtopic.php?f=86&t=18704&p=197646&hilit=planeswalker#p197645
This comment in defs.h seems related to make above work:
TRIGGER_ATTACKER_CHOSEN = 0xDE, // Triggers as each attacker is chosen. Infuriatingly, it's dispatched after PAY_TO_ATTACK when a human attacks, but before when the AI does.
---
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]Attacking opponent with several Planeswalkers

Postby FastEddie » 15 Aug 2020, 11:38

I will have a look at this soon. There is also another piece of code that drew my attention, not a bug but still weird:

Code: Select all
      /* Change effect display to the planeswalker by brute force - legacy_name() doesn't get called if we just call
       * create_targeted_legacy_effect(1-player, planeswalkers[choice], &attacking_planeswalker, player, card) above and I'm not sure why yet. */
      leg->display_pic_csv_id = get_id(1 - player, planeswalkers[choice][0]);
      leg->display_pic_num = get_card_image_number(leg->display_pic_csv_id, 1 - player, planeswalkers[choice][0]);
Right now I am looking into why Three Dreams doesn't work properly whereas Gifts Ungiven does...
---
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]Attacking opponent with several Planeswalkers

Postby Aswan jaguar » 16 Aug 2020, 12:14

Original bug fixed by FastEddie in commit b522cde.
For Propaganda bug there is already report and posts have to be posted there. I have already moved there previous post by FastEddie which belongs there:
viewtopic.php?f=86&t=18704
---
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 33 guests


Who is online

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

Login Form