It is currently 16 Apr 2024, 20:28
   
Text Size

[still bug] Any player may activate vs Abeyance not working.

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

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

[still bug] Any player may activate vs Abeyance not working.

Postby Aswan jaguar » 16 Jan 2018, 16:06

Describe the Bug:
Deadly Designs when cast crashes game.fixed

Which card did behave improperly?
Deadly Designs

Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink dev 778ccb5 version - duel

What exactly should be the correct behavior/interaction?
Deadly Designs

Are any other cards possibly affected by this bug?
-
Attachments
deadly designs crash.rar
Contains also the dump file
(16.18 KiB) Downloaded 157 times
Last edited by Aswan jaguar on 26 Oct 2020, 07:04, edited 3 times in total.
Reason: retittled to current bug
---
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: Deadly Designs when cast crashes game.

Postby Aswan jaguar » 17 Oct 2020, 12:51

Deadly Designs fixed initial crash and some other big issues it had.
The most important issue now is it errors when it has 5 or more counters and triggers it's other ability. As a result of the error it disappears controllers library it does destroy it's targets afterwards.fixed

Code: Select all
int deadly_designs_legacy(int player, int card, event_t event){

   if( event == EVENT_GRAVEYARD_FROM_PLAY ){
      card_instance_t *instance = get_card_instance(player, card);

      int p = instance->targets[0].player;
      int c = instance->targets[0].card;

      if( affect_me(p, c) ){
         if( get_card_instance(p, c)->kill_code == KILL_SACRIFICE ){

            target_definition_t td;
            default_target_definition(player, card, &td, TYPE_CREATURE);
            td.allow_cancel = 2; // "Done" button
            td.illegal_abilities = instance->targets[1].player > -1 ?
                              instance->targets[1].player : KEYWORD_PROT_BLACK;

            int i;
            for(i=0; i<2; i++){
               new_pick_target(&td, "TARGET_CREATURE", i, 0);
            }
            for(i=0; i<instance->number_of_targets; i++){
               if( validate_target(player, card, &td, i) ){
                  kill_card(instance->targets[i].player, instance->targets[i].card, KILL_DESTROY);
               }
            }
         }
         kill_card(player, card, KILL_EXILE);
      }
   }

   return 0;
}

int deadly_designs_effect(int player, int card, event_t event){

   if( event == EVENT_STATIC_EFFECTS && affect_me(player, card) ){
      card_instance_t *instance = get_card_instance(player, card);
      if( instance->targets[0].player > -1 ){
         if( get_id(instance->targets[0].player, instance->targets[0].card) != CARD_ID_DEADLY_DESIGNS ){
            kill_card(player, card, KILL_EXILE);
         }
         if( ! in_play(instance->targets[0].player, instance->targets[0].card) ){
            kill_card(player, card, KILL_EXILE);
         }
      }
   }

   /*if( trigger_condition == TRIGGER_LEAVE_PLAY ){
      card_instance_t *instance = get_card_instance(player, card);

      int p = instance->targets[0].player;
      int c = instance->targets[0].card;

      if( affect_me(p, c) && reason_for_trigger_controller == player ){
         if( event == EVENT_TRIGGER ){
            event_result |= RESOLVE_TRIGGER_MANDATORY;
         }

         if( event == EVENT_RESOLVE_TRIGGER ){
            kill_card(player, card, KILL_EXILE);
         }
      }
   }*/

    if( get_card_instance(player, card)->targets[0].player != -1 ){
      card_instance_t *instance = get_card_instance(player, card);

      int p = instance->targets[0].player;
      int c = instance->targets[0].card;

      if( ! IS_GAA_EVENT(event) ){
         return 0;
      }

      if( event == EVENT_CAN_ACTIVATE || event == EVENT_ACTIVATE ){
         return generic_activated_ability(player, card, event, 0, MANACOST_X(2), 0, NULL, NULL);
      }

      if( event == EVENT_RESOLVE_ACTIVATION ){
         add_counter(p, c, COUNTER_PLOT);
      }
   //return granted_generic_activated_ability(player, card, p, c, event, 0, MANACOST_X(2), 0, NULL, NULL);
   }
   return 0;
}

