Page 1 of 1

[Fixed]AI target Permanent=Planeswalker bad param & crash

PostPosted: 10 Apr 2024, 04:54
by Althuna
I have savegame. It is an autosave from gauntlet mode (not with challenges).

Re: [confirm]AI target Permanent=Planeswalker bad param & cr

PostPosted: 10 Apr 2024, 15:15
by Aswan jaguar
The issue happens as AI wants to target opponent's Planeswalker with Utter End - EDIT: and at the same time attack with creatures.
It will happen with any card that can target a permanent and AI selects to target a Planeswalker.(at least the ones that destroy or exile their targets that I have tested).
Happens only to AI. When AI targets a planeswalker and target type has been set to TYPE_PLANESWALKER so card rules text is "target a planeswalker" it works fine.
The error produced: | Open
bad parameters
get_card_instance(0, -2)
0: 0x026CFB58
1: 0x026D679E
2: 0x0271E27C
3: 0x026AAE72
4: 0x027448D5
5: 0x0271BE5C
6: 0x0271BEDA
7: 0x0271D357
8: 0x00435A13
9: 0x004770E3
10: 0x026E8D21
11: 0x026BF222
12: 0x026EF2D4
13: 0x0047902C
14: 0x004946E9
15: 0x7C80B729

Re: [confirm]AI target Permanent=Planeswalker bad param & cr

PostPosted: 02 Jun 2024, 18:40
by drool66
This particular bug goes through damage_effects.c::effect_damage() - I don't know how the damage_creature is sending -2 in targets[4].card, but the check early on should be "tc > -1", not "tc != -1", as should the various checks to targets[4].card (as should most or all of the various param checks all over the place in Manalink...)

Re: [confirm]AI target Permanent=Planeswalker bad param & cr

PostPosted: 05 Jun 2024, 14:02
by Aswan jaguar
Fixed and tested in commit 36167cd, changed only the first check to targets[4].card.
It was some interaction between Utter End ( or cards like that as I say above ) and a creature ( certainly with a token creature, didn't test with just creature ) that AI was thinking to attack with it, and there was a planeswalker on human's battlefield. If either no creatures to attack or no Utter End and such no bug.

Re: [Fixed]AI target Permanent=Planeswalker bad param & cras

PostPosted: 11 Jun 2024, 05:35
by drool66
Fixed in 08b94da
EDIT: this fix is for bug [fixed]Bad parameters - validate counterslell crashes game and not for the above - edited