private void SetUI(IPokemon pokemon) { lblAtkValue.Text = pokemon.Stats.Attack.ToString(); lblDefValue.Text = pokemon.Stats.Defence.ToString(); lblSpAtkValue.Text = pokemon.Stats.SpecialAttack.ToString(); lblSpDefValue.Text = pokemon.Stats.SpecialDefence.ToString(); lblSpeedValue.Text = pokemon.Stats.Speed.ToString(); var actualAttack = TempStatsCalculator.GetAttack(pokemon); var actualDefence = TempStatsCalculator.GetDefence(pokemon); var actualSpAttack = TempStatsCalculator.GetSpecialAttack(pokemon); var actualSpDefence = TempStatsCalculator.GetSpecialDefence(pokemon); var actualSpeed = TempStatsCalculator.GetSpeed(pokemon); lblCurrentAttackValue.Text = $"({actualAttack.ToString()})"; lblCurrentDefenceValue.Text = $"({actualDefence.ToString()})"; lblCurrentSpAttackValue.Text = $"({actualSpAttack.ToString()})"; lblCurrentSpDefenceValue.Text = $"({actualSpDefence.ToString()})"; lblCurrentSpeedValue.Text = $"({actualSpeed.ToString()})"; lblCurrentAttackValue.ForeColor = GetColorBasedOnValueDiffrence(actualAttack, pokemon.Stats.Attack); lblCurrentDefenceValue.ForeColor = GetColorBasedOnValueDiffrence(actualDefence, pokemon.Stats.Defence); lblCurrentSpAttackValue.ForeColor = GetColorBasedOnValueDiffrence(actualSpAttack, pokemon.Stats.SpecialAttack); lblCurrentSpDefenceValue.ForeColor = GetColorBasedOnValueDiffrence(actualSpDefence, pokemon.Stats.SpecialDefence); lblCurrentSpeedValue.ForeColor = GetColorBasedOnValueDiffrence(actualSpeed, pokemon.Stats.Speed); lblName.Text = pokemon.Name; lblLevel.Text = pokemon.Condition == 0 ? "L" + pokemon.Level.ToString() : (pokemon.Condition).ToString(); lblHealth.Text = $"{pokemon.HPCurrent}/{pokemon.HPMax}"; progressBar1.Maximum = pokemon.HPMax; progressBar1.Value = pokemon.HPCurrent; pictureBox1.Image = ImageHelper.GetImageById(false, pokemon.ID); }
public IPokemon GetFasterPokemon(ICollection <IAdditionalEffect> playerAttackAdditionalEffects, ICollection <IAdditionalEffect> enemyAttackAdditionalEffects) { var playerAttackIsFast = playerAttackAdditionalEffects.ContainsEffectType(typeof(FastAttack)); var enemyAttackIsFast = enemyAttackAdditionalEffects.ContainsEffectType(typeof(FastAttack)); if (playerAttackIsFast == enemyAttackIsFast) { if (TempStatsCalculator.GetSpeed(PlayerPokemon) > TempStatsCalculator.GetSpeed(EnemyPokemon)) { return(PlayerPokemon); } else { return(EnemyPokemon); } } else if (playerAttackIsFast) { return(PlayerPokemon); } else if (enemyAttackIsFast) { return(EnemyPokemon); } return(PlayerPokemon); }