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

Deplete default job first when paying population #1305

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
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
11 changes: 8 additions & 3 deletions src/actions.js
Original file line number Diff line number Diff line change
Expand Up @@ -7329,11 +7329,16 @@ export function payCosts(c_action, costs){
let cost = costs[res]();
global.portal.purifier.supply -= cost;
}
else if (res === 'Species'){
let cost = costs[res]();
global.resource[global.race.species].amount -= cost;
// If the default job does not have enough workers, then the main game loop will deplete some other job
global.civic[global.civic.d_job].workers = Math.max(0, global.civic[global.civic.d_job].workers - cost);
}
else if (res !== 'Morale' && res !== 'Army' && res !== 'HellArmy' && res !== 'Troops' && res !== 'Structs' && res !== 'Bool' && res !== 'Custom'){
let cost = costs[res]();
let f_res = res === 'Species' ? global.race.species : res;
global['resource'][f_res].amount -= cost;
if (f_res === 'Knowledge'){
global.resource[res].amount -= cost;
if (res === 'Knowledge'){
global.stats.know += cost;
}
}
Expand Down