IceYGO / windbot

A C# bot for ygopro, compatible with the ygosharp server.
MIT License
80 stars 103 forks source link

When you add/draw a card and have to discard immediately afterwards, the bot does not see that card in the hand. #150

Open KingDwarf25 opened 1 year ago

KingDwarf25 commented 1 year ago

//Effect: Each player draws 1 card, then each player discards 1 card. private bool ActivateDarkWorldDealings() { AI.SelectCard(CardToDiscard()); return true; }

//Effect: During the Main Phase: You can add 1 "Ojama" card from your Deck to your hand, then discard 1 card private bool ActivateOjamaPajamaSearch() { if (OjamaPajamaMaySearch == true) { AI.SelectCard(OjamaPajamaSearchHelper()); AI.SelectNextCard(CardToDiscard()); return true; } return false; }

For instance: If we draw a card with dark world dealings or add a card to our hand with OjamaPajama we then have to discard a card. I wrote a method that goes over my hand since I am an OjamaABC player and want to discard Ojama Magic A, B, or C as much as possible.

But I found out that the card we just added is not yet in the Bot.Hand.

Is there a fix for this? Or am I just doing it wrong xD

mercury233 commented 1 year ago

The ExecutorType.Activate function is only checked when the bot decide whether to activate the card, it is not when the bot actually select the card to discard ,so it can't get the hand cards list of future.

You should override OnSelectCard, check hint == HintMsg.Discard and return the cards selected.