示例#1
0
        private void GameLoop(object sender, EventArgs e)
        {
            HighScore += ScoreForTick;
            if (Enemies.Any(enemy => CollisionDetector.AreCollided(Batwing, enemy)))
            {
                timer.Stop();
                renderer.ShowEndGameScreen(HighScore);
                return;
            }

            renderer.Clear();
            renderer.Draw(Batwing);

            if (rand.Next(100) < SpawnEnemyChange)
            {
                var enemy = enemiesFactory.Get(renderer.ScreenWidth, rand.Next(renderer.ScreenHeight));
                Enemies.Add(enemy);
                GameObjects.Add(enemy);
            }

            KillEnemiesIfColliding();

            HighScore += Enemies.Count(enemy => !enemy.IsAlive) * ScoreForKill;
            RemoveNotAliveGameObjects();
            UpdateObjectsPositions();
            DrawGameObjects();
        }
示例#2
0
    public override void Update()
    {
        if (currentDeployTick < DeploySpeed)
        {
            currentDeployTick += Time.deltaTime;

            if (currentDeployTick > DeploySpeed)
            {
                TurretBarrel.gameObject.SetActive(true);
            }
        }
        else
        {
            CurrentFireTick += Time.deltaTime;

            if (Enemies.Any())
            {
                if (CurrentFireTick >= FireSpeed)
                {
                    TurretBarrel.gameObject.SetActive(false);
                    CurrentFireTick   = 0f;
                    currentDeployTick = 0f;
                    Fire();
                }
            }
            else
            {
                TurretBarrel.gameObject.SetActive(false);
            }
        }
    }
示例#3
0
    public List <Actor> IdentifyEnemies()
    {
        // needs rest checks for enemies, triggering this very early in decision tree

        ClearTargets();
        Enemies = Me.Senses.Actors.Where(actor => !IsFriendOrNeutral(actor)).ToList();

        for (int i = 0; i < Enemies.Count; i++)
        {
            if (Enemies[i].Actions.Stealth.IsPerforming)
            {
                int performance_challenge_rating = Enemies[i].Actions.SkillCheck(true, Proficiencies.Skill.Performance);
                int my_insight_check             = Me.Actions.SkillCheck(true, Proficiencies.Skill.Insight);
                if (my_insight_check < performance_challenge_rating)
                {
                    Enemies.Remove(Enemies[i]);
                }
                else
                {
                    Debug.Log(Me.name + " succeeded an insight check with " + my_insight_check + " vs " + performance_challenge_rating);
                }
            }
        }

        if (Enemies.Any())
        {
            SetEnemyRanges();
        }
        else
        {
            Me.Actions.Combat.Engaged = false;
        }
        return(Enemies);
    }
示例#4
0
 public GameState UpdateCharacter(Character newCharacter)
 {
     if (Enemies.Any(x => x.ID == newCharacter.ID))
     {
         return(WithEnemies(Enemies.ReplaceWithID(newCharacter)));
     }
     else
     {
         return(WithParty(Party.ReplaceWithID(newCharacter)));
     }
 }
示例#5
0
        ///<inheritdoc/>
        public bool Update()
        {
            if (!Enemies.Any())
            {
                return(false);
            }

            Enemies.ForEach(enemy => enemy.Update());

            return(true);
        }
示例#6
0
        public void PlayGame()
        {
            while (keepPlaying == true)
            {
                while (Players[0].IsAlive && Enemies.Any(x => x.IsAlive))
                {
                    DisplayCombatInfo();
                    //player 1 attack enemies
                    Players[0].Attack(Enemies);
                    //wait for user to read combat data
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                    //attack player
                    DisplayCombatInfo();
                    //each bad guy attacks the player in turn
                    foreach (var baddies in Enemies)
                    {
                        baddies.Attack(Players);
                    }
                    //player reads combat data
                    Console.WriteLine("Press any key to continue...");
                    Console.ReadKey();
                    DisplayCombatInfo();

                    //kill cash reward formula
                    //kill count is = to current list for each bad guy where not alive = true
                    killCount = Enemies.Where(x => x.HP == 0).Count();
                    //if the current kill count is bigger than the previous kill count
                    if (killCount > previousKillCount)
                    {
                        //player 1 money is = to the difference * 25, that way they don't earn more than 1 cash
                        //increment per kill
                        Players[0].Money += (killCount - previousKillCount) * 25;
                        previousKillCount = killCount;
                    }
                }
                //if player 1 is alive at the end of the game
                if (Players[0].IsAlive)
                {
                    Console.WriteLine("You Win!!");
                    PlayAgain();
                }
                //if any enemy is alive at the end of the game
                else if (Enemies.Any(x => x.IsAlive))
                {
                    Console.WriteLine("You Lose");
                    PlayAgain();
                }
            }
        }