int card_deadly_designs(int player, int card, event_t event){
   /* Deadly Designs   |1|B   0x200f09d
    * Enchantment
    * |2: Put a plot counter on ~. Any player may activate this ability.
    * When there are five or more plot counters on ~, sacrifice it. If you do, destroy up to two target creatures. */

   if( event == EVENT_STATIC_EFFECTS && affect_me(player, card) ){
      if( ! is_humiliated(player, card) && count_counters(player, card, COUNTER_PLOT) >= 5 ){
         if( ! check_special_flags2(player, card, SF2_CANNOT_BE_SACRIFICED) ){
            int legacy = create_legacy_effect(player, card, &deadly_designs_legacy);
            card_instance_t *leg = get_card_instance(player, legacy);
            leg->targets[0].player = player;
            leg->targets[0].card = card;
            leg->number_of_targets = 0;
            leg->targets[1].player = get_protections_from(player, card);

            kill_card(player, card, KILL_SACRIFICE);
         }
      }

      int marked[2] = {-1, -1};
      CYCLE_ALL_CARDS(p, c,    {
                           if( in_play(p, c) && is_what(p, c, TYPE_EFFECT) ){
                              card_instance_t *inst = get_card_instance(p, c);
                              if( inst->info_slot == (int)deadly_designs_effect ){
                                 if( inst->targets[0].player == player && inst->targets[0].card == card )
                                 {
                                    marked[p] = c;
                                 }
                              }
                           }
                        }
      );

      if( marked[player] > -1 ){
         kill_card(player, marked[player], KILL_EXILE);
      }

      if( marked[1-player] == -1 ){
         int fake = add_card_to_hand(1-player, get_card_instance(player, card)->internal_card_id);
         int legacy = create_legacy_activate(1-player, fake, &deadly_designs_effect);
         card_instance_t *inst = get_card_instance(1-player, legacy);
         inst->targets[0].player = player;
         inst->targets[0].card = card;
         inst->number_of_targets = 1;
         obliterate_card(1-player, fake);
      }
   }

   if( ! IS_GAA_EVENT(event) ){
      return global_enchantment(player, card, event);
   }

   if( event == EVENT_RESOLVE_ACTIVATION ){
      card_instance_t *instance = get_card_instance(player, card);
      add_counter(instance->parent_controller, instance->parent_card, COUNTER_PLOT);
   }
    return generic_activated_ability(player, card, event, 0, MANACOST_X(2), 0, NULL, NULL);
}
1st error | Open
bad parameters
get_card_instance(1, -1)
0: 0x0254DB68
1: 0x025015FE
2: 0x0250D7AF
3: 0x02513D43
4: 0x02449C55
5: 0x0255E015
6: 0x0253AB7D
7: 0x0253ABDF
8: 0x0253B192
9: 0x0253B1F5
10: 0x0250F389
11: 0x004368F9
12: 0x0250F918
13: 0x0043C200
14: 0x004399BD
15: 0x0047902C
16: 0x004946E9
17: 0x7C80B729

2nd error | Open
bad parameters
get_card_instance(1, -1)
0: 0x0254DB68
1: 0x025015FE
2: 0x0250281B
3: 0x02449C7D
4: 0x0255E015
5: 0x0253AB7D
6: 0x0253ABDF
7: 0x0253B192
8: 0x0253B1F5
9: 0x0250F389
10: 0x004368F9
11: 0x0250F918
12: 0x0043C200
13: 0x004399BD
14: 0x0047902C
15: 0x004946E9
16: 0x7C80B729

3nd error | Open
bad parameters
in_play(1, -1)
0: 0x0254DB68
1: 0x02501D2B
2: 0x02502829
3: 0x02449C7D
4: 0x0255E015
5: 0x0253AB7D
6: 0x0253ABDF
7: 0x0253B192
8: 0x0253B1F5
9: 0x0250F389
10: 0x004368F9
11: 0x0250F918
12: 0x0043C200
13: 0x004399BD
14: 0x0047902C
15: 0x004946E9
16: 0x7C80B729

