예제 #1
0
 protected CharBattleFrame()
 {
     _position   = new Point();
     CharConsole = new RConsole(16, 10);
     _root       = RConsole.RootConsole;
     DrawStatics();
 }
예제 #2
0
 public MainMenuView()
 {
     _rootConsole = RConsole.RootConsole;
     _rootWidth   = _rootConsole.Width;
     _rootHeight  = _rootConsole.Height;
     _menuConsole = new RConsole(9, 4);
     _menuDrawer  = new MenuDrawer();
 }
예제 #3
0
        public SwitchView()
        {
            _frames        = new List <ICharBattleFrame>();
            _drawer        = new StatScreenDrawer();
            _lister        = new SpellLister();
            _clearConsole  = new RConsole(72, 22);
            _borderConsole = new RConsole(16, 10);

            _drawer.SetPosition(80, 3);
            _lister.SetPosition(80, 35);
        }
예제 #4
0
        public TargetSelectView()
        {
            _root             = RConsole.RootConsole;
            _descDrawer       = new CharDescriptionDrawer();
            _statDrawer       = new StatScreenDrawer();
            _afflictionLister = new AfflictionLister();

            _descDrawer.SetPosition(80, 3);
            _statDrawer.SetPosition(80, 3);
            _afflictionLister.SetPosition(80, 35);
        }
예제 #5
0
        public override void InitializeImpl()
        {
            _root = RConsole.RootConsole;
            for (var i = 0; i < 8; ++i)
            {
                var x = StartX + ColOffset * (i % 4);
                var y = StartY + (i < 4 ? 0 : RowOffset);

                _frames.Add(CharBattleFrame.CreateFrameForPlayerChar());
                _frames[i].SetPosition(x, y);
            }
        }
예제 #6
0
        public void DrawMenu(IMenu menu, int row, int col, int offset, IRConsole target, int startItem, int endItem)
        {
            if (menu == null)
            {
                return;
            }

            _menuConsole.Clear();
            var targetConsole = target ?? RConsole.RootConsole;

            var rightMostCol = 0;
            var itemCount    = endItem + 1 - startItem;
            var counter      = 0;
            var newLineCount = 0;

            for (var i = startItem; i <= endItem; ++i, ++counter)
            {
                var printRow    = counter + counter * offset;
                var item        = menu.GetMenuItem(i);
                var label       = item.Label;
                var labelLength = Measure(label);
                newLineCount += label.Count(x => x == '\n');
                if (labelLength > rightMostCol)
                {
                    rightMostCol = labelLength;
                }

                if (item.IsSelected)
                {
                    _menuConsole.SetForegroundColour(TCODColor.red);
                }
                else if (item.IsDisabled)
                {
                    _menuConsole.SetForegroundColour(TCODColor.grey);
                }
                else
                {
                    _menuConsole.SetForegroundColour(TCODColor.white);
                }

                _menuConsole.PrintString(0, printRow, label);
            }

            _heatZone.Width  = rightMostCol;
            _heatZone.Height = itemCount + (offset * itemCount) + newLineCount;

            targetConsole.Blit(_menuConsole, _heatZone, row, col);
        }
예제 #7
0
        public void ListAfflictions(ICharacter character, IModel model, IRConsole target = null)
        {
            var targetConsole = target ?? RootConsole;

            Clear();
            DrawBorder();
            var redControl  = GetColorControlString(TCODColor.red);
            var stopControl = GetStopControl();

            PrintString(1, 1, string.Format("{0}Passives:{1}", redControl, stopControl));

            var passiveBuilder = new StringBuilder();
            var passives       = model.CharacterFactory.GetPassives(character);

            int[] count = { 0 };
            foreach (var passive in passives.Where(passive => count[0] != 4))
            {
                passiveBuilder.Append(passive.Name).AppendNewLine().AppendNewLine();
                ++count[0];
            }

            PrintString(3, 3, passiveBuilder.ToString());
            PrintString(1, 11, string.Format("{0}Afflictions:{1}", redControl, stopControl));

            var afflictions = RHelper.ScriptHelper.GetAfflictions(character);

            count[0] = 13;
            var orangeControl = GetColorControlString(TCODColor.orange);
            var greenControl  = GetColorControlString(TCODColor.green);

            foreach (var affliction in afflictions)
            {
                if (count[0] > 25)
                {
                    break;
                }

                PrintString(3, count[0],
                            string.Format("{0}{1}{2}", affliction.Type == AfflictionType.Debuff ? orangeControl : greenControl,
                                          affliction.Name, stopControl));
                count[0] += 2;
            }

            targetConsole.Blit(this, Bounds, _posX, _posY);
        }
