Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //there is defined Player valiables - 'HP', 'ATK','DEF' etc..
- void FightAction(int ATKf, int DEFf, TYPEf)
- {
- Random generator = new Random();
- int PlayerHP = Convert.ToInt32(HP); // 100
- int FighterHP = HPf; // 20
- fight:
- int PlayerATK = ATK + generator.Next(0, 3);
- int PlayerDEF = DEF + generator.Next(0, 3);
- int FighterATK = ATKf + generator.Next(0, 3);
- int FighterDEF = DEFf + generator.Next(0, 3);
- txt_CalcPlayer.Content = NAME + "\nHP: " + PlayerHP + "\nÚtok: " + PlayerATK + "\nObrana: " + PlayerDEF;
- txt_CalcEnemy.Content = NAMEf + "\n" + FighterHP + " :HP\n" + FighterATK + " :Útok\n" + FighterDEF + " :Obrana";
- int PlayerAttack = PlayerATK - FighterDEF; //(5-7) - (2-4) = 5
- int FighterAttack = FighterATK - PlayerDEF; //(5-7) - (2-4) = 7
- if (FighterAttack <= 0) { FighterAttack = 0; }
- if (PlayerAttack <= 0) { PlayerAttack = 0; }
- PlayerHP = (PlayerHP - FighterAttack);
- FighterHP = (FighterHP - PlayerAttack);
- HP = PlayerHP;
- HPControl();
- if (FighterHP < 0) { FighterHP = 0; }
- if (PlayerHP < 0) { PlayerHP = 0; }
- if (isAlive == true)
- {
- txt_CalcPlayer.Content = NAME + "\nHP: " + PlayerHP + "\nÚtok: " + PlayerATK + "\nObrana: " + PlayerDEF;
- txt_CalcEnemy.Content = NAMEf + "\n" + FighterHP + " :HP\n" + FighterATK + " :Útok\n" + FighterDEF + " :Obrana";
- while (!gotResponse)
- {
- btn_FightRound.Visibility = Visibility.Visible;
- btn_FightRound.Content = "FIGHT";
- }
- btn_FightRound.Visibility = Visibility.Hidden;
- gotResponse = false;
- goto fight;
- }
- private void btn_FightRound_Click(object sender, RoutedEventArgs e)
- {
- gotResponse = true;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement