private void ButtonClickSelectPokemon(object sender, RoutedEventArgs e)
        {
            var     button      = (Button)sender;
            Pokemon selectedPkm = button.DataContext as Pokemon;

            if (selectedPkm.GetHP == 0)
            {
                MessageBox.Show("Your Pokemon is Out of Health! Come again some time.");
                Program.status = 0;
                this.NavigationService.GoBack();
            }
            var sb = new Storyboard();
            var ta = new ThicknessAnimation();

            ta.BeginTime = new TimeSpan(0);
            ta.SetValue(Storyboard.TargetNameProperty, "GridChangePokemon");
            Storyboard.SetTargetProperty(ta, new PropertyPath(MarginProperty));
            ta.From     = new Thickness(0, 0, 0, 100);
            ta.To       = new Thickness(0, 0, 0, -1000);
            ta.Duration = new Duration(TimeSpan.FromSeconds(0.3));
            sb.Children.Add(ta);
            sb.Begin(this);
            GridChangePokemon.Visibility = Visibility.Hidden;
            battleGym          = new BattleGym(p1.GetPokemons().Find(x => x.Id == selectedPkm.Id), generateRandomBoss(), Win, Lose);
            StatusMessage.Text = "Your turn! Pick your move";
            setBoss();
            usePokemon();

            restcount          = 0;
            restTimer.Tick    += restTimer_Tick;
            restTimer.Interval = TimeSpan.FromSeconds(1);
            restTimer.Start();
            bgPic.Opacity = 1;
        }
Example #2
0
        public Battle(Player p)
        {
            InitializeComponent();
            switchingPokemon = false;
            p1 = p;
            List <Pokemon> playerPokemon = p1.GetPokemons();

            battleGym = new BattleGym(playerPokemon[0], playerPokemon[1], Win, Lose); //generateOneRandomBoss(); --TODO
            setBoss();
            usePokemon();
        }