示例#1
0
        // Update the character information
        // Updates the attribute string
        public void Update(Character newData)
        {
            if (newData == null)
            {
                return;
            }

            // Update all the fields in the Data, except for the Id

            // Base information
            Name            = newData.Name;
            Description     = newData.Description;
            Level           = newData.Level;
            ExperienceTotal = newData.ExperienceTotal;
            ImageURI        = newData.ImageURI;
            Alive           = newData.Alive;

            // Database information
            Guid = newData.Guid;
            Id   = newData.Id;

            // Populate the Attributes
            CharacterAttribute = newData.CharacterAttribute;

            // set the attribute string, for the Attribute
            AttributeString = AttributeBase.GetAttributeString(CharacterAttribute);

            // Set the strings for the items
            Head        = newData.Head;
            Feet        = newData.Feet;
            Necklass    = newData.Necklass;
            RightFinger = newData.RightFinger;
            LeftFinger  = newData.LeftFinger;
            Feet        = newData.Feet;
        }
示例#2
0
        // Upgrades a monster to a set level
        public void ScaleLevel(int level)
        {
            // Calculate Experience Remaining based on Lookup...
            Level = level;

            // Get the number of points at the next level, and set it for Experience Total...
            ExperienceTotal     = LevelTable.Instance.LevelDetailsList[Level + 1].Experience;
            ExperienceRemaining = ExperienceTotal;

            Damage = GetLevelBasedDamage() + LevelTable.Instance.LevelDetailsList[Level].Attack;
            MonsterAttribute.Attack        = LevelTable.Instance.LevelDetailsList[Level].Attack;
            MonsterAttribute.Defense       = LevelTable.Instance.LevelDetailsList[Level].Defense;
            MonsterAttribute.Speed         = LevelTable.Instance.LevelDetailsList[Level].Speed;
            MonsterAttribute.MaxHealth     = 5 * Level; // 1/2 of what Characters can get per level..
            MonsterAttribute.CurrentHealth = MonsterAttribute.MaxHealth;

            AttributeString = AttributeBase.GetAttributeString(MonsterAttribute);
        }
示例#3
0
        // Level Up
        public bool LevelUp()
        {
            // Walk the Level Table descending order
            // Stop when experience is >= experience in the table
            for (var i = LevelTable.Instance.LevelDetailsList.Count - 1; i > 0; i--)
            {
                // Check the Level
                // If the Level is > Experience for the Index, increment the Level.
                if (LevelTable.Instance.LevelDetailsList[i].Experience <= ExperienceTotal)
                {
                    var NewLevel = LevelTable.Instance.LevelDetailsList[i].Level;

                    // When leveling up, the current health is adjusted up by an offset of the MaxHealth, rather than full restore
                    var OldCurrentHealth = CharacterAttribute.CurrentHealth;
                    var OldMaxHealth     = CharacterAttribute.MaxHealth;

                    // Set new Health
                    // New health, is d10 of the new level.  So leveling up 1 level is 1 d10, leveling up 2 levels is 2 d10.
                    var NewHealthAddition = HelperEngine.RollDice(NewLevel - Level, 10);

                    // Increment the Max health
                    CharacterAttribute.MaxHealth += NewHealthAddition;

                    // Calculate new current health
                    // old max was 10, current health 8, new max is 15 so (15-(10-8)) = current health
                    CharacterAttribute.CurrentHealth = (CharacterAttribute.MaxHealth - (OldMaxHealth - OldCurrentHealth));

                    // Refresh the Attriburte String
                    AttributeString = AttributeBase.GetAttributeString(this.CharacterAttribute);

                    // Set the new level
                    Level = NewLevel;

                    // Done, exit
                    return(true);
                }
            }

            return(false);
        }