Example #1
0
        public Mob GenerateOne()
        {
            // completely unbiased. YOU WILL GET THE WORST MOBS ANYWAY
            var template = GenGod.SelectOne(_templates);

            var health  = new Dice(template.HealthDice);
            var attack  = new Dice(template.AttackDice);
            var defense = new Dice(template.DefenseDice);

            return(new Mob(_level, _grid, template, health.Roll(), attack.Roll(), defense.Roll()));
        }
Example #2
0
        public Player PopulateLevel()
        {
            var player   = new Player(_level, _grid);
            var position = _level.GetWalkablePoint();

            player.Place(position.X, position.Y);

            // generate mobs
            var count = GenGod.GenOne(7, 10);

            while (count-- > 0)
            {
                PlaceOne();
            }

            return(player);
        }
Example #3
0
        public void MoveRandomly()
        {
            var directions = new[] {
                Direction.Up,
                Direction.Down,
                Direction.Left,
                Direction.Right,
                Direction.UpRight,
                Direction.UpLeft,
                Direction.DownLeft,
                Direction.DownRight
            };

            Direction direction;

            do
            {
                direction = GenGod.SelectOne(directions);
            } while (Move(direction) == MoveResult.Blocked);
        }
Example #4
0
 public int Roll()
 {
     return(GenGod.RollDice(Count, Sides) + Offset);
 }