It is currently 07 Jul 2021, 21:28
   
Text Size

[fixed/closed]Jace, the Mind Sculptor

Moderators: BAgate, drool66, stassy, Aswan jaguar, gmzombie, CCGHQ Admins

[fixed/closed]Jace, the Mind Sculptor

Postby HarlequinCasts » 11 Nov 2013, 11:13

Describe the Bug:
Jace, the Mind Sculptor cannot put back any planeswalker card when you are using his Brainstorm ability. You receive the error "Illegal Target (Type)"

You can lock yourself out of the game if you were to draw 3 planeswalkers with no other cards in hand.

Which card did behave improperly ?
Jace, the Mind Sculptor

Which update are you using?(date,name)Which type(Duel,Gauntlet,Sealed Deck)
OoAv2

What exactly should be the correct behavior/interaction ?
Brainstorm

Are any other cards possibly affected by this bug ?
NA
Attachments
manalink jace tms.png
jace ability.zip
(2.78 KiB) Downloaded 85 times
Last edited by BAgate on 31 Jan 2014, 02:37, edited 4 times in total.
Reason: closed
User avatar
HarlequinCasts
 
Posts: 917
Joined: 07 May 2013, 14:33
Has thanked: 68 times
Been thanked: 30 times

Re: Jace, the Mind Sculptor

Postby Acra » 11 Nov 2013, 12:03

common bug with any "target" planeswalker card. you cannot discard them either.
Acra
 
Posts: 69
Joined: 11 Mar 2012, 11:36
Has thanked: 4 times
Been thanked: 0 time

Re: Jace, the Mind Sculptor

Postby Korath » 11 Nov 2013, 12:04

Even worse in dev - you can only put back sorceries and instants, and fourth ability is Θ(3n²). Not sure why it was rewritten or what else is broke.

The common bug I fixed some time ago, along with flash permanents (which mostly could count as instants, more so for the non-creature ones), except for a handful of asm cards. Verduran Enchantress and Mesa Enchantress are the only ones that see any use at all.
User avatar
Korath
DEVELOPER
 
Posts: 3522
Joined: 02 Jun 2013, 05:57
Has thanked: 491 times
Been thanked: 1037 times

Re: Jace, the Mind Sculptor

Postby Aswan jaguar » 11 Nov 2013, 15:04

This bug was already submitted:
viewtopic.php?f=110&t=12287&p=136108&hilit=Jace%2C+the+Mind+Sculptor#p136085
and
Gargaroz said:
Oh, I see, it's a global bug related to the changes we made in the targeting function for avoiding AI using Disenchant on Planeswalkers. It's fixed as 16d1128
In the version we have Jace, the Mind Sculptor has only this bug as I tested all abilities,if you say that in dev version brainstorm ability is even worse and 4th has a problem,too then this needs to be rolled back maybe? and try a different approach?
---
Trying to squash some bugs and playtesting.
User avatar
Aswan jaguar
Super Tester Elite
 
Posts: 7450
Joined: 13 May 2010, 12:17
Has thanked: 639 times
Been thanked: 351 times

Re: Jace, the Mind Sculptor

Postby Gargaroz » 11 Nov 2013, 22:52

Fixed the first bug Korath reported in dev, however I could not understant the one about the ultimatum : you mean is displayed in that way ?
However, the code was rewritten as it was poorly coded in origin, for example the ultimatum didn't target.
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7095
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 593 times

Re: Jace, the Mind Sculptor

Postby Korath » 12 Nov 2013, 00:33

Hrm. There's a wikipedia article, but it's dense reading even for a native speaker who's familiar with the subject already. Schlemiel the Painter's algorithm is easier going: "Schlemiel has a job painting the dotted lines down the middle of a road. Each day, Schlemiel paints less than he painted the day before. When he is asked why, Schlemiel complains that it is because each day he gets farther away from the paint can."

