77 lines
1.8 KiB
Java
77 lines
1.8 KiB
Java
package minigame;
|
|
|
|
import java.util.ArrayList;
|
|
import java.util.stream.IntStream;
|
|
|
|
public class Horse {
|
|
|
|
public int price;
|
|
public double speedx;
|
|
public int stamina;
|
|
public String name;
|
|
public String tag = "None";
|
|
public double current_pos;
|
|
|
|
public Horse(int price, double speed, int stamina, String name, String tag){
|
|
this.price = price;
|
|
this.speedx = speed;
|
|
this.stamina = stamina;
|
|
this.name = name;
|
|
this.tag = tag;
|
|
this.current_pos = 0;
|
|
}
|
|
|
|
public String toString() {
|
|
return String.format("Price: %d, Name: %s, Speed: %.1f, Stamina: %d", this.price, this.name, this.speedx * 10, this.stamina);
|
|
}
|
|
|
|
public String toOwnedString() {
|
|
return String.format("Name: %s, Speed: %.1f, Stamina: %d", this.name, this.speedx * 10, this.stamina);
|
|
}
|
|
|
|
public String toBotString() {
|
|
return String.format("%s, Sp: %.1f, St: %d", this.name, this.speedx * 10, this.stamina);
|
|
}
|
|
|
|
public String toRacePosString() {
|
|
return String.format("%s, Distance: %.1f", this.name, this.current_pos);
|
|
}
|
|
|
|
public static ArrayList<Horse> genHorses(int max, int level, String tag){
|
|
ArrayList<Horse> horses = new ArrayList<>();
|
|
IntStream.rangeClosed(1, max).forEach(x-> horses.add(new Horse((int)((Math.random()*(level*5*level))+3),(Math.random()*level/5)+0.1,(int)(Math.random()*5*(level*2)),genName(),tag)));
|
|
return horses;
|
|
}
|
|
|
|
public double getCurrentPos() {
|
|
return current_pos;
|
|
}
|
|
|
|
private static String genName() {
|
|
String [] names = {
|
|
"Maverick",
|
|
"Luna",
|
|
"Shadow",
|
|
"Echo",
|
|
"Willow",
|
|
"Blaze",
|
|
"Atlas",
|
|
"Harmony",
|
|
"Dakota",
|
|
"Nova",
|
|
"Titan",
|
|
"Luna",
|
|
"Diesel",
|
|
"Indie",
|
|
"Bella",
|
|
"Jasper",
|
|
"Zoe",
|
|
"Titan",
|
|
"Misty",
|
|
"Ace"
|
|
};
|
|
int x = (int)(Math.random()*names.length);
|
|
return names[x];
|
|
}
|
|
}
|