private void ConfirmAttack(int moveID, TextBlock skillTextBlock, Button skillButton) { if (battleGym.GetSkillTime[moveID] > 0) { // My turn skillButtonGroup.Visibility = Visibility.Collapsed; opImageAttack.Visibility = Visibility.Visible; int prevHP = battleGym.GetOpponentPokemon.GetHP; if (battleGym.PlayerMove(moveID)) { criticalText.Visibility = Visibility.Visible; var quicktimer = new DispatcherTimer { Interval = TimeSpan.FromSeconds(1) }; quicktimer.Start(); quicktimer.Tick += (sender, args) => { quicktimer.Stop(); criticalText.Visibility = Visibility.Hidden; }; } int afterHP = battleGym.GetOpponentPokemon.GetHP; StatusMessage.Text = battleGym.GetPlayerPokemon.Name + " used " + battleGym.GetPlayerPokemon.Moveslist[moveID].name + "! Dealt " + (prevHP - afterHP).ToString() + " damage."; opHP.Width = battleGym.GetOpponentPokemon.GetHPPercentage(280, prevHP); opHPAfterAttack.Width = battleGym.GetOpponentPokemon.GetHPPercentage(280, afterHP); opHPAfterAttack.Fill = battleGym.GetOpponentPokemon.GetHPColor(); skillTextBlock.Text = battleGym.GetSkillTime[moveID] + " left"; skillButton.Opacity = (battleGym.GetSkillTime[moveID] > 0) ? 1 : 0.5; restcount = 0; } }
private void ConfirmAttack(int moveID) { if (skillcount[moveID] == 0) // The skill is actived(allowed) to use after count down to zero { skillButtonGroup.Visibility = Visibility.Collapsed; opponentPokemonImageAttack.Visibility = Visibility.Visible; restcount = 0; if (battleGym.PlayerMove(moveID)) { MessageBox.Show("Critical attack!"); } opponentPokemonCP.Text = battleGym.GetOpponentPokemon.GetCP.ToString(); opponentPokemonHP.Width = 280 * (double)battleGym.GetOpponentPokemon.GetHP / battleGym.GetOpponentPokemon.MaxHP; opponentPokemonHPAfterAttack.Width = 280 * (double)battleGym.GetOpponentPokemon.GetHP / battleGym.GetOpponentPokemon.MaxHP; skillcount[moveID] = skilltime[moveID]; } }