Example #1
0
        public DragunityExecutor(GameAI ai, Duel duel)
            : base(ai, duel)
        {
            // Set traps
            AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);

            // Execute spells
            AddExecutor(ExecutorType.Activate, (int)CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);
            AddExecutor(ExecutorType.Activate, (int)CardId.AssaultTeleport);
            AddExecutor(ExecutorType.Activate, (int)CardId.UpstartGoblin);
            AddExecutor(ExecutorType.Activate, (int)CardId.DragonRavine, DragonRavineField);
            AddExecutor(ExecutorType.Activate, (int)CardId.Terraforming, Terraforming);
            AddExecutor(ExecutorType.Activate, (int)CardId.FoolishBurial, FoolishBurial);
            AddExecutor(ExecutorType.Activate, (int)CardId.MonsterReborn, MonsterReborn);

            // Execute monsters
            AddExecutor(ExecutorType.Activate, (int)CardId.ScrapDragon, ScrapDragonEffect);
            AddExecutor(ExecutorType.Activate, (int)CardId.DragunityPhalanx);
            AddExecutor(ExecutorType.Activate, (int)CardId.DragunityKnightVajrayana);
            AddExecutor(ExecutorType.Activate, (int)CardId.DragunityArmaMysletainn);
            AddExecutor(ExecutorType.Activate, (int)CardId.DragunityDux);

            // Summon
            AddExecutor(ExecutorType.Activate, (int)CardId.DragonsMirror, DragonsMirror);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.ScrapDragon, ScrapDragonSummon);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.StardustDragon);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.DragunityKnightVajrayana);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.DragunityKnightGaeDearg);
            AddExecutor(ExecutorType.Summon, (int)CardId.DragunityPhalanx, DragunityPhalanxSummon);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.DragunityArmaMysletainn, DragunityArmaMysletainn);
            AddExecutor(ExecutorType.Summon, (int)CardId.DragunityArmaMysletainn, DragunityArmaMysletainnTribute);

            // Use draw effects if we can't do anything else
            AddExecutor(ExecutorType.Activate, (int)CardId.CardsOfConsonance);
            AddExecutor(ExecutorType.Activate, (int)CardId.DragonRavine, DragonRavineEffect);
            AddExecutor(ExecutorType.Activate, (int)CardId.FireFormationTenki, FireFormationTenki);
            AddExecutor(ExecutorType.Activate, (int)CardId.DragunitySpearOfDestiny);

            // Summon
            AddExecutor(ExecutorType.Summon, (int)CardId.DragunityDux, DragunityDux);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.DragunityPhalanx, DragunityPhalanxSet);
            AddExecutor(ExecutorType.SummonOrSet, (int)CardId.AssaultBeast);

            // Draw assault mode if we don't have one
            AddExecutor(ExecutorType.Activate, (int)CardId.AssaultBeast, AssaultBeast);

            // Set useless cards
            AddExecutor(ExecutorType.SpellSet, (int)CardId.DragonsMirror, SetUselessCards);
            AddExecutor(ExecutorType.SpellSet, (int)CardId.Terraforming, SetUselessCards);
            AddExecutor(ExecutorType.SpellSet, (int)CardId.AssaultTeleport, SetUselessCards);
            AddExecutor(ExecutorType.SpellSet, (int)CardId.CardsOfConsonance, SetUselessCards);

            // Chain traps and monsters
            AddExecutor(ExecutorType.Activate, (int)CardId.StardustDragonAssaultMode, StardustDragon);
            AddExecutor(ExecutorType.Activate, (int)CardId.StardustDragon, StardustDragon);
            AddExecutor(ExecutorType.Activate, (int)CardId.StarlightRoad, DefaultTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.MirrorForce, DefaultUniqueTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.DimensionalPrison, DefaultUniqueTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.AssaultModeActivate);
        }
