Removed CampaignData.java/GlobalData.java

This commit is contained in:
Anuken
2020-06-20 12:28:24 -04:00
parent ec4a5880b7
commit 25338ff1cf
13 changed files with 66 additions and 80 deletions

View File

@@ -61,27 +61,32 @@ public class ResearchBlock extends Block{
@Override
public void updateTile(){
if(researching != null){
double totalTicks = researching.time * 60.0;
double amount = researchSpeed * edelta() / totalTicks;
double maxProgress = checkRequired(amount, false);
for(int i = 0; i < researching.requirements.length; i++){
int reqamount = Math.round(state.rules.buildCostMultiplier * researching.requirements[i].amount);
accumulator[i] += Math.min(reqamount * maxProgress, reqamount - totalAccumulator[i] + 0.00001); //add min amount progressed to the accumulator
totalAccumulator[i] = Math.min(totalAccumulator[i] + reqamount * maxProgress, reqamount);
}
maxProgress = checkRequired(maxProgress, true);
float increment = (float)(maxProgress * researching.time);
researching.progress += increment;
//check if it has been researched
if(researching.progress >= researching.time){
data.unlockContent(researching.content);
//don't research something that is already researched
if(researching.content.unlocked()){
setTo(null);
}else{
double totalTicks = researching.time * 60.0;
double amount = researchSpeed * edelta() / totalTicks;
double maxProgress = checkRequired(amount, false);
for(int i = 0; i < researching.requirements.length; i++){
int reqamount = Math.round(state.rules.buildCostMultiplier * researching.requirements[i].amount);
accumulator[i] += Math.min(reqamount * maxProgress, reqamount - totalAccumulator[i] + 0.00001); //add min amount progressed to the accumulator
totalAccumulator[i] = Math.min(totalAccumulator[i] + reqamount * maxProgress, reqamount);
}
maxProgress = checkRequired(maxProgress, true);
float increment = (float)(maxProgress * researching.time);
researching.progress += increment;
//check if it has been researched
if(researching.progress >= researching.time){
researching.content.unlocked();
setTo(null);
}
}
}
}