7 Developer Reference
None of these APIs should be considered stable enough for use in projects other than Frosthaven Manager. They should be considered stable enough for use in Frosthaven Manager. Changes to an internally-used API should be made with care and compelling reason.
7.1 aoe
This module implements the Area-of-Effect (AoE) language. See Programming a Scenario and frosthaven-manager/aoe for more information.
7.2 aoe-images
(require frosthaven-manager/aoe-images) | |
package: frosthaven-manager |
This module provides procedures for constructing area-of-effect diagrams.
parameter
(hex-size size) → void? size : natural-number/c
= 30
procedure
(border-size max-row max-col) → (and/c positive? number?)
max-row : natural-number/c max-col : natural-number/c
value
spec-sym? : flat-contract? = (or/c 's 'x 'o 'm 'g)
value
=
(listof (list/c exact-positive-integer? boolean? (listof (list/c spec-sym? natural-number/c))))
procedure
(spec->shape s) → pict?
s : spec?
The symbols represent the corresponding shapes, with 'g a ghost hex.
value
procedure
(syntaxes->spec stxs) → spec?
stxs : (and/c (listof syntax?) syntaxes-can-be-spec?)
procedure
(string->spec s) → spec?
s : string?
7.3 Constant Formatting and Parsing
(require frosthaven-manager/constants) | |
package: frosthaven-manager |
This module provides forms for binding formatters and parsers where the mapping from constant to string and vice-versa is static.
syntax
(define-constant-format/parse formatter-id parser-id ([constant-id string] ...))
syntax
(define-constant-format formatter-id ([constant-id string] ...))
syntax
(define-constant-parse parser-id ([constant-id string] ...))
7.4 contracts
(require frosthaven-manager/contracts) | |
package: frosthaven-manager |
procedure
(unique-with/c key c) → contract?
key : (-> any/c any/c) c : flat-contract?
7.5 curlique
(require frosthaven-manager/curlique) | |
package: frosthaven-manager |
This module provides a shorthand notation for Qi flows. It overrides Racket’s #%app: forms written in curly braces like {(all positive?)} are implictly wrapped in flow from Qi.
In addition, it provides the following overrides:
; A very small identity > (map {} (range 10)) '(0 1 2 3 4 5 6 7 8 9)
> (define all-good? {(all positive?)}) > (all-good? 1 2 3 4) #t
> (all-good? 1 -2 3 4) #f
> (~> (1 2 3) (-< + count) /) 2
> (define average {~> (-< + count) /}) > (average 1 2 3) 2
7.6 defns
(require frosthaven-manager/defns) | |
package: frosthaven-manager |
This module reprovides everything from frosthaven-manager/defns/level, frosthaven-manager/defns/loot, frosthaven-manager/defns/monsters, frosthaven-manager/defns/players, and frosthaven-manager/defns/scenario.
7.6.1 Level Info
(require frosthaven-manager/defns/level) | |
package: frosthaven-manager |
struct
(struct level-info ( monster-level gold trap-damage hazardous-terrain exp) #:transparent) monster-level : natural-number/c gold : natural-number/c trap-damage : natural-number/c hazardous-terrain : natural-number/c exp : natural-number/c
value
value
value
value
procedure
(get-level-info level) → level-info?
level : level/c
procedure
(inspiration-reward num-players) → natural-number/c
num-players : num-players/c
7.6.2 Loot Deck
(require frosthaven-manager/defns/loot) | |
package: frosthaven-manager |
value
value
value
value
value
Serializable.
value
value
value
value
value
value
value
value
Serializable.
value
value
Serializable.
struct
(struct money (amount) #:transparent) amount : natural-number/c
Serializable.
struct
(struct material (name amount) #:transparent) name : material-kind? amount : (apply list/c (make-list (sub1 max-players) natural-number/c))
Serializable.
procedure
(material-amount* m n) → natural-number/c
m : material? n : num-players/c
struct
(struct herb (name amount) #:transparent) name : herb-kind? amount : natural-number/c
Serializable.
struct
(struct special-loot (name) #:transparent) name : string?
Serializable.
value
= (or/c money? material? herb? random-item? special-loot?)
value
= (or/c 'money material-kind? herb-kind? 'random-item 'special)
procedure
(card->type c) → loot-type/c
c : loot-card?
procedure
((format-loot-card n) card) → string?
n : num-players/c card : loot-card?
value
value
value
value
value
money-deck : (apply list/c (make-list max-money-cards money?))
value
: (hash/c material-kind? (apply list/c (make-list max-material-cards material?)))
value
: (hash/c herb-kind? (apply list/c (make-list max-herb-cards herb?)))
value
standard-loot-deck : (hash/c loot-type/c (listof loot-card?))
procedure
(apply-sticker card) → loot-card?
card :
(and/c loot-card? (not/c random-item?) (not/c special-loot?))
7.6.3 Monster Cards
(require frosthaven-manager/defns/monsters) | |
package: frosthaven-manager |
struct
(struct monster-stats ( max-hp move attack bonuses effects immunities) #:prefab) max-hp : (or/c positive-integer? string?) move : (or/c #f natural-number/c) attack : (or/c natural-number/c string?) bonuses : (listof string?) effects : (listof string?) immunities : (listof string?)
struct
(struct monster-info (set-name name normal-stats elite-stats) #:prefab) set-name : string? name : string? normal-stats : (apply list/c (make-list number-of-levels monster-stats?)) elite-stats : (apply list/c (make-list number-of-levels monster-stats?))
struct
(struct monster-ability ( set-name name initiative abilities shuffle?) #:prefab) set-name : string? name : string? initiative : initiative? abilities : (listof (listof (or/c string? pict?))) shuffle? : boolean?
Note that pre-fab syntax does not permit path? or pict? objects.
The monster abilities are a list of sub-abilities, much like a character’s ability card. Each sub-ability is a list of parts, which may include pictures such as for embedded AoE diagrams.
value
struct
(struct monster (number elite? current-hp conditions) #:transparent) number : monster-number/c elite? : boolean? current-hp : natural-number/c conditions : (listof condition?)
Prefer the smart constructor make-monster.
Serializable.
struct
(struct monster-group ( set-name name level normal-stats elite-stats monsters) #:transparent) set-name : string? name : string? level : level/c normal-stats : monster-stats? elite-stats : monster-stats? monsters : (listof monster?)
Prefer the smart constructor make-monster-group and the update functions, which maintain an invariant of monsters sorted by eliteness and number.
Serializable.
procedure
(monster-stats-max-hp* stats env) → positive-integer?
stats : monster-stats? env : env/c
procedure
(monster-stats-attack* stats env) → positive-integer?
stats : monster-stats? env : env/c
procedure
m : monster-stats?
procedure
m : monster-stats?
procedure
m : monster-stats?
procedure
(monster-ability-name->text ability) → string?
ability : (or/c #f monster-ability?)
procedure
(monster-ability-initiative->text ability) → string?
ability : (or/c #f monster-ability?)
procedure
(monster-ability-ability->rich-text ability-text mg env) → (listof (or/c string? pict? pict/alt-text? newline?)) ability-text : (listof (or/c string? pict?)) mg : monster-group? env : env/c
procedure
(make-monster info level number elite? env) → monster?
info : monster-info? level : level/c number : monster-number/c elite? : boolean? env : env/c
procedure
(make-monster-group info level num+elite?s env) → monster-group? info : monster-info? level : level/c
num+elite?s :
(and/c (listof (cons/c monster-number/c boolean?)) (unique-with/c car any/c)) env : env/c
The num+elite?s parameter provides a mapping from (unique) monster numbers to their elite status. Only monster numbers in the mapping are added to the monster-group.
Formulas are calculated using env.
procedure
(get-monster-stats mg m) → monster-stats?
mg : monster-group? m : monster?
procedure
(monster-at-max-health? m s env) → boolean?
m : monster? s : monster-stats? env : env/c
procedure
(monster-dead? m) → boolean?
m : monster?
procedure
((monster-update-condition c on?) m) → monster?
c : condition? on? : boolean? m : monster?
procedure
m : monster?
procedure
((monster-group-update-num n f) mg) → monster-group?
n : monster-number/c f : (-> monster? monster?) mg : monster-group?
procedure
((monster-group-remove n) mg) → monster-group?
n : monster-number/c mg : monster-group?
procedure
((monster-group-add n elite? env) mg) → monster-group?
n : monster-number/c elite? : boolean? env : env/c mg : monster-group?
procedure
(monster-group-first-monster mg) → (or/c #f monster-number/c)
mg : monster-group?
procedure
(monster-group-update-level mg info new-level) → monster-group? mg : monster-group? info : monster-info? new-level : level/c
procedure
(monster->hp-text m ms env) → string?
m : monster? ms : monster-stats env : env/c
procedure
mg : monster-group?
procedure
(swap-monster-elite m) → monster?
m : monster?
procedure
(monster-group-change-max-HP mg f env) → monster-group?
mg : monster-group? f : (-> (or/c 'normal 'elite) natural-number/c number?) env : env/c
7.6.4 Players
(require frosthaven-manager/defns/players) | |
package: frosthaven-manager |
struct
(struct player ( name max-hp current-hp xp conditions initiative loot summons) #:transparent) name : string? max-hp : positive-integer? current-hp : natural-number/c xp : natural-number/c conditions : (listof condition?) initiative : initiative? loot : (listof loot-card?) summons : (listof summon?)
You will not usually need the player constructor: use the smart constructor make-player instead.
Serializable.
procedure
(make-player name max-hp) → player?
name : string? max-hp : positive-integer?
procedure
((player-update-name new-name) p) → player?
new-name : string? p : player?
procedure
((player-act-on-hp f) p) → player?
f : (-> natural-number/c number?) p : player?
procedure
((player-act-on-max-hp f) p) → player?
f : (-> natural-number/c number?) p : player?
procedure
((player-act-on-xp f) p) → player?
f : (-> natural-number/c number?) p : player?
procedure
((player-add-condition c) p) → player?
c : condition? p : player?
procedure
((player-remove-condition c) p) → player?
c : condition? p : player?
procedure
((player-condition-handler c?) p) → player?
c? : (list/c condition? boolean?) p : player?
procedure
((player-afflicted-by? c) p) → boolean?
c : condition? p : player?
procedure
p : player?
procedure
(player-dead? p) → boolean?
p : player?
In practice, player HP does not currently fall below 1. This may be a bug.
procedure
p : player?
procedure
(player-set-initiative p i) → player?
p : player? i : initiative?
procedure
p : player?
procedure
((player-add-loot card) p) → player?
card : loot-card? p : player?
procedure
(player->hp-text p) → string?
p : player?
procedure
(player-conditions* p) → (listof condition?)
p : player?
struct
(struct summon (name max-hp current-hp conditions) #:transparent) name : string? max-hp : positive-integer? current-hp : natural-number/c conditions : (listof condition?)
procedure
((summon-update-name new-name) s) → summon?
new-name : string? s : summon?
procedure
((summon-act-on-hp f) s) → summon?
f : (-> natural-number/c number?) s : summon?
procedure
((summon-act-on-max-hp f) s) → summon?
f : (-> natural-number/c number?) s : summon?
procedure
((summon-add-condition c) s) → summon?
c : condition? s : summon?
procedure
((summon-remove-condition c) s) → summon?
c : condition? s : summon?
procedure
((summon-condition-handler c?) s) → summon?
c? : (list/c condition? boolean?) s : summon?
procedure
((summon-afflicted-by? c) s) → boolean?
c : condition? s : summon?
procedure
(summon-dead? s) → boolean?
s : summon?
In practice, summon HP does not currently fall below 1. This may be a bug.
procedure
s : summon?
procedure
(summon->hp-text s) → string?
s : summon?
procedure
(summon-conditions* s) → (listof condition?)
s : summon?
procedure
(player-summon p name max-hp) → player?
p : player? name : string? max-hp : positive-integer?
procedure
((update-player-summon i f) p) → player?
i : natural-number/c f : (-> summon? summon?) p : player?
procedure
((player-kill-summon i) p) → player?
i : natural-number/c p : player?
7.6.5 Scenario
(require frosthaven-manager/defns/scenario) | |
package: frosthaven-manager |
value
value
value
value
value
value
value
Serializable.
value
value
value
value
value
value
value
value
value
value
Serializable.
value
value
value
value
value
value
value
value
value
value
value
value
value
value
Serializable.
procedure
c : condition?
procedure
(selector:condition i) → condition?
i : integer?
procedure
(initiative? v) → boolean?
v : any/c
value
value
expirable-conditions : (setof conditions?)
procedure
(conditions->string cs) → string?
cs : (listof condition?)
value
value
value
procedure
(shuffle-modifier-deck? deck) → boolean?
deck : (listof monster-modifier?)
procedure
(better-modifier a b) → monster-modifier?
a : monster-modifier? b : monster-modifier?
procedure
(worse-modifier a b) → monster-modifier?
a : monster-modifier? b : monster-modifier?
procedure
(absent-from-modifier-deck cards) → (listof monster-modifier?)
cards : (listof monster-modifier?)
7.7 elements
(require frosthaven-manager/elements) | |
package: frosthaven-manager |
value
struct
(struct element-pics (name infused waning unfused consume) #:transparent) name : string? infused : pict? waning : pict? unfused : pict? consume : pict?
procedure
(elements) → (listof element-pics?)
7.8 enum-helpers
(require frosthaven-manager/enum-helpers) | |
package: frosthaven-manager |
syntax
(define-serializable-enum-type id (constant-id ...) enum-option ...)
enum-option = #:omit-root-binding | #:descriptor-name descriptor-id | #:predicate-name predicate-id | #:discriminator-name discriminator-id | #:selector-name selector-id | #:property-maker prop-maker-expr | #:inspector inspector-expr
prop-maker-expr :
(-> uninitialized-enum-descriptor? (listof (cons/c struct-type-property? any/c)))
inspector-expr : inspector?
7.9 icons
(require frosthaven-manager/icons) | |
package: frosthaven-manager |
This module provides various icons that are spliced into ability card texts. All replacements are case insensitive; any numbers or other accompanying text are preserved. The signifier N denotes where a number is expected.
Target N
Target all
+N target(s)
Range N
Push N
Pull N
Move +N
Move -N
Jump
Teleport
Attack +N
Attack -N
7.10 manager
(require frosthaven-manager/manager) | |
package: frosthaven-manager |
This module reprovides all the bindings from frosthaven-manager/manager/state, frosthaven-manager/manager/ability-decks, frosthaven-manager/manager/modifier-decks, frosthaven-manager/manager/db, frosthaven-manager/manager/elements, frosthaven-manager/manager/loot, frosthaven-manager/manager/round-prompts, frosthaven-manager/manager/transition, and frosthaven-manager/manager/save.
7.10.1 manager/state
(require frosthaven-manager/manager/state) | |
package: frosthaven-manager |
This module provides facilities for manipulating manager-level state.
A creature is identified by its unique creature-id.
Serializable.
struct
(struct monster-group* (active mg) #:transparent) active : (or/c #f monster-number/c) mg : monster-group?
Serializable.
procedure
(creature-is-mg*? c) → any/c
c : creature?
struct
(struct state ( @level @num-players @creatures @type->number-of-cards @loot-deck @num-loot-cards @elements @in-draw? @round @monster-modifier-deck @monster-discard @player-blesses @curses @blesses @modifier @monster-prev-discard @bestiary-path @ability-decks @prompts @type->deck)) @level : (obs/c level/c) @num-players : (obs/c num-players/c) @creatures : (obs/c (listof creature?)) @type->number-of-cards : (obs/c (hash/c loot-type/c natural-number/c)) @loot-deck : (obs/c (listof loot-card?)) @num-loot-cards : (obs/c natural-number/c) @elements : (listof (obs/c element-state/c)) @in-draw? : (obs/c boolean?) @round : (obs/c natural-number/c) @monster-modifier-deck : (obs/c (listof monster-modifier?)) @monster-discard : (obs/c (listof monster-modifier?)) @player-blesses : (obs/c (listof monster-modifier?)) @curses : (obs/c (listof monster-modifier?)) @blesses : (obs/c (listof monster-modifier?)) @modifier : (obs/c (or/c #f monster-modifier?)) @monster-prev-discard : (obs/c (or/c #f monster-modifier?)) @bestiary-path : (obs/c (or/c #f path-string?)) @ability-decks : (obs/c (hash/c string? ability-decks?)) @prompts : (obs/c (listof prompt/c)) @type->deck : (maybe-obs/c (hash/c loot-type/c (listof loot-card?)))
procedure
(make-state [ @level @num-players @creatures @type->number-of-cards @loot-deck @num-loot-cards @elements @in-draw? @round @monster-modifier-deck @monster-discard @player-blesses @curses @blesses @modifier @monster-prev-discard @bestiary-path @ability-decks @prompts @type->deck]) → state? @level : (maybe-obs/c level/c) = (@ 0) @num-players : (maybe-obs/c num-players/c) = (@ 2) @creatures : (maybe-obs/c (listof creature?)) = (@ empty)
@type->number-of-cards : (maybe-obs/c (hash/c loot-type/c natural-number/c)) = (@ (hash)) @loot-deck : (maybe-obs/c (listof loot-card?)) = (@ empty) @num-loot-cards : (maybe-obs/c natural-number/c) = (@ 0)
@elements : (listof (maybe-obs/c element-state/c)) = (make-states '(fire ice air earth light dark)) @in-draw? : (maybe-obs/c boolean?) = (@ #f) @round : (maybe-obs/c natural-number/c) = (@ 1)
@monster-modifier-deck : (maybe-obs/c (listof monster-modifier?)) = (@ (shuffle monster-modifier-deck))
@monster-discard : (maybe-obs/c (listof monster-modifier?)) = (@ empty)
@player-blesses : (maybe-obs/c (listof monster-modifier?)) = (@ empty)
@curses : (maybe-obs/c (listof monster-modifier?)) = (@ monster-curse-deck)
@blesses : (maybe-obs/c (listof monster-modifier?)) = (@ bless-deck) @modifier : (maybe-obs/c (or/c #f monster-modifier?)) = (@ #f)
@monster-prev-discard : (maybe-obs/c (or/c #f monster-modifier?)) = (@ #f) @bestiary-path : (maybe-obs/c (or/c #f path-string?)) = (@ #f)
@ability-decks : (maybe-obs/c (hash/c string? ability-decks?)) = (@ (hash)) @prompts : (maybe-obs/c (listof prompt/c)) = (@ empty)
@type->deck : (maybe-obs/c (hash/c loot-type/c (listof loot-card?))) = (@ standard-loot-deck)
procedure
(state-@env s) → (obs/c env/c)
s : state?
procedure
(state-@info-db s) → (obs/c info-db/c)
s : state?
procedure
(state-@ability-db s) → (obs/c ability-db/c)
s : state?
procedure
(serialize-state s out) → any
s : state? out : output-port?
procedure
(deserialize-state in) → state?
in : input-port?
procedure
(copy-state from to) → any
from : state? to : state?
Warning: sometimes multiple undos are necessary to be coherent. Not all state changes are recorded.
procedure
i : any/c
procedure
(setup-players s) → any
s : state?
procedure
(update-players creatures k f) → (listof creature?)
creatures : (listof creature?) k : any/c f : (-> player? player?)
procedure
(update-monster-groups creatures k f [fn]) → (listof creature?)
creatures : (listof creature?) k : any/c f : (-> monster-group? monster-group?)
fn : (-> (or/c #f monster-number/c) monster-group? (or/c #f monster-number/c)) = (flow 1>)
procedure
(kill-monster s monster-group-id monster-number) → any s : state? monster-group-id : any/c monster-number : monster-number/c
procedure
(update-all-players creatures f) → (listof creature?)
creatures : (listof creature?) f : (-> player? player?)
procedure
(update-all-monster-groups creatures f) → (listof creature?)
creatures : (listof creature?) f : (-> monster-group? monster-group?)
procedure
((update-player-name s) k name) → any
s : state? k : any/c name : string?
procedure
((update-player-max-hp s) k f) → any
s : state? k : any/c f : (-> natural-number/c natural-number/c)
procedure
(creature-initiative ads)
→ (-> creature? (or/c +inf.0 initiative?)) ads : (hash/c string? ability-decks?)
value
=
(or/c (list/c 'set 'from string? 'to string?) (list/c 'monster 'from monster-info? 'to monster-info?) (list/c 'include? monster-number/c 'to boolean?) (list/c 'elite? monster-number/c 'to boolean?) (list/c 'level level/c))
value
add-monster-event/c : contract? = (list/c 'add monster-group?)
value
= (list/c 'remove monster-group?)
procedure
→
(-> (or/c add-monster-event/c remove-monster-event/c) any) s : state?
procedure
(draw-new-card-mid-round-if-needed s set) → any
s : state? set : string?
It is the caller’s responsibility to verify that a monster has been added and needs to potentially trigger a new card.
procedure
(initiative-public? in-draw?) → boolean?
in-draw? : boolean?
procedure
(add-prompt s) → (-> prompt/c any)
s : state?
procedure
((remove-prompt s) i p) → any
s : state? i : natural-number/c p : prompt/c
7.10.2 manager/ability-decks
(require frosthaven-manager/manager/ability-decks) | |
package: frosthaven-manager |
struct
(struct ability-decks (current draw discard) #:transparent) current : (or/c #f monster-ability?) draw : (listof monster-ability?) discard : (listof monster-ability?)
Serializable.
procedure
ad : ability-decks?
procedure
(ability-decks-discard-and-maybe-shuffle ad) → ability-decks?
ad : ability-decks?
procedure
→ (-> (hash/c string? ability-decks?) (hash/c string? ability-decks?)) f : (-> string? ability-decks? ability-decks?)
procedure
ad : ability-decks?
7.10.3 manager/modifier-decks
(require frosthaven-manager/manager/modifier-decks) | |
package: frosthaven-manager |
This module provides facilities for manipulating the modifier deck.
procedure
(reshuffle-modifier-deck s) → any
s : state?
procedure
s : state? card : monster-modifier?
procedure
(draw-modifier s) → (-> any)
s : state?
procedure
(draw-modifier* s keep) → (-> any)
s : state? keep : (-> monster-modifier? monster-modifier? monster-modifier?)
procedure
(do-curse-monster s) → (-> any)
s : state?
procedure
(do-bless-monster s) → (-> any)
s : state?
procedure
(do-bless-player s) → (-> any)
s : state?
procedure
(do-unbless-player s) → (-> any)
s : state?
procedure
(add-monster-modifier s) → (-> monster-modifier? any)
s : state?
procedure
→ (-> exact-nonnegative-integer? any) s : state?
7.10.4 manager/db
(require frosthaven-manager/manager/db) | |
package: frosthaven-manager |
This module provides facilities for manipulating the active monster databases.
procedure
db : path-string? s : state?
procedure
(init-dbs-and-foes db s) → any
db : path-string? s : state?
7.10.5 manager/elements
(require frosthaven-manager/manager/elements) | |
package: frosthaven-manager |
value
element-state/c : contract? = (or/c 'unfused 'infused 'waning)
procedure
(make-states es) → (listof (obs/c element-state/c))
es : (listof any/c)
procedure
(infuse-all es) → any
es : (listof (obs/c element-state/c))
procedure
(consume-all es) → any
es : (listof (obs/c element-state/c))
procedure
(wane-element state) → element-state/c
state : element-state/c
procedure
(transition-element-state state) → element-state/c
state : element-state/c
7.10.6 manager/loot
(require frosthaven-manager/manager/loot) | |
package: frosthaven-manager |
This module provides facilities for manipulating the loot deck.
procedure
(build-loot-deck type->number-of-cards type->deck) → (listof loot-card?) type->number-of-cards : (hash/c loot-type/c natural-number/c) type->deck : (hash/c loot-type/c (listof loot-card?))
The mapping type->number-of-cards maps a loot card type to a number of loot cards of that type. The mapping type->deck specifies which deck cards of that type should be drawn from.
This function assumes, but does not check, that for all types t the number of cards for that type (hash-ref type->number-of-cards t) is less than or equal to the number of loot cards in that type’s deck (length (hash-ref type->deck t)).
procedure
(build-loot-deck! s) → any
s : state?
procedure
((give-player-loot s) k) → any
s : state? k : any/c
procedure
(place-loot-on-bottom s) → any
s : state?
procedure
(player->rewards p num-players level) → (listof string?)
p : player? num-players : num-players/c level : level/c
7.10.7 manager/round-prompts
(require frosthaven-manager/manager/round-prompts) | |
package: frosthaven-manager |
This module provides facilities for manipulating round prompt values.
syntax
(prompt [time rule] ...)
rule = m-expr | even | odd | every n-expr starting-at start-expr
time : time/c
m-expr : natural-number/c
n-expr : natural-number/c
start-expr : natural-number/c
A rule consisting of m-expr means to prompt at round m-expr.
A rule consisting of even means to prompt at every even round.
A rule consisting of odd means to prompt at every odd round.
A rule consisting of every n-expr starting-at start-expr means to prompt at every n-exprth round, starting at the start-exprth round.
procedure
(should-do-prompt? t current-round prompts) → any/c
t : time/c current-round : natural-number/c prompts : (listof prompt/c)
value
value
value
value
procedure
(prompt->string p) → string?
p : prompt/c
7.10.8 manager/transition
(require frosthaven-manager/manager/transition) | |
package: frosthaven-manager |
value
value
7.10.9 manager/save
(require frosthaven-manager/manager/save) | |
package: frosthaven-manager |
procedure
(do-save-game s) → any
s : state?
procedure
(do-load-game s) → any
s : state?
procedure
s : state? p : path-string?
7.11 gui
This collection provides modules for operating GUIs.
7.11.1 gui/common-menu
(require frosthaven-manager/gui/common-menu) | |
package: frosthaven-manager |
value
about-menu-item : (-> (is-a?/c view<%>))
value
issue-menu-item : (-> (is-a?/c view<%>))
value
feature-menu-item : (-> (is-a?/c view<%>))
value
contribute-menu-item : (-> (is-a?/c view<%>))
value
value
value
value
gc-menu-item : (-> (is-a?/c view<%>))
7.11.2 gui/counter
(require frosthaven-manager/gui/counter) | |
package: frosthaven-manager |
7.11.3 gui/elements
(require frosthaven-manager/gui/elements) | |
package: frosthaven-manager |
procedure
@states : (listof (obs/c element-state/c)) es : (listof element-pics?) panel : (unconstrained-domain-> (is-a?/c view<%>)) = hpanel
7.11.4 gui/font
(require frosthaven-manager/gui/font) | |
package: frosthaven-manager |
This module provides helpers for manipulating font objects, as in font%.
procedure
→ (is-a?/c font%) f : (is-a?/c font%)
size : (real-in 0.0 1024.0) = (send f get-size size-in-pixels?) face : (or/c string? #f) = (send f get-face)
family : (or/c 'default 'decorative 'roman 'script 'swiss 'modern 'symbol 'system) = (send f get-family) style : (or/c 'normal 'italic 'slant) = (send f get-style) weight : font-weight/c = (send f get-weight) underlined? : any/c = (send f get-underlined)
smoothing : (or/c 'default 'partly-smoothed 'smoothed 'unsmoothed) = (send f get-smoothing) size-in-pixels? : any/c = (send f get-size-in-pixels) hinting : (or/c 'aligned 'unaligned) = (send f get-hinting)
feature-settings : font-feature-settings/c = (send f get-feature-settings)
font-list : (or/c (is-a?/c font-list%) #f) = (current-font-list)
7.11.5 gui/formula-editor
(require frosthaven-manager/gui/formula-editor) | |
package: frosthaven-manager |
This module provides GUI objects for interactive formula editing.
7.11.6 gui/helpers
(require frosthaven-manager/gui/helpers) | |
package: frosthaven-manager |
procedure
→
position-integer? position-integer? this : (is-a?/c area<%>) top : (is-a?/c area<%>) x : position-integer? y : position-integer?
7.11.7 gui/level-info
(require frosthaven-manager/gui/level-info) | |
package: frosthaven-manager |
procedure
@level : (obs/c level/c) @num-players : (obs/c num-players/c)
procedure
@num-players : (obs/c num-players/c)
7.11.8 gui/level-picker
(require frosthaven-manager/gui/level-picker) | |
package: frosthaven-manager |
procedure
(level-picker #:choose on-choose #:selection selection [ #:label label]) → (is-a?/c view<%>) on-choose : (-> level/c any) selection : (maybe-obs/c level/c) label : (maybe-obs/c maybe-label/c) = #f
7.11.9 gui/loot
(require frosthaven-manager/gui/loot) | |
package: frosthaven-manager |
procedure
(loot-picker @type->cards @type->deck [ #:on-card on-card #:on-deck on-deck]) → (is-a?/c view<%>) @type->cards : (obs/c (hash/c loot-type/c natural-number/c)) @type->deck : (obs/c (hash/c loot-type/c (listof loot-card?)))
on-card : (-> (list/c (or/c 'add 'remove) loot-type/c) any) = void
on-deck : (-> (hash/c loot-type/c (listof loot-card?)) any) = void
This picker allows loading new decks of loot cards and stickering cards on the fly with + 1 stickers. It does not allow removing such stickers; reset the deck to start over.
procedure
(loot-button @loot-deck @num-loot-cards @num-players @players [ #:on-player on-player #:on-top on-top #:on-bottom on-bottom]) → (is-a?/c view<%>) @loot-deck : (obs/c (listof loot-card?)) @num-loot-cards : (obs/c natural-number/c) @num-players : (obs/c num-players/c) @players : (obs/c (listof (cons/c player? any/c))) on-player : (-> any/c any) = void on-top : (-> any) = void on-bottom : (-> any) = void
Additionally, buttons for the top and bottom of the deck trigger the on-top and on-bottom callbacks, which then also close the view.
See Scenario information and loot for how loot-button functions in Frosthaven Manager.
procedure
(loot-preview @loot-deck @num-players) → (is-a?/c view<%>)
@loot-deck : (obs/c (listof loot-card?)) @num-players : (obs/c num-players/c)
7.11.10 gui/manager
(require frosthaven-manager/gui/manager) | |
package: frosthaven-manager |
This module’s main function is to run the Frosthaven Manager. It provides only a single binding:
procedure
(manager s) → (is-a?/c window-view<%>)
s : state?
7.11.11 gui/markdown
(require frosthaven-manager/gui/markdown) | |
package: frosthaven-manager |
procedure
(markdown-text @content [ #:min-size min-size #:stretch stretch #:margin margin #:inset inset #:style style]) → (is-a?/c view<%>) @content : (maybe-obs/c (or/c string? path?)) min-size : (maybe-obs/c size/c) = '(#f #f) stretch : (maybe-obs/c stretch/c) = '(#t #t) margin : (maybe-obs/c margin/c) = '(0 0) inset : (maybe-obs/c margin/c) = '(5 5)
style :
(listof (one-of/c 'no-border 'control-border 'combo 'no-hscroll 'no-vscroll 'hide-hscroll 'hide-vscroll 'auto-vscroll 'auto-hscroll 'resize-corner 'deleted 'transparent)) = '(no-hscroll)
Paragraphs;
HTML comments;
Hyperlinks;
Blockquotes;
Unordered and ordered lists;
Horizontal rules;
Bold, italic, and code styles;
and six levels of headings.
Any string
Any expression tagged !HTML-COMMENT, the tag for HTML comments
Any expression tagged a
Any expression tagged blockquote
Any expression tagged ul
Any expression tagged ol
Any expression tagged li
Any expression tagged hr
Any expression tagged p
Any expression tagged strong
Any expression tagged em
Any expression tagged code
Any expression tagged h1
Any expression tagged h2
Any expression tagged h3
Any expression tagged h4
Any expression tagged h5
Any expression tagged h6
Note that Markdown technically requires 4 spaces or a single tab as leading indent for nesting lists and other blocks; while many Markdown implementations (such as those used on GitHub) are more lenient, the implementation backing markdown-text is stricter on this point.
7.11.12 gui/mixins
(require frosthaven-manager/gui/mixins) | |
package: frosthaven-manager |
procedure
→ (make-mixin-contract top-level-window<%>) out : (-> (-> any) any)
procedure
→ (make-mixin-contract top-level-window<%>) proc : (-> any)
7.11.13 gui/monster-modifier
(require frosthaven-manager/gui/monster-modifier) | |
package: frosthaven-manager |
procedure
(modify-monster-deck-menu-item @cards [ #:on-add on-add #:on-remove on-remove] #:on-shuffle on-shuffle) → (is-a?/c view<%>) @cards : (obs/c (listof monster-modifier?)) on-add : (-> monster-modifier? any) = void on-remove : (-> exact-nonnegative-integer? any) = void on-shuffle : (-> any)
procedure
(favors-dialog @cards [ #:on-add on-add #:on-remove on-remove] #:on-shuffle on-shuffle) → (is-a?/c window-view<%>) @cards : (obs/c (listof monster-modifier?)) on-add : (-> monster-modifier? any) = void on-remove : (-> exact-nonnegative-integer? any) = void on-shuffle : (-> any)
procedure
(card-swapper @cards [ #:on-add on-add #:on-remove on-remove]) → (is-a?/c view<%>) @cards : (obs/c (listof monster-modifier?)) on-add : (-> monster-modifier? any) = void on-remove : (-> exact-nonnegative-integer? any) = void
When a card is added via the <= arrow, calls on-add with the card. When a card is removed via the => arrow, calls on-remove with the cards index.
7.11.14 gui/monsters
(require frosthaven-manager/gui/monsters) | |
package: frosthaven-manager |
procedure
(single-monster-picker info-db @initial-level [ #:on-change on-change #:unavailable unavailable]) → (is-a?/c view<%>) info-db : info-db/c @initial-level : (obs/c level/c) on-change : (-> single-monster-event/c any) = void unavailable : (set/c string?) = empty
procedure
(simple-monster-group-view @mg) → (is-a?/c view<%>)
@mg : (obs/c monster-group?)
procedure
(monster-group-view @mg @ability-deck @monster-num @env [ #:on-select on-select #:on-condition on-condition #:on-hp on-hp #:on-kill on-kill #:on-new on-new #:on-swap on-swap #:on-move-ability-card on-move-ability-card #:on-max-hp on-max-hp] #:on-change-level on-change-level #:on-update arbitrary-update) → (is-a?/c view<%>) @mg : (obs/c monster-group?) @ability-deck : (obs/c ability-decks?) @monster-num : (obs/c (or/c #f monster-number/c)) @env : (obs/c env/c) on-select : (-> (or/c #f monster-number/c) any) = void
on-condition : (-> monster-number/c condition? boolean? any) = void on-hp : (-> monster-number/c (-> number? number?) any) = void on-kill : (-> monster-number/c any) = void on-new : (-> monster-number/c boolean? any) = void on-swap : (-> (or/c 'all monster-number/c) any) = void on-move-ability-card : (-> any) = void
on-max-hp : (-> (-> (or/c 'normal 'elite) natural-number/c number?) any) = void on-change-level : (-> level/c any) arbitrary-update : (-> (-> monster-group? monster-group?) any)
on-select is given a new monster number when one is selected in the detailed view, or #false if there are none.
on-condition is given a monster number, condition, and either #true or #false to indiciate whether the condition should be applied or removed.
on-hp is given a monster number and a procedure to update the monsters monster-current-hp.
on-kill is invoked with a monster number when that monster is killed.
on-new is invoked with a monster number and #true if the monster is elite or #false otherwise for a newly added monster.
on-swap is invoked with 'all if all monsters should be swapped by swap-monster-group-elites, or with a monster number if only that monster should be swapped by swap-monster-elite.
on-move-ability-card is invoked when the top of the ability draw pile should be moved to the bottom using the ability deck previewer.
on-max-hp is invoked when adjusting all maximum HP of the group. The given procedure computes new maximum HP values as for monster-group-change-max-HP.
on-change-level is invoked when adjusting the group’s level with the new level.
The arbitrary-update callback is invoked with a function that computes a new monster-group?; it is intended to update @mg for more complicated events that are logically a single step.
procedure
(db-view @info-db @ability-db @monster-groups) → (is-a?/c view<%>) @info-db : (obs/c info-db/c) @ability-db : (obs/c ability-db/c) @monster-groups : (obs/c (listof monster-group?))
Any pre-set monster groups will also be shown.
procedure
(add-monster-group @info-db @initial-level @monster-names @env [ #:on-group on-group]) → any @info-db : (obs/c info-db/c) @initial-level : (obs/c level/c) @monster-names : (obs/c (set/c string? #:cmp 'dont-care #:kind 'dont-care)) @env : (obs/c env/c) on-group : (-> monster-group? any) = void
7.11.15 gui/number-players
(require frosthaven-manager/gui/number-players) | |
package: frosthaven-manager |
procedure
(number-players-picker #:choose on-choose #:selection selection [ #:label label]) → (is-a?/c view<%>) on-choose : (-> level/c any) selection : (maybe-obs/c level/c) label : (maybe-obs/c maybe-label/c) = "Number of Players"
7.11.16 gui/player-info
(require frosthaven-manager/gui/player-info) | |
package: frosthaven-manager |
procedure
→ (is-a?/c view<%>) @player : (obs/c player?) on-condition : (-> (list/c condition? boolean?) any) = void on-hp : (-> (-> number? number?) any) = void on-xp : (-> (-> number? number?) any) = void on-initiative : (-> number? any) = void arbitrary-update : (-> (-> player? player?) any) add-summon : (-> string? positive-integer? any) update-summon-hp : (-> natural-number/c (-> number? number?) any) update-summon-condition : (-> natural-number/c (list/c condition? boolean?) any) kill-summon : (-> natural-number/c any)
The summon callbacks are given the summon number, a list index, to indicate which summon to update. Adding a summon is done by name and max HP.
The arbitrary-update callback is invoked with a function that computes a new player?; it is intended to update @player for more complicated events that are logically a single step.
7.11.17 gui/render
(require frosthaven-manager/gui/render) | |
package: frosthaven-manager |
parameter
(current-renderer) → (or/c #f renderer?)
(current-renderer r) → void? r : (or/c #f renderer?)
= #f
(define root (render ...)) (current-renderer root)
This will not affect multiple applications built and run separately that use this library, since they’re in separate processes completely.
procedure
(render/eventspace tree [ #:parent parent #:eventspace es]) → renderer? tree : (is-a?/c view<%>) parent : (or/c #f renderer?) = #f es : eventspace? = (current-eventspace)
Pass a new eventspace created with make-eventspace to separate the rendered tree and corresponding current-renderer from other applications.
This can be used to group windows in an application together, but note that subsequent calls with the same es will override that eventspace’s handler thread’s current-renderer.
For a short-lived window that should tear down the eventspace on closure, combine with with-closing-custodian/eventspace.
syntax
(with-closing-custodian/eventspace e ...+)
syntax
syntax
syntax
closing-custodian is a new custodian that manages closing-eventspace.
closing-eventspace is a new eventspace managed by closing-custodian.
close-custodian-mixin is a new mixin for top-level-window<%>s that causes closing-custodian to shutdown after the corresponding window is closed.
(require racket/gui/easy) (define main-es (make-eventspace)) (render/eventspace