[fix]Shattergang Brothers abilities when resolve not correct
Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins
[fix]Shattergang Brothers abilities when resolve not correct
by Aswan jaguar » 22 Jul 2019, 09:48
Describe the Bug:
I have fixed a crash when Shattergang Brothers entering the battlefield in commit a106c2a6.
They still have a problem in resolution which I don't know how to fix.
Opponent (tested only AI-not human) AI will sacrifice anything including special cards - rules engine instead of the ability you choose.
Current code:
Shattergang Brothers
Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink dev version a106c2a6.
What exactly should be the correct behavior/interaction?
Shattergang Brothers, sacrifice creature or artifact or enchantment depending what ability was chosen.
Are any other cards possibly affected by this bug?
-
I have fixed a crash when Shattergang Brothers entering the battlefield in commit a106c2a6.
They still have a problem in resolution which I don't know how to fix.
Opponent (tested only AI-not human) AI will sacrifice anything including special cards - rules engine instead of the ability you choose.
Current code:
- Code: Select all
int card_shattergang_brothers(int player, int card, event_t event ){
/*
Shattergang Brothers |1|B|R|G
Legendary Creature — Goblin Artificer 3/3
{2}{B}, Sacrifice a creature: Each other player sacrifices a creature.
{2}{R}, Sacrifice an artifact: Each other player sacrifices an artifact.
{2}{G}, Sacrifice an enchantment: Each other player sacrifices an enchantment.
*/
check_legend_rule(player, card, event);
if( ! IS_GAA_EVENT(event) ){
return 0;
}
enum{
CHOICE_SAC_CREATURE = 1,
CHOICE_SAC_ARTIFACT,
CHOICE_SAC_ENCHANTMENT
};
card_instance_t *instance = get_card_instance(player, card);
if( event == EVENT_CAN_ACTIVATE ){
if( generic_activated_ability(player, card, event, GAA_SACRIFICE_CREATURE, MANACOST_XB(2, 1), 0, NULL, NULL) ){
return 1;
}
if( can_sacrifice_type_as_cost(player, 1, TYPE_ARTIFACT) ){
return generic_activated_ability(player, card, event, 0, MANACOST_XR(2, 1), 0, NULL, NULL);
}
if( can_sacrifice_type_as_cost(player, 1, TYPE_ENCHANTMENT) ){
return generic_activated_ability(player, card, event, 0, MANACOST_XG(2, 1), 0, NULL, NULL);
}
}
if( event == EVENT_ACTIVATE ){
int abils[4] = {
0,
generic_activated_ability(player, card, EVENT_CAN_ACTIVATE, GAA_SACRIFICE_CREATURE, MANACOST_XB(2, 1), 0,
NULL, NULL),
can_sacrifice_type_as_cost(player, 1, TYPE_ARTIFACT) &&
generic_activated_ability(player, card, EVENT_CAN_ACTIVATE, 0, MANACOST_XR(2, 1), 0, NULL, NULL),
can_sacrifice_type_as_cost(player, 1, TYPE_ENCHANTMENT) &&
generic_activated_ability(player, card, EVENT_CAN_ACTIVATE, 0, MANACOST_XG(2, 1), 0, NULL, NULL)
};
int priorities[4] = {
0,
count_subtype(1-player, TYPE_CREATURE, -1) ?
5+(5*(count_subtype(player, TYPE_CREATURE, -1)-count_subtype(1-player, TYPE_CREATURE, -1))) : 0,
count_subtype(1-player, TYPE_ARTIFACT, -1) ?
5+(5*(count_subtype(player, TYPE_ARTIFACT, -1)-count_subtype(1-player, TYPE_ARTIFACT, -1))) : 0,
count_subtype(1-player, TYPE_ENCHANTMENT, -1) ?
5+(5*(count_subtype(player, TYPE_ENCHANTMENT, -1)-count_subtype(1-player, TYPE_ENCHANTMENT, -1))) : 0
};
int choice = DIALOG(player, card, event, DLG_RANDOM, DLG_NO_STORAGE,
"Sac a creature", abils[1], priorities[1],
"Sac an artifact", abils[2], priorities[2],
"Sac an enchantment", abils[3], priorities[3]);
if( ! choice ){
spell_fizzled = 1;
return 0;
}
if( choice == CHOICE_SAC_CREATURE ){
return generic_activated_ability(player, card, event, GAA_SACRIFICE_CREATURE, MANACOST_XB(2, 1), 0, NULL, NULL);
}
if( choice == CHOICE_SAC_ARTIFACT ){
test_definition_t test;
default_test_definition(&test, TYPE_ARTIFACT);
int sac = new_sacrifice(player, card, player, SAC_AS_COST|SAC_RETURN_CHOICE, &test);
generic_activated_ability(player, card, event, 0, MANACOST_XR(2, 1), 0, NULL, "TARGET_ARTIFACT");
if( spell_fizzled != 1 ){
kill_card(BYTE2(sac), BYTE3(sac), KILL_SACRIFICE);
}
}
if( choice == CHOICE_SAC_ENCHANTMENT ){
test_definition_t test;
default_test_definition(&test, TYPE_ENCHANTMENT);
int sac = new_sacrifice(player, card, player, SAC_AS_COST|SAC_RETURN_CHOICE, &test);
generic_activated_ability(player, card, event, 0, MANACOST_XG(2, 1), 0, NULL, "TARGET_ENCHANTMENT");
if( spell_fizzled != 1 ){
kill_card(BYTE2(sac), BYTE3(sac), KILL_SACRIFICE);
}
}
}
if( event == EVENT_RESOLVE_ACTIVATION ){
int types[4] = { 0, TYPE_CREATURE, TYPE_ARTIFACT, TYPE_ENCHANTMENT };
test_definition_t test;
default_test_definition(&test, types[instance->info_slot]);
new_sacrifice(player, card, 1-player, SAC_CAUSED | SAC_NO_CANCEL, &test);
}
return 0;
}
Shattergang Brothers
Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink dev version a106c2a6.
What exactly should be the correct behavior/interaction?
Shattergang Brothers, sacrifice creature or artifact or enchantment depending what ability was chosen.
Are any other cards possibly affected by this bug?
-
Last edited by Aswan jaguar on 23 Jun 2022, 18:50, edited 1 time in total.
Reason: fixed
Reason: fixed
---
Trying to squash some bugs and playtesting.
Trying to squash some bugs and playtesting.
-
Aswan jaguar - Super Tester Elite
- Posts: 8078
- Joined: 13 May 2010, 12:17
- Has thanked: 730 times
- Been thanked: 458 times
Re: Shattergang Brothers abilities when resolve not correct
by Aswan jaguar » 23 Jun 2022, 18:50
Fixed in commit fe5d62a.
---
Trying to squash some bugs and playtesting.
Trying to squash some bugs and playtesting.
-
Aswan jaguar - Super Tester Elite
- Posts: 8078
- Joined: 13 May 2010, 12:17
- Has thanked: 730 times
- Been thanked: 458 times
2 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 28 guests