public void UpdateStats() { PhysicalDamage physicalDamage = (PhysicalDamage)_player.attributes[(int)PlayerStat.Attribute.PhysicalDamage]; // Update player stat display. tbNameSet.Text = _player.name; tbClass.Text = Enum.GetName(typeof(Player.Class), _player.playerClass); tbLevel.Text = _player.level.ToString(); tbExperience.Text = $"{_player.experienceCurrent}/{_player.experienceNextLevel}"; tbSkillPoints.Text = _player.skillPoints.ToString(); tbTalentPoints.Text = _player.talentPoints.ToString(); tbStrength.Text = _player.attributes[(int)PlayerStat.Attribute.Strength].Final().ToString(); tbIntelligence.Text = _player.attributes[(int)PlayerStat.Attribute.Intelligence].Final().ToString(); tbDexterity.Text = _player.attributes[(int)PlayerStat.Attribute.Dexterity].Final().ToString(); tbHealth.Text = _player.attributes[(int)PlayerStat.Attribute.Health].Final().ToString(); tbMana.Text = _player.attributes[(int)PlayerStat.Attribute.Mana].Final().ToString(); tbArmour.Text = _player.attributes[(int)PlayerStat.Attribute.Armour].Final().ToString(); tbPhysicalDamage.Text = $"{physicalDamage.MinFinal().ToString("0.##")}-{physicalDamage.MaxFinal().ToString("0.##")}"; tbPhysicalDamageIncrease.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.PhysicalDamage].Final()) * 100).ToString("0.##")}%"; tbFireDamageIncrease.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.FireDamage].Final()) * 100).ToString("0.##")}%"; tbLightningDamageIncrease.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.LightningDamage].Final()) * 100).ToString("0.##")}%"; tbColdDamageIncrease.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.ColdDamage].Final()) * 100).ToString("0.##")}%"; tbPoisonDamageIncrease.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.PoisonDamage].Final()) * 100).ToString("0.##")}%"; tbCriticalChance.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.CriticalChance].Final()) * 100).ToString("0.##")}%"; tbCriticalDamage.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.CriticalDamage].Final()) * 100).ToString("0.##")}%"; tbPhysicalReduction.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.PhysicalResistance].Final()) * 100).ToString("0.##")}%"; tbFireResistance.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.FireResistance].Final()) * 100).ToString("0.##")}%"; tbLightningResistance.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.LightningResistance].Final()) * 100).ToString("0.##")}%"; tbColdResistance.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.ColdResistance].Final()) * 100).ToString("0.##")}%"; tbPoisonResistance.Text = $"{((_player.attributes[(int)PlayerStat.Attribute.PoisonResistance].Final()) * 100).ToString("0.##")}%"; tbHealthRegeneration.Text = $"{_player.attributes[(int)PlayerStat.Attribute.HealthRegeneration].Final()}/s"; tbManaRegeneration.Text = $"{_player.attributes[(int)PlayerStat.Attribute.ManaRegeneration].Final()}/s"; // Enable skill up buttons if player has skill points. Disable if player doesn't. if (_player.skillPoints > 0) { btnIncreaseStrength.Enabled = true; btnIncreaseIntelligence.Enabled = true; btnIncreaseDexterity.Enabled = true; } else { btnIncreaseStrength.Enabled = false; btnIncreaseIntelligence.Enabled = false; btnIncreaseDexterity.Enabled = false; } if (warriorTalentForm != null) { warriorTalentForm.UpdateText(); } if (skillBook != null) { skillBook.UpdateForm(); } }
public override double Damage() { PhysicalDamage weaponDamage = (PhysicalDamage)_player.attributes[(int)PlayerStat.Attribute.PhysicalDamage]; double damage = _random.Next((int)weaponDamage.MinFinal(), (int)weaponDamage.MaxFinal()); return(damage); }
public double WeaponAttack(Enemy enemy) { Random random = new Random(); PhysicalDamage physicalDamage = (PhysicalDamage)this.attributes[(int)PlayerStat.Attribute.PhysicalDamage]; int damage = random.Next((int)physicalDamage.MinFinal(), (int)physicalDamage.MaxFinal()); enemy.healthCurrent -= (int)(damage * (1 - enemy.PhysicalResistance())); return(damage * (1 - enemy.PhysicalResistance())); }