///
import CentaurCoordinates = Forest.CentaurCoordinates;
module Forest{
export let CentaurCoordinates = Forest.rnc.generate(-4,-3, 1, 4);
export let CentaurVillageSouthwestWall = new RoomRandom("Around the Centaur Village - Southwest", false, true);
export let CentaurVillageNorthwestWall = new RoomRandom("The Centaur Village - North Gates", false, true);
export let CentaurVillageWestWall = new RoomRandom("Around the Centaur Village - West", false, true);
export let CentaurVillageNorthWall = new RoomRandom("Around the Centaur Village - North", false, true);
export let CentaurVillageNortheastWall = new RoomRandom("Around the Centaur Village - Northeast", false, true);
export let CentaurVillageEastWall = new RoomRandom("Around the Centaur Village - East", false, true);
export let CentaurVillageSoutheastGates = new RoomRandom("The Centaur Village - Eastern Gates", false, true);
export let CentaurVillageSouthWall = new RoomRandom("Around the Centaur Village - South", false, true);
CentaurVillageSouthwestWall.mapRoom(CentaurVillageWestWall, Direction.NORTH);
CentaurVillageWestWall.mapRoom(CentaurVillageNorthwestWall, Direction.NORTH);
CentaurVillageNorthwestWall.mapRoom(CentaurVillageNorthWall, Direction.EAST);
CentaurVillageNorthWall.mapRoom(CentaurVillageNortheastWall, Direction.EAST);
CentaurVillageNortheastWall.mapRoom(CentaurVillageEastWall, Direction.SOUTH);
CentaurVillageEastWall.mapRoom(CentaurVillageSoutheastGates, Direction.SOUTH);
CentaurVillageSoutheastGates.mapRoom(CentaurVillageSouthWall, Direction.WEST);
CentaurVillageSouthWall.mapRoom(CentaurVillageSouthwestWall, Direction.WEST);
export let CentaurVillageWalls = [CentaurVillageSouthwestWall, CentaurVillageWestWall, CentaurVillageNorthWall, CentaurVillageNortheastWall, CentaurVillageEastWall, CentaurVillageNorthwestWall, CentaurVillageSouthWall];
}
Forest.region.place(Forest.CentaurVillageSoutheastGates);
Forest.CentaurVillageSoutheastGates.backgroundImage = "roomCentaurVillage";
Forest.CentaurVillageWalls.forEach(wall => {
Forest.region.place(wall);
wall.backgroundImage = "roomCentaurVillage";
});
RegionRandom.rulebookAfterPlaceRoom.addRule(new Rule({
name : "After placing the Forest.CentaurVillageSoutheastGates",
code : (runner : RulebookRunner) => {
// Place the rest of the village
let map = runner.noun.map;
let southeast = map.getCoordinates(runner.noun.room);
let center = [southeast[0] - 1, southeast[1] + 1];
map.map(Forest.CentaurVillageNorthwestWall, center[0] -1 , center[1] + 1) ;
map.map(Forest.CentaurVillageNorthWall, center[0], center[1] + 1) ;
map.map(Forest.CentaurVillageNortheastWall, center[0] + 1, center[1] + 1) ;
map.map(Forest.CentaurVillageWestWall, center[0] - 1, center[1]);
map.block(center[0], center[1]);
map.map(Forest.CentaurVillageEastWall, center[0] + 1, center[1]) ;
map.map(Forest.CentaurVillageSouthWall, center[0], center[1] - 1) ;
map.map(Forest.CentaurVillageSouthwestWall, center[0] - 1, center[1] - 1);
},
conditions : (runner : RulebookRunner) => {
return runner.noun.room == Forest.CentaurVillageSoutheastGates;
}
}));
Forest.CentaurVillageSoutheastGates.trickyCode = (options : TrickyOptions) => {
while (!options.map.isFreeSquare(Forest.CentaurCoordinates[0] - 1, Forest.CentaurCoordinates[1] + 1, 1)) {
Forest.CentaurCoordinates[0] -= 1;
}
return options.x == Forest.CentaurCoordinates[0] && options.y == Forest.CentaurCoordinates[1];
};