ShuffleAi
Post MTG Forge Related Programming Questions Here
Moderators: timmermac, Blacksmith, KrazyTheFox, Agetian, friarsol, CCGHQ Admins
ShuffleAi
by 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.
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.
Re: ShuffleAi
by 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"
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
by 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.
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.
Re: ShuffleAi
by friarsol » 27 Feb 2016, 03:41
Cleanup always returns true: it's in "SpellApiToAI"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.
.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
by 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.
5 posts
• Page 1 of 1
Who is online
Users browsing this forum: No registered users and 52 guests