Exemple #1
0
        public bool IsVisibleFrom(CharacterEntity characterEntity)
        {
            if (characterEntity == null) throw new ArgumentNullException("characterEntity");
            List<Point> linePoints = Utils.LinePoints(new Point(characterEntity.X, characterEntity.Y), new Point(Entity.X, Entity.Y));
            GameTile[,,] gameTiles = Entity.Game.GameTiles;

            if (Utils.Distance(characterEntity.X, characterEntity.Y, Entity.X, Entity.Y) < 3)
            {
                if (characterEntity != Entity)
                {
                    characterEntity.VisibleThisTurn.Add(Entity);
                }
                return true;
            }

            foreach (Point tempPoint in linePoints)
            {
                if (gameTiles[tempPoint.X, tempPoint.Y, 2].Entity.Obstacle)
                {
                    return false;
                }
            }

            if (characterEntity != Entity)
            {
                characterEntity.VisibleThisTurn.Add(Entity);
            }
            return true;
        }
        public void Combat(CharacterEntity entity)
        {
            entity.StatusManager.HP = entity.StatusManager.HP - (StatusManager.Attack - entity.StatusManager.Defence);
            StatusManager.HP = StatusManager.HP - (entity.StatusManager.Attack - StatusManager.Defence);

            if (entity.StatusManager.HP <= 0)
            {
                entity.Game.GameTiles[entity.X, entity.Y, entity.Z].Entity = new Nothing(entity.Game, entity.X, entity.Y,
                                                                                         entity.Z);
            }
        }