Example #1
0
        public void TakeDamage(double value)
        {
            if (value <= 0d)
            {
                return;
            }

            var evaChance = _stats.GetEVAChance(CurrentLevel);

            RollingEvasion(this, ref evaChance);

            var attackEvaded = RHelper.RollPercentage((int)evaChance);

            if (attackEvaded && _stats.EVAType == EVAType.Dodge)
            {
                AttackDodged(this, value);
                DodgedAttack = true;
                return;
            }
            BlockedDamage = attackEvaded;

            var reduction = attackEvaded ? 2d : 1d;

            if (attackEvaded)
            {
                AttackBlocked(this, ref value, ref reduction);
            }

            value /= reduction;
            TakeTrueDamage(value);
        }
Example #2
0
        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);
        }
Example #3
0
        private bool CheckAvailableSpace(int row, int col, Direction dir)
        {
            var topRow  = row;
            var leftCol = col;

            GetTopLeftCorner(ref topRow, ref leftCol, dir);

            // We have to move one block away, or it's guaranteed to fail the check
            RHelper.MoveInDirection(ref topRow, ref leftCol, dir);

            for (var r = topRow; r < topRow + Height; ++r)
            {
                for (var c = leftCol; c < leftCol + Width; ++c)
                {
                    if (r < 0 || r >= Map.Rows || c < 0 || c >= Map.Columns)
                    {
                        return(false);
                    }

                    if (!Map[r, c].Is(RCell.Diggable))
                    {
                        return(false);
                    }
                }
            }
            return(true);
        }
Example #4
0
        private bool ValidCell(int row, int col, ref Direction direction)
        {
            var cell = _map[row, col];

            if (!cell.Is(RCell.Wall))
            {
                return(false);
            }

            _directions.ShuffleList();

            foreach (var dir in _directions)
            {
                direction = dir;
                var checkRow = row;
                var checkCol = col;
                RHelper.MoveInDirection(ref checkRow, ref checkCol, dir);

                var checkRowOpp = row;
                var checkColOpp = col;
                RHelper.MoveInDirection(ref checkRowOpp, ref checkColOpp, _oppositeDirections[dir]);

                if (_map[checkRow, checkCol].Is(RCell.Diggable) &&
                    _map[checkRowOpp, checkColOpp].Is(RCell.Walkable))
                {
                    return(true);
                }
            }

            return(false);
        }
        public void SharedGenerationFunction(ICharacter newChar, int level, IRaceTemplate race = null)
        {
            var rTemplate   = race ?? _model.RaceFactory.GetRandomTemplate();
            var randomStats = Stats.GetRandomBaseStats();

            newChar.Race  = rTemplate.Name;
            newChar.Lore  = rTemplate.Description;
            newChar.Stats = randomStats;
            ApplyRaceTemplate(rTemplate, randomStats);
            newChar.LvlUp(_model.Party.Experience);
            var spells = new List <ISpell> {
                _spellFactory.GetSpell("Attack"), _spellFactory.GetSpell("Defend")
            };
            var spellCount = RHelper.Roll(2, 5);

            for (var i = 0; i < spellCount; ++i)
            {
                ISpell spell;

                do
                {
                    spell = _spellFactory.GetRandomSpell();
                } while (spells.Contains(spell));

                spells.Add(spell);
            }
            newChar.Spells = spells;
        }
Example #6
0
        public override void GenerateImpl(int row, int col, Direction dir)
        {
            var topRow  = row;
            var leftCol = col;

            GetTopLeftCorner(ref topRow, ref leftCol, dir);

            var goalRow = row;
            var goalCol = col;

            RHelper.MoveInDirection(ref goalRow, ref goalCol, dir);

            var digArea = new Rectangle(leftCol + 1, topRow + 1, Width - 2, Height - 2);
            var digger  = new Digger(goalRow, goalCol, (int)((digArea.Width * digArea.Height) / 25d), Map);

            Map[row, col] = Map[row, col].Is(RCell.Important)
                ? RCell.Door | RCell.Important | RCell.Closed
                : RCell.Floor;
            digger.DigCell(row, col);
            digger.DigCell(row + 1, col);
            digger.DigCell(row - 1, col);
            digger.DigCell(row, col + 1);
            digger.DigCell(row, col - 1);
            digger.Dig();
        }