示例#7
0
        private void Fight(RealmTime time)
        {
            if (!Enemies.Any(e => e.Value.ObjectDesc.Enemy && !e.Value.Spawned && !e.Value.Name.Contains("Torii")))
            {
                _wave++;
                _restTime    = _time;
                CurrentState = ArenaState.Rest;

                if (_bossLevel + 1 < _changeBossLevel.Length &&
                    _changeBossLevel[_bossLevel + 1] <= _wave)
                {
                    _bossLevel++;
                }

                Rest(time, true);
            }
        }
示例#8
0
        private void Fight(RealmTime time)
        {
            if (!Enemies.Any(e => e.Value.ObjectDesc.Enemy))
            {
                _wave++;
                _restTime   = _time;
                _arenaState = ArenaState.Rest;

                if (_bossLevel + 1 < _changeBossLevel.Length &&
                    _changeBossLevel[_bossLevel + 1] <= _wave)
                {
                    _bossLevel++;
                }

                Rest(time, true);
            }
        }
示例#9
0
        private void Fight(RealmTime time)
        {
            if (!_solo && Players.Count(p => !p.Value.Client.Account.Admin || p.Value.SpectateTarget != null) <= 1)
            {
                _solo = true;

                Manager.Monitor.OpenPortal(World.Arena);
                Manager.Monitor.UpdateWorldInstance(World.Arena, Manager.Worlds[World.Arena]);

                var plr = Players.FirstOrDefault(p => !p.Value.Client.Account.Admin).Value;
                if (plr != null && _startingPlayers > 1)
                {
                    Manager.Chat.Announce(
                        "Congrats to " + plr.Name +
                        " for being the sole survivor of the public arena. (Wave: " + _wave + ", Starting Players: " +
                        _startingPlayers + ")", true);

                    foreach (var client in Manager.Clients.Keys)
                    {
                        client.SendPacket(new GlobalNotification
                        {
                            Type = GlobalNotification.DELETE_ARENA,
                            Text = "Public Arena"
                        });
                    }
                }
            }

            if (!Enemies.Any(e => e.Value.ObjectDesc.Enemy))
            {
                _wave++;
                _restTime    = _time;
                CurrentState = ArenaState.Rest;

                if (_bossLevel + 1 < _changeBossLevel.Length &&
                    _changeBossLevel[_bossLevel + 1] <= _wave)
                {
                    _bossLevel++;
                }

                Rest(time, true);
            }
        }
示例#10
0
    public override void Update()
    {
        if (currentDeployTick < DeploySpeed)
        {
            currentDeployTick += Time.deltaTime;

            // If the turret is deployed and an enemey is avalible it sets the gun barrel to that transform immeditaly
            if (currentDeployTick > DeploySpeed)
            {
                TurretBarrel.gameObject.SetActive(true);

                if (Enemies.Any())
                {
                    targetDirection       = (Enemies[0].transform.position - TurretBarrel.transform.position).normalized;
                    targetRotation        = Quaternion.FromToRotation(Vector3.up, targetDirection);
                    TurretBarrel.rotation = targetRotation;
                }
            }
        }
        else
        {
            CurrentFireTick += Time.deltaTime;

            if (Enemies.Any())
            {
                // This Turret cannot rotate towards a target whilst reloading
                if (CurrentFireTick >= FireSpeed)
                {
                    targetDirection = (Enemies[0].transform.position - TurretBarrel.transform.position).normalized;
                    targetRotation  = Quaternion.FromToRotation(Vector3.up, targetDirection);

                    TurretBarrel.rotation = Quaternion.RotateTowards(TurretBarrel.rotation, targetRotation, Time.deltaTime * RotateSpeed);

                    if (TurretBarrel.rotation == targetRotation)
                    {
                        CurrentFireTick = 0f;
                        Fire();
                    }
                }
            }
        }
    }
示例#11
0
        private void GetNames(List <Game> games)
        {
            foreach (var game in games)
            {
                if (Enemies.Any(e => e.Id == game.EnemyId))
                {
                    continue;
                }

                var name = EnemyNameService.GetNameFromGame(game, Enemies);
                if (name != string.Empty)
                {
                    var enemy = Enemies.FirstOrDefault(e => e.Name == name);
                    if (enemy != null)
                    {
                        enemy.Id = game.EnemyId;
                    }
                }
            }
        }
