You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

main.go 6.8KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202
  1. package main
  2. import (
  3. "fmt"
  4. "math/rand"
  5. // "sort"
  6. // "strings"
  7. "time"
  8. "util"
  9. )
  10. type Character struct {
  11. Name string
  12. TotalForces int
  13. CorporealForces int
  14. EtherealForces int
  15. CelestialForces int
  16. Strength int
  17. Agility int
  18. Intellect int
  19. Precision int
  20. Will int
  21. Perception int
  22. Skills map[string]int
  23. Songs map[string]int
  24. Attunements []string
  25. Distinctions []string
  26. Artifacts []string
  27. Vessels map[string]int
  28. Roles map[string][]int
  29. }
  30. func main() {
  31. rand.Seed(time.Now().UnixNano()) // Keep this first in main()
  32. ply := Character{}
  33. ply.Name = util.Namegen()
  34. ply.TotalForces = 9
  35. ply.CorporealForces = 1
  36. ply.EtherealForces = 1
  37. ply.CelestialForces = 1
  38. ply.Strength = 1
  39. ply.Agility = 1
  40. ply.Intellect = 1
  41. ply.Precision = 1
  42. ply.Will = 1
  43. ply.Perception = 1
  44. ply.Skills = make(map[string]int)
  45. ply.Songs = make(map[string]int)
  46. corSkills := make([]string, 0, 50)
  47. ethSkills := make([]string, 0, 50)
  48. celSkills := make([]string, 0, 50)
  49. akList := make([]string, 0, 50)
  50. knowList := make([]string, 0, 50)
  51. langList := make([]string, 0, 50)
  52. songList := make([]string, 0, 50)
  53. for _, v := range []string{"Acrobatics", "Climbing", "Dodge", "Escape", "Fighting", "Large Weapon", "Move Silently", "Running", "Swimming", "Throwing"} {
  54. corSkills = append(corSkills, v)
  55. }
  56. for _, v := range []string{"Knowledge", "Knowledge", "Knowledge", "Area Knowledge", "Area Knowledge", "Area Knowledge", "Chemistry", "Computer Operation", "Driving", "Electronics", "Engineering", "Language", "Lockpicking", "Lying", "Medicine", "Ranged Weapon", "Savoir-Faire", "Small Weapon", "Tactics"} {
  57. ethSkills = append(ethSkills, v)
  58. }
  59. for _, v := range []string{"Artistry", "Detect Lies", "Emote", "Fast-Talk", "Seduction", "Singing", "Survival", "Tracking"} {
  60. celSkills = append(celSkills, v)
  61. }
  62. for _, v := range []string{"Heaven", "Hell", "Marches", "Caribbean", "New York", "New England", "Florida", "Atlanta", "Texas", "California", "American Southwest", "Pacific Northwest", "Portland", "Toronto", "Vancouver", "Mexico", "Central America", "Brazil", "Argentina", "England", "London", "France", "Paris", "Norway", "Scandinavia", "Greece", "Egypt", "North Africa", "Sub-Saharan Africa", "Saudi Arabia", "Middle East", "Russia", "Moscow", "China", "Shanghai", "Hong Kong", "Japan", "Hokkaido", "Tokyo", "Australia", "Sydney", "Melbourne", "Perth", "Fiji", "Antarctica"} {
  63. akList = append(akList, v)
  64. }
  65. for _, v := range []string{"Astronomy", "Biology", "Literature", "Aircraft", "American Football", "Football", "Baseball", "Sumo", "Giant Robot Anime", "German Cuisine", "Catholicism", "Islam", "Buddhism", "Shinto", "Architecture", "Eschatology", "Numinology", "Role-Playing Games", "Spelunking", "Parliamentary Procedure", "Olympic History", "18th-Century Botanical Manuals", "Photography", "Marine Biology", "Entomology", "Archaeology"} {
  66. knowList = append(knowList, v)
  67. }
  68. for _, v := range []string{"Mandarin", "Spanish", "English", "Hindi", "Arabic", "Portuguese", "Bengali", "Russian", "Japanese", "Punjabi", "German", "Javanese", "Wu", "Malay", "Telugu", "Vietnamese", "Korean", "French", "Marathi", "Tamil", "Urdu", "Turkish", "Italian", "Yue (Cantonese)", "Thai", "Latin", "Greek", "Ancient Egyptian", "Apache", "Ainu", "Aleut", "Inuit", "Mayan"} {
  69. langList = append(langList, v)
  70. }
  71. for _, v := range []string{"Attraction", "Charm", "Dreams", "Entropy", "Form", "Harmony", "Healing", "Motion", "Numinous Corpus", "Possession", "Projection", "Shields", "Thunder", "Tongues"} {
  72. songList = append(songList, v)
  73. }
  74. i := ply.TotalForces - (ply.CorporealForces + ply.EtherealForces + ply.CelestialForces)
  75. for i > 0 {
  76. r := rand.Intn(3)
  77. if r == 0 {
  78. ply.CorporealForces = ply.CorporealForces + 1
  79. } else if r == 1 {
  80. ply.EtherealForces = ply.EtherealForces + 1
  81. } else {
  82. ply.CelestialForces = ply.CelestialForces + 1
  83. }
  84. i--
  85. }
  86. cp, corBrk, ethBrk := ply.TotalForces*4, ply.CorporealForces, ply.CorporealForces+ply.EtherealForces
  87. sklBrk := 12
  88. // Corporeal
  89. coratt := (ply.CorporealForces * 4) - (ply.Strength + ply.Agility)
  90. for coratt > 0 {
  91. r := rand.Intn(2)
  92. if r == 0 {
  93. if ply.Strength == 12 || (ply.Strength >= (ply.Agility*2) && rand.Intn(3) == 0) {
  94. continue
  95. }
  96. ply.Strength = ply.Strength + 1
  97. } else {
  98. if ply.Agility == 12 || (ply.Agility >= (ply.Strength*2) && rand.Intn(3) == 0) {
  99. continue
  100. }
  101. ply.Agility = ply.Agility + 1
  102. }
  103. coratt--
  104. }
  105. // Ethereal
  106. ethatt := (ply.EtherealForces * 4) - (ply.Intellect + ply.Precision)
  107. for ethatt > 0 {
  108. r := rand.Intn(2)
  109. if r == 0 {
  110. if ply.Intellect == 12 || (ply.Intellect >= (ply.Precision*2) && rand.Intn(3) == 0) {
  111. continue
  112. }
  113. ply.Intellect = ply.Intellect + 1
  114. } else {
  115. if ply.Precision == 12 || (ply.Precision >= (ply.Intellect*2) && rand.Intn(3) == 0) {
  116. continue
  117. }
  118. ply.Precision = ply.Precision + 1
  119. }
  120. ethatt--
  121. }
  122. // Celestial
  123. celatt := (ply.CelestialForces * 4) - (ply.Will + ply.Perception)
  124. for celatt > 0 {
  125. r := rand.Intn(2)
  126. if r == 0 {
  127. if ply.Will == 12 || (ply.Will >= (ply.Perception*2) && rand.Intn(3) == 0) {
  128. continue
  129. }
  130. ply.Will = ply.Will + 1
  131. } else {
  132. if ply.Perception == 12 || (ply.Perception >= (ply.Will*2) && rand.Intn(3) == 0) {
  133. continue
  134. }
  135. ply.Perception = ply.Perception + 1
  136. }
  137. celatt--
  138. }
  139. b := 7 + rand.Intn(6)
  140. for i := cp; i > b; i-- {
  141. r := rand.Intn(15)
  142. if r < sklBrk { // it's a skill
  143. q := rand.Intn(ply.TotalForces)
  144. skl := ""
  145. if q < corBrk { // it's a corporeal skill
  146. skl = util.ChoiceStr(corSkills)
  147. // fmt.Println("Selected Corporeal skill: ", skl)
  148. } else if q < ethBrk { // it's an ethereal skill
  149. skl = util.ChoiceStr(ethSkills)
  150. if skl == "Knowledge" {
  151. subskl := util.ChoiceStr(knowList)
  152. skl = "Knowledge (" + subskl + ")"
  153. } else if skl == "Area Knowledge" {
  154. subskl := util.ChoiceStr(akList)
  155. skl = "Area Knowledge (" + subskl + ")"
  156. } else if skl == "Language" {
  157. subskl := util.ChoiceStr(langList)
  158. skl = "Language (" + subskl + ")"
  159. }
  160. // fmt.Println("Selected Ethereal skill: ", skl)
  161. } else { // it's a celestial skill
  162. skl = util.ChoiceStr(celSkills)
  163. // fmt.Println("Selected Celestial skill: ", skl)
  164. }
  165. ply.Skills[skl] = ply.Skills[skl] + 1
  166. } else { // Songs
  167. skl := util.ChoiceStr(songList)
  168. // fmt.Println("Selected song: ", skl)
  169. ply.Songs[skl] = ply.Songs[skl] + 1
  170. }
  171. }
  172. fmt.Println("=== Generated In Nomine character ===")
  173. fmt.Println(ply.Name)
  174. fmt.Printf("Cor %d\tEth %d\tCel %d\n",
  175. ply.CorporealForces,
  176. ply.EtherealForces,
  177. ply.CelestialForces)
  178. fmt.Printf("Str %d\tInt %d\tCel %d\n",
  179. ply.Strength,
  180. ply.Intellect,
  181. ply.Will)
  182. fmt.Printf("Agi %d\tPre %d\tPer %d\n",
  183. ply.Agility,
  184. ply.Precision,
  185. ply.Perception)
  186. fmt.Println("Skills: ", ply.Skills)
  187. fmt.Println("Songs: ", ply.Songs)
  188. fmt.Println("CP Remaining: ", b)
  189. }