예제 #8
0
        public void DrawSummary(ICharacter character, IRConsole target = null)
        {
            if (character == null)
            {
                return;
            }

            var targetConsole = target ?? RootConsole;

            Clear();
            DrawBorder();
            PrintString(1, 1, "Name:");
            PrintString(4, 3, character.Name);
            PrintString(1, 5, "Race:");
            PrintString(4, 7, character.Race);
            PrintString(1, 9, "Lore:");
            PrintString(new Rectangle(4, 11, 32, 11), character.Lore);
            targetConsole.Blit(this, Bounds, _posX, _posY);
        }
예제 #9
0
        public void Draw(ICharacter character, IRConsole target = null)
        {
            var targetConsole = target ?? RootConsole;

            Clear();
            DrawBorder();
            var redControl = GetColorControlString(TCODColor.red);

            PrintString(1, 1, "{0}Spelllist:{1}", redControl, GetStopControl());

            var row = 1;

            foreach (var spell in character.Spells)
            {
                row += 2;
                PrintString(1, row, spell.Name);
            }
            targetConsole.Blit(this, Bounds, _posX, _posY);
        }
예제 #10
0
        public PreGameView()
        {
            _console          = new RConsole(39, 61);
            _menuDrawer       = new MenuDrawer();
            _charDescDrawer   = new CharDescriptionDrawer();
            _statScreenDrawer = new StatScreenDrawer();
            _normAttackDrawer = new SpellDescriptionDrawer();
            _afflictionLister = new AfflictionLister();
            _spell1Drawer     = new SpellDescriptionDrawer();
            _spell2Drawer     = new SpellDescriptionDrawer();
            _spell3Drawer     = new SpellDescriptionDrawer();
            _spell4Drawer     = new SpellDescriptionDrawer();

            _charDescDrawer.SetPosition(43, 3);
            _statScreenDrawer.SetPosition(80, 3);
            _normAttackDrawer.SetPosition(43, 35);
            _afflictionLister.SetPosition(80, 35);

            _spell1Drawer.SetPosition(43, 3);
            _spell2Drawer.SetPosition(80, 3);
            _spell3Drawer.SetPosition(43, 35);
            _spell4Drawer.SetPosition(80, 35);
        }
예제 #11
0
 public void Blit(IRConsole src, Rectangle srcRect, int dstX, int dstY, float fgAlpha = 1, float bgAlpha = 1)
 {
     _console.Blit(src, srcRect, dstX, dstY, fgAlpha, bgAlpha);
 }
예제 #12
0
        public void DrawStats(ICharacter character, IRConsole targetConsole = null)
        {
            var target = targetConsole ?? RootConsole;

            Clear();
            SetupStatics();
            PrintString(35, 1, string.Format("Level: {0}", character.CurrentLevel), TCODAlignment.RightAlignment);
            PrintString(23, 30, character.Stats.EVAType == EVAType.Dodge ? "Dodge" : "Block");
            PrintString(4, 2, character.Name);
            PrintString(4, 5, character.Race);

            var stats      = character.Stats;
            var statFormat = new StringBuilder();

            statFormat.AppendFormat("{0} / {1}\n", RHelper.SanitizeNumber(character.CurrentHP),
                                    RHelper.SanitizeNumber(stats.GetTotalStat(BaseStat.HP)));
            statFormat.AppendFormat("{0} / {1}\n", character.CurrentMP, 200);

            var statStrengthFormat = new StringBuilder();
            var hpPercentage       = (float)(character.CurrentHP / stats.GetTotalStat(BaseStat.HP));
            var mpPercentage       = (float)(character.CurrentMP / 200d);

            //var stopControl2 = GetColorControlString(TCODColor.white);
            //var stopControl = TCODConsole.getColorControlString(8); // \b
            var stopControl = GetStopControl();

            statStrengthFormat.AppendFormat("{0}{1}%%{2}\n",
                                            GetColorControlString(new TCODColor(120f * hpPercentage, 1f, 1f)),
                                            (hpPercentage * 100d).ToString("F0"), stopControl);

            statStrengthFormat.AppendFormat("{0}{1}%%{2}\n",
                                            GetColorControlString(new TCODColor(205f * mpPercentage, 1f, 1f)),
                                            (mpPercentage * 100d).ToString("F0"), stopControl);

            for (var stat = Stat.AD; stat <= Stat.CHA; ++stat)
            {
                statFormat.AppendFormat("{0}\n", RHelper.SanitizeNumber(stats.GetTotalStat(stat)));
                statStrengthFormat.AppendFormat("{0}{1}%%{2}\n", GetColor(stats, stat),
                                                (stats[stat][StatType.BattleMod] * 100d).ToString("F0"), stopControl);
            }

            PrintString(StatRectangle, statFormat.ToString().TrimEnd());
            PrintString(StatStrengthRect, statStrengthFormat.ToString().TrimEnd());

            var masteryFormat         = new StringBuilder();
            var masteryStrengthFormat = new StringBuilder();

            for (var stat = Stat.FIR; stat <= Stat.LGT; ++stat)
            {
                masteryFormat.AppendFormat("{0}\n", (int)stats.GetTotalStat(stat));
                masteryStrengthFormat.AppendFormat("{0}{1}%%{2}\n",
                                                   GetColor(stats, stat), (int)(stats[stat][StatType.BattleMod] * 100d), stopControl);
            }

            PrintString(MasteryRect, masteryFormat.ToString().TrimEnd());
            PrintString(MasteryStrengthRect, masteryStrengthFormat.ToString().TrimEnd());

            var resiFormat         = new StringBuilder();
            var resiStrengthFormat = new StringBuilder();

            for (var stat = Stat.PSN; stat <= Stat.SIL; ++stat)
            {
                if (stat == Stat.SLW || stat == Stat.STD)
                {
                    continue;
                }

                resiFormat.AppendFormat("{0}\n", (int)stats.GetTotalStat(stat));
                resiStrengthFormat.AppendFormat("{0}{1}%%{2}\n", GetColor(stats, stat),
                                                (int)(stats[stat][StatType.BattleMod] * 100d), stopControl);
            }

            PrintString(ResiRect, resiFormat.ToString().TrimEnd());
            PrintString(ResiStrengthRect, resiStrengthFormat.ToString().TrimEnd());

            target.Blit(this, Bounds, _position.X, _position.Y);
        }