Example #2
0
        public ZexalWeaponsExecutor(GameAI ai, Duel duel)
            : base(ai, duel)
        {
            // Quick spells
            AddExecutor(ExecutorType.Activate, (int)CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);

            // XYZ summons
            AddExecutor(ExecutorType.SpSummon, (int)CardId.Number39Utopia);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.ZwLionArms);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.AdreusKeeperOfArmageddon);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.Number61Volcasaurus);

            // XYZ effects
            AddExecutor(ExecutorType.Activate, (int)CardId.Number39Utopia, Number39Utopia);
            AddExecutor(ExecutorType.Activate, (int)CardId.ZwLionArms, ZwLionArms);
            AddExecutor(ExecutorType.Activate, (int)CardId.AdreusKeeperOfArmageddon);
            AddExecutor(ExecutorType.Activate, (int)CardId.Number61Volcasaurus);

            // Weapons
            AddExecutor(ExecutorType.Activate, (int)CardId.ZwTornadoBringer);
            AddExecutor(ExecutorType.Activate, (int)CardId.ZwLightningBlade);

            // Spell cards
            AddExecutor(ExecutorType.Activate, (int)CardId.DarkHole, DefaultDarkHole);
            AddExecutor(ExecutorType.Activate, (int)CardId.Raigeki, DefaultRaigeki);
            AddExecutor(ExecutorType.Activate, (int)CardId.ReinforcementOfTheArmy, ReinforcementOfTheArmy);

            // Special summons
            AddExecutor(ExecutorType.SpSummon, (int)CardId.PhotonTrasher);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragon);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.SolarWindJammer, SolarWindJammer);

            AddExecutor(ExecutorType.Activate, (int)CardId.InstantFusion, InstantFusion);

            // Normal summons
            AddExecutor(ExecutorType.Summon, (int)CardId.Goblindbergh, GoblindberghFirst);
            AddExecutor(ExecutorType.Summon, (int)CardId.TinGoldfish, GoblindberghFirst);
            AddExecutor(ExecutorType.Summon, (int)CardId.StarDrawing);
            AddExecutor(ExecutorType.Summon, (int)CardId.SacredCrane);
            AddExecutor(ExecutorType.Summon, (int)CardId.HeroicChallengerExtraSword);
            AddExecutor(ExecutorType.Summon, (int)CardId.Goblindbergh);
            AddExecutor(ExecutorType.Summon, (int)CardId.TinGoldfish);
            AddExecutor(ExecutorType.Summon, (int)CardId.SummonerMonk);

            // Summons: Effects
            AddExecutor(ExecutorType.Activate, (int)CardId.Goblindbergh, GoblindberghEffect);
            AddExecutor(ExecutorType.Activate, (int)CardId.TinGoldfish, GoblindberghEffect);
            AddExecutor(ExecutorType.Activate, (int)CardId.Kagetokage);
            AddExecutor(ExecutorType.Activate, (int)CardId.SummonerMonk, SummonerMonkEffect);

            // Reposition
            AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);

            // Set and activate traps
            AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);

            AddExecutor(ExecutorType.Activate, (int)CardId.BreakthroughSkill, BreakthroughSkill);
            AddExecutor(ExecutorType.Activate, (int)CardId.SolemnWarning, DefaultTrap);
        }
Example #3
0
        public GameAI(GameClient game, Duel duel)
        {
            Game = game;
            Duel = duel;
            Utils = new AIFunctions(duel);

            _dialogs = new Dialogs(game);
        }
Example #4
0
        public GameAI(AIGameClient game, Duel duel)
        {
            Game = game;
            Connection = game.Connection;
            Duel = duel;
            Utils = new AIFunctions(duel);

            _dialogs = new Dialogs(game);
        }
