コード例 #1
0
        private void StartNewBattle()
        {
            MapGenerator mapGen = new MapGenerator(_randomator, _myInterface, _myDrawer);

            _currentMap      = mapGen.GenerateBasicGrasslands(Constants.MapSize, Constants.MapSize);
            this._playerTeam = _currentMap.TeamRosterGetTeamFrom(0);

            _currentMap.SetTile(new Coords(0, 0), new Tile(_currentMap, new Coords(CoordsType.Tile, 0, 0), Constants.TileGeneratorGrass));
            _currentMap.SetTile(new Coords(0, 1), new Tile(_currentMap, new Coords(CoordsType.Tile, 0, 1), Constants.TileGeneratorGrass));
            _currentMap.SetTile(new Coords(3, 3), new Tile(_currentMap, new Coords(CoordsType.Tile, 3, 3), Constants.TileGeneratorGrass));
            _currentMap.AnalyzeTileAccessibility();

            _scheduler = new Scheduler(_currentMap);
            _ledger    = new Ledger(_scheduler);

            _myInterface.MyDrawer = _myDrawer;

            Creature hero1 = _currentMap.CreateCreature(new Coords(CoordsType.Tile, 0, 0), _currentMap.TeamRosterGetTeamFrom(0),
                                                        Constants.CreatureGeneratorHero, new BrainPlayerControlled(), _myDrawer, _myInterface);

            Creature hero2 = _currentMap.CreateCreature(new Coords(CoordsType.Tile, 0, 1), _currentMap.TeamRosterGetTeamFrom(0),
                                                        Constants.CreatureGeneratorHero, new BrainPlayerControlled(), _myDrawer, _myInterface);

            hero2.SkillPointsAdd(5);

            _currentMap.CreateItem(hero1, Constants.ItemGeneratorSword);
            _currentMap.CreateItem(hero2, Constants.ItemGeneratorSword);
            _currentMap.CreateItem(hero2, Constants.ItemGeneratorBow);
        }
コード例 #2
0
        public void PopulateMapWithMonsters(MapBattle map)
        {
            map.CreateTeam(Color.Red);
            map.CreateTeam(Color.Blue); //team 1. fix this later.

            for (int i = 0; i < map.BoundX; ++i)
            {
                for (int j = 0; j < map.BoundY; ++j)
                {
                    UInt32 dicethrow = _randomator.NSidedDice(50, 1);
                    if (dicethrow == 20 && map.TileIsPassable(new Coords(i, j)))
                    {
                        Creature goblin = map.CreateCreature(new Coords(CoordsType.Tile, i, j), map.TeamRosterGetTeamFrom(1),
                                                             Constants.CreatureGeneratorGoblin, new BrainBasicAI(_drawer), _drawer, _interface);
                        //map.CreateSpellForCreature(goblin, Spells.SkillMelee, _drawer, _interface);
                    }
                }
            }
        }