Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package xenophobia;
- import java.util.Random;
- public class RandomEvent {
- Random rndm = new Random();
- private int max;
- private int min;
- public RandomEvent(){
- max = 10;
- min = 0;
- }
- public void eventChance(double currentThreat){
- int odds = rndm.nextInt((max - min) + 1) + min;
- if (odds == 7 || odds == 6){
- if (currentThreat <= 49){
- System.out.println(printEvent());
- }
- else {
- System.out.println(threatEvent());
- }
- }
- }
- public String printEvent(){
- int eventNum = rndm.nextInt((max - min) + 1) + min;
- switch(eventNum){
- case 0:
- return "You miss your parents.";
- case 1:
- return "You hear something break in the distance.";
- case 2:
- return "It's dead silent.";
- case 3:
- return "You feel lightheaded.";
- case 4:
- return "You can't hear the stranger's footsteps any more.";
- case 5:
- return "Something topples over a few aisles away.";
- case 6:
- return "You're tired.";
- case 7:
- return "Your hands feel numb.";
- case 8:
- return "You feel cold.";
- default:
- return "Footsteps echo across the store.";
- }
- }
- public String threatEvent(){
- int eventNum = rndm.nextInt((max - min) + 1) + min;
- switch(eventNum){
- case 0:
- return "It's difficult to breathe.";
- case 1:
- return "You can clearly hear the stranger's footsteps.";
- case 2:
- return "It's close.";
- case 3:
- return "It's coming for you.";
- case 4:
- return "You can hear glass breaking not too far away.";
- case 5:
- return "You don't feel safe here.";
- case 6:
- return "You feel sick.";
- case 7:
- return "Something heavy falls down closeby.";
- case 8:
- return "Your vision is getting blurry.";
- case 9:
- return "Everything feels hazy.";
- default:
- return "It's getting closer.";
- }
- }
- public String describeFood(){
- int descriptionNum = rndm.nextInt((max - min) + 1) + min;
- switch(descriptionNum){
- case 1:
- return "...It tastes terrible.";
- case 2:
- return "It's surprisingly tasty.";
- case 3:
- return "You feel slightly guilty for eating it.";
- case 4:
- return "It tastes slightly odd.";
- case 5:
- return "It's delicious.";
- case 6:
- return "You feel slightly better.";
- case 7:
- return "It tastes amazing.";
- case 8:
- return "It has a mild, pleasant flavour.";
- case 9:
- return "But shouldn't you be focusing on something else?";
- case 10:
- return "You feel full.";
- default:
- return "It's alright.";
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement