Page 1 of 1

[fix]Wurmcoil Engine when dies makes green artifact tokens.

PostPosted: 25 Jan 2020, 15:20
by Aswan jaguar
Describe the Bug:
Wurmcoil Engine when dies makes green artifact tokens.

Which card did behave improperly?
Wurmcoil Engine

Which update are you using? (date, name)Which type? (duel, gauntlet, sealed deck)
Manalink dev 566b672e version - duel

What exactly should be the correct behavior/interaction?
Wurmcoil Engine when dies makes colorless artifact tokens.

Are any other cards possibly affected by this bug?
-
I tried to use Phyrexian Rebirth - Horror as an example which works fine
but didn't work.

Re: Wurmcoil Engine when dies makes green artifact tokens.

PostPosted: 14 Nov 2020, 13:53
by Aswan jaguar
The token.color_forced = COLOR_TEST_COLORLESS; doesn't force color to change to colorless.

I can fix the bug by changing the color to colorless in both csv's for Wurm and Beast tokens ( same bug for Architect of the Untamed ) but then I have to check and fix accordingly all Wurm and Beast tokens to force green color. korath do you know if there is another way now, without having to check and fix all those tokens? Otherwise besides this fix we have to keep in mind that whenever WOTC makes colorless tokens for the first time for tokens that are of another color in csv's we have to follow this routine, too.

Re: Wurmcoil Engine when dies makes green artifact tokens.

PostPosted: 14 Nov 2020, 14:40
by drool66
I have some good news - this can probably be handled by changing just 3 lines in token_generation.c
In token_characteristic_setting_effects() and set_token() you'll see a total of 3 references to COLOR_TEST_ANY_COLORED; these can probably be safely changed to COLOR_TEST_ANY. Doing this does indeed make colorless wurms, but I'm trying to think if it breaks anything else.

Re: [conf]Wurmcoil Engine when dies makes green artifact tok

PostPosted: 14 Nov 2020, 15:01
by Aswan jaguar
drool66 wrote:In token_characteristic_setting_effects() and set_token() you'll see a total of 3 references to COLOR_TEST_ANY_COLORED;
I thought the change of COLOR_TEST_ANY_COLORED to COLOR_TEST_ANY but I changed it in another function that I thought it would matter somewhere in event.c which Korath placed when fixing Wurmcoil Engine to make Wurm tokens instead of Wurmcoil Engine tokens that it made before back in 2015. But what I tried didn't work. #-o

drool66 wrote: these can probably be safely changed to COLOR_TEST_ANY. Doing this does indeed make colorless wurms, but I'm trying to think if it breaks anything else.
It would be nice if korath chipped in with some info if that breaks anything. I could test a couple of tokens alone and vs Sleight to see if everything works but I can't think of any other cases to test.

Re: [conf]Wurmcoil Engine when dies makes green artifact tok

PostPosted: 14 Nov 2020, 15:54
by Aswan jaguar
I did some testing with your proposal and we also need to change COLOR_TEST_ANY_COLORED to COLOR_TEST_ANY in int copy_token_characteristics_for_clone() otherwise if you copy the tokens I used Copy Artifact for that, the tokens are green instead of colorless.

Re: Wurmcoil Engine when dies makes green artifact tokens.

PostPosted: 16 Nov 2020, 03:46
by Korath
Aswan jaguar wrote:I can fix the bug by changing the color to colorless in both csv's for Wurm and Beast tokens ( same bug for Architect of the Untamed ) but then I have to check and fix accordingly all Wurm and Beast tokens to force green color. korath do you know if there is another way now, without having to check and fix all those tokens?
There can't be all that many hits for "git grep -Ew 'CARD_ID_(WURM|BEAST)' src/cards/ src/functions/" to check.

Last I looked at Manalink's token-customization system, none of it worked properly. To create, say, a 5/2 Zombie, it makes a 2/2 Zombie token (as usual) with the equivalent of "if (event == EVENT_POWER && affect_me(player, card)) event_result += 3;". Which does the wrong thing if there's an effect with an earlier timestamp saying "all creatures have base power and toughness 1/1".

The traditional horrible hacky quick fix here is to change card_wurm_token() to look for whatever it is token_generation_t::set_special_infos translates on the token's instance - looks like instance->targets[14].player - and add a special case to set color to colorless.

(The actual clean way to do it is to create_a_card_type() for tokens that don't exactly match the base type, like Shandalar's Token::resolve_iid() does. Then not only do the timestamps work right, but the bigcard on the left side of the screen shows that individual token's base characteristics, and you can treat tokens like any other card instead of the pages and pages and pages of special cases for them in functions/token_generation.c.)

Re: [fix]Wurmcoil Engine when dies makes green artifact toke

PostPosted: 22 Dec 2020, 21:48
by drool66
Fixed for create_a_card_type() in 7275d09
Fingers crossed that I haven't created more issues with it