internal override void Process()
        {
            if (this.Device.State == State.IN_PC_BATTLE)
            {
                if (!this.Device.Player.Avatar.Variables.IsBuilderVillage && !this.Device.Player.Avatar.Modes.IsAttackingOwnBase)
                {
                    var            Battle  = Core.Resources.Battles.Get(this.Device.Player.Avatar.Battle_ID);
                    Battle_Command Command = new Battle_Command
                    {
                        Command_Type = this.Identifier,
                        Command_Base = new Command_Base {
                            Tick = this.Tick
                        }
                    };
                    Battle.Add_Command(Command);
                }
            }
            else if (this.Device.State == State.IN_1VS1_BATTLE)
            {
                long UserID   = this.Device.Player.Avatar.UserId;
                long BattleID = this.Device.Player.Avatar.Battle_ID_V2;
                var  Home     = Resources.Battles_V2.GetPlayer(BattleID, UserID);

                Battle_Command Command = new Battle_Command
                {
                    Command_Type = this.Identifier,
                    Command_Base = new Command_Base {
                        Tick = this.Tick
                    }
                };
                Home.Add_Command(Command);
            }
        }
 internal override void Process()
 {
     if (this.Device.State == State.IN_PC_BATTLE)
     {
         if (!this.Device.Player.Avatar.Modes.IsAttackingOwnBase)
         {
             var            Battle  = Core.Resources.Battles.Get(this.Device.Player.Avatar.Battle_ID);
             Battle_Command Command =
                 new Battle_Command
             {
                 Command_Type = this.Identifier,
                 Command_Base = new Command_Base
                 {
                     Base = new Base
                     {
                         Tick = this.Tick
                     },
                     Data = this.GlobalId,
                     X    = this.X,
                     Y    = this.Y
                 }
             };
             Battle.Add_Command(Command);
             Battle.Replay_Info.Stats.Alliance_Used = true;
             Battle.Attacker.Castle_Units           = this.Device.Player.Avatar.Castle_Units.Clone();
         }
         this.Device.Player.Avatar.Castle_Units.Clear();
         this.Device.Player.Avatar.Castle_Used = 0;
     }
 }
Пример #3
0
        internal override void Process()
        {
            if (this.Device.State == State.IN_PC_BATTLE)
            {
                if (!this.Device.Player.Avatar.Variables.IsBuilderVillage && !this.Device.Player.Avatar.Modes.IsAttackingOwnBase)
                {
                    var            Battle  = Core.Resources.Battles.Get(this.Device.Player.Avatar.Battle_ID);
                    Battle_Command Command =
                        new Battle_Command
                    {
                        Command_Type = this.Identifier,
                        Command_Base =
                            new Command_Base
                        {
                            Base = new Base {
                                Tick = this.Tick
                            },
                            Data = this.GlobalId,
                            X    = this.X,
                            Y    = this.Y
                        }
                    };
                    Battle.Add_Command(Command);

                    int Index = Battle.Replay_Info.Spells.FindIndex(T => T[0] == this.GlobalId);
                    if (Index > -1)
                    {
                        Battle.Replay_Info.Spells[Index][1]++;
                    }
                    else
                    {
                        Battle.Replay_Info.Spells.Add(new[] { this.GlobalId, 1 });
                    }

                    Battle.Attacker.Add_Spells(GlobalId, 1);
                }
            }
            List <Slot> _PlayerSpells = this.Device.Player.Avatar.Spells;

            Slot _DataSlot = _PlayerSpells.Find(t => t.Data == GlobalId);

            if (_DataSlot != null)
            {
                _DataSlot.Count -= 1;
            }
        }