Example #7
0
            public void Dig()
            {
                DigOut();

                do
                {
                    var dir     = RHelper.GetRandomDirection();
                    var nextRow = _row;
                    var nextCol = _col;
                    RHelper.MoveInDirection(ref nextRow, ref nextCol, dir);

                    if (!CanMove(nextRow, nextCol))
                    {
                        continue;
                    }

                    _row = nextRow;
                    _col = nextCol;

                    if (!CanDig())
                    {
                        continue;
                    }

                    DigOut();
                    ++_digged;
                } while (_digged < _digGoal);
            }
Example #8
0
        private void FindSuitableSpot(out int row, out int col, Func <int, int, bool> predicate)
        {
            var heatZone = _map.HeatZone;

            do
            {
                row = RHelper.Roll(heatZone.Top, heatZone.Bottom);
                col = RHelper.Roll(heatZone.Left, heatZone.Right);
            } while (predicate(row, col));
        }
        public void GeneratePack(int x, int y)
        {
            var pack = new MobPack(_model.Map)
            {
                Position = new Point(x, y)
            };
            var enemyCount = _model.Party.FrontRow.Count - RHelper.Roll(0, 1);

            if (enemyCount == 0)
            {
                ++enemyCount;
            }

            var xpReward = 0;

            // 25% Chance to get a group of enemies with the same race
            var raceGroup = RHelper.RollPercentage(25) ? _model.RaceFactory.GetRandomTemplate() : null;

            for (var i = 0; i < enemyCount; ++i)
            {
                var strengthRoll = RHelper.Roll(0, 99);
                var strength     = strengthRoll < 60
                    ? MobPackStrength.Equal
                    : strengthRoll < 90
                        ? MobPackStrength.Stronger
                        : strengthRoll < 98
                            ? MobPackStrength.Challenging
                            : MobPackStrength.Elite;

                xpReward += GenerateEnemy(pack, raceGroup, strength);
            }

            pack.XPReward = xpReward;

            switch (pack.Strength)
            {
            case MobPackStrength.Equal:
                pack.SightRadius = 25;
                break;

            case MobPackStrength.Stronger:
                pack.SightRadius = 20;
                break;

            case MobPackStrength.Challenging:
                pack.SightRadius = 10;
                break;

            case MobPackStrength.Elite:
                pack.SightRadius = 5;
                break;
            }

            _packs.Add(pack);
        }
Example #10
0
        protected override void DrawHP()
        {
            CharConsole.PrintString(6, 6, "         ");
            var currentHP     = CurrentChar.CurrentHP;
            var percentage    = currentHP / CurrentChar.Stats.GetTotalStat(BaseStat.HP);
            var colour        = new TCODColor((float)(120d * percentage), 1f, 1f);
            var colourControl = CharConsole.GetColorControlString(colour);

            CharConsole.PrintString(14, 6, "{0}{1}{2}", TCODAlignment.RightAlignment, colourControl,
                                    RHelper.SanitizeNumber(currentHP), CharConsole.GetStopControl());
        }
Example #11
0
        public ISpell GetRandomSpell()
        {
            ISpell spell;

            do
            {
                spell = _spells[RHelper.Roll(_spells.Count - 1)];
            } while (spell.Name == "Attack" || spell.Name == "Defend" || spell.Name == "Switch");

            return(spell);
        }
Example #12
0
 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);
 }
Example #13
0
 public void GenerateMap(int level)
 {
     _mobPackManager.ClearPacks();
     _featureTarget = level * 2 + RHelper.Roll(5, 15);
     PrepareMap();
     GenerateFeatures();
     PlaceWarp();
     EnsureEnemies();
     PlacePortal();
     _map.RecalculateHeatZone();
     _map.CreateFoVMap();
 }