Example #5
0
        public Rank5Executor(GameAI ai, Duel duel)
            : base(ai, duel)
        {
            // Quick spells
            AddExecutor(ExecutorType.Activate, (int)CardId.BookOfMoon, DefaultBookOfMoon);
            AddExecutor(ExecutorType.Activate, (int)CardId.MysticalSpaceTyphoon, DefaultMysticalSpaceTyphoon);

            // XYZ Monsters: Effect
            AddExecutor(ExecutorType.Activate, (int)CardId.DigvorzhakKingOfHeavyIndustry);
            AddExecutor(ExecutorType.Activate, (int)CardId.TirasKeeperOfGenesis);
            AddExecutor(ExecutorType.Activate, (int)CardId.AdreusKeeperOfArmageddon);
            AddExecutor(ExecutorType.Activate, (int)CardId.Number61Volcasaurus);
            AddExecutor(ExecutorType.Activate, (int)CardId.Number19Freezerdon);

            // Summon LV.5 Monsters
            AddExecutor(ExecutorType.SpSummon, (int)CardId.CyberDragon);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.ViceDragon);
            AddExecutor(ExecutorType.Summon, (int)CardId.PowerInvader, PowerInvader);
            AddExecutor(ExecutorType.Summon, (int)CardId.WindUpSoldier);
            AddExecutor(ExecutorType.Summon, (int)CardId.StarDrawing);
            AddExecutor(ExecutorType.Summon, (int)CardId.GagagaMagician);

            AddExecutor(ExecutorType.SpSummon, (int)CardId.TheTricky, TheTricky);

            AddExecutor(ExecutorType.Summon, (int)CardId.MistArchfiend, MistArchfiend);
            AddExecutor(ExecutorType.Activate, (int)CardId.InstantFusion, IsAnotherRank5Available);

            AddExecutor(ExecutorType.Activate, (int)CardId.GagagaMagician, GagagaMagicianEffect);
            AddExecutor(ExecutorType.Activate, (int)CardId.WindUpSoldier, WindUpSoldierEffect);

            // Useful spells
            AddExecutor(ExecutorType.Activate, (int)CardId.DoubleSummon, DoubleSummon);
            AddExecutor(ExecutorType.Activate, (int)CardId.XyzUnit, XyzUnit);

            // XYZ Monsters: Summon
            AddExecutor(ExecutorType.SpSummon, (int)CardId.DigvorzhakKingOfHeavyIndustry, SummonXYZ);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.TirasKeeperOfGenesis, SummonXYZ);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.AdreusKeeperOfArmageddon, SummonXYZ);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.Number61Volcasaurus, SummonXYZ);
            AddExecutor(ExecutorType.SpSummon, (int)CardId.Number19Freezerdon, SummonXYZ);

            // Xyz Reborn
            AddExecutor(ExecutorType.Activate, (int)CardId.XyzReborn);

            // Reposition
            AddExecutor(ExecutorType.Repos, DefaultMonsterRepos);

            // Set and activate traps
            AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);

            AddExecutor(ExecutorType.Activate, (int)CardId.XyzVeil, XyzVeil);
            AddExecutor(ExecutorType.Activate, (int)CardId.XyzEffect, XyzEffect);
            AddExecutor(ExecutorType.Activate, (int)CardId.TorrentialTribute, DefaultTorrentialTribute);
            AddExecutor(ExecutorType.Activate, (int)CardId.MirrorForce, DefaultTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.SakuretsuArmor, DefaultTrap);
        }
Example #6
0
        public FrogExecutor(GameAI ai, Duel duel)
            : base(ai, duel)
        {
            AddExecutor(ExecutorType.SpellSet, DefaultSpellSet);

            AddExecutor(ExecutorType.Activate, (int)CardId.Solidarity, Solidarity);
            AddExecutor(ExecutorType.Activate, (int)CardId.Terraforming, Terraforming);
            AddExecutor(ExecutorType.Activate, (int)CardId.Wetlands, DefaultField);
            AddExecutor(ExecutorType.Activate, (int)CardId.DarkHole, DefaultDarkHole);
            AddExecutor(ExecutorType.Activate, (int)CardId.Raigeki, DefaultRaigeki);
            AddExecutor(ExecutorType.Activate, (int)CardId.PotOfDuality, PotOfDuality);

            AddExecutor(ExecutorType.SpSummon, (int)CardId.SwapFrog, SwapFrogSummon);
            AddExecutor(ExecutorType.Activate, (int)CardId.SwapFrog, SwapFrogActivate);
            AddExecutor(ExecutorType.Activate, (int)CardId.DupeFrog, DupeFrog);
            AddExecutor(ExecutorType.Activate, (int)CardId.FlipFlopFrog, FlipFlopFrog);
            AddExecutor(ExecutorType.Activate, (int)CardId.Ronintoadin, Ronintoadin);
            AddExecutor(ExecutorType.Activate, (int)CardId.TreebornFrog);
            AddExecutor(ExecutorType.Activate, (int)CardId.Unifrog);

            AddExecutor(ExecutorType.Summon, (int)CardId.CryomancerOfTheIceBarrier, SummonFrog);
            AddExecutor(ExecutorType.Summon, (int)CardId.DewdarkOfTheIceBarrier, SummonFrog);
            AddExecutor(ExecutorType.Summon, (int)CardId.SubmarineFrog, SummonFrog);
            AddExecutor(ExecutorType.Summon, (int)CardId.SwapFrog, SummonFrog);
            AddExecutor(ExecutorType.Summon, (int)CardId.Unifrog, SummonFrog);
            AddExecutor(ExecutorType.Summon, (int)CardId.Ronintoadin, SummonFrog);
            AddExecutor(ExecutorType.Summon, (int)CardId.DupeFrog, SummonFrog);
            AddExecutor(ExecutorType.Summon, (int)CardId.Tradetoad, SummonFrog);
            AddExecutor(ExecutorType.Summon, (int)CardId.TreebornFrog, SummonFrog);
            AddExecutor(ExecutorType.Summon, (int)CardId.FlipFlopFrog, SummonFrog);

            AddExecutor(ExecutorType.MonsterSet, (int)CardId.FlipFlopFrog);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.DupeFrog);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.Tradetoad);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.Ronintoadin);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.TreebornFrog);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.Unifrog);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.SwapFrog);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.SubmarineFrog);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.DewdarkOfTheIceBarrier);
            AddExecutor(ExecutorType.MonsterSet, (int)CardId.CryomancerOfTheIceBarrier);

            AddExecutor(ExecutorType.Repos, FrogMonsterRepos);

            AddExecutor(ExecutorType.Activate, (int)CardId.FroggyForcefield, DefaultTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.TheHugeRevolutionIsOver, DefaultTrap);
            AddExecutor(ExecutorType.Activate, (int)CardId.GravityBind, GravityBind);
        }
