Created
July 22, 2017 11:47
-
-
Save Namelessname9/e7ae48a34a776b9253d85e9ac3ba94a1 to your computer and use it in GitHub Desktop.
Returns cost, FC cost and gems needed, all to buy all the RPs unlocked in a R at once
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package RG; | |
import java.util.Arrays; | |
public class Reincarnation | |
{ | |
private int currentRP, maxRP; | |
private double totalCost, factionCost, gemsRequired; | |
private int rNumber; | |
public static void main(String[] args) | |
{ | |
Reincarnation[] R = new Reincarnation[85]; | |
String[][] output = new String[86][5]; | |
output[1][0] = "R"; | |
output[1][1] = "Cost of maxing RPs in all branches"; | |
output[1][2] = "Cost in Faction Coins"; | |
output[1][3] = "Availabale RPs in each branch"; | |
output[1][4] = "Recommended gems"; | |
for(int i=16; i<40; i++) | |
{ | |
R[i-16] = new Reincarnation(i); | |
for(int j=0; j<(R[i-16].getMaxRP()-R[i-16].getcurrentRP()); j++) | |
{ | |
R[i-16].totalCost = R[i-16].nextRPCostPreA() + R[i-16].totalCost; | |
R[i-16].factionCost = R[i-16].nextFCCost() + R[i-16].factionCost; | |
} | |
R[i-16].totalCost= R[i-16].totalCost*6; | |
R[i-16].factionCost = R[i-16].factionCost*6; | |
R[i-16].gemsRequired = R[i-16].calculateGems(); | |
output[i-15][0] = "R" + i; | |
output[i-15][1] = R[i-16].getCost() + " cost in coins"; | |
output[i-15][2] = R[i-16].getFactionCost() + " cost in Faction coins"; | |
output[i-15][3] = R[i-16].getMaxRP() + " available RPs"; | |
output[i-15][4] = R[i-16].getGems() + " gems"; | |
} | |
for(int i=40; i<101; i++) | |
{ | |
R[i-16] = new Reincarnation(i); | |
for(int j=0; j<(R[i-16].getMaxRP()-R[i-16].getcurrentRP()); j++) | |
{ | |
R[i-16].totalCost = R[i-16].nextRPCostPostA() + R[i-16].totalCost; | |
R[i-16].factionCost = R[i-16].nextFCCost() + R[i-16].factionCost; | |
} | |
R[i-16].totalCost= R[i-16].totalCost*6; | |
R[i-16].factionCost = R[i-16].factionCost*6; | |
R[i-16].gemsRequired = R[i-16].calculateGems(); | |
output[i-15][0] = "R" + i; | |
output[i-15][1] = R[i-16].getCost() + " cost in coins"; | |
output[i-15][2] = R[i-16].getFactionCost() + " cost in Faction coins"; | |
output[i-15][3] = R[i-16].getMaxRP() + " available RPs"; | |
output[i-15][4] = R[i-16].getGems() + " gems"; | |
} | |
printTable(output); | |
} | |
public Reincarnation(int R) | |
{ | |
this.maxRP = (R+1) * R/2; | |
this.currentRP = R * (R-1)/2; | |
this.totalCost = 0; | |
this.factionCost = 0; | |
this.rNumber = R; | |
} | |
public double nextRPCostPostA() | |
{ | |
return 1e42 * Math.pow(1.15, (this.currentRP-780)); | |
} | |
public double nextRPCostPreA() | |
{ | |
return 1e126 * Math.pow(1.5, this.currentRP); | |
} | |
public double nextFCCost() | |
{ | |
return Math.pow((this.currentRP+1), 3); | |
} | |
public double getCost() | |
{ | |
return this.totalCost; | |
} | |
public double getFactionCost() | |
{ | |
return this.factionCost; | |
} | |
public double calculateGems() | |
{ | |
return Math.sqrt((totalCost/5e11)); | |
} | |
public int getRNumber() | |
{ | |
return rNumber; | |
} | |
public int getMaxRP() | |
{ | |
return this.maxRP; | |
} | |
public int getcurrentRP() | |
{ | |
return this.currentRP; | |
} | |
public double getGems() | |
{ | |
return gemsRequired; | |
} | |
public String toString() | |
{ | |
return "R" + this.getRNumber() + ": " + (this.getCost()*6) + " cost in coins, " + this.getFactionCost() + " cost in Faction coins, " + this.getMaxRP() + " available RPs, " + this.getGems() + " reccomended gems"; | |
} | |
static void printTable(String[][] grid) | |
{ | |
for(int r=0; r<grid.length; r++) | |
{ | |
for(int c=0; c<grid[r].length; c++) | |
System.out.print(grid[r][c] + " "); | |
System.out.println(); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Don't expect some quality code here, I did it in a few hours and didn't put too much effort to improve the coding.