/// <summary> /// Gets the an int value that will modify a stat. /// </summary> /// <returns>The modifier value.</returns> /// <param name="m">Minimum value.</param> /// <param name="M">Maximum value.</param> public int GetModPwr(int m, int M) { // Minimum and maximum is multiplied by the dificulty level. int mod = Random.Range(m * DifficultyLevel.GetInstance().GetDifficultyMultiplier(), M * DifficultyLevel.GetInstance().GetDifficultyMultiplier()); return(mod); }
/// <summary> /// Called on player victory to decide what comes next /// </summary> void PlayerVictory() { //Debug.Log("Winner"); // increase number of battles until level up BattleCounter.GetInstance().IncreaseCurrentBattleCount(); // if no more battles if (BattleCounter.GetInstance().GetRemainingBattles() <= 0) { //Debug.Log("Increasing Difficulty"); // increase difficulty DifficultyLevel.GetInstance().IncreaseDifficulty(); // increase number of battles to difficulty level BattleCounter.GetInstance().SetBattlesNeeded(DifficultyLevel.GetInstance().GetDifficultyMultiplier()); // start back from 0 battles BattleCounter.GetInstance().ResetCurrentBattleCount(); // set a checkpoint for enemy stat creation EnemyStats.GetInstance().SetCheckpoint(); // go to town, no more battles to be fought this round LoadStatSelect(); _backgroundManager.BackgroundChange(); } else { //Debug.Log("On to the next battle!"); // check to see if player wants to use a camp kit (only if they have one!) if (this.player.inventory.CampKits > 0) { // check if player wants to camp out before next battle // load camp kit check scene? } // No more resetting stats on retreat. So this is to save the stats after each battle. EnemyStats.GetInstance().SetCheckpoint(); LoadNextBattle(); } }
/// <summary> /// Ends the game. /// </summary> private void EndGame() { // player dead TransferGoldOnDeath(); // this.player.transform.localPosition = this.prevPos; // check for high score if (PlayerPrefs.GetInt("score") > PlayerPrefs.GetInt("hiscore")) { // set new HighScore PlayerPrefs.SetInt("hiscore", PlayerPrefs.GetInt("score")); } // reset score/turn PlayerPrefs.SetInt("turn", 0); // reset difficulty DifficultyLevel.GetInstance().ResetDifficulty(); BattleCounter.GetInstance().ResetCurrentBattleCount(); BattleCounter.GetInstance().ResetBattlesNeeded(); // Set the idle animation to town idle player.playerAnimator.SetBool("InBattle", false); if (!waiting) { // load death scene LevelLoadHandler.Instance.LoadLevel("DeathScene_LVP", false); } }
/// <summary> /// Updates the text for HUD in battle. /// </summary> private void UpdateText() { // Battle stats (Top UI) this.leftHealthText.text = this.player.remainingHealth + " / " + this.player.totalHealth; this.rightHealthText.text = this.enemy.remainingHealth + " / " + this.enemy.totalHealth; this.leftManaText.text = this.player.remainingEnergy + " / " + this.player.totalEnergy; this.rightManaText.text = this.enemy.remainingEnergy + " / " + this.enemy.totalEnergy; this.leftArmorText.text = this.player.GetTotalArmor().ToString(); this.rightArmorText.text = this.enemy.GetTotalArmor().ToString(); this.leftDamageText.text = this.player.GetTotalDamage().ToString(); this.rightDamageText.text = this.enemy.GetTotalDamage().ToString(); this.healTurnsRemainText.text = this.player.numTurnsLeftToHeal.ToString(); // score stat //this.numEnemiesKilledText.text = score.ToString(); // battles stat this.battleText.text = (currentBattle + 1) + " / " + DifficultyLevel.GetInstance().GetDifficultyMultiplier(); if (this.inventoryToggleButton.isActiveAndEnabled) { // inventory text this.apples.text = this.player.inventory.Apples.ToString(); this.bread.text = this.player.inventory.Bread.ToString(); this.cheese.text = this.player.inventory.Cheese.ToString(); this.hPots.text = this.player.inventory.HealthPotions.ToString(); this.ePots.text = this.player.inventory.EnergyPotions.ToString(); //this.campKits.text = this.player.inventory.CampKits.ToString(); } }
void Awake() { PlayerPrefs.SetInt("midgame", 0); // reset to level 1 DifficultyLevel.GetInstance().ResetDifficulty(); // make sure we start at 0 BattleCounter.GetInstance().ResetCurrentBattleCount(); BattleCounter.GetInstance().ResetBattlesNeeded(); // set number of battles BattleCounter.GetInstance().SetBattlesNeeded(DifficultyLevel.GetInstance().GetDifficultyMultiplier()); }
/// <summary> /// Randomizes the cost of item. /// </summary> private void RandomizeCost() { for (int i = 0; i < shopItems.Length; i++) { int totalStats = shopItems[i].GetDefMod() + shopItems[i].GetAtkMod(); this.LO_DOLLAR_VALUE = totalStats - (int)(totalStats * 0.2) + DifficultyLevel.GetInstance().GetDifficultyMultiplier(); int score = PlayerPrefs.GetInt("score"); if (score > 0) { this.HI_DOLLAR_VALUE = (int)((Mathf.FloorToInt(score * 1.5f) / 2) + this.LO_DOLLAR_VALUE); } else { this.HI_DOLLAR_VALUE = (DifficultyLevel.GetInstance().GetDifficultyMultiplier() + this.LO_DOLLAR_VALUE); } shopItems[i].dollarCost = (int)(Random.Range(LO_DOLLAR_VALUE, HI_DOLLAR_VALUE) / 2); } }
private int GetRandomArmor() { return(Mathf.RoundToInt(Random.Range(1.0f, 1.1f) * (DifficultyLevel.GetInstance().GetDifficultyMultiplier() / 3) * EnemyStats.GetInstance().GetCurrentEnemyDEF())); }