Example #7
0
        public GameBehavior(GameClient game)
        {
            Game = game;
            Connection = game.Connection;

            _packets = new Dictionary<StocMessage, Action<GameServerPacket>>();
            _messages = new Dictionary<GameMessage, Action<GameServerPacket>>();
            RegisterPackets();

            _room = new Room();
            _duel = new Duel();

            _ai = new GameAI(Game, _duel);
            _ai.Executor = DecksManager.Instantiate(_ai, _duel);
            Deck = Deck.Load(_ai.Executor.Deck);
        }
Example #8
0
 public GameAI(Duel duel, string dialog, System.Action <string, bool> chat, System.Action <string, int> log, string path)
 {
     Duel     = duel;
     _log     = log;
     _dialogs = new Dialogs(dialog, chat, path);
 }
Example #9
0
        public void Update(BinaryReader packet, Duel duel)
        {
            int flag = packet.ReadInt32();

            if ((flag & (int)Query.Code) != 0)
            {
                SetId(packet.ReadInt32());
            }
            if ((flag & (int)Query.Position) != 0)
            {
                Controller = duel.GetLocalPlayer(packet.ReadByte());
                packet.ReadByte();
                packet.ReadByte();
                Position = packet.ReadByte();
            }
            if ((flag & (int)Query.Alias) != 0)
            {
                Alias = packet.ReadInt32();
            }
            if ((flag & (int)Query.Type) != 0)
            {
                Type = packet.ReadInt32();
            }
            if ((flag & (int)Query.Level) != 0)
            {
                Level = packet.ReadInt32();
            }
            if ((flag & (int)Query.Rank) != 0)
            {
                Rank = packet.ReadInt32();
            }
            if ((flag & (int)Query.Attribute) != 0)
            {
                Attribute = packet.ReadInt32();
            }
            if ((flag & (int)Query.Race) != 0)
            {
                Race = packet.ReadInt32();
            }
            if ((flag & (int)Query.Attack) != 0)
            {
                Attack = packet.ReadInt32();
            }
            if ((flag & (int)Query.Defence) != 0)
            {
                Defense = packet.ReadInt32();
            }
            if ((flag & (int)Query.BaseAttack) != 0)
            {
                BaseAttack = packet.ReadInt32();
            }
            if ((flag & (int)Query.BaseDefence) != 0)
            {
                BaseDefense = packet.ReadInt32();
            }
            if ((flag & (int)Query.Reason) != 0)
            {
                packet.ReadInt32();
            }
            if ((flag & (int)Query.ReasonCard) != 0)
            {
                packet.ReadInt32(); // Int8 * 4
            }
            if ((flag & (int)Query.EquipCard) != 0)
            {
                packet.ReadInt32(); // Int8 * 4
            }
            if ((flag & (int)Query.TargetCard) != 0)
            {
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // Int8 * 4
                }
            }
            if ((flag & (int)Query.OverlayCard) != 0)
            {
                Overlays.Clear();
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    Overlays.Add(packet.ReadInt32());
                }
            }
            if ((flag & (int)Query.Counters) != 0)
            {
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // Int16 * 2
                }
            }
            if ((flag & (int)Query.Owner) != 0)
            {
                Owner = duel.GetLocalPlayer(packet.ReadInt32());
            }
            if ((flag & (int)Query.IsDisabled) != 0)
            {
                Disabled = packet.ReadInt32();
            }
            if ((flag & (int)Query.IsPublic) != 0)
            {
                packet.ReadInt32();
            }
            if ((flag & (int)Query.LScale) != 0)
            {
                LScale = packet.ReadInt32();
            }
            if ((flag & (int)Query.RScale) != 0)
            {
                RScale = packet.ReadInt32();
            }
            if ((flag & (int)Query.Link) != 0)
            {
                Link       = packet.ReadInt32();
                LinkMarker = packet.ReadInt32();
            }
        }
