Exemplo n.º 1
0
 public ITerminal this[TermColor foreColor, TermColor backColor]
 {
     get
     {
         return(CreateWindowCore(foreColor, backColor, new Rect(Size)));
     }
 }
Exemplo n.º 2
0
        private void WriteStat(ITerminal terminal, int y, string name, Stat stat)
        {
            // drained  red
            // normal   white
            // max      green

            TermColor color     = TermColor.White;
            TermColor textColor = TermColor.Gray;

            // highlight stats that have negative bonuses
            if (stat.IsLowered)
            {
                // drained
                color = TermColor.Purple;
                terminal[-1, y][TermColor.DarkPurple].Write(Glyph.ArrowDown);
                textColor = TermColor.DarkPurple;
            }
            else if (stat.Base == Stat.BaseMax)
            {
                // maxed
                color = TermColor.Green;
                terminal[-1, y][TermColor.Green].Write(Glyph.Mountains);
            }
            else if (stat.IsRaised)
            {
                // raised
                terminal[-1, y][TermColor.DarkGreen].Write(Glyph.ArrowUp);
            }

            terminal[0, y][color].Write(stat.Current.ToString().PadLeft(terminal.Size.X - 1));
            terminal[0, y][textColor].Write(name);
        }
Exemplo n.º 3
0
 public void Seed()
 {
     if (Status.HasFlag(FieldTileStatus.Tilled))
     {
         Status            |= FieldTileStatus.Seeded;
         renderer.Character = new Character((int)Glyph.Bullet, TermColor.Parse("#1a140d"), renderer.Character.BackColor);
     }
 }
Exemplo n.º 4
0
        internal override ITerminal CreateWindowCore(TermColor foreColor, TermColor backColor, Rect bounds)
        {
            // transform by this window's bounds and then defer to the parent.
            // this flattens out a chain of windows at creation time so that
            // drawing commands don't have to burn cycles walking up the chain
            // each time. this shaves a measurable chunk of time off drawing.
            bounds += mBounds.Position;
            bounds  = bounds.Intersect(mBounds);

            return(mParent.CreateWindowCore(foreColor, backColor, bounds));
        }
Exemplo n.º 5
0
        private Tile GetTile(TmxLayerTile tile, TmxTileset tileset)
        {
            int       code       = int.Parse(tileset.Tiles[tile.Gid - 1].Properties["Code"]);
            TermColor foreground = TermColor.Parse(tileset.Tiles[tile.Gid - 1].Properties["Foreground"]);
            TermColor background = TermColor.Parse(tileset.Tiles[tile.Gid - 1].Properties["Background"]);

            Character character   = new Character(code, foreground, background);
            Vector2D  position    = new Vector2D(tile.X, tile.Y);
            bool      collideable = bool.Parse(tileset.Tiles[tile.Gid - 1].Properties["Collideable"]);

            return(new Tile(character, position, collideable));
        }
Exemplo n.º 6
0
        private void WriteResist(ITerminal terminal, Element element, Vec pos)
        {
            int numResists = mHero.GetNumResists(element);

            TermColor color  = GameArt.GetColor(element);
            string    letter = element.ToString().Substring(0, 1);

            switch (numResists)
            {
            case 0: terminal[pos][TermColor.DarkGray].Write("-"); break;

            case 1: terminal[pos][color].Write(letter.ToLower()); break;

            default: terminal[pos][color].Write(letter); break;
            }
        }
Exemplo n.º 7
0
        private void WriteStat(ITerminal terminal, int y, string name, FluidStat value)
        {
            TermColor color     = TermColor.Green;
            TermColor textColor = TermColor.Gray;

            // highlight stats that are below the base value
            if (value.Current < value.Max)
            {
                color = TermColor.Red;
                terminal[-1, y][TermColor.DarkRed].Write(Glyph.ExclamationMark);
                textColor = TermColor.DarkRed;
            }

            terminal[0, y][color].Write(value.Current.ToString().PadLeft(terminal.Size.X - 1));
            terminal[0, y][textColor].Write(name);
        }
