public void resetPlayer(Randing1 randomize1) { hp = randomize1.Random(31, 40); atk = randomize1.Random(4, 6); def = randomize1.Random(1, 3); ki = randomize1.Random(0, 2); spd = 1; will = randomize1.Random(0, 2); }
public Monstro(Randing1 randomize1) { hp = randomize1.Random(31, 40); atk = randomize1.Random(4, 6); def = randomize1.Random(1, 3); winning = false; for (int i = 0; i < acaoTurno.Length; i++) { acaoTurno[i] = false; } }
/// <summary> /// Allows the game to run logic such as updating the world, /// checking for collisions, gathering input, and playing audio. /// </summary> /// <param name="gameTime">Provides a snapshot of timing values.</param> protected override void Update(GameTime gameTime) { // Allows the game to exit if (GamePad.GetState(PlayerIndex.One).Buttons.Back == ButtonState.Pressed) { this.Exit(); } // TODO: Add your update logic here previousMouseState = currentMouseState; currentMouseState = Mouse.GetState(); mousePos.X = currentMouseState.X; mousePos.Y = currentMouseState.Y; if (player.getHp() <= 0 || monster.getHp() <= 0) { endGame = true; finalHp1 = player.getHp(); finalHp2 = monster.getHp(); if (player.getHp() <= 0) { player.win(false); monster.win(true); player.resetPlayer(); } else { player.win(true); monster.win(false); } monster.resetPlayer(randomize); butaoStart.setActive(true); butaoAv.setActive(false); } if (currentMouseState.LeftButton == ButtonState.Pressed && previousMouseState.LeftButton == ButtonState.Released) { if (mousePos.X >= butaoAv.getPosition().X&& mousePos.Y >= butaoAv.getPosition().Y&& mousePos.X <= (butaoAv.getPosition().X + 64) && mousePos.Y <= (butaoAv.getPosition().Y + 20) && butaoAv.getActive()) { if (player.getTurn()) { butao.setActive(true); butao2.setActive(true); butao3.setActive(true); butao4.setActive(true); butaoAv.setActive(false); } else if (monster.getTurn()) { count = count + 1; dano = monster.getAtk() + randomize.Random(1, 4) - player.getDef(); hp1 = player.getHp() - (dano); player.setHp(hp1); player.setTurn(true); monster.setTurn(false); } else if (listTexto[countTexto]) { countTexto++; if (countTexto < 2) { listTexto.Add(true); } else { butaoAv.setActive(true); monster.setTurn(true); butaoKill.setActive(true); butaoKill2.setActive(true); } } } else if (mousePos.X >= butao.getPosition().X&& mousePos.Y >= butao.getPosition().Y&& mousePos.X <= (butao.getPosition().X + 64) && mousePos.Y <= (butao.getPosition().Y + 20) && butao.getActive()) { count = count + 1; dano2 = player.getAtk() + randomize.Random(1, 4) - monster.getDef(); hp2 = monster.getHp() - (dano2); player.setKi(player.getKi() + 1); if (player.getKi() >= 2) { player.setWarning(0); } monster.setHp(hp2); monster.setTurn(true); player.setTurn(false); butao.setActive(false); butao2.setActive(false); butao3.setActive(false); butao4.setActive(false); butaoAv.setActive(true); } else if (mousePos.X >= butao2.getPosition().X&& mousePos.Y >= butao2.getPosition().Y&& mousePos.X <= (butao2.getPosition().X + 64) && mousePos.Y <= (butao2.getPosition().Y + 20) && butao.getActive()) { if (player.getKi() < 2) { player.setWarning(1); } else { dano2 = player.getAtk() + randomize.Random(1, 4) * 2 - monster.getDef(); hp2 = monster.getHp() - (dano2); monster.setHp(hp2); player.dropKi(2); monster.setTurn(true); player.setTurn(false); butao.setActive(false); butao2.setActive(false); butao3.setActive(false); butao4.setActive(false); butaoAv.setActive(true); } } else if (mousePos.X >= butaoStart.getPosition().X&& mousePos.Y >= butaoStart.getPosition().Y&& mousePos.X <= (butaoStart.getPosition().X + 64) && mousePos.Y <= (butaoStart.getPosition().Y + 20) && butaoStart.getActive()) { endGame = false; butaoAv.setActive(true); butaoStart.setActive(false); } else if (mousePos.X >= butaoKill.getPosition().X&& mousePos.Y >= butaoKill.getPosition().Y&& mousePos.X <= (butaoKill.getPosition().X + 64) && mousePos.Y <= (butaoKill.getPosition().Y + 20) && butaoKill.getActive()) { player.setHp(0); } else if (mousePos.X >= butaoKill2.getPosition().X&& mousePos.Y >= butaoKill2.getPosition().Y&& mousePos.X <= (butaoKill2.getPosition().X + 64) && mousePos.Y <= (butaoKill2.getPosition().Y + 20) && butaoKill2.getActive()) { monster.setHp(0); } } base.Update(gameTime); }