/// <summary> /// Sets the Level to Scale Up to /// </summary> /// <param name="level">The New Level</param> /// <returns>True if New Level Occurs</returns> public bool ScaleLevel(int level) { // Level of < 1 does not need changing if (level < 1) { return(false); } // Same level does not need changing if (level == this.Level) { 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; Attribute.MaxHealth = HelperEngine.RollDice(Level, HealthDice); return(true); }
// Upgrades to a set level public bool ScaleLevel(int newLevel) { LevelTable lt = new LevelTable(); // Return false if the requested level is too high if (newLevel > LevelTable.MaxLevel) { return(false); } // Return false if the requested level is too low if (newLevel < this.Level) { return(false); } Attribute.Attack = baseAttack() + AttackBuff + lt.LevelDetailsList[newLevel].Attack; Attribute.Defense = baseDefense() + DefenseBuff + lt.LevelDetailsList[newLevel].Defense; Attribute.Speed = baseSpeed() + SpeedBuff + lt.LevelDetailsList[newLevel].Speed; Attribute.MaxHealth = baseHealth() + HealthBuff; Attribute.MaxHealth += HelperEngine.RollDice(newLevel - Level, 10); return(true); }
//Picks new and randomized stats for the monster public void RollStats() { Attribute.MaxHealth = 1000 + HelperEngine.RollDice(3, 10); Attribute.Attack = 1000 + HelperEngine.RollDice(3, 10); Attribute.Defense = 1000 + HelperEngine.RollDice(3, 10); Attribute.Speed = 1000 + HelperEngine.RollDice(3, 10); Attribute.CurrentHealth = Attribute.MaxHealth; }
public void GameEngine_Helper_Random_For_UnitTests_Roll1_DiceNeg_Should_Have_Known_Values() { // Turn off random numbers GameGlobals.SetForcedRandomNumbers(1, 20); var Expected = 0; var Actual = HelperEngine.RollDice(1, -1); // Reset GameGlobals.ToggleRandomState(); Assert.AreEqual(Expected, Actual, TestContext.CurrentContext.Test.Name); }
// Get the Level based damage // Then add the damage for the primary hand item as a Dice Roll public int GetDamageRollValue() { var myReturn = GetLevelBasedDamage(); var myItem = ItemsViewModel.Instance.GetItem(PrimaryHand); if (myItem != null) { // Damage is base damage plus dice of the weapon. So sword of Damage 10 is d10 myReturn += HelperEngine.RollDice(1, myItem.Damage); } return(myReturn); }
// 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); }
// Will update the Item to be stronger... public void ScaleLevel(int level) { var newValue = 1; if (GameGlobals.ForceRollsToNotRandom) { newValue = level; } else { // Add value 1 to level passed in... newValue = HelperEngine.RollDice(1, level); } Value = newValue; }
public void GameEngine_Helper_Random_For_Dice_Should_Have_Known_Range() { // Turn off random numbers GameGlobals.SetForcedRandomNumbers(1, 20); var ExpectedMin = 6; var ExpectedMax = 6 * 18; var Actual = HelperEngine.RollDice(6, 6); // Reset GameGlobals.ToggleRandomState(); Assert.GreaterOrEqual(Actual, ExpectedMin, "Min " + TestContext.CurrentContext.Test.Name); Assert.LessOrEqual(Actual, ExpectedMax, "Max " + TestContext.CurrentContext.Test.Name); }
// 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 exit on same level, because the settings below need to be calculated //// Same level does not need changing //if (level == this.Level) //{ // 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; 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, true); Attribute.CurrentHealth = Attribute.MaxHealth; 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); }
//Levels up chracter based on level table private void 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 <= CurrentExp) { var NewLvl = 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 = CurrentHP; var OldMaxHealth = MaxHP; // 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(NewLvl - Lvl, 10); // Increment the Max health MaxHP += NewHealthAddition; // Calculate new current health // old max was 10, current health 8, new max is 15 so (15-(10-8)) = current health CurrentHP = (MaxHP - (OldMaxHealth - OldCurrentHealth)); // Refresh the Attriburte String // I WILL DEAL WITH THIS LATER. !!!!!!!!!!!!! //AttributeString = AttributeBase.GetAttributeString(this.Attribute); // Set the new level Lvl = NewLvl; // Done, exit break; } } }
// 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); }
// Return a random item from the list of items... public string ChooseRandomItemString(ItemLocationEnum location, AttributeEnum attribute) { if (location == ItemLocationEnum.Unknown) { return(null); } if (Dataset.Count < 1) { return(null); } // Get all the items for that location var myList = Dataset.Where(a => a.Location == location).ToList(); // If an attribute is selected... if (attribute != AttributeEnum.Unknown) { // Filter down to the items that fit the attribute myList = myList.Where(a => a.Attribute == attribute).ToList(); } if (myList.Count < 1) { return(null); } // Pick a random item from the list var myRnd = HelperEngine.RollDice(1, myList.Count); // Return that item... // -1 because of 0 index list... var myReturn = myList[myRnd - 1]; return(myReturn.Guid); }
// Get the Level based damage // Then add the damage for the primary hand item as a Dice Roll public int GetDamageRollValue() { var myReturn = GetLevelBasedDamage(); // Get primary hand weapon and determine damage var primary = ItemsViewModel.Instance.GetItem(PrimaryHand); if (primary != null) { // Damage is base damage plus dice of the weapon. So sword of Damage 10 is d10 myReturn += HelperEngine.RollDice(1, primary.Damage); } // Get off hand weapon and determine damage var offhand = ItemsViewModel.Instance.GetItem(OffHand); if (offhand != null) { // Damage is base damage plus dice of the weapon. So sword of Damage 10 is d10 myReturn += HelperEngine.RollDice(1, offhand.Damage); } return(myReturn); }