Exemplo n.º 8
0
        private void WriteLog(ITerminal terminal, LogEntry entry)
        {
            TermColor color = terminal.ForeColor;

            switch (entry.Type)
            {
            case LogType.Good:          color = TermColor.Green; break;

            case LogType.Bad:           color = TermColor.Red; break;

            case LogType.PermanentGood: color = TermColor.Gold; break;

            case LogType.TemporaryGood: color = TermColor.Blue; break;

            case LogType.WearOff:       color = TermColor.DarkCyan; break;

            case LogType.Resist:        color = TermColor.Cyan; break;

            case LogType.BadState:      color = TermColor.Orange; break;

            case LogType.DidNotWork:    color = TermColor.Yellow; break;

            case LogType.Fail:          color = TermColor.Gray; break;

            case LogType.Special:       color = TermColor.Purple; break;

            default:                    color = TermColor.White; break;
            }

            terminal = terminal[color];

            string text = entry.Text;

            // add the repeat count
            if (entry.Count > 1)
            {
                text += " (x" + entry.Count.ToString() + ")";
            }

            foreach (string line in text.WordWrap(terminal.Size.X))
            {
                terminal.Scroll(0, -1, pos => new Character(Glyph.Space));
                terminal[0, -1].Write(line);
            }
        }
Exemplo n.º 9
0
        /// <summary>
        /// Parses a Character from the given string formatted like:
        /// <code>Glyph [ForeColor [BackColor]]</code>
        /// "Glyph" can either be the case-insensitive name of a value in the <see cref="Glyph"/>
        /// enum, or a single character representing the ASCII value of the glyph. ForeColor and
        /// BackColor, if present, are the case-insensitive names of values in
        /// <see cref="TerminalColors"/>.
        /// </summary>
        /// <param name="text">The text to parse.</param>
        /// <returns>A Character defined by the given text.</returns>
        /// <exception cref="ArgumentNullException"><c>text</c> is null.</exception>
        /// <exception cref="ArgumentException"><c>text</c> is empty or contains more than three words.</exception>
        public static Character Parse(string text)
        {
            if (text == null)
            {
                throw new ArgumentNullException("text");
            }
            if (text.Length == 0)
            {
                throw new ArgumentException("Argument 'text' cannot be empty.");
            }

            text = text.Trim();

            // separate out the colors and glyph
            string[] parts = text.Split(new char[] { ' ' }, StringSplitOptions.RemoveEmptyEntries);

            // only supports three parts (max)
            if (parts.Length > 3)
            {
                throw new ArgumentException("Character.Parse() should be formatted \"Glyph\", \"ForeColor Glyph\", or \"ForeColor BackColor Glyph\".");
            }

            Glyph     glyph;
            TermColor foreColor = DefaultForeColor;
            TermColor backColor = DefaultBackColor;

            // parse the glyph
            glyph = ParseGlyph(parts[parts.Length - 1]);

            // parse the fore color
            if (parts.Length > 1)
            {
                foreColor = TermColors.FromName(parts[0]);
            }

            // parse the back color
            if (parts.Length > 2)
            {
                backColor = TermColors.FromName(parts[1]);
            }

            return(new Character(glyph, foreColor, backColor));
        }
Exemplo n.º 10
0
        private void WriteMaxStat(ITerminal terminal, int y, string name, FluidStat value, Func <int, string> formatter)
        {
            TermColor color     = TermColor.Gray;
            TermColor textColor = TermColor.Gray;

            // highlight stats that are below the base value
            if (value.IsLowered)
            {
                color = TermColor.Purple;
                terminal[-1, y][TermColor.DarkPurple].Write(Glyph.ArrowDown);
                textColor = TermColor.DarkPurple;
            }
            else if (value.IsRaised)
            {
                color = TermColor.Blue;
                terminal[-1, y][TermColor.DarkBlue].Write(Glyph.ArrowUp);
            }

            terminal[0, y][color].Write(formatter(value.Max).PadLeft(terminal.Size.X - 1));
            terminal[0, y][textColor].Write(name);
        }
