Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add names to DnD generator #2735

Merged
merged 1 commit into from
Mar 23, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions doc/games/dnd.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,23 @@ Faker::Games::DnD.background #=> "Urchin"

Faker::Games::DnD.city #=> "Earthfast"

Faker::Games::DnD.first_name #=> "Celestine"

Faker::Games::DnD.klass #=> "Warlock"

Faker::Games::DnD.language #=> "Gnomish"

Faker::Games::DnD.last_name #=> "Nightbreeze"

Faker::Games::DnD.melee_weapon #=> "Handaxe"

Faker::Games::DnD.monster #=> "Manticore"

Faker::Games::DnD.name #=> "Drust Silverveil"

Faker::Games::DnD.race #=> "Dwarf"

Faker::Games::DnD.ranged_weapon #=> "Shortbow"

Faker::Games::DnD.title_name #=> "Selene the Dreamer"
```
56 changes: 49 additions & 7 deletions lib/faker/games/dnd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,19 @@ def city
fetch('dnd.cities')
end

##
# Produces the first name of a character or monster from Dungeons and Dragons.
#
# @return [String]
#
# @example
# Faker::Games::DnD.name #=> "Eilonwy"
#
# @faker.version next
def first_name
fetch('dnd.name.first_name')
end

##
# Produces the name of a class from Dungeons and Dragons (PHB).
#
Expand All @@ -69,6 +82,19 @@ def language
fetch('dnd.languages')
end

##
# Produces a last name from Dungeons and Dragons.
#
# @return [String]
#
# @example
# Faker::Games::DnD.last_name #=> "Leafwhisper"
#
# @faker.version next
def last_name
fetch('dnd.name.last_name')
end

##
# Produces the name of a melee weapon from Dungeons and Dragons.
#
Expand All @@ -95,6 +121,19 @@ def monster
fetch('dnd.monsters')
end

##
# Produces a full name from Dungeons and Dragons.
#
# @return [String]
#
# @example
# Faker::Games::DnD.name #=> "Drakon Blackthorn"
#
# @faker.version next
def name
"#{fetch('dnd.name.first_name')} #{fetch('dnd.name.last_name')}"
end

##
# Produces the name of a race from Dungeons and Dragons (PHB).
#
Expand All @@ -121,14 +160,17 @@ def ranged_weapon
fetch('dnd.ranged_weapons')
end

# This method is deprecated. The implementation will be removed in a near future release.
# Use `DnD.race` instead.
##
# Produces a last name from Dungeons and Dragons.
#
# @deprecated Use {#race} instead.
def species
warn '`DnD.species` is deprecated. Use `DnD.race` instead.'

super
# @return [String]
#
# @example
# Faker::Games::DnD.title_name #=> "Corvus the Cunning"
#
# @faker.version next
def title_name
"#{fetch('dnd.name.first_name')} #{fetch('dnd.name.title')}"
end
end
end
Expand Down
187 changes: 186 additions & 1 deletion lib/locales/en/dnd.yml
Original file line number Diff line number Diff line change
Expand Up @@ -440,6 +440,191 @@ en:
- Verdan
- Warforged
- Yuan-Ti
name:
first_name:
- Aeliana
- Alaric
- Aldric
- Alessia
- Alistair
- Althea
- Amonar
- Andros
- Anya
- Aria
- Ariadne
- Ariella
- Azarion
- Baelgor
- Baelin
- Belmorn
- Brondar
- Caelum
- Calista
- Cassandra
- Celestia
- Celestine
- Corvus
- Delara
- Drakon
- Drust
- Eamon
- Eilonwy
- Elara
- Eldric
- Elowen
- Elyria
- Emeric
- Faelina
- Fionna
- Freya
- Galen
- Garrick
- Gavric
- Gideon
- Gruffudd
- Illiana
- Isolde
- Kael
- Kael'thas
- Kaela
- Kaelis
- Kaldris
- Kethric
- Kyros
- Leilani
- Liora
- Lorimar
- Lucius
- Lysandra
- Lysara
- Maelis
- Magnus
- Marik
- Melisandra
- Nymeria
- Nymira
- Oriana
- Orianna
- Osric
- Ragnor
- Rendal
- Rhovaniel
- Rurik
- Selene
- Seraphina
- Seraphine
- Seren
- Sylvaria
- Taryn
- Thalia
- Thane
- Tharivol
- Thorgrim
- Throrin
- Tordek
- Torvald
- Uldar
- Ulfgar
- Valthor
- Vespera
- Xander
- Xanthe
- Ygritte
- Yondalla
- Zara
- Zarathos
- Zephyra
- Zoltan
last_name:
- Axebreaker
- Blackthorn
- Brightsong
- Dawnbringer
- Dreamweaver
- Earthshaker
- Fireheart
- Ironfoot
- Ironheart
- Leafwhisper
- Lightbringer
- Lightfoot
- Mistwalker
- Moonfall
- Moonshadow
- Moonsong
- Moonwhisper
- Nightbreeze
- Nightshade
- Nightstalker
- Ravenscar
- Ravenshadow
- Shadowbane
- Shadowdancer
- Silverhand
- Silverveil
- Starborn
- Starweaver
- Starwhisper
- Stonewarden
- Stormborn
- Stormbringer
- Stormcloak
- Stormrider
- Sunweaver
- Swiftwind
- Wildheart
- Willowbrook
- Winddancer
title:
- the Arcane
- the Bard
- the Beautiful
- the Bold
- the Brave
- the Clever
- the Cunning
- the Defender
- the Dreamer
- the Elegant
- the Enchanted
- the Enchanter
- the Enchantress
- the Fair
- the Fearless
- the Fierce
- the Gentle
- the Graceful
- the Healer
- the Huntress
- the Illusionist
- the Just
- the Kind
- the Loyal
- the Mighty
- the Moonlit
- the Poet
- the Protector
- the Radiant
- the Relentless
- the Resolute
- the Scribe
- the Seeker
- the Silent
- the Slayer
- the Stalwart
- the Stoic
- the Strong
- the Swift
- the Unbreakable
- the Unbroken
- the Unconquered
- the Unseen
- the Unyielding
- the Vindicator
- the Wanderer
- the Wild
- the Wise
ranged_weapons:
- Blowgun
- Boomerang
Expand All @@ -448,4 +633,4 @@ en:
- Longbow
- Net
- Shortbow
- Sling
- Sling
16 changes: 16 additions & 0 deletions test/faker/games/test_faker_dnd.rb
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,10 @@ def test_city
assert_match(/\w+/, @tester.city)
end

def test_first_name
assert_match(/\w+/, @tester.first_name)
end

def test_klass
assert_match(/\w+/, @tester.klass)
end
Expand All @@ -27,6 +31,10 @@ def test_language
assert_match(/\w+/, @tester.language)
end

def test_last_name
assert_match(/\w+/, @tester.last_name)
end

def test_melee_weapon
assert_match(/\w+/, @tester.melee_weapon)
end
Expand All @@ -35,11 +43,19 @@ def test_monster
assert_match(/\w+/, @tester.monster)
end

def test_name
assert_match(/\w+/, @tester.name)
end

def test_race
assert_match(/\w+/, @tester.race)
end

def test_ranged_weapon
assert_match(/\w+/, @tester.ranged_weapon)
end

def test_title_name
assert_match(/\w+/, @tester.title_name)
end
end