Пример #4
0
        internal override void Process()
        {
            if (this.Device.Player.Avatar.Variables.IsBuilderVillage)
            {
                List <Component> components = this.Device.Player.GetComponentManager.GetComponents(11);

                foreach (Component t in components)
                {
                    Unit_Storage_V2_Componenent c = (Unit_Storage_V2_Componenent)t;
                    if (c.GetUnitTypeIndex(this.Troop) != -1)
                    {
                        var storageCount = c.GetUnitCountByData(this.Troop);
                        if (storageCount >= 1)
                        {
                            c.RemoveUnits(this.Troop, 1);
                            break;
                        }
                    }
                }
            }
            else
            {
                List <Slot> _PlayerUnits = this.Device.Player.Avatar.Units;

                Slot _DataSlot = _PlayerUnits.Find(t => t.Data == GlobalId);
                if (_DataSlot != null)
                {
                    _DataSlot.Count -= 1;
                }
            }

            if (this.Device.State == State.IN_PC_BATTLE)
            {
                if (!this.Device.Player.Avatar.Variables.IsBuilderVillage && !this.Device.Player.Avatar.Modes.IsAttackingOwnBase)
                {
                    var            Battle  = Core.Resources.Battles.Get(this.Device.Player.Avatar.Battle_ID);
                    Battle_Command Command =
                        new Battle_Command
                    {
                        Command_Type = this.Identifier,
                        Command_Base =
                            new Command_Base
                        {
                            Base = new Base {
                                Tick = this.Tick
                            },
                            Data = this.GlobalId,
                            X    = this.X,
                            Y    = this.Y
                        }
                    };
                    Battle.Add_Command(Command);


                    int Index = Battle.Replay_Info.Units.FindIndex(T => T[0] == this.GlobalId);
                    if (Index > -1)
                    {
                        Battle.Replay_Info.Units[Index][1]++;
                    }
                    else
                    {
                        Battle.Replay_Info.Units.Add(new[] { this.GlobalId, 1 });
                    }

                    Battle.Attacker.Add_Unit(GlobalId, 1);
                }
            }
            else if (this.Device.State == State.IN_1VS1_BATTLE)
            {
                var Battle = Resources.Battles_V2.GetPlayer(this.Device.Player.Avatar.Battle_ID_V2,
                                                            this.Device.Player.Avatar.UserId);

                Battle_Command Command =
                    new Battle_Command
                {
                    Command_Type = this.Identifier,
                    Command_Base =
                        new Command_Base
                    {
                        Base = new Base {
                            Tick = this.Tick
                        },
                        Data = this.GlobalId,
                        X    = this.X,
                        Y    = this.Y
                    }
                };
                int Index = Battle.Replay_Info.Units.FindIndex(T => T[0] == this.GlobalId);
                if (Index > -1)
                {
                    Battle.Replay_Info.Units[Index][1]++;
                }
                else
                {
                    Battle.Replay_Info.Units.Add(new[] { this.GlobalId, 1 });
                }
                Battle.Add_Command(Command);
            }
        }
Пример #5
0
 internal void Add_Command(Battle_Command Command)
 {
     this.Commands.Add(this, Command);
 }
Пример #6
0
        internal override void Process()
        {
            if (this.Device.State == State.IN_PC_BATTLE)
            {
                if (!this.Device.Player.Avatar.Variables.IsBuilderVillage && !this.Device.Player.Avatar.Modes.IsAttackingOwnBase)
                {
                    var            Battle  = Core.Resources.Battles.Get(this.Device.Player.Avatar.Battle_ID);
                    Battle_Command Command =
                        new Battle_Command
                    {
                        Command_Type = this.Identifier,
                        Command_Base =
                            new Command_Base
                        {
                            Base = new Base {
                                Tick = this.Tick
                            },
                            Data = this.GlobalId,
                            X    = this.X,
                            Y    = this.Y
                        }
                    };
                    Battle.Add_Command(Command);

                    int Index = Battle.Replay_Info.Units.FindIndex(T => T[0] == this.GlobalId);
                    if (Index > -1)
                    {
                        Battle.Replay_Info.Units[Index][1]++;
                    }
                    else
                    {
                        Battle.Replay_Info.Units.Add(new[] { this.GlobalId, 1 });
                    }

                    Battle.Attacker.Heroes_Health.Add(new Slot(GlobalId, 0));
                }
            }
            else if (this.Device.State == State.IN_1VS1_BATTLE)
            {
                var Battle = Resources.Battles_V2.GetPlayer(this.Device.Player.Avatar.Battle_ID_V2,
                                                            this.Device.Player.Avatar.UserId);
                Battle_Command Command =
                    new Battle_Command
                {
                    Command_Type = this.Identifier,
                    Command_Base =
                        new Command_Base
                    {
                        Base = new Base {
                            Tick = this.Tick
                        },
                        Data = this.GlobalId,
                        X    = this.X,
                        Y    = this.Y
                    }
                };
                Battle.Add_Command(Command);

                int Index = Battle.Replay_Info.Units.FindIndex(T => T[0] == this.GlobalId);
                if (Index > -1)
                {
                    Battle.Replay_Info.Units[Index][1]++;
                }
                else
                {
                    Battle.Replay_Info.Units.Add(new[] { this.GlobalId, 1 });
                }

                Battle.Attacker.Heroes_Health.Add(new Slot(GlobalId, 0));
            }
        }