예제 #1
0
        public override bool UseTactic(IGameEngineCore engine, Monster monster)
        {
            if (IsPlayerVisible(engine, monster))
            {
                List<Point> pathToPlayer = GetPathToPlayer(engine, monster);

                if (IsNextToPlayer(engine, pathToPlayer))
                {
                    if (AttackPlayer(engine, monster))
                        return true;
                }

                if (HasPathToPlayer(engine, pathToPlayer))
                {
                    if (MoveOnPath(engine, pathToPlayer, monster))
                        return true;
                }
            }
            else
            {
                if (WalkTowardsLastKnownPosition(engine, monster))
                    return true;
            }
            WanderRandomly(engine, monster);   // We have nothing else to do, so wander                
            return true;
        }
예제 #2
0
 protected int GetPathToPlayerLength(IGameEngineCore engine, Monster monster)
 {
     List<Point> pathToPlayer = GetPathToPlayer(engine, monster);
     if (pathToPlayer == null)
         return -1;
     return pathToPlayer.Count;
 }
예제 #3
0
 public override bool UseTactic(IGameEngineCore engine, Monster monster)
 {
     bool usedSkill = engine.MonsterSkillEngine.UseSkill(monster, MonsterSkillType.SlingStone, engine.Player.Position);
     if (usedSkill)
         UsedCooldown(monster, CooldownName, CooldownAmount);
     return usedSkill;
 }
예제 #4
0
 private bool MoveCore(IGameEngineCore engine, Direction direction, Monster monster)
 {
     if (engine.Move(monster, direction))
         return true;
     Point position = PointDirectionUtils.ConvertDirectionToDestinationPoint(monster.Position, direction);
     if (monster.Intelligent && engine.Operate(monster, position))
         return true;
     return false;
 }
예제 #5
0
 public override bool CouldUseTactic(IGameEngineCore engine, Monster monster)
 {
     if (CanUseCooldown(monster, CooldownName))
     {
         int range = GetPathToPlayer(engine, monster).Count;
         if (range > 2)
             return true;
     }
     return false;
 }
예제 #6
0
 public override bool CouldUseTactic(IGameEngineCore engine, Monster monster)
 {
     // If see an ally who's wounded (I have something to do)
     List<Character> nearbyAllies = OtherNearbyEnemies(engine, monster);
     foreach (Character allyNeedingHealing in nearbyAllies.Where(x => x.CurrentHP < x.MaxHP).OrderBy(x => x.CurrentHP))
     {
         List<Point> pathToAlly = GetPathToCharacter(engine, monster, allyNeedingHealing);
         if (pathToAlly != null && pathToAlly.Count > 1)
             return true;
     }
     return false;
 }
예제 #7
0
 public override bool CouldUseTactic(IGameEngineCore engine, Monster monster)
 {
     List<Character> nearbyAllies = OtherNearbyEnemies(engine, monster);
     if (nearbyAllies.Count > 0 && CanUseCooldown(monster, CooldownName))
     {
         foreach (Character allyNeedingHealing in nearbyAllies.Where(x => x.CurrentHP < x.MaxHP).OrderBy(x => x.CurrentHP))
         {
             List<Point> pathToAlly = GetPathToCharacter(engine, monster, allyNeedingHealing);
             if (pathToAlly != null && pathToAlly.Count <= 1)
                 return true;
         }
     }
     return false;
 }
예제 #8
0
        protected bool WalkTowardsLastKnownPosition(IGameEngineCore engine, Monster monster)
        {
            if (monster.PlayerLastKnownPosition == Point.Invalid)
                return false;

            List<Point> pathTowards = engine.PathToPoint(monster, monster.PlayerLastKnownPosition, monster.Intelligent, false, true);
            if (pathTowards == null || pathTowards.Count == 0)
            {
                monster.PlayerLastKnownPosition = Point.Invalid;
                return false;
            }
            else
            {
                return MoveOnPath(engine, pathTowards, monster);
            }
        }
예제 #9
0
 public override bool UseTactic(IGameEngineCore engine, Monster monster)
 {
     List<Character> nearbyAllies = OtherNearbyEnemies(engine, monster);
     if (nearbyAllies.Count > 0 && CanUseCooldown(monster, CooldownName))
     {
         foreach (Character allyNeedingHealing in nearbyAllies.Where(x => x.CurrentHP < x.MaxHP).OrderBy(x => x.CurrentHP))
         {
             List<Point> pathToAlly = GetPathToCharacter(engine, monster, allyNeedingHealing);
             if (pathToAlly != null && pathToAlly.Count <= 1)
             {
                 engine.MonsterSkillEngine.UseSkill(monster, MonsterSkillType.FirstAid, allyNeedingHealing.Position);
                 UsedCooldown(monster, CooldownName, CooldownAmount);
                 return true;
             }
         }
     }
     return false;
 }
 public override bool UseTactic(IGameEngineCore engine, Monster monster)
 {
     if (s_random.Chance(50))
         return MoveTowardsPlayer(engine, monster);
     return false;
 }