Exemplo n.º 11
0
        public static Character Get(Entity entity)
        {
            Hero hero = entity as Hero;

            if (hero != null)
            {
                TermColor color = TermColor.Flesh;

                // choose a color based on condition

                // disease
                if (hero.Health.HasBonus(BonusType.Disease))
                {
                    color = TermColor.Purple;
                }

                // poison
                if (hero.Conditions.Poison.IsActive)
                {
                    color = TermColor.DarkGreen;
                }

                // near death
                if (hero.Health.Current < (hero.Health.Max / 5))
                {
                    color = TermColor.Red;
                }

                return(new Character(Glyph.Face, color));
            }

            // monster
            Monster monster = (Monster)entity;

            return((Character)(monster.Race.Appearance));
        }
Exemplo n.º 12
0
        /// <summary>
        /// Initializes a new CharacterString using the given string of ASCII characters.
        /// Color escape codes will also be parsed out of the string.
        /// </summary>
        /// <param name="text"></param>
        public CharacterString(string text, TermColor foreColor, TermColor backColor)
        {
            TermColor originalForeColor = foreColor;

            bool waitingForColor = false;

            foreach (char c in text)
            {
                // see if this character should be a color code
                if (waitingForColor)
                {
                    if (c == '-')
                    {
                        // - means "return to original color"
                        foreColor = originalForeColor;
                    }
                    else
                    {
                        foreColor = TermColors.FromEscapeChar(c);
                    }
                    waitingForColor = false;
                }
                else
                {
                    // handle color escape keys
                    if (c == '^')
                    {
                        waitingForColor = true;
                    }
                    else
                    {
                        Add(new Character(c, foreColor, backColor));
                    }
                }
            }
        }
Exemplo n.º 13
0
 /// <summary>
 /// Initializes a new Character.
 /// </summary>
 /// <param name="glyph">Glyph used to draw the Character.</param>
 /// <param name="foreColor">Foreground <see cref="TermColor"/> of the Character.</param>
 /// <param name="backColor">Background <see cref="TermColor"/> of the Character.</param>
 public Character(Glyph glyph, TermColor foreColor, TermColor backColor)
 {
     mGlyph     = glyph;
     mBackColor = backColor;
     mForeColor = foreColor;
 }
        public static Color ToSystemColor(this TermColor color)
        {
            switch (color)
            {
            case TermColor.Black: return(Color.Black);

            case TermColor.White: return(Color.White);

            case TermColor.LightGray: return(Color.FromArgb(192, 192, 192));

            case TermColor.Gray: return(Color.FromArgb(128, 128, 128));

            case TermColor.DarkGray: return(Color.FromArgb(48, 48, 48));

            case TermColor.LightRed:
            case TermColor.Pink:
                return(Color.FromArgb(255, 160, 160));

            case TermColor.Red: return(Color.FromArgb(220, 0, 0));

            case TermColor.DarkRed: return(Color.FromArgb(100, 0, 0));

            case TermColor.LightOrange:
            case TermColor.Flesh:
                return(Color.FromArgb(255, 200, 170));

            case TermColor.Orange: return(Color.FromArgb(255, 128, 0));

            case TermColor.DarkOrange: return(Color.FromArgb(128, 64, 0));

            case TermColor.LightGold: return(Color.FromArgb(255, 230, 150));

            case TermColor.Gold: return(Color.FromArgb(255, 192, 0));

            case TermColor.DarkGold: return(Color.FromArgb(128, 96, 0));

            case TermColor.LightYellow: return(Color.FromArgb(255, 255, 150));

            case TermColor.Yellow: return(Color.FromArgb(255, 255, 0));

            case TermColor.DarkYellow: return(Color.FromArgb(128, 128, 0));

            case TermColor.LightGreen: return(Color.FromArgb(130, 255, 90));

            case TermColor.Green: return(Color.FromArgb(0, 200, 0));

            case TermColor.DarkGreen: return(Color.FromArgb(0, 100, 0));

            case TermColor.LightCyan: return(Color.FromArgb(200, 255, 255));

            case TermColor.Cyan: return(Color.FromArgb(0, 255, 255));

            case TermColor.DarkCyan: return(Color.FromArgb(0, 128, 128));

            case TermColor.LightBlue: return(Color.FromArgb(128, 160, 255));

            case TermColor.Blue: return(Color.FromArgb(0, 64, 255));

            case TermColor.DarkBlue: return(Color.FromArgb(0, 37, 168));

            case TermColor.LightPurple: return(Color.FromArgb(200, 140, 255));

            case TermColor.Purple: return(Color.FromArgb(128, 0, 255));

            case TermColor.DarkPurple: return(Color.FromArgb(64, 0, 128));

            case TermColor.LightBrown: return(Color.FromArgb(190, 150, 100));

            case TermColor.Brown: return(Color.FromArgb(160, 110, 60));

            case TermColor.DarkBrown: return(Color.FromArgb(100, 64, 32));

            default: throw new UnexpectedEnumValueException(color);
            }
        }
