/// module Forest{ export let OrcCoordinates = Forest.rnc.generate(3,4, 2, 4); export let OrcVillageSouthGates = new RoomRandom("The Orc Tribe - South Gates", false, true); export let OrcVillageNorthwestGates = new RoomRandom("The Orc Tribe - North Gates", false, true); export let OrcVillageWestWall = new RoomRandom("Around the Orc Tribe - West", false, true); export let OrcVillageNorthWall = new RoomRandom("Around the Orc Tribe - North", false, true); export let OrcVillageNortheastWall = new RoomRandom("Around the Orc Tribe - Northeast", false, true); export let OrcVillageEastWall = new RoomRandom("Around the Orc Tribe - East", false, true); export let OrcVillageSoutheastWall = new RoomRandom("Around the Orc Tribe - Southeast", false, true); export let OrcVillageSouthWall = new RoomRandom("Around the Orc Tribe - South", false, true); OrcVillageSouthGates.mapRoom(OrcVillageWestWall, Direction.NORTH); OrcVillageWestWall.mapRoom(OrcVillageNorthwestGates, Direction.NORTH); OrcVillageNorthwestGates.mapRoom(OrcVillageNorthWall, Direction.EAST); OrcVillageNorthWall.mapRoom(OrcVillageNortheastWall, Direction.EAST); OrcVillageNortheastWall.mapRoom(OrcVillageEastWall, Direction.SOUTH); OrcVillageEastWall.mapRoom(OrcVillageSoutheastWall, Direction.SOUTH); OrcVillageSoutheastWall.mapRoom(OrcVillageSouthWall, Direction.WEST); OrcVillageSouthWall.mapRoom(OrcVillageSouthGates, Direction.WEST); export let OrcVillageWalls = [OrcVillageWestWall, OrcVillageNorthWall, OrcVillageNortheastWall, OrcVillageEastWall, OrcVillageSoutheastWall, OrcVillageSouthWall]; } Forest.region.place(Forest.OrcVillageSouthGates); Forest.region.place(Forest.OrcVillageNorthwestGates); Forest.OrcVillageSouthGates.backgroundImage = "roomOrcVillage"; Forest.OrcVillageNorthwestGates.backgroundImage = "roomOrcVillage"; Forest.OrcVillageWalls.forEach(wall => { Forest.region.place(wall); wall.backgroundImage = "roomOrcVillage"; }); RegionRandom.rulebookAfterPlaceRoom.addRule(new Rule({ name : "After placing the Forest.OrcVillageSouthGates", code : (runner : RulebookRunner) => { // Place the rest of the village let map = runner.noun.map; let southwest = map.getCoordinates(runner.noun.room); let center = [southwest[0] + 1, southwest[1] + 1]; map.map(Forest.OrcVillageNorthwestGates, center[0] -1 , center[1] + 1) ; map.map(Forest.OrcVillageNorthWall, center[0], center[1] + 1) ; map.map(Forest.OrcVillageNortheastWall, center[0] + 1, center[1] + 1) ; map.map(Forest.OrcVillageWestWall, center[0] - 1, center[1]); map.block(center[0], center[1]); map.map(Forest.OrcVillageEastWall, center[0] + 1, center[1]) ; map.map(Forest.OrcVillageSouthWall, center[0], center[1] - 1) ; map.map(Forest.OrcVillageSoutheastWall, center[0] + 1, center[1] - 1); }, conditions : (runner : RulebookRunner) => { return runner.noun.room == Forest.OrcVillageSouthGates; } })); Forest.OrcVillageSouthGates.trickyCode = (options : TrickyOptions) => { while (!options.map.isFreeSquare(Forest.OrcCoordinates[0] + 1, Forest.OrcCoordinates[1] + 1, 1)) { Forest.OrcCoordinates[0] += 1; } return options.x == Forest.OrcCoordinates[0] && options.y == Forest.OrcCoordinates[1]; };