monster-gen.scm 2.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  1. (import (scheme base)
  2. (scheme read)
  3. (scheme write)
  4. (scheme load)
  5. (srfi 27)
  6. (srfi 28))
  7. (load "./name-gen.scm")
  8. (random-source-randomize! default-random-source)
  9. (define (list-random l)
  10. (list-ref l (random-integer (length l))))
  11. ;; Monster generator
  12. (define monster-quantities
  13. '("one" "two" "three" "four" "five" "six"))
  14. (define monster-qualities
  15. '("giant" "miniature" "fiery" "icy" "demonic"
  16. "underground" "flying" "lightning" "holy"
  17. "demonic" "horrific" "beautiful" "shadowy"
  18. "mechanical" "crafty" "tricky" "poisonous"))
  19. (define hybrid-animals
  20. '("wolf" "cat" "dragon" "fish" "elephant" "bee" "human"
  21. "horse" "armadillo" "bird" "bat"))
  22. (define body-parts
  23. '("eyes" "arms" "legs" "heads" "mouths" "ears"
  24. "torsos" "hands" "feet" "faces"))
  25. (define monster-alignments
  26. '("Chaotic" "Lawful Evil" "Evil" "Chaotic Evil"))
  27. (define monster-homes
  28. '("caves" "forests" "castles" "deserts" "graveyards"))
  29. (define monster-combat-types
  30. '("magic" "brute force" "melee weapon" "ranged weapon"
  31. "poison gas" "ranged acid" "stealth"))
  32. (define (make-hybrid)
  33. (define name (random-single-name))
  34. (define quality (list-random monster-qualities))
  35. (define alignment (list-random monster-alignments))
  36. (define a1 (list-random hybrid-animals))
  37. (define a2 (list-random hybrid-animals))
  38. (format "~a: A ~a half-~a half-~a that is ~a."
  39. name
  40. quality
  41. a1
  42. a2
  43. alignment))
  44. (define (make-horror)
  45. (define horrors
  46. (let loop ((new-horror? #t)
  47. (horrors '()))
  48. (if new-horror?
  49. (loop (< 3 (random-integer 10))
  50. (cons (format "~a ~a, "
  51. (list-random monster-quantities)
  52. (list-random body-parts))
  53. horrors))
  54. horrors)))
  55. (apply string-append
  56. (cons "It has "
  57. (reverse (cons
  58. (format "and ~a ~a."
  59. (list-random monster-quantities)
  60. (list-random body-parts))
  61. horrors)))))
  62. (define (make-total-horror)
  63. (string-append
  64. (make-hybrid)
  65. " "
  66. (make-horror)
  67. " "
  68. (format "It lives in ~a."
  69. (list-random monster-homes))
  70. " "
  71. (format "It likes to fight with ~a."
  72. (list-random monster-combat-types))
  73. " "
  74. (format
  75. "Its intelligence is ~a, its difficulty is ~a, and its morale is ~a."
  76. (random-integer 10)
  77. (random-integer 10)
  78. (random-integer 10))))