Example #14
0
        public static IStats GetRandomBaseStats()
        {
            var stats = new Stats();
            var hp    = stats[Stat.HP];

            hp[StatType.Base]   = RHelper.Roll(75, 200);
            hp[StatType.Growth] = RHelper.Roll(5, 25);

            stats[BaseStat.MP][StatType.Base] = 200d;

            for (var stat = Stat.AD; stat <= Stat.CHA; ++stat)
            {
                var s = stats[stat];
                s[StatType.Base]   = RHelper.Roll(20, 80);
                s[StatType.Growth] = RHelper.Roll(1, 20);
            }

            stats.EVAType = RHelper.RollPercentage(10) ? EVAType.Block : EVAType.Dodge;

            if (stats.EVAType == EVAType.Dodge)
            {
                stats[BaseStat.EVA][StatType.Base]   = 2d;
                stats[BaseStat.EVA][StatType.Growth] = RHelper.Roll(1, 8);
            }
            else
            {
                stats[BaseStat.EVA][StatType.Base]   = RHelper.Roll(20, 80);
                stats[BaseStat.EVA][StatType.Growth] = RHelper.Roll(0, 1);
            }

            var spd = stats[BaseStat.SPD];

            spd[StatType.Base]       = 100d;
            spd[StatType.Growth]     = RHelper.Roll(5, 10);
            spd[StatType.Multiplier] = 0.0255d;

            for (var stat = Stat.FIR; stat <= Stat.LGT; ++stat)
            {
                stats[stat][StatType.Base] = RHelper.Roll(50, 200);
            }

            for (var stat = Stat.PSN; stat <= Stat.SIL; ++stat)
            {
                stats[stat][StatType.Base] = RHelper.Roll(0, 30);
            }

            stats.XPMultiplier = RHelper.Roll(80, 120) / 100d;

            return(stats);
        }
Example #15
0
        protected override void OnTurnTriggered(ICharacter character)
        {
            var silChance = GetVar(character, "sil_Chance");
            var silResi   = character.Stats.GetTotalStat(DebuffResistance.SIL) * 3;

            if (RHelper.Roll(0, 99) > (silChance - silResi))
            {
                RemoveFrom(character);
            }
            else
            {
                SetVar(character, "sil_Chance", silChance / 3);
            }
        }
        public override void SpellEffect(ICharacter caster, ICharacter target)
        {
            var damage = (3.75 * aAD * (aARC / 100) - 1.25 * dDEF) * (100 / dARC);

            DealDamage(damage);
            for (var i = Stat.HP; i <= Stat.SIL; ++i)
            {
                var stat      = target.Stats[i];
                var battleMod = stat[StatType.BattleMod];
                if (battleMod > 1 && RHelper.RollPercentage(40))
                {
                    BuffStat(caster, i, battleMod - 1);
                    stat[StatType.BattleMod] = 1;
                }
            }
        }
Example #17
0
        public override void GenerateImpl(int row, int col, Direction dir)
        {
            var topRow  = row;
            var leftCol = col;

            GetTopLeftCorner(ref topRow, ref leftCol, dir);

            var maxRow = topRow + Height;
            var maxCol = leftCol + Width;

            for (var r = topRow; r < maxRow; ++r)
            {
                for (var c = leftCol; c < maxCol; ++c)
                {
                    if (r == topRow || c == leftCol || r == maxRow - 1 || c == maxCol - 1)
                    {
                        Map[r, c] = RCell.Wall | RCell.Important;
                    }
                    else
                    {
                        Map[r, c] = RCell.Floor;
                    }
                }
            }

            var treasureCount = (int)Math.Sqrt(Width * Height);

            for (var i = 0; i < treasureCount; ++i)
            {
                int chestRow;
                int chestCol;
                do
                {
                    chestRow = RHelper.Roll(topRow + 1, maxRow - 2);
                    chestCol = RHelper.Roll(leftCol + 1, maxCol - 2);
                } while (Map[chestRow, chestCol].Is(RCell.Chest));

                Map[chestRow, chestCol] |= RCell.Chest | _rarities.Get() | _sizes.Get();
            }

            if (dir != Direction.Center)
            {
                Map[row, col] = RCell.Door | RCell.Locked | RCell.Closed;
            }
        }
Example #18
0
        public void AddEnemy(ICharacter enemy, MobPackStrength strength = MobPackStrength.Stronger,
                             double convertBonus = 1.2)
        {
            _enemies.Add(enemy);
            SetConvertBonus(enemy, convertBonus);
            SetStrength(enemy, strength);

            var coreCount = RHelper.RollPercentage(10) ? 2 : 1;

            if (RHelper.RollPercentage(20))
            {
                IntactCoreCount += coreCount;
            }
            else
            {
                UnstableCoreCount += coreCount;
            }
        }
