// Update the values passed in public new void Update(Monster newData) { if (newData == null) { return; } // Update all the fields in the Data, except for the Id and guid //Base information Name = newData.Name; Description = newData.Description; Level = newData.Level; ExperienceTotal = newData.ExperienceTotal; ImageURI = GetMonsterImage(newData.MonsterType); Alive = newData.Alive; MonsterType = newData.MonsterType; MonsterTypeString = GetMonsterTypeString(newData.MonsterType); //Populate the Attributes AttributeString = AttributeBase.GetAttributeString(newData.Attribute); Attribute = new AttributeBase(newData.AttributeString); //Set the strings for the items Head = newData.Head; Feet = newData.Feet; Necklass = newData.Necklass; Body = newData.Body; PrimaryHand = newData.PrimaryHand; OffHand = newData.OffHand; RightFinger = newData.RightFinger; LeftFinger = newData.LeftFinger; Feet = newData.Feet; HasBeenZombie = false; }
// Upgrades a monster to a set level public bool ScaleLevel(int level) { // Level of < 1 does not need changing if (level < 1) { return(false); } // Don't go down in level... if (level < this.Level) { return(false); } // Level > Max Level if (level > LevelTable.MaxLevel) { return(false); } // 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; // Set attributes based on level 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 = HelperEngine.RollDice(Level, HealthDice); Attribute.CurrentHealth = Attribute.MaxHealth; // Update the attribute string AttributeString = AttributeBase.GetAttributeString(Attribute); return(true); }
// 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); }
// Upgrades to a set level public bool ScaleLevel(int level) { // Check to see if level is greater than max level if (level > LevelTable.MaxLevel) { return(false); } // Check to see if level is less than or equal to lowest level if (level <= 1) { return(false); } // Check to see if scale level is less than current level if (level < Level) { return(false); } // Set level of character to new level Level = level; // Get the number of points at the next level, and set it for Experience Total... ExperienceTotal = LevelTable.Instance.LevelDetailsList[Level + 1].Experience; // Update the attributes based on the level 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, HealthDice); Attribute.CurrentHealth = Attribute.MaxHealth; // Update the attribute string AttributeString = AttributeBase.GetAttributeString(Attribute); return(true); }
// 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 and guid //Base information Name = newData.Name; Description = newData.Description; Level = newData.Level; ExperienceTotal = newData.ExperienceTotal; ImageURI = GetCharacterImage(newData.PenguinType); Alive = newData.Alive; PenguinType = newData.PenguinType; TypeBonus = GetCharacterBonus(newData.PenguinType); BonusValue = GetCharacterBonusValue(newData.PenguinType); BonusString = GetBonusString(newData.PenguinType); //Populate the Attributes AttributeString = AttributeBase.GetAttributeString(newData.Attribute); Attribute = new AttributeBase(newData.AttributeString); //Set the strings for the items Head = newData.Head; Feet = newData.Feet; Necklass = newData.Necklass; Body = newData.Body; PrimaryHand = newData.PrimaryHand; OffHand = newData.OffHand; RightFinger = newData.RightFinger; LeftFinger = newData.LeftFinger; Bag = newData.Bag; // Revive IsRevived = false; }