It is currently 23 Apr 2024, 13:21
   
Text Size

ShuffleAi

Post MTG Forge Related Programming Questions Here

Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins

ShuffleAi

Postby excessum » 27 Feb 2016, 02:26

Does anyone know why ShuffleAi always returns false? I was trying to figure out why the AI never casts Ruin in Their Wake and noticed that it was always failing due to ShuffleAi even though the shuffle is not even an optional effect.

It appears that ShuffleAi is only called by small number of cards, most of which are RemAiDeck. However, it does seem to break cards like Elixir of Immortality for the AI since it will never activate the effect due to failing the ShuffleAi check.
excessum
 
Posts: 177
Joined: 21 Oct 2013, 02:30
Has thanked: 0 time
Been thanked: 19 times

Re: ShuffleAi

Postby friarsol » 27 Feb 2016, 02:47

Probably just so it doesn't try to use it for no reason (wasting resources).

I think we really have three cases of Shuffle:

1) Shuffle at the end of some other effect where we'd usually shuffle inside that effect, but can't for some reason.
2) Shuffle and then do something related to the top of your library (Mind's Desire, Temporal Aperture)
3) Shuffle a library. (Soldier of Fortune, Lantern of Insight)

In case of #1 we should just return true (assuming the parent effect has better decision points_
In case of #2 we probably want some AI to handle this situation. I think these are the only two cards with this effect, and they are pretty similar. For Mind's Desire, we probably want a reasonable storm count.
In case #3, we can just return false until the AI is tracking things like what he knows about. "Crap cards on top to shuffle away" "Knows Humans card that we don't want to face"

Should be easy enough to switch all the decision trees to "return sa.getParent() != null"
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: ShuffleAi

Postby excessum » 27 Feb 2016, 03:27

I think I am working with case 1 exclusively since cases 2 and 3 are largely RemAiDeck or cards that require specific AI scripts. Changing shuffleTargetAI() to return sa.getParent() == null seems to be the best solution.

Somehow iterating deeper into chkDrawbackWithSubs() will eventually return false. I suspect that the "Cleanup" ability tagged after Shuffle is failing though I cannot seem to find the code for this part.
excessum
 
Posts: 177
Joined: 21 Oct 2013, 02:30
Has thanked: 0 time
Been thanked: 19 times

Re: ShuffleAi

Postby friarsol » 27 Feb 2016, 03:41

excessum wrote:I think I am working with case 1 exclusively since cases 2 and 3 are largely RemAiDeck or cards that require specific AI scripts. Changing shuffleTargetAI() to return sa.getParent() == null seems to be the best solution.

Somehow iterating deeper into chkDrawbackWithSubs() will eventually return false. I suspect that the "Cleanup" ability tagged after Shuffle is failing though I cannot seem to find the code for this part.
Cleanup always returns true: it's in "SpellApiToAI"

.put(ApiType.Cleanup, AlwaysPlayAi.class)

I'd double check how you compare to parent ability. If the Shuffle ability doesn't have a parent (Soldier of Fortune) we want to return false. So I think it should be how I wrote it: sa.getParent() != null

whereas you wrote it with the conditional flipped.
friarsol
Global Moderator
 
Posts: 7593
Joined: 15 May 2010, 04:20
Has thanked: 243 times
Been thanked: 965 times

Re: ShuffleAi

Postby excessum » 27 Feb 2016, 03:57

Gah it was a stupid typo on my part, it should be "return sa.getParent() != null" as you wrote originally.
excessum
 
Posts: 177
Joined: 21 Oct 2013, 02:30
Has thanked: 0 time
Been thanked: 19 times


Return to Developer's Corner

Who is online

Users browsing this forum: No registered users and 52 guests


Who is online

In total there are 52 users online :: 0 registered, 0 hidden and 52 guests (based on users active over the past 10 minutes)
Most users ever online was 4143 on 23 Jan 2024, 08:21

Users browsing this forum: No registered users and 52 guests

Login Form