diff --git a/src/main/java/org/bitbiome/commands/UseCommand.java b/src/main/java/org/bitbiome/commands/UseCommand.java index 4af63bc..8d3a496 100644 --- a/src/main/java/org/bitbiome/commands/UseCommand.java +++ b/src/main/java/org/bitbiome/commands/UseCommand.java @@ -39,7 +39,7 @@ private boolean combat = false; System.out.println(use(scanner, engine)); break; case "runaway": - if(runawaySucceeds()) { + if(runawaySucceeds(getRunawayChance())) { combat = false; break COMBAT_LOOP; } @@ -52,13 +52,24 @@ private boolean combat = false; } } - public boolean runawaySucceeds() { - int chance = (int)(Math.random()*100); - if(chance < 50) + public boolean runawaySucceeds(int chance) { + int random = (int)(Math.random()*100); + if(random >= chance) return true; return false; } + public int getRunawayChance() { + int chance = 10; + for(int i = 0; i 100) + chance = 100; + return chance; + } + public String use(Scanner scanner, TravelEngine engine) { System.out.println("Which item would you like to use?"); String item = scanner.nextLine();