示例#12
0
        private void Fight(RealmTime time)
        {
            if (Players.Count(p => !p.Value.Client.Account.Admin) <= 1)
            {
                var plr = Players.Values.SingleOrDefault(p => !p.Client.Account.Admin);
                if (plr != null)
                {
                    Manager.Chat.Announce(
                        "Death eludes " + plr.Name +
                        ". Congratulations. (Wave: " + _wave +
                        ", Starting Players: " + _startingPlayers + ")");
                }

                foreach (var p in Manager.Worlds.Values.SelectMany(w => w.Players.Values).Where(p => p.Owner is Nexus))
                {
                    p.Client.SendPacket(new GlobalNotification
                    {
                        Type = GlobalNotification.DELETE_ARENA,
                        Text = "Oryx Arena"
                    });
                }

                _arenaState = ArenaState.Awaiting;
                return;
            }

            if (!Enemies.Any(e => e.Value.ObjectDesc.Enemy && !e.Value.Spawned))
            {
                _wave++;
                _restTime   = _time;
                _arenaState = ArenaState.Rest;

                if (_bossLevel + 1 < _changeBossLevel.Length &&
                    _changeBossLevel[_bossLevel + 1] <= _wave)
                {
                    _bossLevel++;
                }

                Rest(time, true);
            }
        }
示例#13
0
        private void WaitForPlayersToLeave(RealmTime time)
        {
            if (Players.Count == 0)
            {
                CurrentState = ArenaState.Ended;
                LockPortal();
            }

            if (!Enemies.Any(e => e.Value.ObjectDesc.Enemy && !e.Value.Spawned))
            {
                _wave++;
                _restTime    = _time;
                CurrentState = ArenaState.Rest;

                if (_bossLevel + 1 < _changeBossLevel.Length &&
                    _changeBossLevel[_bossLevel + 1] <= _wave)
                {
                    _bossLevel++;
                }

                Rest(time, true);
            }
        }
示例#14
0
    public void Step()
    {
        if (_finished)
        {
            return;
        }

        var containsPlayer = Bounds.Contains(Player.transform.position);

        if (!_activated && containsPlayer)
        {
            _enemyCounter.SetVisible(true);
            Activate();
        }
        else if (_activated && !containsPlayer)
        {
            _enemyCounter.SetVisible(false);
            DeActivateAI();
        }
        else if (_activated && containsPlayer)
        {
            foreach (var enemy in Enemies)
            {
                enemy.CanMove   = true;
                enemy.CanSearch = true;
            }
            _roomEvents.ActiveRoom = this;
            _enemyCounter.SetVisible(true);
            _enemyCounter.SetTally(Enemies.Count(e => e.gameObject.activeSelf), Enemies.Count);
        }

        if (_activated && (!Enemies.Any(i => i.gameObject.activeSelf)))
        {
            _enemyCounter.SetVisible(false);
            OpenDoors();
        }
    }
示例#15
0
 internal bool SquareIsPassable(int x, int y)
 {
     return(map[x, y] && !Enemies.Any(enemy => enemy.X == x && enemy.Y == y));
 }
示例#16
0
 public static bool BeingTargeted(this GameObject unit)
 {
     return(Enemies.Any(u => u.TargetGameObject == unit));
 }
示例#17
0
    private void SetEnemyRanges()
    {
        if (Me == null)
        {
            return;
        }

        float  melee_range   = Me.Actions.Combat.MeleeRange();
        Weapon ranged_weapon = Me.Actions.Combat.EquippedRangedWeapon;
        Weapon combat_spell  = Me.Actions.Combat.CombatSpells.FirstOrDefault(); // TODO: cycle through spells and choose the longest ranged.

        if (Enemies.Any())
        {
            AvailableMeleeTargets.AddRange(Enemies
                                           .Where(actor => actor != null && Me.SeparationFrom(actor.transform) <= melee_range)
                                           .OrderBy(actor => actor.Health.CurrentHitPoints)
                                           .Select(actor => actor.gameObject)
                                           .Distinct()
                                           .ToList());

            if (ranged_weapon != null)
            {
                AvailableRangedTargets.AddRange(Enemies
                                                .Where(actor => actor != null && Me.SeparationFrom(actor.transform) <= ranged_weapon.Range)
                                                .OrderBy(actor => actor.Health.CurrentHitPoints)
                                                .Select(actor => actor.gameObject)
                                                .Distinct()
                                                .ToList());
            }

            if (combat_spell != null)
            {
                AvailableRangedTargets.AddRange(Enemies
                                                .Where(actor => actor != null && Me.SeparationFrom(actor.transform) <= combat_spell.GetComponent <Spell>().range)
                                                .OrderBy(actor => actor.Health.CurrentHitPoints)
                                                .Select(actor => actor.gameObject)
                                                .Distinct()
                                                .ToList());
            }
        }

        if (Me.Actions.Decider.HostileStructures.Any())
        {
            AvailableMeleeTargets.AddRange(Me.Actions.Decider.HostileStructures
                                           .Where(structure => Me.SeparationFrom(structure.transform) <= melee_range + Me.Actions.Movement.StoppingDistance())
                                           .Select(structure => structure.gameObject)
                                           .Distinct()
                                           .ToList());

            if (ranged_weapon != null)
            {
                AvailableRangedTargets.AddRange(Me.Actions.Decider.HostileStructures
                                                .Where(structure => Me.SeparationFrom(structure.transform) <= ranged_weapon.Range + Me.Actions.Movement.StoppingDistance())
                                                .Select(structure => structure.gameObject)
                                                .Distinct()
                                                .ToList());
            }

            if (combat_spell != null)
            {
                AvailableRangedTargets.AddRange(Me.Actions.Decider.HostileStructures
                                                .Where(structure => Me.SeparationFrom(structure.transform) <= combat_spell.GetComponent <Spell>().range + Me.Actions.Movement.StoppingDistance())
                                                .Select(structure => structure.gameObject)
                                                .Distinct()
                                                .ToList());
            }
        }
    }
