[fixed]Karn Liberated game restart
Moderators: BAgate, drool66, Aswan jaguar, gmzombie, stassy, CCGHQ Admins
[fixed]Karn Liberated game restart
by gnomefry » 26 Jul 2020, 15:45
Describe the Bug:
Karn Liberated's 'restart the game' ability does not restart the game with non-aura permanents exiled by Karn in play on your side.
Instead, the game restarts with an empty battlefield and both players have 18 card hands.
Which card behaved improperly?
Karn Liberated
Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
version 6-2020 v3 a8bbff706 - gauntlet
What exactly should be the correct behavior/interaction?
Restart the game, leaving in exile all non-aura permanent cards exiled with Karn Liberated. Then put those cards onto the battlefield under your control.
Are any other cards possibly affected by this bug?
No.
Karn Liberated's 'restart the game' ability does not restart the game with non-aura permanents exiled by Karn in play on your side.
Instead, the game restarts with an empty battlefield and both players have 18 card hands.
Which card behaved improperly?
Karn Liberated
Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
version 6-2020 v3 a8bbff706 - gauntlet
What exactly should be the correct behavior/interaction?
Restart the game, leaving in exile all non-aura permanent cards exiled with Karn Liberated. Then put those cards onto the battlefield under your control.
Are any other cards possibly affected by this bug?
No.
- Attachments
-
- karnliberated.rar
- (2.34 KiB) Downloaded 145 times
Last edited by drool66 on 13 Mar 2021, 23:30, edited 4 times in total.
Reason: fixed
Reason: fixed
Re: Karn Liberated game restart
by Aswan jaguar » 05 Aug 2020, 09:24
Was this the second time you used his ultimate ability in this game?
---
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: [confirmed]Karn Liberated game restart
by Aswan jaguar » 08 Aug 2020, 15:55
I have fixed Karn Liberated didn't put permanents on library and didn't shuffle graveyard into deck. Not pushed I can't connect to server.
The rest is beyond my abilities:
I think it needs work on the targeted arrays so it will put the non aura permanent cards exiled with it onto the battlefield under your control.
I added remove_card_from_rfg() where necessary which still needs correct arrays to work though.
Current code:
The rest is beyond my abilities:
I think it needs work on the targeted arrays so it will put the non aura permanent cards exiled with it onto the battlefield under your control.
I added remove_card_from_rfg() where necessary which still needs correct arrays to work though.
Current code:
- Code: Select all
int card_karn_liberated(int player, int card, event_t event){
/* Karn Liberated
* |7
* Planeswalker - Karn (6)
* +4: Target player exiles a card from his or her hand.
* -3: Exile target permanent.
* -14: Restart the game, leaving in exile all non-Aura permanent cards exiled with ~. Then put those cards onto the battlefield under your control. */
check_legend_rule(player, card, event);
if (IS_ACTIVATING(event)){
card_instance_t* instance = get_card_instance(player, card);
target_definition_t td;
default_target_definition(player, card, &td, 0);
td.zone = TARGET_ZONE_PLAYERS;
target_definition_t td1;
default_target_definition(player, card, &td1, TYPE_PERMANENT);
enum{
CHOICE_EXILE_CARD_IN_HAND = 1,
CHOICE_EXILE_PERMANENT,
CHOICE_RESTART_GAME,
};
int choice = DIALOG(player, card, event, DLG_RANDOM, DLG_PLANESWALKER,
"Exile a card in target's hand", can_target(&td), would_validate_arbitrary_target(&td, 1-player, -1) && hand_count[1-player] ? 15 : 0, 4,
"Exile a permanent", can_target(&td1), 10, -3,
"Restart the game", 1, 20, -14);
if (event == EVENT_CAN_ACTIVATE)
{
if (!choice)
return 0;
}
else if (event == EVENT_ACTIVATE)
{
instance->number_of_targets = 0;
switch (choice)
{
case CHOICE_EXILE_CARD_IN_HAND:
pick_target(&td, "TARGET_PLAYER");
break;
case CHOICE_EXILE_PERMANENT:
pick_target(&td1, "TARGET_PERMANENT");
break;
case CHOICE_RESTART_GAME:
{
if( ! count_counters(player, card, COUNTER_LOYALTY) || ! in_play(player, card) ){
instance->targets[1].card = exiledby_detach(player, card);
}
break;
}
}
}
else // event == EVENT_RESOLVE_ACTIVATION
switch (choice)
{
case CHOICE_EXILE_CARD_IN_HAND:
{
if( valid_target(&td)){
if( hand_count[instance->targets[0].player] ){
int selected = -1;
test_definition_t this_test;
if( instance->targets[0].player == HUMAN ){
default_test_definition(&this_test, TYPE_ANY);
selected = new_select_a_card(instance->targets[0].player, instance->targets[0].player, TUTOR_FROM_HAND, 1, AI_MIN_VALUE, -1, &this_test);
}
else{
default_test_definition(&this_test, TYPE_PERMANENT);
this_test.type_flag = DOESNT_MATCH;
selected = new_select_a_card(instance->targets[0].player, instance->targets[0].player, TUTOR_FROM_HAND, 1, AI_MIN_VALUE, -1, &this_test);
if( selected == -1 ){
default_test_definition(&this_test, TYPE_ANY);
selected = new_select_a_card(instance->targets[0].player, instance->targets[0].player, TUTOR_FROM_HAND, 1, AI_MIN_VALUE, -1, &this_test);
}
}
if( in_play(instance->parent_controller, instance->parent_card) ){
exile_card_and_remember_it_on_exiledby(instance->parent_controller, instance->parent_card,
instance->targets[0].player, selected);
}
else{
rfg_card_in_hand(instance->targets[0].player, instance->targets[0].card);
}
}
}
}
break;
case CHOICE_EXILE_PERMANENT:
{
if( valid_target(&td1)){
if( ! is_token(instance->targets[0].player, instance->targets[0].card) &&
in_play(instance->parent_controller, instance->parent_card) )
{
exile_card_and_remember_it_on_exiledby(instance->parent_controller, instance->parent_card,
instance->targets[0].player, instance->targets[0].card);
}
else{
kill_card(instance->targets[0].player, instance->targets[0].card, KILL_EXILE);
}
}
}
break;
case CHOICE_RESTART_GAME:
{
int exby_player = instance->targets[1].card > -1 ? player-2 : player;
int exby_card = instance->targets[1].card > -1 ? instance->targets[1].card : card;
int exiled_by_karn[2][18];
int exc[2] = {0, 0};
int leg = 0;
int idx = 0;
int* loc;
while ((loc = exiledby_find_any(exby_player, exby_card, &leg, &idx)) != NULL){
int owner = (*loc & 0x80000000) ? 1 : 0;
int iid = *loc & ~0x80000000;
*loc = -1;
exiled_by_karn[owner][exc[owner]] = iid;
exc[owner]++;
}
// approximation for "restart the game"
APNAP(p,{
int c;
for(c=active_cards_count[p]-1; c>-1; c--){
if( in_play(p, c) && is_what(p, c, TYPE_ENCHANTMENT) && has_subtype(p, c, SUBTYPE_AURA) ){
put_on_top_of_deck(p, c);
}
}
};
);
APNAP(p,{
int c;
for(c=active_cards_count[p]-1; c>-1; c--){
if( in_hand(p, c) ){
put_on_top_of_deck(p, c);
}
if( in_play(p, c) ){
if( is_what(p, c, TYPE_EFFECT) && get_original_internal_card_id(p, c) != activation_card ){
kill_card(p, c, KILL_EXILE);
}
if( is_what(p, c, TYPE_PERMANENT) ){
put_on_top_of_deck(p, c);
}
}
}
};
);
APNAP(p,{
reshuffle_grave_into_deck(p, 1);
};
);
APNAP(p,{
life[p] = get_starting_life_total(p);
raw_set_poison(p, 0);
raw_set_experience(p, 0);
player_counters[player].energy_ = 0;
};
);
APNAP(p,{
int i;
for(i=0; i<exc[p]; i++){
if( ! is_what(-1, exiled_by_karn[p][i], TYPE_PERMANENT) ){
raw_put_iid_on_top_of_deck(p, exiled_by_karn[p][i]);
exiled_by_karn[p][i] = -1;
}
}
};
);
APNAP(p,{
shuffle(p);
draw_cards(p, 7);
};
);
APNAP(p,{
int i;
for(i=0; i<exc[p]; i++){
if( exiled_by_karn[p][i] > -1 ){
if( ! has_subtype_by_id(cards_data[exiled_by_karn[p][i]].id, SUBTYPE_AURA) ){
int card_added = add_card_to_hand(player, exiled_by_karn[p][i]);
if( p != player ){
if( player == AI ){
remove_state(player, card_added, STATE_OWNED_BY_OPPONENT);
}
else{
add_state(player, card_added, STATE_OWNED_BY_OPPONENT);
}
}
exiled_by_karn[p][i] = -1;
remove_card_from_rfg(player, cards_data[exiled_by_karn[p][i]].id);
put_into_play(player, card_added);
}
}
}
};
);
APNAP(p,{
int i;
for(i=0; i<exc[p]; i++){
if( exiled_by_karn[p][i] > -1 ){
int card_added = add_card_to_hand(player, exiled_by_karn[p][i]);
if( p != player ){
if( player == AI ){
remove_state(player, card_added, STATE_OWNED_BY_OPPONENT);
}
else{
add_state(player, card_added, STATE_OWNED_BY_OPPONENT);
}
}
exiled_by_karn[p][i] = -1;
remove_card_from_rfg(player, cards_data[exiled_by_karn[p][i]].id);
put_into_play(player, card_added);
}
}
};
);
}
break;
}
}
return planeswalker(player, card, event, 6);
}
---
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: [confirmed]Karn Liberated game restart
by gnomefry » 10 Aug 2020, 19:42
Can you model his coding from the older Manalink EMN version? Karn Liberated was fully functional in that build. Each exiled permanent/card-in-hand was tracked via a legacy effect card and his game restart ability properly ignored the exiled instants/interrupts, putting just the permanents back into play on your side.
I'll attach a couple saves. These are Manalink-Eldritch Moon savegames with a working Karn.
I'll attach a couple saves. These are Manalink-Eldritch Moon savegames with a working Karn.
- Attachments
-
- karn2_emn.rar
- Karn with a stack of exiled perms/non-perms and enough counters to use his game restart ability where perms come back into play and others ignored.
- (2.42 KiB) Downloaded 136 times
-
- karn1_emn.rar
- Karn just cast. To show his exiled-card tracking.
- (2.21 KiB) Downloaded 143 times
Re: [confirmed]Karn Liberated game restart
by drool66 » 12 Mar 2021, 05:55
Fixed in ffd413a
The latest images for Manalink will be here.
The latest Manalink installation directory will be here. Well, not quite, anymore. Check the latest patches.
The latest Manalink installation directory will be here. Well, not quite, anymore. Check the latest patches.
-
drool66 - Programmer
- Posts: 1163
- Joined: 25 Nov 2010, 22:38
- Has thanked: 186 times
- Been thanked: 267 times
Re: [fixed]Karn Liberated game restart
by Aswan jaguar » 13 Mar 2021, 14:59
These bugs have been fixed if Karn Liberated has more than 14 loyalty when activates if it has 14 as much needed for restart ability then the exiled cards don't return under Karn Liberated 's controller control. The shuffle and draw are still fine.
---
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: [still bugged]Karn Liberated game restart
by drool66 » 13 Mar 2021, 23:30
Fixed remaining bug at 5bf3cfc
The latest images for Manalink will be here.
The latest Manalink installation directory will be here. Well, not quite, anymore. Check the latest patches.
The latest Manalink installation directory will be here. Well, not quite, anymore. Check the latest patches.
-
drool66 - Programmer
- Posts: 1163
- Joined: 25 Nov 2010, 22:38
- Has thanked: 186 times
- Been thanked: 267 times
8 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 93 guests