Example #19
0
        public bool ProcessTurn(int playerX, int playerY)
        {
            _map.SetWalkable(Position.X, Position.Y, true);
            _map.SetVisible(Position.X, Position.Y, true);

            _fovMap.CalculateFoV(Position.X, Position.Y, SightRadius);

            if (_fovMap.IsVisible(playerX, playerY))
            {
                _fovMap.ComputePath(Position.X, Position.Y, playerX, playerY);
            }

            int wantX;
            int wantY;

            if (!_fovMap.PathAvailable())
            {
                do
                {
                    wantX = Position.X;
                    wantY = Position.Y;
                    RHelper.MoveInDirection(ref wantY, ref wantX, RHelper.GetRandomDirection());
                } while (!_fovMap.IsWalkable(wantX, wantY));
            }
            else
            {
                wantX = _position.X;
                wantY = _position.Y;
                _fovMap.WalkPath(ref wantX, ref wantY);
            }

            _position.X = wantX;
            _position.Y = wantY;

            var onPlayer = playerX == _position.X && playerY == _position.Y;

            _map.SetWalkable(_position.X, _position.Y, onPlayer);
            _map.SetVisible(_position.X, _position.Y, onPlayer);

            return(onPlayer);
        }
Example #20
0
        protected override void OnAttacking(ICharacter attacker, ICharacter target, ISpell spell, ref double damage, ref double modifier)
        {
            var drunkCounter = GetVar(attacker, "drunk_turnCounter") - 1;

            SetVar(attacker, "drunk_turnCounter", drunkCounter);

            if (attacker.Race == "Beerman")
            {
                damage *= 1.25d;
            }
            else if (RHelper.RollPercentage(25))
            {
                damage = 0d;
            }

            if (drunkCounter > 0)
            {
                return;
            }

            RemoveFrom(attacker);
        }
Example #21
0
        public bool Generate(int row, int col, Direction direction)
        {
            Width  = RHelper.Roll(MinWidth, MaxWidth);
            Height = RHelper.Roll(MinHeight, MaxHeight);

            if (!CheckAvailableSpace(row, col, direction))
            {
                return(false);
            }

            GenerateImpl(row, col, direction);

            if (!_spawningEnabled || !RHelper.RollPercentage(_spawnChance))
            {
                return(true);
            }

            var topRow  = row;
            var leftCol = col;

            GetTopLeftCorner(ref topRow, ref leftCol, direction);

            var maxRow = topRow + Height;
            var maxCol = leftCol + Width;

            int spawnRow;
            int spawnCol;

            do
            {
                spawnRow = RHelper.Roll(topRow, maxRow);
                spawnCol = RHelper.Roll(leftCol, maxCol);
            } while (!Map[spawnRow, spawnCol].Is(RCell.Walkable));

            _packManager.GeneratePack(spawnCol, spawnRow);

            return(true);
        }
Example #22
0
        private static ICharacter GetTarget(IList <ICharacter> characters)
        {
            /********************************
            * 60% to attack main tank      *
            * 30% to attack secondary tank *
            * 5% each to attack back row   *
            ********************************/

            ICharacter target = null;
            var        size   = characters.Count;

            do
            {
                var targetRoll = RHelper.Roll(99);
                target = characters[targetRoll < 60 || size == 1
                    ? 0
                    : targetRoll < 90 || size == 2
                        ? 1
                        : targetRoll < 95 || size == 3
                            ? 2
                            : 3];
            } while (target.IsDead);
            return(target);
        }
Example #23
0
 protected bool RollPercentage(double chance)
 {
     return(RHelper.RollPercentage((int)chance));
 }
