Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

master -> beta #48

Merged
merged 5 commits into from
Mar 26, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions index.html
Original file line number Diff line number Diff line change
Expand Up @@ -656,7 +656,7 @@ <h1 id="exportToText">Text Export:</h1>

<div id="importDiv" style="display: none" class="dialog help">
<div id="importWarning">Warning! Importing data will overwrite your current game data.</div>
<h1 id="importFrom">Import Form:</h1>
<h1 id="importFrom">Import From:</h1>
<input id="importFromDropbox" type="button" onclick="gamePage.saveImportDropbox();" value="Dropbox (Beta)">
<br>
<h1 id="importFromText">Text Import:</h1>
Expand Down Expand Up @@ -711,4 +711,4 @@ <h1 id="importFromText">Text Import:</h1>
</div>

</body>
</html>
</html>
39 changes: 24 additions & 15 deletions js/religion.js
Original file line number Diff line number Diff line change
Expand Up @@ -268,12 +268,12 @@ dojo.declare("classes.managers.ReligionManager", com.nuclearunicorn.core.TabMana
var necrocornPerDay = this.game.getEffect("necrocornPerDay");
var necrocornVal = this.game.resPool.get("necrocorn").value;
var corruptionWithExisting = this.game.religion.getCorruptionPerTickProduction(true);
var worstPerTickDelta = corruptionWithExisting * days *this.game.calendar.ticksPerDay + corruptionWithExisting;
var worstPerTickDelta = corruptionWithExisting * this.game.calendar.ticksPerDay + necrocornPerDay;
//if(!this.game.science.getPolicy(["siphoning"]).researched){
if(
(worstPerTickDelta >= 0)
||(worstPerTickDelta < 0 && necrocornVal + worstPerTickDelta * days > 0)&&
(this.game.resPool.get("alicorns").value - 1 + necrocornPerDay * days >= 0)){ //naive solution here
||((worstPerTickDelta < 0 && necrocornVal + worstPerTickDelta * days > 0)&&
(this.game.resPool.get("alicorn").value - 1 + necrocornPerDay * days >= 0))){ //naive solution here
this.necrocornsNaiveFastForward(days, times);
return;
}
Expand All @@ -283,30 +283,38 @@ dojo.declare("classes.managers.ReligionManager", com.nuclearunicorn.core.TabMana
if(corruptionWithExisting * this.game.calendar.ticksPerDay + necrocornPerDay < 0 &&
corruptionWithoutExisting * this.game.calendar.ticksPerDay + necrocornPerDay > 0
){
var alicornsResult = this.game.resPool.get("alicorns").value - 1 + necrocornPerDay * days;
var alicornsResult = this.game.resPool.get("alicorn").value - 1 + necrocornPerDay * days;
var alicornsSpent = necrocornPerDay * days;
if (corruptionWithoutExisting * days/this.game.calendar.ticksPerDay + necrocornPerDay * necrocornDeficitRepaymentModifier> 0
&& this.pactsManager.necrocornDeficit>0
){
corruptionWithoutExisting += necrocornPerDay * (necrocornDeficitRepaymentModifier - 1);
}
var daysUntilSpentOne = -(necrocornPerDay * days + corruptionWithExisting/this.game.calendar.ticksPerDay);
var daysUntilCorrupted = necrocornPerDay * days + corruptionWithoutExisting/this.game.calendar.ticksPerDay;
var timePeriodWorking = days - necrocornVal * daysUntilSpentOne;
var daysUntilSpentOne = - Math.ceil(1/(necrocornPerDay + corruptionWithExisting/this.game.calendar.ticksPerDay));
var daysUntilCorrupted = -Math.ceil(1/(necrocornPerDay + corruptionWithoutExisting/this.game.calendar.ticksPerDay));
var timePeriodWorking = Math.floor(days - necrocornVal * daysUntilSpentOne);


if(alicornsResult < 0){
this.pactsManager.deficit -= alicornsResult;
alicornsSpent += alicornsResult;
timePeriodWorking += alicornsResult/necrocornPerDay;
}
var state = timePeriodWorking%(daysUntilCorrupted + daysUntilSpentOne);
this.pactsManager.necrocornDeficit += timePeriodWorking * daysUntilCorrupted/(daysUntilCorrupted + daysUntilSpentOne)* necrocornPerDay * (necrocornDeficitRepaymentModifier - 1);
if (this.pactsManager.necrocornDeficit < 0){
this.pactsManager.necrocornDeficit = 0;
if (daysUntilCorrupted + daysUntilSpentOne == 0){
return;
}
if(state/daysUntilCorrupted <= 1 - this.corruption){
this.corruption += state/daysUntilCorrupted;
var state = timePeriodWorking%(daysUntilCorrupted + daysUntilSpentOne);

//this.pactsManager.necrocornDeficit += timePeriodWorking * daysUntilCorrupted/(daysUntilCorrupted + daysUntilSpentOne)* necrocornPerDay * (necrocornDeficitRepaymentModifier - 1);
//if (this.pactsManager.necrocornDeficit < 0){
// this.pactsManager.necrocornDeficit = 0;
//}
//let's return to deficit delta later

this.pactsManager.necrocornDeficit = 0;
if (state < daysUntilCorrupted){
this.game.resPool.get("necrocorn").value = 0;
this.corruption += necrocornPerDay * state + corruptionWithoutExisting * this.game.calendar.ticksPerDay * state;
}else{
this.game.resPool.get("necrocorn").value = (state - daysUntilCorrupted)/daysUntilSpentOne;
}
Expand All @@ -315,10 +323,11 @@ dojo.declare("classes.managers.ReligionManager", com.nuclearunicorn.core.TabMana
}
var compensatedNecrocorns = 0;
var consumedAlicorns = Math.min(this.game.resPool.get("alicorn").value - 1, necrocornPerDay * days);
/*if(this.game.religion.getCorruptionDeficitPerTick() == 0 && this.game.resPool.get("alicorn").value - necrocornPerDay * days >= 1){ //check if siphening is enough to pay for per day consumption
if(this.game.religion.getCorruptionDeficitPerTick() == 0 && this.game.resPool.get("alicorn").value - necrocornPerDay * days >= 1){ //check if siphening is enough to pay for per day consumption
this.game.resPool.addResPerTick("alicorn",consumedAlicorns);
}*/
}
//var consumedAlicorns = Math.min(this.game.resPool.get("alicorn").value - 1, necrocornPerDay * days);

var siphenedNecrocorns = this.pactsManager.getSiphonedCorruption(days);
compensatedNecrocorns = Math.max(consumedAlicorns, -siphenedNecrocorns);
this.game.resPool.addResPerTick("alicorn", compensatedNecrocorns);
Expand Down