Skip to content
This repository has been archived by the owner on Oct 25, 2022. It is now read-only.

Commit

Permalink
fix: Don't hunt during pacifism
Browse files Browse the repository at this point in the history
Implements upstream change 937fb24
  • Loading branch information
oliversalzburg committed Jul 18, 2021
1 parent 92a1782 commit ccbffc5
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 1 deletion.
4 changes: 4 additions & 0 deletions packages/userscript/source/Engine.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1643,6 +1643,10 @@ export class Engine {
const manpower = this._craftManager.getResource("manpower");
const subTrigger = this._host.options.auto.options.items.hunt.subTrigger ?? 0;

if (manpower.value < 100 || this._host.gamePage.challenges.isActive("pacifism")) {
return;
}

if (subTrigger <= manpower.value / manpower.maxValue && 100 <= manpower.value) {
// Determine how many hunts are being performed.
let huntCount = Math.floor(manpower.value / 100);
Expand Down
1 change: 1 addition & 0 deletions packages/userscript/source/types/gamePage.ts
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,7 @@ export type GamePage = {
calculateEffects: (model: unknown, game: GamePage) => void;
researched: number;
};
isActive: (challenge: Challenge) => boolean;
};
console: {
maxMessages: number;
Expand Down
8 changes: 7 additions & 1 deletion packages/userscript/source/types/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -156,7 +156,13 @@ export type GameTab = {
visible: boolean;
};

export type Challenge = "1000Years" | "anarchy" | "atheism" | "energy" | "winterIsComing";
export type Challenge =
| "1000Years"
| "anarchy"
| "atheism"
| "energy"
| "pacifism"
| "winterIsComing";

export * from "./buildings";
export * from "./gamePage";
Expand Down

0 comments on commit ccbffc5

Please sign in to comment.