Skip to content

Commit

Permalink
icons: add push, pull
Browse files Browse the repository at this point in the history
  • Loading branch information
benknoble committed Mar 25, 2024
1 parent 38fc89a commit 025f9b0
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 4 deletions.
13 changes: 12 additions & 1 deletion defns/monsters.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -222,6 +222,16 @@
(list _ prefix suffix))
(list prefix (scale-icon (icons:range)) suffix)]
[x (list x)]))
(define (push-pull x)
(match x
[(regexp #px"^(.*)((?i:push)|(?i:pull))(.*)$"
(list _ prefix push-pull suffix))
(list prefix
(match (string-downcase push-pull)
["push" (icons:push)]
["pull" (icons:pull)])
suffix)]
[x (list x)]))
(define replacements
(list bulleted
attack
Expand All @@ -234,7 +244,8 @@
consume-element
consume-wild
target
range))
range
push-pull))
(for/fold ([result (list (regexp-replaces ability-text replacements))])
([pict-replacement (in-list pict-replacements)])
(append-map (only-on-text pict-replacement) result)))
Expand Down
24 changes: 22 additions & 2 deletions icons.rkt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,9 @@
(provide
(contract-out
[target (-> pict?)]
[range (-> pict?)]))
[range (-> pict?)]
[push (-> pict?)]
[pull (-> pict?)]))

(require pict
pict/color
Expand Down Expand Up @@ -34,8 +36,26 @@
(inset 0 0 -10 0)
highlight)))

(define (push)
(define (outlined-arrowhead size)
(cc-superimpose (arrowhead size 0)
(white (scale (arrowhead size 0) 6/10))))
(define arrows
(map (flow (~> outlined-arrowhead (rotate (* 1/2 pi))))
(list 20 10 5)))

(~> (arrows) sep
(vc-append -2 __)
(scale 1 3/4)
highlight))

(define (pull)
(rotate (push) pi))

(module+ main
(require (only-in racket/gui))
(for ([p (list target
range)])
range
push
pull)])
(show-pict (p))))
4 changes: 3 additions & 1 deletion scribblings/icons.scrbl
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@

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.
are preserved. The signifier @racket[_N] denotes where a number is expected.

@(require syntax/parse/define)

Expand All @@ -18,3 +18,5 @@ are preserved.

@deficon[target "Target N" "Target all" "+N target(s)"]
@deficon[range "Range N"]
@deficon[push "Push N"]
@deficon[pull "Pull N"]

0 comments on commit 025f9b0

Please sign in to comment.