4th error | Open
bad parameters
get_card_instance(1, -1)
0: 0x0254DB68
1: 0x025015FE
2: 0x02501D48
3: 0x0250285C
4: 0x02449C7D
5: 0x0255E015
6: 0x0253AB7D
7: 0x0253ABDF
8: 0x0253B192
9: 0x0253B1F5
10: 0x0250F389
11: 0x004368F9
12: 0x0250F918
13: 0x0043C200
14: 0x004399BD
15: 0x0047902C
16: 0x004946E9
17: 0x7C80B729

and then:
2020-10-17_155649.jpg

5th | Open
bad parameters
get_card_instance(1, -1)
0: 0x0254DB68
1: 0x025015FE
2: 0x02503754
3: 0x00410FFB
4: 0x02502839
5: 0x02449C7D
6: 0x0255E015
7: 0x0253AB7D
8: 0x0253ABDF
9: 0x0253B192
10: 0x0253B1F5
11: 0x0250F389
12: 0x004368F9
13: 0x0250F918
14: 0x0043C200
15: 0x004399BD
16: 0x0047902C
17: 0x004946E9
18: 0x7C80B729
Last edited by Aswan jaguar on 26 Oct 2020, 07:02, edited 2 times in total.
Reason: edit add 5th-strikethrough 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: Deadly Designs when cast crashes game.

Postby drool66 » 18 Oct 2020, 06:03

I got it working. Basically the main problem is the card kept going back & forth with its activation legacy when it was headed to the GY. I added a marker to targets[9] to stop this, but I feel there's a better way. Checking kill_code didn't break the loop. Marking this bug fixed, but maybe someone can improve on the code before I commit:

Code: Select all
int deadly_designs_legacy(int player, int card, event_t event){

   card_instance_t *instance = get_card_instance(player, card);

   if( other_leaves_play(player, card, instance->targets[0].player, instance->targets[0].card, event) ){

      int illegal = instance->targets[1].player;
      instance->number_of_targets = 0;

      target_definition_t td;
      default_target_definition(player, card, &td, TYPE_CREATURE);
      td.allow_cancel = 2; // "Done" button
      td.illegal_abilities = illegal > -1 ? illegal : KEYWORD_PROT_BLACK;

      pick_up_to_n_targets(&td, "TARGET_CREATURE", 2);
      int i;
      for(i=0; i<instance->number_of_targets; i++){
         if( validate_target(player, card, &td, i) ){
            kill_card(instance->targets[i].player, instance->targets[i].card, KILL_DESTROY);
         }
      }
      kill_card(player, card, KILL_EXILE);
   }

   if( event == EVENT_CLEANUP )
      kill_card(player, card, KILL_EXILE);


   return 0;
}

int deadly_designs_effect(int player, int card, event_t event){

   card_instance_t *instance = get_card_instance(player, card);

   if( event == EVENT_STATIC_EFFECTS && affect_me(player, card) && stack_size == 0 ){
      if( instance->targets[0].player > -1 ){
         if( get_id(instance->targets[0].player, instance->targets[0].card) != CARD_ID_DEADLY_DESIGNS ){
            instance->targets[0].player = instance->targets[0].card = -1;
            kill_card(player, card, KILL_EXILE);
         }
         int p, c, found = 0;
         for(p=0; p<2; p++){
            for(c=0; c <= active_cards_count[p]; c++){
               if( in_play(p, c) && p == instance->targets[0].player && c == instance->targets[0].card ){
                  found = 1;
                  break;
               }
            }
         }
         if( ! found ){
            kill_card(player, card, KILL_EXILE);
         }
      }
   }

   if( ! IS_GAA_EVENT(event) ){
      return 0;
   }

   int p = instance->targets[0].player;
   int c = instance->targets[0].card;

   if( event == EVENT_RESOLVE_ACTIVATION )
      if( instance->targets[0].player > -1 )
         add_counter(p, c, COUNTER_PLOT);

   return generic_activated_ability(player, card, event, 0, MANACOST_X(2), 0, NULL, NULL);
}

