-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
7 changed files
with
228 additions
and
72 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
import { Location } from "kolmafia"; | ||
import { $location } from "libram"; | ||
|
||
import { haveMachete, lianasCanBeFree } from "./hiddenCity"; | ||
|
||
interface ZoneDelay { | ||
zone: Location; | ||
length: number; | ||
needed?: () => boolean; | ||
} | ||
|
||
export const DELAY_ZONES: ZoneDelay[] = [ | ||
{ | ||
zone: $location`The Outskirts of Cobb's Knob`, | ||
length: 10, | ||
}, | ||
{ | ||
zone: $location`The Spooky Forest`, | ||
length: 5, | ||
}, | ||
{ | ||
zone: $location`The Boss Bat's Lair`, | ||
length: 5, | ||
}, | ||
{ | ||
zone: $location`The Haunted Gallery`, | ||
length: 5, | ||
}, | ||
{ | ||
zone: $location`The Haunted Bathroom`, | ||
length: 5, | ||
}, | ||
{ | ||
zone: $location`The Haunted Bedroom`, | ||
length: 6, | ||
}, | ||
{ | ||
zone: $location`The Haunted Ballroom`, | ||
length: 5, | ||
}, | ||
{ | ||
zone: $location`The Penultimate Fantasy Airship`, | ||
length: 25, | ||
}, | ||
{ | ||
zone: $location`The Castle in the Clouds in the Sky (Ground Floor)`, | ||
length: 10, | ||
}, | ||
{ | ||
zone: $location`The Hidden Park`, | ||
length: 6, | ||
needed: () => !haveMachete() && lianasCanBeFree(), | ||
}, | ||
{ | ||
zone: $location`The Copperhead Club`, | ||
// Not including NCs themselves here. | ||
length: 12, | ||
}, | ||
{ | ||
zone: $location`The Upper Chamber`, | ||
length: 5, | ||
}, | ||
{ | ||
zone: $location`The Middle Chamber`, | ||
length: 9, | ||
}, | ||
]; | ||
|
||
export function remainingDelay() { | ||
return DELAY_ZONES.map(({ zone, length, needed }) => ({ | ||
zone, | ||
remaining: needed === undefined || needed() ? length - zone.turnsSpent : 0, | ||
})).filter(({ remaining }) => remaining > 0); | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
import { canEquip, haveEquipped, myFamiliar, myPath } from "kolmafia"; | ||
import { $effect, $familiar, $item, $path, get, have } from "libram"; | ||
|
||
import { haveUnrestricted } from "../util/available"; | ||
|
||
export function currentExplorationPerTurn(): number { | ||
let exploration = 1; | ||
if (haveEquipped($item`ornate dowsing rod`)) { | ||
exploration += 2; | ||
} | ||
if (haveEquipped($item`UV-resistant compass`)) { | ||
exploration += 1; | ||
} | ||
if (myPath() === $path`License to Adventure` && get("bondDesert")) { | ||
exploration += 2; | ||
} | ||
if ( | ||
myPath() === $path`Avatar of Sneaky Pete` && | ||
get("peteMotorbikeHeadlight") === "Blacklight Bulb" | ||
) { | ||
exploration += 2; | ||
} | ||
if (haveEquipped($item`survival knife`) && have($effect`Ultrahydrated`)) { | ||
exploration += 2; | ||
} | ||
if (myFamiliar() === $familiar`Melodramedary`) { | ||
exploration += 1; | ||
} | ||
return exploration; | ||
} | ||
export function possibleExplorationPerTurn(): number { | ||
let exploration = 1; | ||
if (have($item`ornate dowsing rod`)) { | ||
exploration += 2; | ||
} | ||
if ( | ||
have($item`UV-resistant compass`) && | ||
(!have($item`ornate dowsing rod`) || | ||
haveUnrestricted($familiar`Left-Hand Man`)) | ||
) { | ||
exploration += 1; | ||
} | ||
if (myPath() === $path`License to Adventure` && get("bondDesert")) { | ||
exploration += 2; | ||
} | ||
if ( | ||
myPath() === $path`Avatar of Sneaky Pete` && | ||
get("peteMotorbikeHeadlight") === "Blacklight Bulb" | ||
) { | ||
exploration += 2; | ||
} | ||
if (have($item`survival knife`)) { | ||
exploration += 2; | ||
} | ||
if ( | ||
haveUnrestricted($familiar`Melodramedary`) && | ||
canEquip($familiar`Melodramedary`) | ||
) { | ||
exploration += 1; | ||
} | ||
return exploration; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
import { myPath } from "kolmafia"; | ||
import { $items, $path, have } from "libram"; | ||
|
||
export const MACHETES = $items`antique machete, muculent machete, machetito`; | ||
export function haveMachete() { | ||
return MACHETES.some((item) => have(item)); | ||
} | ||
|
||
export function lianasCanBeFree() { | ||
return myPath() !== $path`Avant Guard` && myPath() !== $path`BIG!`; | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,73 @@ | ||
import { ListItem, UnorderedList } from "@chakra-ui/react"; | ||
import { canAdventure, Location } from "kolmafia"; | ||
import { sum } from "libram"; | ||
import { FC } from "react"; | ||
|
||
import AdviceTip from "../../components/AdviceTip"; | ||
import Line from "../../components/Line"; | ||
import MainLink from "../../components/MainLink"; | ||
import Tile from "../../components/Tile"; | ||
import { remainingDelay } from "../../questInfo/delay"; | ||
import { parentPlaceLink } from "../../util/links"; | ||
import { plural } from "../../util/text"; | ||
|
||
type Details = { zone: Location; remaining: number; available: boolean }; | ||
|
||
const ZoneList: FC<{ | ||
zones: Details[]; | ||
}> = ({ zones }) => ( | ||
<UnorderedList> | ||
{zones.map(({ zone, remaining, available }) => ( | ||
<ListItem | ||
key={zone.identifierString} | ||
color={available ? undefined : "gray.500"} | ||
> | ||
<MainLink href={parentPlaceLink(zone)}> | ||
{plural(remaining, "turn")} in {zone.identifierString}. | ||
</MainLink> | ||
</ListItem> | ||
))} | ||
</UnorderedList> | ||
); | ||
|
||
const Delay: FC = () => { | ||
let allRemaining = remainingDelay() | ||
.map(({ zone, remaining }) => ({ | ||
zone, | ||
remaining, | ||
available: canAdventure(zone), | ||
})) | ||
.sort( | ||
({ available: availableA }, { available: availableB }) => | ||
+availableB - +availableA, | ||
); | ||
let truncated: Details[] = []; | ||
if ( | ||
allRemaining.length > 7 && | ||
allRemaining.some(({ available }) => !available) | ||
) { | ||
truncated = allRemaining.slice(1); | ||
allRemaining = allRemaining.slice(0, 7); | ||
} | ||
|
||
const total = sum(allRemaining, ({ remaining }) => remaining); | ||
return ( | ||
<Tile | ||
header={`${plural(total, "turn")} of delay`} | ||
id="delay-zones-tile" | ||
imageUrl="/images/itemimages/al_dayshorter.gif" | ||
> | ||
<Line>Use free runs and free wanderers to avoid spending turns.</Line> | ||
<ZoneList zones={allRemaining} /> | ||
{truncated.length > 0 && ( | ||
<Line> | ||
<AdviceTip label={<ZoneList zones={truncated} />}> | ||
Later zones. | ||
</AdviceTip> | ||
</Line> | ||
)} | ||
</Tile> | ||
); | ||
}; | ||
|
||
export default Delay; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters