public void StartBattle(IMobPack pack, Stat statBonus, bool doubleStatBonus)
        {
            CurrentMobPack     = pack;
            CurrentBattleState = BattleState.Idle;
            BattleLvl          = -1;
            IsBossFight        = pack.Strength >= MobPackStrength.Boss;
            Enemies.Clear();
            EnemyMinions.Clear();
            PlayerMinions.Clear();
            FrontRow         = _model.Party.FrontRow;
            EnemyDeathCount  = 0;
            PlayerDeathCount = 0;
            BattleLog.ClearLog();
            GenerateEnemies(pack);
            Character.StaticTimeToAction = GetAvgSPD();
            SetInitialSpeed(Enemies);
            SetInitialSpeed(FrontRow);

            SetupPassives(Enemies, true);
            SetupPassives(EnemyMinions, true, true);
            SetupPassives(FrontRow);
            SetupPassives(_model.Party.BackSeat);

            SetStatBonus(Enemies, statBonus, doubleStatBonus);
            SetStatBonus(FrontRow, statBonus, doubleStatBonus);
            SetStatBonus(EnemyMinions, statBonus, doubleStatBonus);
            SetStatBonus(_model.Party.BackSeat, statBonus, doubleStatBonus);
        }
        private void GenerateEnemies(IMobPack pack)
        {
            if (IsBossFight)
            {
                // TODO Parse Bossfile of Boss and attach behavior
                return;
            }

            var experience = _model.Party.Experience;

            foreach (var enemy in pack.Enemies)
            {
                var xpFactor = 1d;
                switch (pack.GetStrength(enemy))
                {
                case MobPackStrength.Stronger:
                    xpFactor = 1.05d;
                    break;

                case MobPackStrength.Challenging:
                    xpFactor = 1.1d;
                    break;

                case MobPackStrength.Elite:
                    xpFactor = 1.2d;
                    break;

                case MobPackStrength.Boss:
                    xpFactor = 1.5d;
                    break;

                case MobPackStrength.EndBoss:
                    xpFactor = 3.0d;
                    break;

                case MobPackStrength.TheEndOfAllThings:
                    xpFactor = 133.7d;
                    break;
                }

                enemy.LvlUp((int)(experience * xpFactor));
                Enemies.Add(enemy);
            }

            foreach (var minion in pack.Minions)
            {
                minion.LvlUp(experience);
                EnemyMinions.Add(minion);
            }
        }
Exemple #3
0
        public List <Obj_AI_Base> LastHit(LastHitType?t, bool useCast = true)
        {
            var type = t ?? LastHitType.Smartly;

            if (IsReady && type > LastHitType.Never)
            {
                if (_killableMinions.Count == 0)
                {
                    if (type == LastHitType.Smartly)
                    {
                        if (LaneClearMinions.Count > 0)
                        {
                            _killableMinions.AddRange(
                                Prediction.Health.GetPrediction(LaneClearMinions.ToDictionary(minion => minion,
                                                                                              GetArrivalTime))
                                .Where(
                                    tuple =>
                                    tuple.Value > 0 && GetDamage(tuple.Key) >= tuple.Value &&
                                    tuple.Key.Health > tuple.Value)
                                .OrderByDescending(pair => pair.Key.MaxHealth)
                                .ThenBy(pair => pair.Value)
                                .ToDictionary(tuple => tuple.Key, tuple => tuple.Value)
                                .Keys);
                        }
                    }
                    else if (type == LastHitType.Always)
                    {
                        if (EnemyMinions.Count > 0)
                        {
                            _killableMinions.AddRange(
                                Prediction.Health.GetPrediction(EnemyMinions.ToDictionary(minion => minion,
                                                                                          GetArrivalTime))
                                .Where(tuple => tuple.Value > 0 && GetDamage(tuple.Key) >= tuple.Value)
                                .OrderByDescending(pair => pair.Key.MaxHealth)
                                .ThenBy(pair => pair.Value)
                                .ToDictionary(tuple => tuple.Key, tuple => tuple.Value)
                                .Keys);
                        }
                    }
                }
                var first = _killableMinions.FirstOrDefault();
                if (useCast && first != null)
                {
                    Cast(first);
                }
            }
            return(_killableMinions);
        }
Exemple #4
0
        private void Farm()
        {
            if (player.ManaPercent < 60)
            {
                return;
            }
            var allMinionsQ = EnemyMinions.Where(x => x.IsInRange(Player.Instance.ServerPosition, Q.Range));
            var allMinionsW = EnemyMinions.Where(x => x.IsInRange(Player.Instance.ServerPosition, W.Range));

            if (Q.IsReady())
            {
                FarmLocation qPos = Q.GetLineFarmLocation(allMinionsQ, Q.Width());
                if (qPos.HitNumber >= 3)
                {
                    Q.Cast(qPos.CastPosition);
                }
            }

            if (allMinionsW.Count() > 0 && W.IsReady())
            {
                W.Cast();
            }
        }
 public bool CharacterIsEnemy(ICharacter character)
 {
     return(Enemies.Any(x => x == character) || EnemyMinions.Any(x => x == character));
 }
 public void RemoveMinion(ICharacter minion)
 {
     EnemyMinions.Remove(minion);
     PlayerMinions.Remove(minion);
 }
Exemple #7
0
        private void GameObject_OnDelete(GameObject sender, EventArgs args)
        {
            AllObjects.Remove(sender);

            var hero = sender as AIHeroClient;

            if (hero != null)
            {
                AllHeroes.Remove(hero);
                if (hero.IsEnemy)
                {
                    EnemyHeroes.Remove(hero);
                    AllEnemies.Remove(hero);
                }
                else
                {
                    AllyHeroes.Remove(hero);
                    AllAllies.Remove(hero);
                }

                return;
            }

            var minion = sender as Obj_AI_Minion;

            if (minion != null)
            {
                if (minion.Team != GameObjectTeam.Neutral)
                {
                    if (minion.GetMinionType().HasFlag(Extensions.MinionTypes.Ward))
                    {
                        AllWards.Remove(minion);
                        if (minion.IsEnemy)
                        {
                            EnemyWards.Remove(minion);
                        }
                        else
                        {
                            AllyWards.Remove(minion);
                        }
                    }
                    else
                    {
                        AllMinions.Remove(minion);
                        if (minion.IsEnemy)
                        {
                            EnemyMinions.Remove(minion);
                            AllEnemies.Remove(minion);
                        }
                        else
                        {
                            AllyMinions.Remove(minion);
                            AllAllies.Remove(minion);
                        }
                    }
                }
                else if (minion.Name != "WardCorpse")
                {
                    switch (minion.GetJungleType())
                    {
                    case Extensions.JungleType.Small:
                        SmallJungleMinions.Remove(minion);
                        break;

                    case Extensions.JungleType.Large:
                        LargeJungleMinions.Remove(minion);
                        break;

                    case Extensions.JungleType.Epic:
                        EpicJungleMinions.Remove(minion);
                        break;

                    case Extensions.JungleType.Legendary:
                        LegendaryJungleMinions.Remove(minion);
                        break;
                    }

                    AllJungleMinions.Remove(minion);
                }

                return;
            }

            var particle = sender as Obj_GeneralParticleEmitter;

            if (particle != null)
            {
                AllParticleEmitters.Remove(particle);
                return;
            }

            var turret = sender as Obj_AI_Turret;

            if (turret != null)
            {
                AllTurrets.Remove(turret);

                if (turret.IsEnemy)
                {
                    EnemyTurrets.Remove(turret);
                }
                else
                {
                    AllyTurrets.Remove(turret);
                }

                return;
            }

            var shop = sender as Obj_Shop;

            if (shop != null)
            {
                AllShops.Remove(shop);

                if (shop.IsAlly)
                {
                    AllyShops.Remove(shop);
                }
                else
                {
                    EnemyShops.Remove(shop);
                }

                return;
            }

            var spawnPoint = sender as Obj_SpawnPoint;

            if (spawnPoint != null)
            {
                AllSpawnPoints.Remove(spawnPoint);

                if (spawnPoint.IsAlly)
                {
                    AllySpawnPoints.Remove(spawnPoint);
                }
                else
                {
                    EnemySpawnPoints.Remove(spawnPoint);
                }
            }

            var inhibitor = sender as Obj_BarracksDampener;

            if (inhibitor != null)
            {
                AllInhibitors.Remove(inhibitor);

                if (inhibitor.IsAlly)
                {
                    AllyInhibitors.Remove(inhibitor);
                }
                else
                {
                    EnemyInhibitors.Remove(inhibitor);
                }
            }

            var nexus = sender as Obj_HQ;

            if (nexus != null)
            {
                AllNexus.Remove(nexus);

                if (nexus.IsAlly)
                {
                    AllyNexus = null;
                }
                else
                {
                    EnemyNexus = null;
                }
            }

            var missile = sender as MissileClient;

            if (missile != null)
            {
                AllMissiles.Remove(missile);

                if (missile.IsAlly)
                {
                    AllyMissiles.Remove(missile);
                }
                else
                {
                    EnemyMissiles.Remove(missile);
                }
            }
        }