-
Notifications
You must be signed in to change notification settings - Fork 108
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How do I choose a target for a flipped monster? #203
Comments
The mandatory effects don't use Executor to decide whether to activate. You need to override OnSelectCard to do the select. |
I tried to find instances of OnSelectCard in the solution to see if maybe I can get the hang of it on my own...but I don't really get how that works Can you show me how to do it in this case? the effect is very simple, the AI literally just has to select the highest attack monster on my field...but I don't know how to connect the OnSelectCard with Eater's effect I would really appreciate it since I can then use it as a basis for other flip or mandatory effects |
Here's an example(not checked): public override IList<ClientCard> OnSelectCard(IList<ClientCard> _cards, int min, int max, int hint, bool cancelable)
{
// other script
// not in chain solving, meaning it's chaining
if (Duel.GetCurrentSolvingChainCard() == null)
{
ClientCard lastChainCard = Util.GetLastChainCard();
// selecting target for Man-eating bug
if (lastChainCard != null && lastChainCard.Controller == 0 && lastChainCard.IsCode(CardId.ManEaterBug))
{
// whether can destroy enemy's best monster
List<ClientCard> enemyTargets = _cards.Where(c => c.Controller == 1).OrderByDescending(c => c.Attack).ToList();
if (enemyTargets.Count > 0)
{
return Util.CheckSelectCount(enemyTargets, _cards, min, max);
}
// select worst monster(usually bot's monster) to destroy
return Util.CheckSelectCount(_cards.OrderBy(c => c.Attack).ToList(), _cards, min, max);
}
}
// other script
} |
Currently I use this for Man eater Bug and Hane Hane:
public bool EaterHaneactivate()
{
ClientCard mystrongest = Enemy.MonsterZone.GetHighestAttackMonster();
AI.SelectCard(mystrongest);
return true;
}
But it doesn't work, since I use the Executor "Activate" and I don't think that controls how the AI uses its flip effects
AddExecutor(ExecutorType.Activate, CardId.ManEaterBug, EaterHaneactivate);
The text was updated successfully, but these errors were encountered: