Page 1 of 1

[fixed]Radjan Spirit 's ability doesn't remove flying.

PostPosted: 21 Mar 2017, 15:12
by Aswan jaguar
Describe the Bug:
1- Radjan Spirit 's ability doesn't remove flying from targeted creature.
2- Radjan Spirit 's ability creates a legacy that doesn't go away at eot.
Which card did behave improperly?
Radjan Spirit

Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink 2016/08/27: Eldritch Moon v2, duel

What exactly should be the correct behavior/interaction?
1- Radjan Spirit 's ability removes flying from targeted creature.
2- Radjan Spirit 's ability lasts till eot.
Are any other cards possibly affected by this bug?
-

Re: [confirmed]Radjan Spirit 's ability doesn't remove flyin

PostPosted: 28 Jun 2019, 13:45
by Aswan jaguar
I fixed this and all negate_ abilities by removing the check_status() from legacy_negate_ability_and_special_ability that was messing things up. Korath if check_status(player, card, STATUS_CONTROLLED) is needed to help with cases of control please help me to do this correctly if possible.
The code before the removal of check_status():
Code: Select all
int legacy_negate_ability_and_special_ability(int player, int card, event_t event){

   if (event == EVENT_ABILITIES && check_status(player, card, STATUS_CONTROLLED)){
      card_instance_t *instance = get_card_instance(player, card);
      if( instance->damage_target_player > -1 ){
         if (affect_me(instance->damage_target_player, instance->damage_target_card)){
            if( instance->targets[1].player > -1 ){
               event_result &= ~instance->targets[1].player;
            }
            if( instance->targets[1].card > -1 ){
               remove_special_ability(player, card, instance->targets[1].card);
            }
         }
      }
   }

   if( event == EVENT_CLEANUP ){
      card_instance_t *instance = get_card_instance(player, card);
      if( instance->targets[1].player > -1 && (instance->targets[1].player & 1) ){
         effect_on_all_negate_ability_and_special_ability_legacy_attached_to_me(instance->damage_target_player, instance->damage_target_card, 1);
      }
      kill_card(player, card, KILL_EXILE);
   }

   return 0;
}

Re: [confirmed]Radjan Spirit 's ability doesn't remove flyin

PostPosted: 28 Jun 2019, 14:26
by Korath
The thing STATUS_CONTROLLED does in the executable is mark which of a set of mutually-exclusive effects is active. It's set, for example, on exactly one control-changing effect or Aura card attached to each controlled permanent (to indicate whether a change of control will happen if the effect wears off or the Aura is disenchanted); on exactly one base power/toughness-changing effect like Sorceress Queen's (so that if you queen a Hill Giant twice, only one of the Sorceress Queen effects changes its p/t by -3/-1, not both); on Raging River, so that if there are multiple copies on the bf, only one of them makes you choose which side to pick for each nonflying creature (though apparently the correct behavior would be to choose "left" or "right" for each creature separately for each Raging River).

Comments in effect_on_all_negate_ability_and_special_ability_legacy_attached_to_me() seem to indicate Gargaroz's new change-of-control system shares implementation with removal of abilities. Or perhaps that parts of the one were cut-and-pasted from the other. The whole change-of-control system in Magic.exe is held together with popsicle sticks and bubblegum, and Gargaroz's rewrite doesn't actually fix any of it, just hides it behind a curtain so it can be (mostly) safely ignored, so I'd be very leary of changing anything related to it without a great deal of testing.

So for the purpose of this functionality - merely removing abilities - my advice is to ignore what's there and start over. Write a simple effect card that does nothing except remove the abilities, and use that instead. It'll look essentially like legacy_negate_ability_and_special_ability(), without
  • the STATUS_CONTROLLED check, and
  • the call to effect_on_all_negate_ability_and_special_ability_legacy_attached_to_me() just before it removes itself at end-of-turn.

Re: [confirmed]Radjan Spirit 's ability doesn't remove flyin

PostPosted: 28 Jun 2019, 15:43
by Aswan jaguar
Fixed this as suggested ( hopefully I followed instructions correctly - seems good in simple tests) in commit dcfbf873.

Re: [fixed]Radjan Spirit 's ability doesn't remove flying.

PostPosted: 18 Jul 2019, 19:31
by Korath
This broke the build; fixed in 22b5019a2.