generated from nhcarrigan/template
feat: post-prestige automation (auto-adventurer) (#76)
## Summary Closes #61 - Adds the **Autonomous Recruitment** prestige upgrade (50 runestones) to both the API and web data files - Adds `autoAdventurer?: boolean` to the `GameState` type for backwards-compatible saves - Adds tick-loop logic in GameContext that automatically purchases the highest-tier unlocked adventurer the player can afford each frame when the toggle is enabled - Adds `toggleAutoAdventurer` callback and exposes it through the context - Adds toggle UI in the Prestige Shop (mirrors the existing Auto-Prestige toggle pattern) - Updates the How to Play guide in the About panel to document the new automation feature ✨ This issue was created with help from Hikari~ 🌸 Reviewed-on: #76 Co-authored-by: Hikari <hikari@nhcarrigan.com> Co-committed-by: Hikari <hikari@nhcarrigan.com>
This commit was merged in pull request #76.
This commit is contained in:
@@ -89,6 +89,7 @@ const PrestigePanel = (): JSX.Element => {
|
||||
buyPrestigeUpgrade,
|
||||
enableNotifications,
|
||||
enableSounds,
|
||||
toggleAutoAdventurer,
|
||||
toggleAutoPrestige,
|
||||
triggerPrestigeToast,
|
||||
} = useGame();
|
||||
@@ -110,7 +111,7 @@ const PrestigePanel = (): JSX.Element => {
|
||||
);
|
||||
}
|
||||
|
||||
const { prestige: prestigeData, player } = state;
|
||||
const { autoAdventurer, prestige: prestigeData, player } = state;
|
||||
const threshold = calculateThreshold(prestigeData.count);
|
||||
const isEligible = player.totalGoldEarned >= threshold;
|
||||
const runestonePreview = calculateRunestonePreview(
|
||||
@@ -173,6 +174,10 @@ const PrestigePanel = (): JSX.Element => {
|
||||
void handlePrestige();
|
||||
}
|
||||
|
||||
function handleAutoAdventurerToggle(): void {
|
||||
toggleAutoAdventurer();
|
||||
}
|
||||
|
||||
function handleAutoPrestigeToggle(): void {
|
||||
toggleAutoPrestige();
|
||||
}
|
||||
@@ -347,6 +352,9 @@ const PrestigePanel = (): JSX.Element => {
|
||||
= prestigeData.runestones >= upgrade.runestonesCost;
|
||||
const isLoading = buyingId === upgrade.id;
|
||||
|
||||
const isAutoAdventurerToggle
|
||||
= upgrade.id === "auto_adventurer" && purchased;
|
||||
const autoAdventurerEnabled = autoAdventurer ?? false;
|
||||
const isAutoPrestigeToggle
|
||||
= upgrade.id === "auto_prestige" && purchased;
|
||||
const autoPrestigeEnabled
|
||||
@@ -381,6 +389,21 @@ const PrestigePanel = (): JSX.Element => {
|
||||
: `🔮 ${formatNumber(upgrade.runestonesCost)} Runestones`}
|
||||
</p>
|
||||
</div>
|
||||
{isAutoAdventurerToggle
|
||||
? <button
|
||||
className={`auto-prestige-toggle ${
|
||||
autoAdventurerEnabled
|
||||
? "enabled"
|
||||
: "disabled"
|
||||
}`}
|
||||
onClick={handleAutoAdventurerToggle}
|
||||
type="button"
|
||||
>
|
||||
{autoAdventurerEnabled
|
||||
? "⚡ Auto ON"
|
||||
: "⏸ Auto OFF"}
|
||||
</button>
|
||||
: null}
|
||||
{isAutoPrestigeToggle
|
||||
? <button
|
||||
className={`auto-prestige-toggle ${
|
||||
|
||||
Reference in New Issue
Block a user