(And it's actually n³ now that I look at it closer.)

What it boils down to is that this will seem to work ok when used against a "reasonably"-sized library with, say, 25 cards left in it - it'll take on the order of 25*25*25, or 15,625, instructions. If it gets used against a Battle of Wits deck or the Shandalar Arzakon deck or the challenge mode all-Mountain deck with 400 cards left, it'll take on the order of 64 million instructions (400*400*400), or 4096 times as long as the 25-card deck instead of just 8 times. Done properly, the first deck should take 25 constant-time operations and the second 400.

The problematic code is:
Code: Select all
while( count_deck(p) > 0 ){
    rfg_top_card_of_deck(p);
}
with rfg_top_card_of_deck() in relevant part as
Code: Select all
for(i=0;i<count_deck(player);i++){
    deck[i] = deck[i+1];
}
rfg[ count_rfg(player) ] = id;
What's making them blow up is that count_deck() (and count_rfg(), which uses the same underlying code) are sort of like strlen() - it's not instant, it goes through the entire deck[] (or rfg[]) array, element by element, checking each position to see if there's a card in it.

The loop in rfg_top_card_of_deck() calls count_deck() once for each card in the deck, and then count_rfg() once. So it takes on the order of (deck_size * deck_size) + rfg_size instructions to execute. (This is the easiest part to fix - just store count_deck() in a local var once before the loop, and compare against that in the loop condition instead.)

The loop in card_jace_the_mind_sculptor() calls count_deck() and rfg_top_card_of_deck() once for each card in the deck. So it in turn takes on the order of deck_size * (deck_size + (deck_size * deck_size) + rfg_size) instructions.

Since it doesn't matter what order the cards in the deck should be exiled, this shouldn't ever take more than 500 iterations even in the very worst case (500 total cards in the library and exile zone at start of execution), using something like
Code: Select all
void rfg_entire_deck(int player, int* deck){
    // deck can be either a library or graveyard, but must be at the start of the array
    int* rfg = rfg_ptr[player];
    int deck_pos, rfg_pos = 0, any_exiled = 0;
    for (deck_pos = 0; deck_pos < 500; ++deck_pos){
        if (deck[deck_pos] != -1){
            while (rfg[rfg_pos] != -1){
                ++rfg_pos;
            }
            rfg[rfg_pos] = deck[deck_pos];
            deck[deck_pos] = -1;
            any_exiled = 1;
        }
    }
    if (any_exiled){
        play_sound_effect(WAV_DESTROY);    // The exile sound effect, despite its name
    }
}
User avatar
Korath
DEVELOPER
 
Posts: 3522
Joined: 02 Jun 2013, 05:57
Has thanked: 491 times
Been thanked: 1037 times

Re: Jace, the Mind Sculptor

Postby Gargaroz » 12 Nov 2013, 14:17

Thanx for the explanation, the actual code looks like this :
Code: Select all
int exile_whole_library(int p){
   int count = count_deck(p)-1;
   int c2 = count_rfg(p);
   int *deck = deck_ptr[p];
   int *rfg = rfg_ptr[p];
   int result = 0;
   while( count > -1 ){
         rfg[c2] = deck[count];
         deck[count] = -1;
         count--;
         c2++;
         result++;
   }
    if (result){
        play_sound_effect(WAV_DESTROY);    // The exile sound effect, despite its name
    }
   return result;
}
And Jace's code like this :
Code: Select all
         else if ( instance->targets[1].player == 3 && valid_target(&td1) ) {
               int p = instance->targets[0].player;
               exile_whole_library(p);
               int i= active_cards_count[p]-1;
               while( i > -1  ){
                     if( in_hand(p, i) ){
                        put_on_top_of_deck(p, i);
                     }
                     i--;
               }
               gain_life(p, 0);
               shuffle(p);
         }
----
- Current / medium term task: adjusting the code for making Misdirection and such usable
- Long term task: inserting all the good stuff I left out from the "Golden Years" mod
Gargaroz
Programmer
 
Posts: 7095
Joined: 06 Nov 2009, 11:11
Has thanked: 82 times
Been thanked: 593 times


Return to Archived Reports

Who is online

Users browsing this forum: No registered users and 5 guests


Who is online

In total there are 5 users online :: 0 registered, 0 hidden and 5 guests (based on users active over the past 10 minutes)
Most users ever online was 1922 on 07 Jun 2021, 06:01

Users browsing this forum: No registered users and 5 guests

Login Form