Exemplo n.º 15
0
 public TerminalBase(TermColor foreColor, TermColor backColor)
 {
     ForeColor = foreColor;
     BackColor = backColor;
 }
Exemplo n.º 16
0
 public WindowTerminal(TerminalBase parent, TermColor foreColor, TermColor backColor, Rect bounds)
     : base(foreColor, backColor)
 {
     mParent = parent;
     mBounds = bounds;
 }
Exemplo n.º 17
0
 private void WriteStat(ITerminal terminal, int y, string name, int value, TermColor color)
 {
     terminal[0, y][color].Write(value.ToString().PadLeft(13));
     terminal[0, y][TermColor.Gray].Write(name);
 }
Exemplo n.º 18
0
 public ITerminal this[TermColor foreColor]
 {
     get { return(this[foreColor, BackColor]); }
 }
Exemplo n.º 19
0
        protected override void OnPaint(ITerminal terminal)
        {
            base.OnPaint(terminal);

            int x = 0;

            // draw the title
            if (!String.IsNullOrEmpty(Title))
            {
                terminal[0, 0][TitleColor].Write(Title);
                terminal[Title.Length + 1, 0][TermColor.Yellow].Write(Glyph.TriangleRight);

                x += Title.Length + 3;
            }

            // draw the options
            int nameWidth = mStats.Max((stat) => stat.Name.Length);

            for (int i = 0; i < mStats.Count; i++)
            {
                terminal[x, i][TextColor].Write(mStats[i].Name);

                // raw value
                int raw = mStats[i].Current;
                terminal[x + nameWidth + 1, i][TermColor.Gray].Write(raw.ToString().PadLeft(2));

                // race bonus
                terminal[x + nameWidth + 4, i].Write(mRace.StatBonuses[i].ToString("^g+##;^r-##;^m 0"));

                // final value
                int final = mStats[i].Current + mRace.StatBonuses[i];
                terminal[x + nameWidth + 7, i][TermColor.White].Write(final.ToString().PadLeft(2));

                // stat bar
                for (int j = 1; j <= Math.Max(final, raw); j++)
                {
                    Glyph     glyph = Glyph.BarDoubleLeftRight;
                    TermColor color = TermColor.Gray;

                    if (j == 1)
                    {
                        glyph = Glyph.BarUpDownDoubleRight;
                    }
                    else if (j == final)
                    {
                        glyph = Glyph.Solid;
                    }
                    else if (j > final)
                    {
                        glyph = Glyph.BarLeftRight;
                    }

                    if (j <= raw)
                    {
                        if (j <= final)
                        {
                            color = TermColor.Gray;
                        }
                        else
                        {
                            color = TermColor.DarkRed;
                        }
                    }
                    else
                    {
                        color = TermColor.Green;
                    }

                    terminal[x + nameWidth + 9 + j, i][color].Write(glyph);
                }
            }

            // draw the average line
            terminal[x + nameWidth + 9 + 15, 6][TermColor.DarkGray].Write(Glyph.TriangleUp);
            terminal[x + nameWidth + 9 + 12, 7][TermColor.DarkGray].Write("Average");
        }