Example #10
0
        public void Update(BinaryReader packet, Duel duel)
        {
            int flag = packet.ReadInt32();

            if ((flag & (int)Query.Code) != 0)
            {
                SetId(packet.ReadInt32());
            }
            if ((flag & (int)Query.Position) != 0)
            {
                Controller = duel.GetLocalPlayer(packet.ReadByte());
                Location   = (CardLocation)packet.ReadByte();
                Sequence   = packet.ReadByte();
                Position   = packet.ReadByte();
            }
            if ((flag & (int)Query.Alias) != 0)
            {
                Alias = packet.ReadInt32();
            }
            if ((flag & (int)Query.Type) != 0)
            {
                Type = packet.ReadInt32();
            }
            if ((flag & (int)Query.Level) != 0)
            {
                Level = packet.ReadInt32();
            }
            if ((flag & (int)Query.Rank) != 0)
            {
                Rank = packet.ReadInt32();
            }
            if ((flag & (int)Query.Attribute) != 0)
            {
                Attribute = packet.ReadInt32();
            }
            if ((flag & (int)Query.Race) != 0)
            {
                Race = packet.ReadInt32();
            }
            if ((flag & (int)Query.Attack) != 0)
            {
                Attack = packet.ReadInt32();
            }
            if ((flag & (int)Query.Defence) != 0)
            {
                Defense = packet.ReadInt32();
            }
            if ((flag & (int)Query.BaseAttack) != 0)
            {
                BaseAttack = packet.ReadInt32();
            }
            if ((flag & (int)Query.BaseDefence) != 0)
            {
                BaseDefense = packet.ReadInt32();
            }
            if ((flag & (int)Query.Reason) != 0)
            {
                packet.ReadInt32();
            }
            if ((flag & (int)Query.ReasonCard) != 0)
            {
                packet.ReadInt32(); // Int8 * 4
            }
            if ((flag & (int)Query.EquipCard) != 0)
            {
                packet.ReadInt32(); // Int8 * 4
            }
            if ((flag & (int)Query.TargetCard) != 0)
            {
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // Int8 * 4
                }
            }
            if ((flag & (int)Query.OverlayCard) != 0)
            {
                Overlays.Clear();
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    Overlays.Add(packet.ReadInt32());
                }
            }
            if ((flag & (int)Query.Counters) != 0)
            {
                int count = packet.ReadInt32();
                for (int i = 0; i < count; ++i)
                {
                    packet.ReadInt32(); // Int16 * 2
                }
            }
            if ((flag & (int)Query.Owner) != 0)
            {
                Owner = duel.GetLocalPlayer(packet.ReadInt32());
            }
            if ((flag & (int)Query.Status) != 0)
            {
                int       status               = packet.ReadInt32();
                const int STATUS_DISABLED      = 0x0001;
                const int STATUS_PROC_COMPLETE = 0x0008;
                Disabled      = status & STATUS_DISABLED;
                ProcCompleted = status & STATUS_PROC_COMPLETE;
            }
            if ((flag & (int)Query.LScale) != 0)
            {
                LScale = packet.ReadInt32();
            }
            if ((flag & (int)Query.RScale) != 0)
            {
                RScale = packet.ReadInt32();
            }
            if ((flag & (int)Query.Link) != 0)
            {
                LinkCount  = packet.ReadInt32();
                LinkMarker = packet.ReadInt32();
            }
        }
        public long Update(BinaryReader packet, Duel duel)
        {
            long pos = packet.BaseStream.Position;

            while (true)
            {
                int size = packet.ReadInt16();
                if (size == 0)
                {
                    return(packet.BaseStream.Position - pos);
                }
                uint flag = packet.ReadUInt32();
                switch (flag)
                {
                case (uint)Query.Code:
                {
                    SetId(packet.ReadInt32());
                    break;
                }

                case (uint)Query.Position:
                {
                    Position = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Alias:
                {
                    Alias = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Type:
                {
                    Type = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Level:
                {
                    Level = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Rank:
                {
                    Rank = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Attribute:
                {
                    Attribute = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Race:
                {
                    Race = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Attack:
                {
                    Attack = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Defence:
                {
                    Defense = packet.ReadInt32();
                    break;
                }

                case (uint)Query.BaseAttack:
                {
                    BaseAttack = packet.ReadInt32();
                    break;
                }

                case (uint)Query.BaseDefence:
                {
                    BaseDefense = packet.ReadInt32();
                    break;
                }

                case (uint)Query.OverlayCard:
                {
                    Overlays.Clear();
                    int count = packet.ReadInt32();
                    for (int i = 0; i < count; ++i)
                    {
                        Overlays.Add(packet.ReadInt32());
                    }
                }
                break;

                case (uint)Query.Owner:
                {
                    Owner = duel.GetLocalPlayer(packet.ReadByte());
                    break;
                }

                case (uint)Query.Status:
                {
                    int       status               = packet.ReadInt32();
                    const int STATUS_DISABLED      = 0x0001;
                    const int STATUS_PROC_COMPLETE = 0x0008;
                    Disabled      = status & STATUS_DISABLED;
                    ProcCompleted = status & STATUS_PROC_COMPLETE;
                    break;
                }

                case (uint)Query.LScale:
                {
                    LScale = packet.ReadInt32();
                    break;
                }

                case (uint)Query.RScale:
                {
                    RScale = packet.ReadInt32();
                    break;
                }

                case (uint)Query.Link:
                {
                    LinkCount  = packet.ReadInt32();
                    LinkMarker = packet.ReadInt32();
                    break;
                }

                case (uint)Query.End:     //Query.End
                    return(packet.BaseStream.Position - pos);

                default:
                {
                    packet.ReadChars(size - sizeof(uint));
                    break;
                }
                }
            }
        }
Example #12
0
 public void Update(GameServerPacket packet, Duel duel)
 {
     int flag = packet.ReadInt32();
     if ((flag & (int)Query.Code) != 0)
         SetId(packet.ReadInt32());
     if ((flag & (int)Query.Position) != 0)
     {
         Controller = duel.GetLocalPlayer(packet.ReadByte());
         packet.ReadByte();
         packet.ReadByte();
         Position = packet.ReadByte();
     }
     if ((flag & (int)Query.Alias) != 0)
         Alias = packet.ReadInt32();
     if ((flag & (int)Query.Type) != 0)
         Type = packet.ReadInt32();
     if ((flag & (int)Query.Level) != 0)
         Level = packet.ReadInt32();
     if ((flag & (int)Query.Rank) != 0)
         Rank = packet.ReadInt32();
     if ((flag & (int)Query.Attribute) != 0)
         Attribute = packet.ReadInt32();
     if ((flag & (int)Query.Race) != 0)
         Race = packet.ReadInt32();
     if ((flag & (int)Query.Attack) != 0)
         Attack = packet.ReadInt32();
     if ((flag & (int)Query.Defence) != 0)
         Defense = packet.ReadInt32();
     if ((flag & (int)Query.BaseAttack) != 0)
         BaseAttack = packet.ReadInt32();
     if ((flag & (int)Query.BaseDefence) != 0)
         BaseDefense = packet.ReadInt32();
     if ((flag & (int)Query.Reason) != 0)
         packet.ReadInt32();
     if ((flag & (int)Query.ReasonCard) != 0)
         packet.ReadInt32(); // Int8 * 4
     if ((flag & (int)Query.EquipCard) != 0)
         packet.ReadInt32(); // Int8 * 4
     if ((flag & (int)Query.TargetCard) != 0)
     {
         int count = packet.ReadInt32();
         for (int i = 0; i < count; ++i)
             packet.ReadInt32(); // Int8 * 4
     }
     if ((flag & (int)Query.OverlayCard) != 0)
     {
         Overlays.Clear();
         int count = packet.ReadInt32();
         for (int i = 0; i < count; ++i)
             Overlays.Add(packet.ReadInt32());
     }
     if ((flag & (int)Query.Counters) != 0)
     {
         int count = packet.ReadInt32();
         for (int i = 0; i < count; ++i)
             packet.ReadInt32(); // Int16 * 2
     }
     if ((flag & (int)Query.Owner) != 0)
         Owner = duel.GetLocalPlayer(packet.ReadInt32());
     if ((flag & (int)Query.IsDisabled) != 0)
         packet.ReadInt32();
     if ((flag & (int)Query.IsPublic) != 0)
         packet.ReadInt32();
     if ((flag & (int)Query.LScale) != 0)
         packet.ReadInt32();
     if ((flag & (int)Query.RScale) != 0)
         packet.ReadInt32();
 }