-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathBallType.java
More file actions
32 lines (28 loc) · 1018 Bytes
/
BallType.java
File metadata and controls
32 lines (28 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
import java.util.*;
public class BallType {
public static ArrayList<Ball> getBalls(int num) {
ArrayList<Ball> balls = new ArrayList<Ball>() ;
if (num < 1) {
return balls ;
}
for(int i = 0 ; i < num; ++i){
int type = (int)(Math.random()*5);
if (type == 0){
balls.add(new PokeBall("Pokeball"));
}
else if(type == 1){
balls.add(new Quickball("Quickball"));
}
else if(type == 2){
balls.add(new Timerball("Timerball"));
}
else if(type == 3){
balls.add(new Ultraball("Ultraball"));
}
else if(type == 4){
balls.add(new Masterball("Masterball"));
}
}
return balls ;
}
}