int card_deadly_designs(int player, int card, event_t event){
   /* Deadly Designs   |1|B   0x200f09d
    * Enchantment
    * |2: Put a plot counter on ~. Any player may activate this ability.
    * When there are five or more plot counters on ~, sacrifice it. If you do, destroy up to two target creatures. */

   card_instance_t *instance = get_card_instance(player, card);

   if( event == EVENT_STATIC_EFFECTS && in_play(player, card) && affect_me(player, card) ){
      if( ! (is_humiliated(player, card) & AL_TRIG) && count_counters(player, card, COUNTER_PLOT) >= 5 && stack_size == 0 && instance->targets[9].card != 66 ){
         if( ! check_special_flags2(player, card, SF2_CANNOT_BE_SACRIFICED) ){
            int legacy = create_legacy_effect(player, card, &deadly_designs_legacy);
            card_instance_t *leg = get_card_instance(player, legacy);
            leg->targets[0].player = player;
            leg->targets[0].card = card;
            leg->targets[1].player = get_protections_from(player, card);
            leg->number_of_targets = 2;
            instance->targets[9].card = 66;
            kill_card(player, card, KILL_SACRIFICE);
         }
      }
      int p;
      int c;
      int found = 0;
      for(p=0; p<2; p++){
         for(c=0; c <= active_cards_count[p]; c++){
            if( in_play(p, c) && is_what(p, c, TYPE_EFFECT) ){
               card_instance_t *inst = get_card_instance(p, c);
               if( inst->info_slot == (int)deadly_designs_effect ){
                  if( (inst->targets[0].player == player && inst->targets[0].card == card) )
                  {
                     if( p == player ){
                        kill_card(p, c, KILL_EXILE);
                     }
                     else{
                        found = 1;
                        if( p == 1 ){
                           break;
                        }
                     }
                  }
               }
            }
         }
      }
      if( ! found && instance->targets[9].card != 66 ){
         int fake = add_card_to_hand(1-player, instance->internal_card_id);
         int legacy = create_legacy_activate(1-player, fake, &deadly_designs_effect);
         card_instance_t *leg = get_card_instance(1-player, legacy);
         leg->targets[0].player = player;
         leg->targets[0].card = card;
         leg->number_of_targets = 1;
         obliterate_card(1-player, fake);
      }
   }

   if( ! IS_GAA_EVENT(event) ){
      return global_enchantment(player, card, event);
   }

   if( event == EVENT_RESOLVE_ACTIVATION ){
      add_counter(instance->parent_controller, instance->parent_card, COUNTER_PLOT);
   }

   return generic_activated_ability(player, card, event, 0, MANACOST_X(2), 0, NULL, NULL);
}
PS. this happens with things like Ifh-Biff Efreet too, it's just less obvious because it isn't made to leave the BF the way this card is
PPS. I've updated the legacy text too; will commit with the above code
User avatar
drool66
Programmer
 
Posts: 1163
Joined: 25 Nov 2010, 22:38
Has thanked: 186 times
Been thanked: 267 times

Re: [fixed] Deadly Designs when cast crashes game.

Postby FastEddie » 18 Oct 2020, 08:49

I added a marker to targets[9] to stop this, but I feel there's a better way.
After looking two minutes at the code... nah... better make it one... I would think that you could substitute the marker in targets[9] with yet another legacy. The yet another legacy would act as a marker and could be deleted when the card goes to the graveyard.
The issue you might have is that some evil tester puts Opalescence into play, then Cytoshape's the Deadly Designs into Magus of the Candelabra or something similar (didn't think it fully through whether this would actually work in Manalink but I guess brighter minds could come up with a card breaking solution).
---
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] Deadly Designs when cast crashes game.

Postby Aswan jaguar » 18 Oct 2020, 09:24

Another bug that Deadly Designs and most others that can be activated by both players (didn't test them all) that has but didn't want to try to solve before the card works correctly is that if you target with Abeyance (and make Abeyance affect effect cards which it doesn't currently) the player that doesn't control Deadly Designs so activates through the legacy the card can still activate it.
---
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: [fixed] Deadly Designs when cast crashes game.

Postby drool66 » 21 Oct 2020, 04:34

Committed in 5471091

Looking into the Abeyance issue but it is really slippery
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 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