예제 #13
0
 public override void Activate()
 {
     _log  = Model.BattleModel.BattleLog;
     _root = RConsole.RootConsole;
     _log.ClearLog();
 }
예제 #14
0
 public BattleLogDrawer()
 {
     _logConsole = new RConsole(37, 29);
     _logArea    = new Rectangle(1, 3, _logConsole.Width - 2, _logConsole.Height - 3);
     _logBuilder = new StringBuilder();
 }
예제 #15
0
 protected InitializeableModelStateWithConsole(int width, int height)
 {
     _console = new RConsole(width, height);
 }
예제 #16
0
 public override void InitializeImpl()
 {
     _menuModel = Model.MenuModel;
     _root      = RConsole.RootConsole;
     _statDrawer.SetPosition(80, 3);
 }
예제 #17
0
 public void Blit(IRConsole src, Rectangle srcRect, int dstX, int dstY, float fgAlpha = 1, float bgAlpha = 1)
 {
     TCODConsole.blit(src.UnderlyingConsole, srcRect.X, srcRect.Y, srcRect.Width, srcRect.Height, _console, dstX,
                      dstY,
                      fgAlpha, bgAlpha);
 }
예제 #18
0
        public void DrawSpellDescription(ISpell spell, IRConsole target = null)
        {
            var targetConsole = target ?? RootConsole;

            Clear();
            DrawBorder();
            PrintString(1, 1, string.Format("{0}Name:{1}", GetColorControlString(TCODColor.red), GetStopControl()));
            PrintString(1, 3, spell.Name);
            PrintString(1, 6, "{0}Type:{1}", GetColorControlString(TCODColor.red), GetStopControl());

            var type = new StringBuilder();

            switch (spell.SpellType)
            {
            case SpellType.Physical:
                type.Append("Physical ");
                break;

            case SpellType.Magical:
                type.Append("Magical ");
                break;

            case SpellType.Composite:
                type.Append("Composite ");
                break;

            case SpellType.Pure:
                type.Append("Pure ");
                break;
            }

            switch (spell.TargetType)
            {
            case TargetType.Single:
                type.Append("Single Target ");
                break;

            case TargetType.Myself:
                type.Append("Self-cast ");
                break;

            case TargetType.Allies:
                type.Append("Ally AoE ");
                break;

            case TargetType.Enemies:
                type.Append("Enemy AoE ");
                break;

            case TargetType.Decaying:
                type.Append("Proximity-based ");
                break;
            }

            type.Append(spell.IsSupportSpell ? "Support Spell" : "Spell");
            PrintString(new Rectangle(1, 8, 32, 2), type.ToString());
            PrintString(1, 11, "{0}Masteries:{1}", GetColorControlString(TCODColor.red), GetStopControl());

            var masteries = new StringBuilder();

            foreach (var mastery in spell.Masteries.Select(eleMastery => (Stat)eleMastery))
            {
                masteries.Append(mastery.GetString()).Append(" ");
            }

            if (spell.Masteries.Count == 0)
            {
                masteries.Append("None");
            }

            PrintString(new Rectangle(1, 13, 32, 2), masteries.ToString());
            PrintString(_printArea, spell.Description);
            targetConsole.Blit(this, Bounds, _position.X, _position.Y);
        }
예제 #19
0
        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);
        }
예제 #20
0
 public void DrawMenu(IMenu menu, IRConsole target, int row = 0, int col = 0, int offset = 0)
 {
     DrawMenu(menu, row, col, offset, target, 0, menu.GetStateCount() - 1);
 }