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); }
public MapBattle GenerateBasicGrasslands(UInt16 dimensionX, UInt16 dimensionY) { MapBattle newMap = new MapBattle(_randomator, dimensionX, dimensionY); LinkMapToDrawerAndInterface(newMap); for (int i = 0; i < dimensionX; ++i) { for (int j = 0; j < dimensionY; ++j) { // Move the constant parameters to constants UInt32 dicethrow = _randomator.NSidedDice(20, 1); Coords currentCoords = new Coords(i, j); if (dicethrow == 1) { newMap.SetTile(currentCoords, new Tile(newMap, currentCoords, Constants.TileGeneratorSwamp)); } else if (dicethrow <= 2) { newMap.SetTile(currentCoords, new Tile(newMap, currentCoords, Constants.TileGeneratorWallStone)); } else if (dicethrow <= 5) { newMap.SetTile(currentCoords, new Tile(newMap, currentCoords, Constants.TileGeneratorForest)); } // the rest is grass by default. throw items and monsters onto it. } } newMap.AnalyzeTileAccessibility(); PopulateMapWithItems(newMap); PopulateMapWithMonsters(newMap); return(newMap); }