Esempio n. 1
0
        // Create a new character, based on existing Character
        public Character(Character newData)
        {
            // Base information
            Name            = newData.Name;
            Description     = newData.Description;
            Level           = newData.Level;
            ExperienceTotal = newData.ExperienceTotal;
            ImageURI        = newData.ImageURI;
            Alive           = newData.Alive;

            Attribute               = new AttributeBase();
            Attribute.Attack        = newData.Attribute.Attack;
            Attribute.Speed         = newData.Attribute.Speed;
            Attribute.Defense       = newData.Attribute.Defense;
            Attribute.CurrentHealth = newData.Attribute.CurrentHealth;
            Attribute.MaxHealth     = newData.Attribute.MaxHealth;

            // Populate the Attributes
            AttributeString = AttributeBase.GetAttributeString(Attribute);

            // Set the strings for the items
            Head        = newData.Head;
            Feet        = newData.Feet;
            Necklass    = newData.Necklass;
            RightFinger = newData.RightFinger;
            LeftFinger  = newData.LeftFinger;
            Feet        = newData.Feet;
        }
Esempio n. 2
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
            Attribute = newData.Attribute;

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

            // Set the strings for the items
            Head        = newData.Head;
            Feet        = newData.Feet;
            Necklass    = newData.Necklass;
            RightFinger = newData.RightFinger;
            LeftFinger  = newData.LeftFinger;
            Feet        = newData.Feet;
        }
Esempio n. 3
0
        // Upgrades to a set level
        public void ScaleLevel(int level)
        {
            // Calculate Experience Remaining based on Lookup...
            Level           = level;
            ExperienceTotal = LevelTable.Instance.LevelDetailsList[Level].Experience;

            Attribute.Attack        = LevelTable.Instance.LevelDetailsList[Level].Attack;
            Attribute.Defense       = LevelTable.Instance.LevelDetailsList[Level].Defense;
            Attribute.Speed         = LevelTable.Instance.LevelDetailsList[Level].Speed;
            Attribute.MaxHealth     = HelperEngine.RollDice(Level, 10);
            Attribute.CurrentHealth = Attribute.MaxHealth;

            AttributeString = AttributeBase.GetAttributeString(Attribute);
        }
Esempio n. 4
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;
            Attribute.Attack        = LevelTable.Instance.LevelDetailsList[Level].Attack;
            Attribute.Defense       = LevelTable.Instance.LevelDetailsList[Level].Defense;
            Attribute.Speed         = LevelTable.Instance.LevelDetailsList[Level].Speed;
            Attribute.MaxHealth     = 5 * Level; // 1/2 of what Characters can get per level..
            Attribute.CurrentHealth = Attribute.MaxHealth;

            AttributeString = AttributeBase.GetAttributeString(Attribute);
        }
Esempio n. 5
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 = Attribute.CurrentHealth;
                    var OldMaxHealth     = Attribute.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
                    Attribute.MaxHealth += NewHealthAddition;

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

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

                    // Set the new level
                    Level = NewLevel;

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

            return(false);
        }