Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import java.util.Random;
- public class monster {
- int strength;
- String name;
- String[] names = {"Slime","Ghost","Goblin","Spider","Wraith","Skeleton", "Dragon", "Hydra"};
- //constructor
- Random rand = new Random();
- monster(){
- int x = rand.nextInt(7);
- if(x < 5) {
- this.name = names[7];
- this.strength = 30 + rand.nextInt(10);
- }else if(x<10) {
- this.name = names[6];
- this.strength = 20 + rand.nextInt(20);
- }else if(x<20) {
- this.name = names[5];
- this.strength = 15 + rand.nextInt(10);
- }else if(x<30) {
- this.name = names[4];
- this.strength = 15 + rand.nextInt(15);
- }else if(x<40) {
- this.name = names[3];
- this.strength = 5+ rand.nextInt(15);
- }else if(x<50) {
- this.name = names[2];
- this.strength = 5+ rand.nextInt(15);
- }else if(x<75) {
- this.name = names[1];
- this.strength = rand.nextInt(10);
- }else {
- this.name = names[0];
- this.strength = rand.nextInt(10);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement