DragonDice

Check-in [350b0e4e3f]
Login

Many hyperlinks are disabled.
Use anonymous login to enable hyperlinks.

Overview
Comment:Additional race (and language) options from Ixalan and Arkadia
Downloads: Tarball | ZIP archive | SQL archive
Timelines: family | ancestors | descendants | both | trunk
Files: files | file ages | folders
SHA3-256: 350b0e4e3f9a70edc794f3d1a0146f82c2d5cd4bbe55e628fd2be77944541b05
User & Date: murphy 2020-05-01 18:06:33
Context
2020-05-06
11:24
Replacing language placeholders: Merfolk -> Sylvan (Aquan), Vampire -> Infernal check-in: 706c71665d user: murphy tags: trunk
2020-05-01
18:06
Additional race (and language) options from Ixalan and Arkadia check-in: 350b0e4e3f user: murphy tags: trunk
2020-04-29
11:51
Corrected command recognition pattern check-in: e9bc359947 user: murphy tags: trunk
Changes
Hide Diffs Unified Diffs Ignore Whitespace Patch

Changes to DragonDice/Language.fs.

45
46
47
48
49
50
51

52
53
54

55
56
57
58
59
60
61
62
63

64
65
66

67
68
69
70
71
72
73
    ]

  let [<Literal>] Abyssal = "Abyssal"
  let [<Literal>] Celestial = "Celestial"
  let [<Literal>] Draconic = "Draconic"
  let [<Literal>] DeepSpeech = "Deep Speech"
  let [<Literal>] Infernal = "Infernal"

  let [<Literal>] Primordial = "Primordial"
  let [<Literal>] Sylvan = "Sylvan"
  let [<Literal>] Undercommon = "Undercommon"


  /// Set of exotic languages.
  let Exotic =
    Set.ofList [
      Abyssal
      Celestial
      Draconic
      DeepSpeech
      Infernal

      Primordial
      Sylvan
      Undercommon

    ]

  let [<Literal>] Druidic = "Druidic"
  let [<Literal>] ThievesCant = "Thieves' Cant"
  let [<Literal>] DrowSilentCant = "Drow Silent Cant"

  /// Set of secret languages.







>



>









>



>







45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
    ]

  let [<Literal>] Abyssal = "Abyssal"
  let [<Literal>] Celestial = "Celestial"
  let [<Literal>] Draconic = "Draconic"
  let [<Literal>] DeepSpeech = "Deep Speech"
  let [<Literal>] Infernal = "Infernal"
  let [<Literal>] Merfolk = "Merfolk"
  let [<Literal>] Primordial = "Primordial"
  let [<Literal>] Sylvan = "Sylvan"
  let [<Literal>] Undercommon = "Undercommon"
  let [<Literal>] Vampire = "Vampire"

  /// Set of exotic languages.
  let Exotic =
    Set.ofList [
      Abyssal
      Celestial
      Draconic
      DeepSpeech
      Infernal
      Merfolk
      Primordial
      Sylvan
      Undercommon
      Vampire
    ]

  let [<Literal>] Druidic = "Druidic"
  let [<Literal>] ThievesCant = "Thieves' Cant"
  let [<Literal>] DrowSilentCant = "Drow Silent Cant"

  /// Set of secret languages.

Changes to DragonDice/Race.fs.

46
47
48
49
50
51
52









53

54
55
56
57
58
59
60
..
73
74
75
76
77
78
79




80
81
82
83
84

85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107


108
109



110





111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129

130
131
132
133
134
135
136
137
138
139


140
141
142
143
144
145
146
147
...
148
149
150
151
152
153
154

155
156
157
158
159
160
161
162
...
171
172
173
174
175
176
177


178

179
180
181
182
183
184
185
...
200
201
202
203
204
205
206


207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
...
228
229
230
231
232
233
234


235
236
237
238
239
240
241
242
243
244
  | WhiteDragonborn = 0x4A
  | Gnome = 0x50
  | ForestGnome = 0x51
  | RockGnome = 0x52
  | DeepGnome = 0x53
  | HalfElf = 0x60
  | HalfOrc = 0x70









  | Tiefling = 0x80


/// Companion module for the race type.
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Race =
  /// Set of all well-known race tags.
  let All =
    Enum.GetValues(typeof<Race>)
................................................................................
    | Race.Gnome    -> Size.Small
    | _             -> Size.Medium
    
  /// Race-specific movement speeds.
  let speeds race =
    match race with
    | Race.WoodElf    -> EnumMap[Speed.Walk, 35<ft/rnd>]




    | race ->
      match withoutSubrace race with
      | Race.Dwarf
      | Race.Halfling
      | Race.Gnome    -> EnumMap[Speed.Walk, 25<ft/rnd>]

      | _             -> EnumMap[Speed.Walk, 30<ft/rnd>]

  /// Race-specific ability score modifiers.
  let abilities race =
    match race with
    | Race.Dwarf             -> EnumMap[Ability.Constitution, +2]
    | Race.HillDwarf         -> EnumMap[Ability.Constitution, +2; Ability.Wisdom, +1]
    | Race.MountainDwarf
    | Race.GrayDwarf         -> EnumMap[Ability.Constitution, +2; Ability.Strength, +2]
    | Race.Elf               -> EnumMap[Ability.Dexterity, +2]
    | Race.WoodElf           -> EnumMap[Ability.Dexterity, +2; Ability.Wisdom, +1]
    | Race.HighElf           -> EnumMap[Ability.Dexterity, +2; Ability.Intelligence, +1]
    | Race.DarkElf           -> EnumMap[Ability.Dexterity, +2; Ability.Charisma, +1]
    | Race.Halfling          -> EnumMap[Ability.Dexterity, +2]
    | Race.LightfootHalfling -> EnumMap[Ability.Dexterity, +2; Ability.Charisma, +1]
    | Race.StoutHalfling     -> EnumMap[Ability.Dexterity, +2; Ability.Constitution, +1]
    | Race.Gnome             -> EnumMap[Ability.Intelligence, +2]
    | Race.ForestGnome       -> EnumMap[Ability.Intelligence, +2; Ability.Dexterity, +1]
    | Race.RockGnome
    | Race.DeepGnome         -> EnumMap[Ability.Intelligence, +2; Ability.Constitution, +1]
    | Race.HalfElf           -> EnumMap[Ability.Charisma, +2]
    | Race.HalfOrc           -> EnumMap[Ability.Strength, +2; Ability.Constitution, +1]
    | Race.Tiefling          -> EnumMap[Ability.Charisma, +2; Ability.Intelligence, +1]


    | race ->
      match withoutSubrace race with



      | Race.Dragonborn      -> EnumMap[Ability.Strength, +2; Ability.Charisma, +1]





      | _                    -> EnumMap()
    
  /// Race-specific damage defenses.
  let defenses race =
    match race with
    | Race.StoutHalfling
    | Race.GreenDragonborn  -> [Damage.Poison, Defense.Resistant]
    | Race.BlackDragonborn
    | Race.CopperDragonborn -> [Damage.Acid, Defense.Resistant]
    | Race.BlueDragonborn
    | Race.BronzeDragonborn -> [Damage.Lightning, Defense.Resistant]
    | Race.BrassDragonborn
    | Race.GoldDragonborn
    | Race.RedDragonborn    -> [Damage.Fire, Defense.Resistant]
    | Race.SilverDragonborn
    | Race.WhiteDragonborn  -> [Damage.Cold, Defense.Resistant]
    | race ->
      match withoutSubrace race with
      | Race.Dwarf          -> [Damage.Poison, Defense.Resistant]

      | _                   -> List.empty
      
  /// Race-specific skill or saving throw proficiencies.
  let proficiencies race =
    match race with
    | Race.HighElf
    | Race.ForestGnome -> EnumMap[Skill.IntelligenceSpell, 1; Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]
    | Race.DarkElf
    | Race.Tiefling    -> EnumMap[Skill.CharismaSpell, 1; Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]
    | Race.HalfOrc     -> EnumMap[Skill.Intimidation, 1; Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]


    | _                -> EnumMap[Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]

  /// Race-specific senses.
  let senses race =
    match race with
    | Race.GrayDwarf
    | Race.DeepGnome
    | Race.DarkElf    -> EnumMap[Sense.Darkvision, 120<ft>]
................................................................................
    | _ ->
      match withoutSubrace race with
      | Race.Dwarf
      | Race.Elf
      | Race.Gnome
      | Race.HalfElf
      | Race.HalfOrc

      | Race.Tiefling -> EnumMap[Sense.Darkvision, 60<ft>]
      | _             -> EnumMap()

  /// Race-specific languages.
  let rec languages race =
    match race with
    | Race.GrayDwarf
    | Race.DeepGnome ->
................................................................................
      | Race.Dwarf      -> Set.ofList [Language.Common; Language.Dwarvish]
      | Race.Elf
      | Race.HalfElf    -> Set.ofList [Language.Common; Language.Elvish]
      | Race.Halfling   -> Set.ofList [Language.Common; Language.Halfling]
      | Race.Dragonborn -> Set.ofList [Language.Common; Language.Draconic]
      | Race.Gnome      -> Set.ofList [Language.Common; Language.Gnomish]
      | Race.HalfOrc    -> Set.ofList [Language.Common; Language.Orc]


      | Race.Tiefling   -> Set.ofList [Language.Common; Language.Infernal]

      | _               -> Set.singleton Language.Common
    
  /// Map a race tag to a name.
  let toString race =
    match race with
    | Race.HillDwarf         -> "Hill Dwarf"
    | Race.MountainDwarf     -> "Mountain Dwarf"
................................................................................
    | Race.SilverDragonborn  -> "Silver Dragonborn"
    | Race.WhiteDragonborn   -> "White Dragonborn"
    | Race.ForestGnome       -> "Forest Gnome"
    | Race.RockGnome         -> "Rock Gnome"
    | Race.DeepGnome         -> "Deep Gnome"
    | Race.HalfElf           -> "Half-Elf"
    | Race.HalfOrc           -> "Half-Orc"


    | race                   -> string race

  /// Try to map a race name to a tag.
  let tryParse (s:string) =
    match s.ToLowerInvariant() with
    | "hill dwarf"                 -> Some Race.HillDwarf
    | "mountain dwarf"             -> Some Race.MountainDwarf
    | "gray dwarf" | "duergar"     -> Some Race.GrayDwarf
    | "high elf"                   -> Some Race.HighElf
    | "wood elf"                   -> Some Race.WoodElf
    | "dark elf" | "drow"          -> Some Race.DarkElf
    | "lightfoot halfling"         -> Some Race.LightfootHalfling
    | "stout halfling"             -> Some Race.StoutHalfling
    | "black dragonborn"           -> Some Race.BlackDragonborn
    | "blue dragonborn"            -> Some Race.BlueDragonborn
    | "brass dragonborn"           -> Some Race.BrassDragonborn
    | "bronze dragonborn"          -> Some Race.BronzeDragonborn
................................................................................
    | "silver dragonborn"          -> Some Race.SilverDragonborn
    | "white dragonborn"           -> Some Race.WhiteDragonborn
    | "forest gnome"               -> Some Race.ForestGnome
    | "rock gnome"                 -> Some Race.RockGnome
    | "deep gnome" | "svirfneblin" -> Some Race.DeepGnome
    | "half-elf"                   -> Some Race.HalfElf
    | "half-orc"                   -> Some Race.HalfOrc


    | _ ->
      match Enum.TryParse<Race>(s, ignoreCase = true) with
      | true, race -> Some race
      | false, _   -> None

  /// Map a race name to a tag.
  let ofString s =
    match tryParse s with
    | Some race -> race
    | None      -> raise (FormatException "Invalid race tag")







>
>
>
>
>
>
>
>
>
|
>







 







>
>
>
>





>





<



<



<


<





|
>
>


>
>
>

>
>
>
>
>






|

|

|


|

|


|
>






|

|
|
>
>
|







 







>
|







 







>
>

>







 







>
>





|


|
|







 







>
>










46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
..
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104

105
106
107

108
109
110

111
112

113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
...
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
...
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
...
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
...
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
  | WhiteDragonborn = 0x4A
  | Gnome = 0x50
  | ForestGnome = 0x51
  | RockGnome = 0x52
  | DeepGnome = 0x53
  | HalfElf = 0x60
  | HalfOrc = 0x70
  | Merfolk = 0x80
  | BlueMerfolk = 0x81
  | GreenMerfolk = 0x82
  | Phaedran = 0x90
  | Satyr = 0x91
  | Siren = 0x92
  | Gorgon = 0x93
  | Harpy = 0x94
  | Centaur = 0x95
  | Tiefling = 0xA0
  | Vampire = 0xB0

/// Companion module for the race type.
[<CompilationRepresentation(CompilationRepresentationFlags.ModuleSuffix)>]
module Race =
  /// Set of all well-known race tags.
  let All =
    Enum.GetValues(typeof<Race>)
................................................................................
    | Race.Gnome    -> Size.Small
    | _             -> Size.Medium
    
  /// Race-specific movement speeds.
  let speeds race =
    match race with
    | Race.WoodElf    -> EnumMap[Speed.Walk, 35<ft/rnd>]
    | Race.Siren      -> EnumMap[Speed.Walk, 30<ft/rnd>; Speed.Swim, 60<ft/rnd>]
    | Race.Gorgon     -> EnumMap[Speed.Walk, 40<ft/rnd>]
    | Race.Harpy      -> EnumMap[Speed.Walk, 30<ft/rnd>; Speed.Fly, 25<ft/rnd>]
    | Race.Centaur    -> EnumMap[Speed.Walk, 60<ft/rnd>]
    | race ->
      match withoutSubrace race with
      | Race.Dwarf
      | Race.Halfling
      | Race.Gnome    -> EnumMap[Speed.Walk, 25<ft/rnd>]
      | Race.Merfolk  -> EnumMap[Speed.Walk, 30<ft/rnd>; Speed.Swim, 30<ft/rnd>]
      | _             -> EnumMap[Speed.Walk, 30<ft/rnd>]

  /// Race-specific ability score modifiers.
  let abilities race =
    match race with

    | Race.HillDwarf         -> EnumMap[Ability.Constitution, +2; Ability.Wisdom, +1]
    | Race.MountainDwarf
    | Race.GrayDwarf         -> EnumMap[Ability.Constitution, +2; Ability.Strength, +2]

    | Race.WoodElf           -> EnumMap[Ability.Dexterity, +2; Ability.Wisdom, +1]
    | Race.HighElf           -> EnumMap[Ability.Dexterity, +2; Ability.Intelligence, +1]
    | Race.DarkElf           -> EnumMap[Ability.Dexterity, +2; Ability.Charisma, +1]

    | Race.LightfootHalfling -> EnumMap[Ability.Dexterity, +2; Ability.Charisma, +1]
    | Race.StoutHalfling     -> EnumMap[Ability.Dexterity, +2; Ability.Constitution, +1]

    | Race.ForestGnome       -> EnumMap[Ability.Intelligence, +2; Ability.Dexterity, +1]
    | Race.RockGnome
    | Race.DeepGnome         -> EnumMap[Ability.Intelligence, +2; Ability.Constitution, +1]
    | Race.HalfElf           -> EnumMap[Ability.Charisma, +2]
    | Race.HalfOrc           -> EnumMap[Ability.Strength, +2; Ability.Constitution, +1]
    | Race.Merfolk           -> EnumMap[Ability.Charisma, +1]
    | Race.BlueMerfolk       -> EnumMap[Ability.Charisma, +1; Ability.Intelligence, +2]
    | Race.GreenMerfolk      -> EnumMap[Ability.Charisma, +1; Ability.Wisdom, +2]
    | race ->
      match withoutSubrace race with
      | Race.Dwarf           -> EnumMap[Ability.Constitution, +2]
      | Race.Elf             -> EnumMap[Ability.Dexterity, +2]
      | Race.Halfling        -> EnumMap[Ability.Dexterity, +2]
      | Race.Dragonborn      -> EnumMap[Ability.Strength, +2; Ability.Charisma, +1]
      | Race.Gnome           -> EnumMap[Ability.Intelligence, +2]
      | Race.Merfolk         -> EnumMap[Ability.Charisma, +1]
      | Race.Phaedran        -> EnumMap[Ability.Charisma, +2]
      | Race.Tiefling        -> EnumMap[Ability.Charisma, +2; Ability.Intelligence, +1]
      | Race.Vampire         -> EnumMap[Ability.Charisma, +2; Ability.Wisdom, +1]
      | _                    -> EnumMap()
    
  /// Race-specific damage defenses.
  let defenses race =
    match race with
    | Race.StoutHalfling
    | Race.GreenDragonborn  -> [Damage.Magical ||| Damage.Poison, Defense.Resistant]
    | Race.BlackDragonborn
    | Race.CopperDragonborn -> [Damage.Magical ||| Damage.Acid, Defense.Resistant]
    | Race.BlueDragonborn
    | Race.BronzeDragonborn -> [Damage.Magical ||| Damage.Lightning, Defense.Resistant]
    | Race.BrassDragonborn
    | Race.GoldDragonborn
    | Race.RedDragonborn    -> [Damage.Magical ||| Damage.Fire, Defense.Resistant]
    | Race.SilverDragonborn
    | Race.WhiteDragonborn  -> [Damage.Magical ||| Damage.Cold, Defense.Resistant]
    | race ->
      match withoutSubrace race with
      | Race.Dwarf          -> [Damage.Magical ||| Damage.Poison, Defense.Resistant]
      | Race.Vampire        -> [Damage.Magical ||| Damage.Necrotic, Defense.Resistant]
      | _                   -> List.empty
      
  /// Race-specific skill or saving throw proficiencies.
  let proficiencies race =
    match race with
    | Race.HighElf
    | Race.ForestGnome  -> EnumMap[Skill.IntelligenceSpell, 1; Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]
    | Race.DarkElf
    | Race.Tiefling     -> EnumMap[Skill.CharismaSpell, 1; Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]
    | Race.HalfOrc      -> EnumMap[Skill.Intimidation, 1; Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]
    | Race.BlueMerfolk  -> EnumMap[Skill.History, 1; Skill.Nature, 1; Skill.IntelligenceSpell, 1; Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]
    | Race.GreenMerfolk -> EnumMap[Skill.WisdomSpell, 1; Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]
    | _                 -> EnumMap[Skill.StrengthAttack, 1; Skill.DexterityAttack, 1]

  /// Race-specific senses.
  let senses race =
    match race with
    | Race.GrayDwarf
    | Race.DeepGnome
    | Race.DarkElf    -> EnumMap[Sense.Darkvision, 120<ft>]
................................................................................
    | _ ->
      match withoutSubrace race with
      | Race.Dwarf
      | Race.Elf
      | Race.Gnome
      | Race.HalfElf
      | Race.HalfOrc
      | Race.Tiefling
      | Race.Vampire  -> EnumMap[Sense.Darkvision, 60<ft>]
      | _             -> EnumMap()

  /// Race-specific languages.
  let rec languages race =
    match race with
    | Race.GrayDwarf
    | Race.DeepGnome ->
................................................................................
      | Race.Dwarf      -> Set.ofList [Language.Common; Language.Dwarvish]
      | Race.Elf
      | Race.HalfElf    -> Set.ofList [Language.Common; Language.Elvish]
      | Race.Halfling   -> Set.ofList [Language.Common; Language.Halfling]
      | Race.Dragonborn -> Set.ofList [Language.Common; Language.Draconic]
      | Race.Gnome      -> Set.ofList [Language.Common; Language.Gnomish]
      | Race.HalfOrc    -> Set.ofList [Language.Common; Language.Orc]
      | Race.Merfolk    -> Set.ofList [Language.Common; Language.Merfolk]
      | Race.Phaedran   -> Set.ofList [Language.Common; Language.Sylvan]
      | Race.Tiefling   -> Set.ofList [Language.Common; Language.Infernal]
      | Race.Vampire    -> Set.ofList [Language.Common; Language.Vampire]
      | _               -> Set.singleton Language.Common
    
  /// Map a race tag to a name.
  let toString race =
    match race with
    | Race.HillDwarf         -> "Hill Dwarf"
    | Race.MountainDwarf     -> "Mountain Dwarf"
................................................................................
    | Race.SilverDragonborn  -> "Silver Dragonborn"
    | Race.WhiteDragonborn   -> "White Dragonborn"
    | Race.ForestGnome       -> "Forest Gnome"
    | Race.RockGnome         -> "Rock Gnome"
    | Race.DeepGnome         -> "Deep Gnome"
    | Race.HalfElf           -> "Half-Elf"
    | Race.HalfOrc           -> "Half-Orc"
    | Race.BlueMerfolk       -> "Blue Merfolk"
    | Race.GreenMerfolk      -> "Green Merfolk"
    | race                   -> string race

  /// Try to map a race name to a tag.
  let tryParse (s:string) =
    match s.ToLowerInvariant() with
    | "hill dwarf" | "field dwarf" -> Some Race.HillDwarf
    | "mountain dwarf"             -> Some Race.MountainDwarf
    | "gray dwarf" | "duergar"     -> Some Race.GrayDwarf
    | "high elf" | "scyllaean elf" -> Some Race.HighElf
    | "wood elf" | "oreyan elf"    -> Some Race.WoodElf
    | "dark elf" | "drow"          -> Some Race.DarkElf
    | "lightfoot halfling"         -> Some Race.LightfootHalfling
    | "stout halfling"             -> Some Race.StoutHalfling
    | "black dragonborn"           -> Some Race.BlackDragonborn
    | "blue dragonborn"            -> Some Race.BlueDragonborn
    | "brass dragonborn"           -> Some Race.BrassDragonborn
    | "bronze dragonborn"          -> Some Race.BronzeDragonborn
................................................................................
    | "silver dragonborn"          -> Some Race.SilverDragonborn
    | "white dragonborn"           -> Some Race.WhiteDragonborn
    | "forest gnome"               -> Some Race.ForestGnome
    | "rock gnome"                 -> Some Race.RockGnome
    | "deep gnome" | "svirfneblin" -> Some Race.DeepGnome
    | "half-elf"                   -> Some Race.HalfElf
    | "half-orc"                   -> Some Race.HalfOrc
    | "blue merfolk"               -> Some Race.BlueMerfolk
    | "green merfolk"              -> Some Race.GreenMerfolk
    | _ ->
      match Enum.TryParse<Race>(s, ignoreCase = true) with
      | true, race -> Some race
      | false, _   -> None

  /// Map a race name to a tag.
  let ofString s =
    match tryParse s with
    | Some race -> race
    | None      -> raise (FormatException "Invalid race tag")