示例#18
0
 private bool InCombat()
 {
     return(HasObjective() ? Enemies.Any() && Me.Actions.Combat.Engaged : !GiveUpChase() && Enemies.Any() && Me.Actions.Combat.Engaged);
 }
示例#19
0
文件: Lulu.cs 项目: sadnecc/CHportcn
 private static bool AutoQ()
 {
     return(getCheckBoxItem(qMenu, "QImpaired") && Q.IsReady() &&
            Enemies.Any(e => e.LSIsValidTarget(Q.Range) && e.IsMovementImpaired() && Q.Cast(e).IsCasted()));
 }
示例#20
0
        public override void OnUpdate()
        {
            if (Player.IsDead)
            {
                return;
            }

            if (Menu.Item("RStealth").IsActive() && R.IsReady() && Player.CountEnemiesInRange(RRange) == 0 && R.Cast())
            {
                LastStealthedUlt = Utils.TickCount;
                return;
            }

            var c = Player.IsChannelingImportantSpell();

            if (c)
            {
                if (Menu.Item("RCancelUlt").IsActive() && Utility.MoveRandomly())
                {
                    return;
                }

                if (Menu.Item("RCancelNoEnemies").IsActive() && Player.CountEnemiesInRange(RRange) == 0 &&
                    !CancellingUlt && Utils.TickCount - LastStealthedUlt > 2500)
                {
                    CancellingUlt = true;
                    LeagueSharp.Common.Utility.DelayAction.Add(
                        300, () =>
                    {
                        CancellingUlt = false;
                        if (Player.CountEnemiesInRange(RRange) == 0 && Utility.MoveRandomly())
                        {
                        }
                    });
                }
            }

            if (WardJumping)
            {
                if (Utils.TickCount - LastWardPlacement < Game.Ping + 100 || E.LastCastedDelay(200))
                {
                    return;
                }

                if (!E.IsReady())
                {
                    WardJumping = false;
                    return;
                }

                var ward =
                    ObjectManager.Get <Obj_AI_Minion>()
                    .Where(o => E.IsInRange(o) && MinionManager.IsWard(o) && o.Buffs.Any(b => b.Caster.IsMe))
                    .OrderBy(o => o.Distance(Game.CursorPos))
                    .ThenByDescending(o => o.DistanceToPlayer())
                    .FirstOrDefault();

                if (ward == null)
                {
                    WardJumping = false;
                    return;
                }

                // stop movement to prevent turning around after e
                if (EloBuddy.Player.IssueOrder(GameObjectOrder.Stop, Player.ServerPosition) && E.CastOnUnit(ward))
                {
                    Console.WriteLine("WARD JUMP");
                    return;
                }
            }

            if (Flee())
            {
                return;
            }

            if (AutoKill())
            {
                return;
            }

            if (c)
            {
                return;
            }

            if (Menu.Item("REvade").IsActive() && EvadeDisabler.EvadeDisabled)
            {
                EvadeDisabler.EnableEvade();
            }

            if (Menu.Item("WAuto").IsActive() && W.IsReady() && Enemies.Any(h => h.IsValidTarget(W.Range)) && W.Cast())
            {
                Console.WriteLine("AUTO W");
            }
        }
示例#21
0
 public bool CharacterIsEnemy(ICharacter character)
 {
     return(Enemies.Any(x => x == character) || EnemyMinions.Any(x => x == character));
 }
示例#22
0
 private static bool AutoQ()
 {
     return(Menu.Item("QImpaired").IsActive() && Q.IsReady() &&
            Enemies.Any(e => e.IsValidTarget(Q.Range) && e.IsMovementImpaired() && Q.Cast(e).IsCasted()));
 }
示例#23
0
 internal bool SquareHasEnemy(int x, int y)
 {
     return(Enemies.Any(enemy => enemy.X == x && enemy.Y == y));
 }