import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStreamReader;
/**
* dnf强化系统实测
*/
public class Qianghua {
public static void main(String[] args) throws IOException {
//手动强化
//manualQianghua();
//自动强化
autoQianghua(0,16);
}
public static void manualQianghua() throws IOException{
BufferedReader in =
new BufferedReader(new InputStreamReader(System.in));
int current = 0;
while (true){
System.out.println("当前强化: +" + current + ",是否继续强化?" );
String str = in.readLine();
if("q".equals(str)) break;
current = qianghua(current);
}
}
public static void autoQianghua(int current,int target){
final int init = current;
long sum = 0;
long zengfubaohu = 0;
while (true){
System.out.println("当前强化: +" + current + ",是否继续强化?" );
current = qianghua(current);
System.out.println("==================>");
sum++;
if(current == 0) zengfubaohu++;
if(current == target) break;
}
System.out.println("初始强化等级:" + init);
System.out.println("目标强化等级:" + target);
System.out.println("强化次数:" + sum);
System.out.println("强化保护劵次数:" + zengfubaohu);
}
public static int qianghua(int current){
if (success(current)){
int temp = current + 1;
System.out.println("强化 +" + temp + "成功");
return temp;
}else{
return current - wrong(current);
}
}
public static int wrong(int current){
System.out.println("强化失败");
if(current <= 3){
return 0;
}else if(current <= 7){
return 1;
}else if(current < 10){
double d = Math.random();
if(d < 0.5){
//50%失败不掉
return 0;
}else if(d < 0.8){
//30%失败掉1
return 1;
}else{
//20%失败掉2
return 2;
}
}else {
return current;
}
}
public static boolean success(int current){
double d = Math.random();
if(current <= 3){
return true;
}else if(current <= 4){
return d <= 0.95;
}else if(current <= 5){
return d <= 0.90;
}else if(current <= 6){
return d <= 0.80;
}else if(current <= 7){
return d <= 0.75;
}else if(current <= 8){
return d <= 0.621;
}else if(current <= 9){
return d <= 0.537;
}else if(current <= 10){
return d <= 0.414;
}else if(current <= 11){
return d <= 0.339;
}else if(current <= 12){
return d <= 0.28;
}else if(current <= 13){
return d <= 0.207;
}else if(current <= 14){
return d <= 0.173;
}else if(current <= 15){
return d <= 0.136;
}else{
return d <= 0.101;
}
}
}
转载请注明原文地址:https://ipadbbs.8miu.com/read-9466.html