Fixed in commit c1cafc75.
DLG_RANDOM crashed even if I set 1st priority > 1000000 so AI
selects only that and even if I set 2nd priority a negative value -1 so
it can't select the 2nd one. (this is supposed to work however right?)
DLG_RANDOM crashed anyway I tried unless it was together with DLG_NO_STORAGE.
AI isn't able (I don't know if it was able as designed earlier but crashed) to activate the untap ability if tapped: to block a creature that will set AI's life to 0 or less if not blocked or do it to block and kill opponent's creature or to fizzle an
Assassinate that targets the tapped
Cinderhaze Wretch and so save it if 3/2 or bigger of course.
Current code with only DLG_RANDOM substituted by DLG_NO_STORAGE:
- Code: Select all
int card_cinderhaze_wretch(int player, int card, event_t event){
/*
Cinderhaze Wretch |4|B
Creature — Elemental Shaman 3/2
{T}: Target player discards a card. Activate this ability only during your turn.
Put a -1/-1 counter on Cinderhaze Wretch: Untap Cinderhaze Wretch.
*/
if( ! IS_GAA_EVENT(event) ){
return 0;
}
target_definition_t td;
default_target_definition(player, card, &td, 0);
td.zone = TARGET_ZONE_PLAYERS;;
card_instance_t *instance = get_card_instance(player, card);
enum{
CHOICE_DISCARD = 1,
CHOICE_UNTAP
};
if( event == EVENT_CAN_ACTIVATE ){
if( generic_activated_ability(player, card, event, GAA_CAN_TARGET | GAA_IN_YOUR_TURN | GAA_UNTAPPED, MANACOST0, 0, &td, NULL) )
{
return 1;
}
return generic_activated_ability(player, card, event, 0, MANACOST0, 0, NULL, NULL);
}
if(event == EVENT_ACTIVATE ){
int abils[3] = {
0,
generic_activated_ability(player, card, EVENT_CAN_ACTIVATE, GAA_CAN_TARGET | GAA_IN_YOUR_TURN | GAA_UNTAPPED,
MANACOST0, 0, &td, NULL),
generic_activated_ability(player, card, EVENT_CAN_ACTIVATE, 0, MANACOST0, 0, NULL, NULL)
};
int priority_untap = is_tapped(player, card) && get_toughness(player, card) > 1 ? 10 : 1;
int choice = DIALOG(player, card, event, DLG_NO_STORAGE,
"Target player discard", abils[1], 5,
"Untap Cinderhaze Wretch", abils[2], priority_untap);
if( ! choice ){
spell_fizzled = 1;
return 0;
}
if( choice == CHOICE_DISCARD ){
return generic_activated_ability(player, card, event, GAA_CAN_TARGET | GAA_IN_YOUR_TURN | GAA_UNTAPPED, MANACOST0, 0,
&td, "TARGET_PLAYER");
}
if( choice == CHOICE_UNTAP ){
generic_activated_ability(player, card, event, 0, MANACOST0, 0, NULL, NULL);
if( spell_fizzled != 1 ){
add_counter(player, card, COUNTER_M1_M1);
}
}
}
if( event == EVENT_RESOLVE_ACTIVATION ){
if( instance->info_slot == CHOICE_DISCARD && valid_target(&td) ){
discard(instance->targets[0].player, 0, player);
}
if( instance->info_slot == CHOICE_UNTAP ){
untap_card(instance->parent_controller, instance->parent_card);
}
}
return 0;
}