- #1
stonecoldgen
- 109
- 0
Code:
import java.util.Scanner;
import static java.lang.System.out;
import java.util.Random;
public class wolf {
public static void main (String[] args){
int hitpoints = 100;
int damage = 40; //un numero cualquiera, solo para hacer una prueba
Scanner keyboard = new Scanner(System.in);
out.println("You have encountered a wild wolf!");
out.println("Would you like to ATTACK or RUN?");
String wolfSituation = keyboard.next();
int wolfHP = 60;
int wolfDMG = 20; //falta añadir la probabilidad de hit del wolf
if (wolfSituation.equals("RUN")){ //al correr, hay que hacer que el jugador queda en la misma casilla pero sin el evento especial
int randomnessWolfRun = new Random().nextInt(10) + 1;
if (randomnessWolfRun <= 5){
out.println("You have succesfully escaped from the wild wolf.");
} else{
int remainingHitPoints = hitPoints - wolfDMG;
out.println("You have roughly managed to escape, but you have been hurt by the wild wolf.");
}
}
}
}
on the line
Code:
int remainingHitPoints = hitPoints - wolfDMG;
Code:
int hitPoints = hitPoints - wolfDMG;
Any help?