예제 #11
0
 protected bool MoveOnPath(IGameEngineCore engine, List<Point> path, Monster monster)
 {
     Direction nextPosition = PointDirectionUtils.ConvertTwoPointsToDirection(monster.Position, path[0]);
     return MoveCore(engine, nextPosition, monster);
 }
예제 #12
0
 public abstract bool UseTactic(IGameEngineCore engine, Monster monster);
예제 #13
0
 protected bool MoveTowardsPlayer(IGameEngineCore engine, Monster monster)
 {
     return MoveOnPath(engine, GetPathToPlayer(engine, monster), monster);
 }
예제 #14
0
 protected bool AreOtherNearbyEnemies(IGameEngineCore engine, Monster monster)
 {
     return OtherNearbyEnemies(engine, monster).Count() > 1;
 }
예제 #15
0
 public override bool CouldUseTactic(IGameEngineCore engine, Monster monster)
 {
    return GetPathToPlayerLength(engine, monster) == 2;
 }
예제 #16
0
 public EffectEngine(IGameEngineCore engine)
 {
     m_engine = engine;
 }
 public override bool UseTactic(IGameEngineCore engine, Monster monster)
 {
     if (AreOtherNearbyEnemies(engine, monster))
         return MoveAwayFromPlayer(engine, monster);
     return false;
 }
예제 #18
0
 protected bool IsNextToPlayer(IGameEngineCore engine, Monster monster)
 {
     return GetPathToPlayerLength(engine, monster) == 1;
 }
예제 #19
0
 protected List<Point> GetPathToPlayer(IGameEngineCore engine, Monster monster)
 {
     return engine.PathToPoint(monster, engine.Player.Position, monster.Intelligent, false, true);
 }
예제 #20
0
        protected bool WanderRandomly(IGameEngineCore engine, Monster monster)
        {
            foreach (Direction d in DirectionUtils.GenerateRandomDirectionList())
            {
                if (engine.Move(monster, d))
                    return true;
            }

            // If nothing else, 'wait'
            engine.Wait(monster);
            return false;
        }
예제 #21
0
 protected bool IsPlayerVisible(IGameEngineCore engine, Monster monster)
 {
     return engine.FOVManager.VisibleSingleShot(engine.Map, monster.Position, monster.Vision, engine.Player.Position);
 }
 public override bool CouldUseTactic(IGameEngineCore engine, Monster monster)
 {
     return IsNextToPlayer(engine, monster);
 }
예제 #23
0
        protected bool MoveAwayFromPlayer(IGameEngineCore engine, Monster monster)
        {
            Direction directionTowardsPlayer = PointDirectionUtils.ConvertTwoPointsToDirection(monster.Position, engine.Player.Position);
            if (MoveCore(engine, PointDirectionUtils.GetDirectionOpposite(directionTowardsPlayer), monster))
                return true;

            foreach (Direction attemptDirection in PointDirectionUtils.GetDirectionsOpposite(directionTowardsPlayer))
            {
                if (MoveCore(engine, attemptDirection, monster))
                    return true;
            }
            return false;
        }
예제 #24
0
 protected bool HasPathToPlayer(IGameEngineCore engine, List<Point> pathToPlayer)
 {
     return pathToPlayer != null && pathToPlayer.Count > 0;
 }
예제 #25
0
 public override bool UseTactic(IGameEngineCore engine, Monster monster)
 {
     return engine.MonsterSkillEngine.UseSkill(monster, MonsterSkillType.Rush, engine.Player.Position);
 }
예제 #26
0
 protected bool AttackPlayer(IGameEngineCore engine, Monster monster)
 {
     if (engine.Attack(monster, engine.Player.Position))
         return true;
     return false;
 }
예제 #27
0
 protected bool IsNextToPlayer(IGameEngineCore engine, List<Point> pathToPlayer)
 {
     return pathToPlayer != null && pathToPlayer.Count == 1;
 }
예제 #28
0
 protected List<Character> OtherNearbyEnemies(IGameEngineCore engine, Monster monster)
 {
     return engine.MonstersInCharactersLOS(monster).Where(x => PointDirectionUtils.NormalDistance(x.Position, engine.Player.Position) < 4).OfType < Character>().ToList();
 }
 public override bool CouldUseTactic(IGameEngineCore engine, Monster monster)
 {
     return true;
 }
예제 #30
0
 protected void UpdateKnownPlayerLocation(IGameEngineCore engine)
 {
     PlayerLastKnownPosition = engine.Player.Position;
 }