public float CalculateDamage(GameObject instigator, Health target, Weapon weapon) { attackerStats = instigator.GetComponent <BaseStats>(); attackerLevel = attackerStats.GetLevel(); attackerCritChange = attackerStats.GetStat(Stat.CritPercentage); weaponDamage = weapon.WeaponDamage; weaponSpeed = weapon.WeaponSpeed; defenderStats = target.GetComponent <BaseStats>(); defenderLevel = defenderStats.GetLevel(); float hitChance = random.Next(1, 100); if (hitChance <= (hitEqualLevel + hitChangePrLevel * (attackerLevel - defenderLevel))) { if (weapon.IsMagicAttack) { return(CalculateMagicDamage()); } else { return(CalculateMeleeDamage()); } } else //miss { Debug.Log("Miss"); return(0f); } }
public void RandomDrop() { IEnumerable <DropLibrary.Dropped> drops = dropLibrary.GetRandomDrops(baseStats.GetLevel()); foreach (var drop in drops) { DropItem(drop.item, drop.number); } }
private int GetShopperLevel() { BaseStats stats = currentShopper.GetComponent <BaseStats>(); if (stats == null) { return(0); } return(stats.GetLevel()); }
private void Update() { playerHealthHolder.text = String.Format("{0}%", playerHealth.GetNormilizedHP()); if (playerFighter.GetTarget()) { enemyHealthHolder.text = String.Format("{0}%", playerFighter.GetTarget().GetNormilizedHP()); } else { enemyHealthHolder.text = "N/A"; } playerExpHolder.text = $"{playerExp.GetExp()}"; playerLevelHolder.text = $"{stats.GetLevel()}"; }
private int CalculateLevels() { int level = baseStats.GetLevel(); int goal = baseStats.GetStat(CharacterStat.xPRequirement); int currentXP = xPTracker.GetXP(); int levels = 0; while (goal < currentXP) { levels++; goal = baseStats.GetStat(CharacterStat.xPRequirement); } return(levels); }
public void LoadPartyPanels() { if (playerTeam == null) { playerTeam = GameObject.FindWithTag("Player").GetComponent <PlayerTeam>(); } if (playerTeam != null) { CharacterSheet[] team = playerTeam.GetPlayerTeam(); if (team != null) { for (int i = 0; i < team.Length; i++) { if (team[i] != null) { partyPanels[i].SetActive(true); BaseStats currentStats = team[i].GetStats(); partyMemberInfo[i].name.text = team[i].GetCharName().ToUpper(); partyMemberInfo[i].type.text = currentStats.GetStatType().ToString().ToUpper(); partyMemberInfo[i].level.text = "LVL " + currentStats.GetLevel(); partyMemberInfo[i].hp.text = currentStats.GetStat(StatsAtributte.Health) + "/" + currentStats.GetStat(StatsAtributte.MaxHealth); partyMemberInfo[i].hpSlider.maxValue = currentStats.GetStat(StatsAtributte.MaxHealth); partyMemberInfo[i].hpSlider.value = currentStats.GetStat(StatsAtributte.Health); partyMemberInfo[i].sp.text = currentStats.GetStat(StatsAtributte.SkillPoints) + "/" + currentStats.GetStat(StatsAtributte.MaxSkillPoints);; partyMemberInfo[i].spSlider.maxValue = currentStats.GetStat(StatsAtributte.MaxSkillPoints); partyMemberInfo[i].spSlider.value = currentStats.GetStat(StatsAtributte.SkillPoints); partyMemberInfo[i].charImage.sprite = team[i].GetSprite(); if (currentStats.GetStatusCondition() != StatusCondition.None) { partyMemberInfo[i].statusCondition.gameObject.SetActive(true); partyMemberInfo[i].statusCondition.text = currentStats.GetStatusCondition().ToString().ToUpper(); } else { partyMemberInfo[i].statusCondition.gameObject.SetActive(false); } } else { partyPanels[i].SetActive(false); } } } } }
private void Update() { //Get the players level, XP and the range of XP for the level int level = m_BaseStats.GetLevel(); float xp = m_XPComp.GetCurrentXP(); float levelXP = m_BaseStats.GetStat(StatType.LevelXp); float baseXP = 0; //If current level is 1 then baseXP is 0 if (level > 1) { baseXP = m_BaseStats.GetStatAtLevel(StatType.LevelXp, level - 1); } //Amount of XP that needs to be earned to move from current level to next float xpRange = levelXP - baseXP; //Update Display bar m_ImageForeground.localScale = new Vector3((xp - baseXP) / xpRange, 1, 1); }
void Update() { levelText.text = "Level: " + playerStats.GetLevel().ToString(); }
void Update() { GetComponent <Text>().text = String.Format("{0}", baseStats.GetLevel()); }
private void Update() { healthDisplay.text = String.Format("Health : {0:0}/{1:0}", health.GetCurrentHealth(), health.GetMaxHealth()); experienceDisplay.text = String.Format("Experience : {0:0}", experience.GetExperience()); levelDisplay.text = String.Format("Level : {0:0}", playerStats.GetLevel()); }
private void Update() { levelDisplay.text = stats.GetLevel().ToString(); }
// Update is called once per frame void Update() { xpLevel.text = String.Format("Level {0}", baseStats.GetLevel()); }
private void Update() { //Update player health text display GetComponent <Text>().text = String.Format("{0:0}", m_BaseStats.GetLevel()); }
// Update is called once per frame void Update() { GetComponent <Text>().text = string.Format("{0:0}", bstat.GetLevel()); }