Exemplo n.º 20
0
 internal abstract ITerminal CreateWindowCore(TermColor foreColor, TermColor backColor, Rect bounds);
Exemplo n.º 21
0
 /// <summary>
 /// Initializes a new Character using the default background <see cref="TermColor"/>.
 /// </summary>
 /// <param name="glyph">Glyph used to draw the Character.</param>
 /// <param name="foreColor">Foreground <see cref="TermColor"/> of the Character.</param>
 public Character(Glyph glyph, TermColor foreColor)
     : this(glyph, foreColor, DefaultBackColor)
 {
 }
Exemplo n.º 22
0
 /// <summary>
 /// Initializes a new Character using the default background <see cref="Color"/>.
 /// </summary>
 /// <param name="ascii">ASCII representation of the <see cref="Glyph"/> used
 /// to draw the Character.</param>
 /// <param name="foreColor">Foreground <see cref="TermColor"/> of the Character.</param>
 public Character(char ascii, TermColor foreColor)
     : this(Character.ToGlyph(ascii), foreColor, DefaultBackColor)
 {
 }
Exemplo n.º 23
0
        protected override void OnPaint(ITerminal terminal)
        {
            terminal.Clear();

            const int StrikeX = 3;
            const int DamageX = 9;
            const int DodgeX  = 16;
            const int ArmorX  = 23;
            const int ElemX   = 27;
            const int StatX   = 32;
            const int ResistX = 51;
            const int LabelX  = 80;

            // draw the table
            terminal[0, 0, 80, 28][TermColor.DarkGray].DrawBox();
            terminal[31, 0, 1, 28][TermColor.DarkGray].DrawBox(DrawBoxOptions.DoubleLines);
            terminal[50, 0, 1, 28][TermColor.DarkGray].DrawBox(DrawBoxOptions.DoubleLines);

            terminal[31, 0][TermColor.DarkGray].Write(Glyph.BarDoubleDownSingleLeftRight);
            terminal[50, 0][TermColor.DarkGray].Write(Glyph.BarDoubleDownSingleLeftRight);
            terminal[31, 27][TermColor.DarkGray].Write(Glyph.BarDoubleUpSingleLeftRight);
            terminal[50, 27][TermColor.DarkGray].Write(Glyph.BarDoubleUpSingleLeftRight);

            // write the header
            terminal[14, 0][TermColor.Gray].Write("Melee");
            terminal[39, 0][TermColor.Gray].Write("Stats");
            terminal[60, 0][TermColor.Gray].Write("Resistances");

            terminal[1, 1].Write("Strike Damage Dodge Armor Elem");
            terminal[StatX, 1].Write("StrAgiStaWilIntCha");

            // write the elements in color
            int x = ResistX;

            foreach (Element element in Enum.GetValues(typeof(Element)))
            {
                terminal[x, 1][GameArt.GetColor(element)].Write(GameArt.GetAbbreviation2(element));
                x += 2;
            }

            int y = 2;

            DrawRowLine(terminal, y++);

            // write the base values
            terminal[LabelX, y].Write("Base");

            // melee
            terminal[StrikeX, y].Write(" 0");
            terminal[DamageX, y].Write("x1.0");
            terminal[DodgeX, y].Write(Hero.DodgeBase.ToString());
            terminal[ArmorX, y].Write(" 0");
            terminal[ElemX, y][GameArt.GetColor(Element.Anima)].Write(GameArt.GetAbbreviation4(Element.Anima));

            // stats
            x = StatX;
            foreach (Stat stat in mHero.Stats)
            {
                terminal[x, y].Write(stat.Base.ToString().PadLeft(2));
                x += 3;
            }

            // resists
            terminal[ResistX, y].Write("0 0 0 0 0 0 0 0 0 0 0 0 0 0");

            y++;

            DrawRowLine(terminal, y++);

            // draw the equipment
            for (int i = 0; i < mHero.Equipment.Count; i++)
            {
                Item item = mHero.Equipment[i];

                if (item != null)
                {
                    terminal[LabelX, y].Write(item.ToString());
                }
                else
                {
                    terminal[LabelX, y][TermColor.DarkGray].Write(mHero.Equipment.GetCategory(i));
                }

                // melee stats
                if (item != null)
                {
                    // strike
                    WriteBonus(terminal, StrikeX, y, item.StrikeBonus);

                    // damage
                    float bonus = item.DamageBonus;
                    if (bonus < 1.0f)
                    {
                        terminal[DamageX, y][TermColor.Red].Write("x" + bonus.ToString("F2"));
                    }
                    else if (bonus == 1.0f)
                    {
                        terminal[DamageX, y][TermColor.DarkGray].Write("  -  ");
                    }
                    else
                    {
                        terminal[DamageX, y][TermColor.Green].Write("x" + bonus.ToString("F2"));
                    }

                    // dodge
                    terminal[DodgeX + 1, y][TermColor.DarkGray].Write(Glyph.Dash);

                    // armor
                    TermColor color = TermColor.White;
                    if (item.ArmorBonus < 0)
                    {
                        color = TermColor.Red;
                    }
                    else if (item.ArmorBonus > 0)
                    {
                        color = TermColor.Green;
                    }
                    else if (item.TotalArmor == 0)
                    {
                        color = TermColor.DarkGray;
                    }

                    if (item.TotalArmor < 0)
                    {
                        terminal[ArmorX, y][color].Write(Glyph.ArrowDown);
                        terminal[ArmorX + 1, y][color].Write(Math.Abs(item.TotalArmor).ToString());
                    }
                    else if (item.TotalArmor == 0)
                    {
                        terminal[ArmorX + 1, y][color].Write(Glyph.Dash);
                    }
                    else
                    {
                        terminal[ArmorX, y][color].Write(Glyph.ArrowUp);
                        terminal[ArmorX + 1, y][color].Write(item.TotalArmor.ToString());
                    }

                    // element
                    if (item.Attack != null)
                    {
                        Element element = item.Attack.Element;
                        terminal[ElemX, y][GameArt.GetColor(element)].Write(GameArt.GetAbbreviation4(element));
                    }
                }

                // stat bonuses
                x = StatX;
                foreach (Stat stat in mHero.Stats)
                {
                    if (item != null)
                    {
                        WriteBonus(terminal, x, y, item.GetStatBonus(stat));
                    }
                    x += 3;
                }

                // resists
                x = ResistX;
                foreach (Element element in Enum.GetValues(typeof(Element)))
                {
                    if (item != null)
                    {
                        if (item.Resists(element))
                        {
                            terminal[x, y][TermColor.Green].Write(Glyph.ArrowUp);
                        }
                        else
                        {
                            terminal[x, y][TermColor.DarkGray].Write(Glyph.Dash);
                        }
                    }
                    x += 2;
                }

                y++;
            }

            DrawRowLine(terminal, y++);

            // draw the stats
            foreach (Stat stat in mHero.Stats)
            {
                terminal[LabelX, y].Write(stat.Name);

                // melee bonuses

                // strike
                if (stat == mHero.Stats.Agility)
                {
                    WriteBonus(terminal, StrikeX, y, mHero.Stats.Agility.StrikeBonus);
                }

                // damage
                if (stat == mHero.Stats.Strength)
                {
                    float bonus = mHero.Stats.Strength.DamageBonus;
                    if (bonus < 1.0f)
                    {
                        terminal[DamageX, y][TermColor.Red].Write("x" + bonus.ToString("F1"));
                    }
                    else if (bonus == 1.0f)
                    {
                        terminal[DamageX, y][TermColor.DarkGray].Write("  -  ");
                    }
                    else
                    {
                        terminal[DamageX, y][TermColor.Green].Write("x" + bonus.ToString("F1"));
                    }
                }

                // dodge
                if (stat == mHero.Stats.Agility)
                {
                    WriteBonus(terminal, DodgeX, y, mHero.Stats.Agility.StrikeBonus);
                }

                // armor

                y++;
            }

            DrawRowLine(terminal, y++);

            terminal[LabelX, y].Write("Total");

            // melee totals
            if (mHero.MeleeStrikeBonus < 0)
            {
                terminal[StrikeX, y][TermColor.Red].Write(mHero.MeleeStrikeBonus.ToString());
            }
            else if (mHero.MeleeStrikeBonus == 0)
            {
                terminal[StrikeX + 1, y][TermColor.DarkGray].Write(Glyph.Digit0);
            }
            else
            {
                terminal[StrikeX, y][TermColor.Green].Write(Glyph.Plus);
                terminal[StrikeX + 1, y][TermColor.Green].Write(mHero.MeleeStrikeBonus.ToString());
            }

            // damage
            if (mHero.MeleeDamageBonus < 1.0f)
            {
                terminal[DamageX, y][TermColor.Red].Write("x" + mHero.MeleeDamageBonus.ToString("F1"));
            }
            else if (mHero.MeleeDamageBonus == 1.0f)
            {
                terminal[DamageX, y][TermColor.DarkGray].Write("x" + mHero.MeleeDamageBonus.ToString("F1"));
            }
            else
            {
                terminal[DamageX, y][TermColor.Green].Write("x" + mHero.MeleeDamageBonus.ToString("F1"));
            }

            // dodge
            if (mHero.GetDodge() < Hero.DodgeBase)
            {
                terminal[DodgeX, y][TermColor.Red].Write(mHero.GetDodge().ToString());
            }
            else
            {
                terminal[DodgeX, y].Write(mHero.GetDodge().ToString());
            }

            // armor
            if (mHero.Armor < 0)
            {
                terminal[ArmorX, y][TermColor.Red].Write(mHero.Armor.ToString());
            }
            else if (mHero.Armor == 0)
            {
                terminal[ArmorX + 1, y][TermColor.DarkGray].Write("0");
            }
            else
            {
                terminal[ArmorX + 1, y][TermColor.Green].Write(mHero.Armor.ToString());
            }

            // stat totals
            x = StatX;
            foreach (Stat stat in mHero.Stats)
            {
                if (stat.IsLowered)
                {
                    terminal[x, y][TermColor.Red].Write(stat.Current.ToString().PadLeft(2));
                }
                else if (stat.IsRaised)
                {
                    terminal[x, y][TermColor.Green].Write(stat.Current.ToString().PadLeft(2));
                }
                else
                {
                    terminal[x, y].Write(stat.Current.ToString().PadLeft(2));
                }
                x += 3;
            }

            // resistance totals
            x = ResistX;
            foreach (Element element in Enum.GetValues(typeof(Element)))
            {
                int resists = mHero.GetNumResists(element);

                if (resists == 0)
                {
                    terminal[x, y].Write(Glyph.Digit0);
                }
                else
                {
                    terminal[x, y][TermColor.Green].Write(resists.ToString());
                }
                x += 2;
            }

            // element
            Element attackElement = Element.Anima;
            Item    weapon        = mHero.Equipment.MeleeWeapon;

            if (weapon != null)
            {
                if (weapon.Attack != null)
                {
                    attackElement = weapon.Attack.Element;
                }
            }
            terminal[ElemX, y][GameArt.GetColor(attackElement)].Write(GameArt.GetAbbreviation4(attackElement));

            y += 2;
            terminal[1, y].Write("A total armor of " + mHero.Armor + " reduces damage by " + (100 - (int)(100.0f * Entity.GetArmorReduction(mHero.Armor))) + "%.");
        }
Exemplo n.º 24
0
 internal override ITerminal CreateWindowCore(TermColor foreColor, TermColor backColor, Rect bounds)
 {
     return(new WindowTerminal(this, foreColor, backColor, bounds));
 }
Exemplo n.º 25
0
 public ColorPair(TermColor fore, TermColor back)
 {
     Fore = fore;
     Back = back;
 }