Example #24
0
        public ITargetInfo SelectSpell(ICharacter character, IBattleModel battleModel, bool isEnemy)
        {
            // TODO Check if Boss has Rotation
            var targetInfo        = new TargetInfo();
            var lowHP             = character.CurrentHP / character.Stats.GetTotalStat(BaseStat.HP) <= .3d;
            var lowMP             = character.CurrentMP <= 75d;
            var silenced          = character.IsSilenced;
            var defendAvailable   = silenced || lowHP || lowMP;
            var spellSelectCount  = 0;
            var initialSpellIndex = defendAvailable ? 1 : 2;
            var spellList         = character.Spells;

            do
            {
                if (spellList.Count == 1)
                {
                    targetInfo.Spell = spellList[0];
                    break;
                }

                ++spellSelectCount;
                if (spellSelectCount == 10)
                {
                    initialSpellIndex = 0;
                }

                targetInfo.Spell =
                    spellList[RHelper.Roll(silenced ? 0 : initialSpellIndex, silenced ? 1 : spellList.Count - 1)];
            } while (targetInfo.Spell.MPCost >= character.CurrentMP + 1f);

            targetInfo.Target = null;
            var targetType = targetInfo.Spell.TargetType;

            if (targetType == TargetType.Allies || targetType == TargetType.Enemies)
            {
                return(targetInfo);
            }

            if (targetType == TargetType.Myself)
            {
                targetInfo.Target = character;
                return(targetInfo);
            }

            var enemies  = battleModel.Enemies;
            var frontRow = battleModel.FrontRow;

            if (targetInfo.Spell.IsSupportSpell)
            {
                var rollMax = isEnemy ? enemies.Count - 1 : frontRow.Count - 1;
                do
                {
                    targetInfo.Target = isEnemy ? enemies[RHelper.Roll(rollMax)] : frontRow[RHelper.Roll(rollMax)];
                } while (targetInfo.Target.IsDead);

                return(targetInfo);
            }

            targetInfo.Target = isEnemy ? GetTarget(frontRow) : GetTarget(enemies);
            return(targetInfo);
        }
 private string GetRandomName()
 {
     return(_names[RHelper.Roll(_names.Count)]);
 }
Example #26
0
        public bool TryToApplyDebuf(DebuffResistance type, int successChance)
        {
            var resistance = GetTotalStat(type) * 3;

            return(RHelper.RollPercentage((int)(successChance - resistance)));
        }
        public override void Run()
        {
            var fetchCount   = 5;
            var printedLines = 0;

            do
            {
                _logConsole.Clear();
                var redControl   = _logConsole.GetColorControlString(TCODColor.red);
                var greenControl = _logConsole.GetColorControlString(TCODColor.green);
                var stopControl  = _logConsole.GetStopControl();

                _logConsole.PrintString(1, 1, "{0}Battlelog:{1}", redControl, stopControl);
                _logConsole.DrawBorder();

                var log = _log.GetLastEntries(fetchCount);
                printedLines = 0;

                foreach (var logEntry in log)
                {
                    _logBuilder.Clear();
                    var printArea = new Rectangle(_logArea.X, _logArea.Y + printedLines, _logArea.Width,
                                                  _logArea.Height - printedLines);
                    if (logEntry.IsCustomMessage)
                    {
                        _logBuilder.Append(logEntry.CustomMessage).AppendNewLine().AppendNewLine();
                        printedLines += _logConsole.PrintString(printArea, _logBuilder.ToString());
                        continue;
                    }

                    _logBuilder.AppendFormat("{0}{1}{2} uses {3} on {4}{5}{6}",
                                             logEntry.CasterIsEnemy ? redControl : greenControl, logEntry.CasterName, stopControl,
                                             logEntry.SpellName, logEntry.ReceiverIsEnemy ? redControl : greenControl,
                                             logEntry.SelfCast ? "self" : logEntry.ReceiverName, stopControl);

                    if (logEntry.AttackDodged)
                    {
                        _logBuilder.Append(" but the attack was dodged");
                    }
                    else
                    {
                        _logBuilder.Append(logEntry.WasHealed ? " healing for " : " dealing ")
                        .Append(logEntry.WasHealed ? greenControl : redControl)
                        .Append(logEntry.Value <= 0d ? "no" : RHelper.SanitizeNumber(logEntry.Value))
                        .Append(stopControl)
                        .Append(logEntry.WasHealed ? " healing" : " damage");
                    }

                    if (logEntry.AttackBlocked)
                    {
                        _logBuilder.Append(" (blocked)");
                    }

                    if (logEntry.WasAfflicted)
                    {
                        _logBuilder.Append(" and inflicting ")
                        .Append(logEntry.AfflictedBy);
                    }

                    _logBuilder.Append("!");

                    if (logEntry.Fatal)
                    {
                        _logBuilder.AppendNewLine()
                        .AppendNewLine()
                        .Append(logEntry.ReceiverName)
                        .AppendNewLine(" dies!");
                    }

                    _logBuilder.AppendNewLine();
                    printedLines += _logConsole.PrintString(printArea, _logBuilder.ToString());
                }
                --fetchCount;
            } while (printedLines > MaxLogLines);
            _root.Blit(_logConsole, _logConsole.Bounds, _position.X, _position.Y);
        }
Example #28
0
 public IRaceTemplate GetRandomTemplate()
 {
     return(Templates[RHelper.Roll(Templates.Count - 1)]);
 }
Example #29
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);
        }