Exemple #1
0
        /// <summary>
        /// Writes the character info in the character info box.
        /// </summary>
        private void DrawCharInfo(SpriteBatch spriteBatch)
        {
            if (_myInterface.IsBoxOpen(InterfaceBattle.Buttons.CharacterInfo) && _myInterface.SelectedCreature != null)
            {
                Rectangle box = _myInterface.GetBox(InterfaceBattle.Buttons.CharacterInfo);

                Vector2 loc = new Vector2(box.Left + Constants.TextDisplayItemBoxDefaultXOffset,
                                          box.Top + Constants.TextDisplayDefaultVerticalSpacing);
                spriteBatch.DrawString(_font, ("Name: " + _myInterface.SelectedCreature.ToString()), loc, Constants.ColorCharacterName);

                Creature subject = _myInterface.SelectedCreature;
                int      delta   = Constants.FontDefaultSize + Constants.TextDisplayDefaultVerticalSpacing;

                loc.Y += delta;
                spriteBatch.DrawString(_font, ("Level: " + _myInterface.SelectedCreature.Level), loc, Constants.ColorCharacterProperties);

                for (int i = 0; i < (sbyte)Creature.StatBasic.COUNT; ++i)
                {
                    loc.Y += delta;
                    spriteBatch.DrawString(_font, (((Creature.StatBasic)i).ToString() + ": " + subject.GetStatBasic((Creature.StatBasic)i, true) + "/"
                                                   + subject.GetStatBasic((Creature.StatBasic)i, false)), loc, Constants.ColorCharacterProperties);
                }

                for (int i = 0; i < (sbyte)Creature.StatMain.COUNT; ++i)
                {
                    loc.Y += delta;
                    spriteBatch.DrawString(_font, (((Creature.StatMain)i).ToString() + ": " + subject.GetStatMain((Creature.StatMain)i, true) +
                                                   "(" + subject.GetStatMain((Creature.StatMain)i, false) + ")"), loc, Constants.ColorCharacterProperties);
                }
            }
        }
        /// <summary>
        /// Returns the experience gained upon defeating the passed Creature parameter.
        /// Currently the XP gain is the sum of the target's main stats to the power of 3/2 (to reward defeating tougher enemies).
        /// </summary>
        public static UInt16 XPFormula(Creature cible)
        {
            UInt16 returnValue = 0;

            for (int i = 0; i < (sbyte)Creature.StatMain.COUNT; ++i)
            {
                returnValue += cible.GetStatMain((Creature.StatMain)i, false);
            }

            return((UInt16)Math.Pow(returnValue, 1.5));
        }