public MapGenerator(IRMap map, IMobPackManager mobPackManager) { _map = map; _mobPackManager = mobPackManager; _rows = map.Rows; _cols = map.Columns; _directions = RHelper.GetDirections(); _oppositeDirections = new Dictionary <Direction, Direction> { { Direction.North, Direction.South }, { Direction.East, Direction.West }, { Direction.South, Direction.North }, { Direction.West, Direction.East }, { Direction.Center, Direction.Center } }; var roomGen = new RoomGenerator(5, 5, 10, 10, _map); var corridorGen = new HallwayGenerator(20, 20, 50, 50, _map); var drunkDrigger = new DrunkDigger(50, 50, 100, 100, _map); var treasureRoomGen = new TreasureRoom(5, 5, 13, 13, _map); _generators = new RandomContainer <IGenerator> { { roomGen, 60 }, { corridorGen, 5 }, { drunkDrigger, 180 }, { treasureRoomGen, 2 } }; roomGen.EnableEnemySpawning(_mobPackManager, 15); drunkDrigger.EnableEnemySpawning(_mobPackManager, 20); }
public OverworldPlayer(IRMap map, IStatistics statistics) { _map = map; _statistics = statistics; _fovMap = _map.Subscribe(); _viewRadius = 10; }
protected Generator(int minWidth, int minHeight, int maxWidth, int maxHeight, IRMap map) { MinWidth = minWidth; MinHeight = minHeight; MaxWidth = maxWidth; MaxHeight = maxHeight; Map = map; }
/// <summary> /// Contains an IRMap translated opcode and the registers at execution time for a particular bytecode instruction. /// </summary> /// <param name="iROp"></param> /// <param name="originalOp"></param> /// <param name="originalIndex">Index of original instruction.</param> /// <param name="regA"></param> /// <param name="regB"></param> /// <param name="regC"></param> public IntegratedInstruction(IRMap iROp, BytecodeInstruction bci) { this.bci = bci; this.iROp = iROp; registers = bci.regs; originalOp = bci.opcode; originalIndex = bci.index; }
public MobPack(IRMap map) { _map = map; _fovMap = _map.Subscribe(); _enemies = new List <ICharacter>(); _minions = new List <ICharacter>(); _convertBoni = new Dictionary <ICharacter, double>(); _strengths = new Dictionary <ICharacter, MobPackStrength>(); }
public Digger(int row, int col, int digGoal, IRMap map) { _row = row; _col = col; _digGoal = digGoal; _map = map; _digged = 0; _darkDigger = RHelper.RollPercentage(25); _doubleCombatBonus = RHelper.RollPercentage(10); _combatBonus = (ulong)RHelper.Roll(0, 23); }
public IMapGenerator CreateMapGenerator(IRMap map, IMobPackManager mobPackManager) { return(new MapGenerator(map, mobPackManager)); }
public OverworldCamera(IRMap map) { _map = map; Speed = 1; }
public TreasureRoom(int minWidth, int minHeight, int maxWidth, int maxHeight, IRMap map) : base(minWidth, minHeight, maxWidth, maxHeight, map) { }
public DrunkDigger(int minWidth, int minHeight, int maxWidth, int maxHeight, IRMap map) : base(minWidth, minHeight, maxWidth, maxHeight, map) { }
public void DrawMap(IRMap map, IOverworldCamera camera, IOverworldPlayer player, IMobPackManager mobPackManager, IStatistics statistics, IRConsole target = null) { var targetConsole = target ?? RootConsole; Clear(); var viewPort = camera.ViewPort; for (var row = 0; row <= viewPort.Height; ++row) { for (var col = 0; col <= viewPort.Width; ++col) { var charCell = ' '; var cellColour = TCODColor.white; var mapRow = viewPort.Y + row; var mapCol = viewPort.X + col; var cell = map[mapRow, mapCol]; cellColour = GetRarityColour(cell, cellColour); if (cell.Is(RCell.Wall)) { charCell = '#'; } if (cell.Is(RCell.Floor)) { charCell = '.'; } if (cell.Is(RCell.Door)) { charCell = 'D'; } if (cell.Is(RCell.Small)) { charCell = 'S'; } if (cell.Is(RCell.Normal)) { charCell = 'N'; } if (cell.Is(RCell.Big)) { charCell = 'B'; } if (cell.Is(RCell.Grand)) { charCell = 'G'; } if (cell.Is(RCell.Portal)) { charCell = 'O'; } foreach (var pack in from pack in mobPackManager.MobPacks let packX = pack.Position.X let packY = pack.Position.Y where mapCol == packX && mapRow == packY && player.CanSee(packX, packY) select pack) { charCell = 'E'; cellColour = pack.Strength.GetAssociatedColour(); } if (mapCol == player.Position.X && mapRow == player.Position.Y) { charCell = '@'; cellColour = TCODColor.white; } var visitedMod = .2f; if (player.CanSee(mapCol, mapRow)) { if (!cell.Is(RCell.Visited)) { statistics.AddToStatistic(Statistic.SquaresRevealed, 1); } visitedMod = 1f; map[mapRow, mapCol] |= RCell.Visited; } if (cell.Is(RCell.Dark)) { visitedMod *= 0.5f; } if (!cell.Is(RCell.Visited)) { continue; } cellColour = cellColour.Multiply(visitedMod); SetCharacter(col, row, charCell, cellColour); } } targetConsole.Blit(this, Bounds, _posX, _posY); }
public HallwayGenerator(int minWidth, int minHeight, int maxWidth, int maxHeight, IRMap map) : base(minWidth, minHeight, maxWidth, maxHeight, map) { }