Moratorium Stone no exile others from graveyard or battlefie
Describe the Bug:
I have fixed Moratorium Stone crash on etb and can't activate in commit b430dee.
Still 2nd ability resolution doesn't exile all other cards with the same name as exiled from all graveyards nor exiles the permanent with same name as exiled card. Exiles only the chosen card.
Moratorium Stone
Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink dev b430dee version - duel
What exactly should be the correct behavior/interaction?
Moratorium Stone, 2nd ability: Exile target nonland card from a graveyard, all other cards from graveyards with the same name as that card, and all permanents with that name.
Are any other cards possibly affected by this bug?
-
I have fixed Moratorium Stone crash on etb and can't activate in commit b430dee.
Still 2nd ability resolution doesn't exile all other cards with the same name as exiled from all graveyards nor exiles the permanent with same name as exiled card. Exiles only the chosen card.
- Code: Select all
int card_moratorium_stone(int player, int card, event_t event){
/*
Moratorium Stone |1
Artifact, 1
{2}, {T}: Exile target card from a graveyard.
{2}{W}{B}, {T}, Sacrifice Moratorium Stone: Exile target nonland card from a graveyard, all other cards from graveyards with the same name
as that card, and all permanents with that name.
*/
test_definition_t test;
new_default_test_definition(&test, TYPE_ANY, "Select target card to exile.");
test_definition_t test2;
new_default_test_definition(&test2, TYPE_LAND, "Select target nonland card to exile.");
test2.type_flag = DOESNT_MATCH;
enum{
CHOICE_EXILE = 1,
CHOICE_EXILE_ALL
};
if( event == EVENT_CAN_ACTIVATE ){
if( generic_activated_ability_with_target_in_grave(player, card, event, GAA_UNTAPPED, MANACOST_X(2), 0, NULL, NULL,
0, &test, GS_GRAVE_RECYCLER_BOTH_GRAVES) ){
return 1;
}
if( generic_activated_ability_with_target_in_grave(player, card, event, GAA_UNTAPPED, MANACOST_XBW(2, 1, 1), 0, NULL, NULL,
0, &test2, GS_GRAVE_RECYCLER_BOTH_GRAVES) ){
return 1;
}
}
if(event == EVENT_ACTIVATE ){
card_instance_t *instance = get_card_instance(player, card);
int abilities[3] = { generic_activated_ability_with_target_in_grave(player, card, EVENT_CAN_ACTIVATE, GAA_UNTAPPED, MANACOST_X(2), 0, NULL, NULL,
0, &test, GS_GRAVE_RECYCLER_BOTH_GRAVES),
generic_activated_ability_with_target_in_grave(player, card, EVENT_CAN_ACTIVATE, GAA_UNTAPPED, MANACOST_XBW(2, 1, 1), 0, NULL, NULL,
0, &test2, GS_GRAVE_RECYCLER_BOTH_GRAVES)
};
int priorities[3] = { 5,
find_target_for_moratorium_stone(player, card) ? 10 : 0
};
int choice = DIALOG(player, card, event, DLG_RANDOM, DLG_NO_STORAGE,
"Exile a card from a graveyard", abilities[0], priorities[0],
"Moratorium effect", abilities[1], priorities[1]);
if ( !choice ){
spell_fizzled = 1;
return 0;
}
if( choice == CHOICE_EXILE ){
return generic_activated_ability_with_target_in_grave(player, card, event, GAA_UNTAPPED, MANACOST_X(2), 0, NULL, NULL,
0, &test, GS_GRAVE_RECYCLER_BOTH_GRAVES);
}
if( choice == CHOICE_EXILE_ALL ){
if( player == HUMAN ){
return generic_activated_ability_with_target_in_grave(player, card, event, GAA_UNTAPPED | GAA_SACRIFICE_ME,
MANACOST_XBW(2, 1, 1), 0, NULL, NULL,
0, &test2, GS_GRAVE_RECYCLER_BOTH_GRAVES);
}
else{
int result = find_target_for_moratorium_stone(player, card);
if( result ){
int t_player = BYTE1(result);
int pos = BYTE2(result);
instance->targets[0].player = t_player;
instance->targets[1].player = pos;
instance->targets[1].card = graveyard_source[t_player][pos];
return generic_activated_ability(player, card, event, GAA_UNTAPPED | GAA_SACRIFICE_ME, MANACOST_XBW(2, 1, 1), 0,
NULL, NULL);
}
}
}
}
if( event == EVENT_RESOLVE_ACTIVATION ){
card_instance_t *instance = get_card_instance(player, card);
int selected = validate_target_from_grave_source(player, card, instance->targets[0].player, 1);
if( selected != -1 ){
int csvid = cards_data[get_grave(instance->targets[0].player)[selected]].id;
rfg_card_from_grave(instance->targets[0].player, selected);
if( instance->info_slot == CHOICE_EXILE_ALL ){
rfg_id_from_grave(ANYBODY, csvid);
test_definition_t this_test2;
default_test_definition(&this_test2, TYPE_PERMANENT);
this_test2.id = csvid;
APNAP(p, { new_manipulate_all(player, card, p, &this_test2, KILL_EXILE); };);
}
}
}
return 0;
}
- Code: Select all
static int rfg_id_from_grave(int player, int id){
int i;
int result = 0;
for(i=0; i<2; i++){
if( i == player || player == 2 ){
const int *grave = get_grave(i);
int count = count_graveyard(i)-1;
while( count > -1 ){
if( cards_data[grave[count]].id == id ){
rfg_card_from_grave(i, count);
result++;
}
count--;
}
}
}
return result;
}
Moratorium Stone
Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink dev b430dee version - duel
What exactly should be the correct behavior/interaction?
Moratorium Stone, 2nd ability: Exile target nonland card from a graveyard, all other cards from graveyards with the same name as that card, and all permanents with that name.
Are any other cards possibly affected by this bug?
-