Skip to content
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

Special Summoning Monster from Deck due to Card effect #179

Open
jdistro07 opened this issue Nov 27, 2023 · 4 comments
Open

Special Summoning Monster from Deck due to Card effect #179

jdistro07 opened this issue Nov 27, 2023 · 4 comments

Comments

@jdistro07
Copy link

Hi. I am making a bot that uses Spirit Charmers Structure Deck. I can't figure out how to Special Summon Awakening of the Possessed - Nefariouser Archfiend from the deck by tributing 1 spellcaster and 1 level 4 or lower Earth monster on the bot's field.

I have this code currently and it seems SpSummon doesn't seem to work:

[Deck("SpiritCharmers", "AI_SDSpiritCharmers")]
public class SpiritCharmers : DefaultExecutor
{
	public SpiritCharmers(GameAI ai, Duel duel)
	: base(ai, duel)
        {
		...
                AddExecutor(ExecutorType.SpSummon, CardId.AwakeningNefariouserArch, AwakeningNefariouserArch_Effect);
		...
	}
	
	public bool AwakeningNefariouserArch_Effect()
	{
		if (ActivateDescription == Util.GetStringId(CardId.AwakeningNefariouserArch, 0))
		{
			AI.SelectCard(CardId.AwakeningNefariouserArch);
			return true;
		}

		return false;
	}
}

The bot special summons but only if Awakening of the Possessed - Nefariouser Archfiend is on the hand which is not really productive. Any help would be appreciated.

Thanks!

@Wind2009-Louse
Copy link
Contributor

Wind2009-Louse commented Dec 5, 2023

        private void OnSelectIdleCmd(BinaryReader packet)
        {
            packet.ReadByte(); // player

            _duel.MainPhase = new MainPhase();
            MainPhase main = _duel.MainPhase;
            int count;
            for (int k = 0; k < 5; k++)
            {
                count = packet.ReadByte();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // card id
                    int con = GetLocalPlayer(packet.ReadByte());
                    CardLocation loc = (CardLocation)packet.ReadByte();
                    int seq = packet.ReadByte();
                    ClientCard card = _duel.GetCard(con, loc, seq);
                    if (card == null) continue;

Seems that calling _duel.GetCard() to get cards in deck will return null, so Bot won't try to special summon monsters from deck directly.

@jdistro07
Copy link
Author

        private void OnSelectIdleCmd(BinaryReader packet)
        {
            packet.ReadByte(); // player

            _duel.MainPhase = new MainPhase();
            MainPhase main = _duel.MainPhase;
            int count;
            for (int k = 0; k < 5; k++)
            {
                count = packet.ReadByte();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // card id
                    int con = GetLocalPlayer(packet.ReadByte());
                    CardLocation loc = (CardLocation)packet.ReadByte();
                    int seq = packet.ReadByte();
                    ClientCard card = _duel.GetCard(con, loc, seq);
                    if (card == null) continue;

Seems that calling _duel.GetCard() to get cards in deck will return null, so Bot won't try to special summon monsters from deck directly.

So it's a current issue on the bot? But it's odd the "Feelin' Lucky" executor can Special Summon from deck like immediately in Main Phase 1. Where can I see the implementation of "Feelin' Lucky" executor?

@Wind2009-Louse
Copy link
Contributor

Maybe you can try to catch Card from Executor(.SpSummon, Func), to find out why it can't be special summoned by Executor(.SpSummon, int, Func).

@jdistro07
Copy link
Author

I just saw AI.SelectMaterials(). And I think I should use that instead of AI.SelectCard(). And the SpSummon executor type seems to be working fine. But since it's some sort of a tribute summon I need to use AI.SelectMaterials(). I think that's where the problem is. I am gonna to test this out to see if I am correct. Then close the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants