adventure 0.17.7.pre.pre

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,76 @@
1
+ # Contributor Covenant Code of Conduct
2
+
3
+ ## Our Pledge
4
+
5
+ In the interest of fostering an open and welcoming environment, we as
6
+ contributors and maintainers pledge to making participation in our project and
7
+ our community a harassment-free experience for everyone, regardless of age, body
8
+ size, disability, ethnicity, sex characteristics, gender identity and expression,
9
+ level of experience, education, socio-economic status, nationality, personal
10
+ appearance, race, religion, or sexual identity and orientation.
11
+
12
+ ## Our Standards
13
+
14
+ Examples of behavior that contributes to creating a positive environment
15
+ include:
16
+
17
+ * Using welcoming and inclusive language
18
+ * Being respectful of differing viewpoints and experiences
19
+ * Gracefully accepting constructive criticism
20
+ * Focusing on what is best for the community
21
+ * Showing empathy towards other community members
22
+
23
+ Examples of unacceptable behavior by participants include:
24
+
25
+ * The use of sexualized language or imagery and unwelcome sexual attention or
26
+ advances
27
+ * Trolling, insulting/derogatory comments, and personal or political attacks
28
+ * Public or private harassment
29
+ * Publishing others' private information, such as a physical or electronic
30
+ address, without explicit permission
31
+ * Other conduct which could reasonably be considered inappropriate in a
32
+ professional setting
33
+
34
+ ## Our Responsibilities
35
+
36
+ Project maintainers are responsible for clarifying the standards of acceptable
37
+ behavior and are expected to take appropriate and fair corrective action in
38
+ response to any instances of unacceptable behavior.
39
+
40
+ Project maintainers have the right and responsibility to remove, edit, or
41
+ reject comments, commits, code, wiki edits, issues, and other contributions
42
+ that are not aligned to this Code of Conduct, or to ban temporarily or
43
+ permanently any contributor for other behaviors that they deem inappropriate,
44
+ threatening, offensive, or harmful.
45
+
46
+ ## Scope
47
+
48
+ This Code of Conduct applies within all project spaces, and it also applies when
49
+ an individual is representing the project or its community in public spaces.
50
+ Examples of representing a project or community include using an official
51
+ project e-mail address, posting via an official social media account, or acting
52
+ as an appointed representative at an online or offline event. Representation of
53
+ a project may be further defined and clarified by project maintainers.
54
+
55
+ ## Enforcement
56
+
57
+ Instances of abusive, harassing, or otherwise unacceptable behavior may be
58
+ reported by contacting the project team at [igorpadoim@gmail.com](mailto:igorpadoim@gmail.com). All
59
+ complaints will be reviewed and investigated and will result in a response that
60
+ is deemed necessary and appropriate to the circumstances. The project team is
61
+ obligated to maintain confidentiality with regard to the reporter of an incident.
62
+ Further details of specific enforcement policies may be posted separately.
63
+
64
+ Project maintainers who do not follow or enforce the Code of Conduct in good
65
+ faith may face temporary or permanent repercussions as determined by other
66
+ members of the project's leadership.
67
+
68
+ ## Attribution
69
+
70
+ This Code of Conduct is adapted from the [Contributor Covenant][homepage], version 1.4,
71
+ available at https://www.contributor-covenant.org/version/1/4/code-of-conduct.html
72
+
73
+ [homepage]: https://www.contributor-covenant.org
74
+
75
+ For answers to common questions about this code of conduct, see
76
+ https://www.contributor-covenant.org/faq
@@ -0,0 +1,22 @@
1
+ # Contributing Guidelines
2
+
3
+ When contributing to this repository, please first discuss the change you wish to make via issue, email, or any other method with the owners of this repository before making a change.
4
+
5
+ Please note we have a [code of conduct](CODE-OF-CONDUCT.md), please follow it in all your interactions with the project.
6
+
7
+ ## Pull Request Checklist
8
+
9
+ Before sending your pull requests, make sure you followed this list.
10
+
11
+ 1. Read [contributing guidelines](CONTRIBUTING.md).
12
+ 2. Read [Code of Conduct](CODE-OF-CONDUCT.md).
13
+ 3. Increase the version numbers in any examples files, the [ruby gem version](lib/adventure/version.rb) file, and the [ReadMe file badge](README.md) to the new version that this Pull Request would represent. The versioning scheme we use is [SemVer](http://semver.org/).
14
+ 4. You may merge the Pull Request in once you have the approval of the project owner.
15
+
16
+ ## Reporting a Bug & Requesting Features
17
+
18
+ For both actions, this project uses GitHub templates, please use the adequate template when either reporting a bug or requesting a new feature.
19
+
20
+ ## Licensing and copyright
21
+
22
+ Please note that accepted contributions are included in the repository and hence added under the same [license](LICENSE.md) as the repository to which it was contributed.
data/Gemfile ADDED
@@ -0,0 +1,10 @@
1
+ # frozen_string_literal: true
2
+
3
+ source 'https://rubygems.org'
4
+
5
+ gem 'rubocop', '~> 0.74.0', require: false
6
+ gem 'simplecov', '~> 0.17.0', require: false
7
+ gem 'yard', '~> 0.9.20', require: false
8
+
9
+ # Specify your gem's dependencies in Adventure.gemspec
10
+ gemspec
@@ -0,0 +1,84 @@
1
+ PATH
2
+ remote: .
3
+ specs:
4
+ adventure (0.17.7-pre)
5
+ indefinite_article (~> 0.2.4)
6
+ jekyll_slugify (~> 0.4.2)
7
+ random_name_generator (~> 1.0.3)
8
+
9
+ GEM
10
+ remote: https://rubygems.org/
11
+ specs:
12
+ activesupport (6.0.0)
13
+ concurrent-ruby (~> 1.0, >= 1.0.2)
14
+ i18n (>= 0.7, < 2)
15
+ minitest (~> 5.1)
16
+ tzinfo (~> 1.1)
17
+ zeitwerk (~> 2.1, >= 2.1.8)
18
+ ast (2.4.0)
19
+ concurrent-ruby (1.1.5)
20
+ diff-lcs (1.3)
21
+ docile (1.3.2)
22
+ i18n (1.6.0)
23
+ concurrent-ruby (~> 1.0)
24
+ indefinite_article (0.2.4)
25
+ activesupport
26
+ jaro_winkler (1.5.3)
27
+ jekyll_slugify (0.4.2)
28
+ i18n (~> 1.6.0)
29
+ json (2.2.0)
30
+ minitest (5.11.3)
31
+ parallel (1.17.0)
32
+ parser (2.6.3.0)
33
+ ast (~> 2.4.0)
34
+ rainbow (3.0.0)
35
+ rake (12.3.3)
36
+ random_name_generator (1.0.3)
37
+ rspec (3.8.0)
38
+ rspec-core (~> 3.8.0)
39
+ rspec-expectations (~> 3.8.0)
40
+ rspec-mocks (~> 3.8.0)
41
+ rspec-core (3.8.2)
42
+ rspec-support (~> 3.8.0)
43
+ rspec-expectations (3.8.4)
44
+ diff-lcs (>= 1.2.0, < 2.0)
45
+ rspec-support (~> 3.8.0)
46
+ rspec-mocks (3.8.1)
47
+ diff-lcs (>= 1.2.0, < 2.0)
48
+ rspec-support (~> 3.8.0)
49
+ rspec-support (3.8.2)
50
+ rubocop (0.74.0)
51
+ jaro_winkler (~> 1.5.1)
52
+ parallel (~> 1.10)
53
+ parser (>= 2.6)
54
+ rainbow (>= 2.2.2, < 4.0)
55
+ ruby-progressbar (~> 1.7)
56
+ unicode-display_width (>= 1.4.0, < 1.7)
57
+ ruby-progressbar (1.10.1)
58
+ simplecov (0.17.0)
59
+ docile (~> 1.1)
60
+ json (>= 1.8, < 3)
61
+ simplecov-html (~> 0.10.0)
62
+ simplecov-html (0.10.2)
63
+ thread_safe (0.3.6)
64
+ tzinfo (1.2.5)
65
+ thread_safe (~> 0.1)
66
+ unicode-display_width (1.6.0)
67
+ yard (0.9.20)
68
+ zeitwerk (2.1.10)
69
+
70
+ PLATFORMS
71
+ ruby
72
+ x64-mingw32
73
+
74
+ DEPENDENCIES
75
+ adventure!
76
+ bundler (~> 2.0)
77
+ rake (~> 12.3)
78
+ rspec (~> 3.8.0)
79
+ rubocop (~> 0.74.0)
80
+ simplecov (~> 0.17.0)
81
+ yard (~> 0.9.20)
82
+
83
+ BUNDLED WITH
84
+ 2.0.2
@@ -0,0 +1,25 @@
1
+ The MIT License (MIT)
2
+ =====================
3
+
4
+ Copyright © `2019` `Igor Padoim`
5
+
6
+ Permission is hereby granted, free of charge, to any person
7
+ obtaining a copy of this software and associated documentation
8
+ files (the “Software”), to deal in the Software without
9
+ restriction, including without limitation the rights to use,
10
+ copy, modify, merge, publish, distribute, sublicense, and/or sell
11
+ copies of the Software, and to permit persons to whom the
12
+ Software is furnished to do so, subject to the following
13
+ conditions:
14
+
15
+ The above copyright notice and this permission notice shall be
16
+ included in all copies or substantial portions of the Software.
17
+
18
+ THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND,
19
+ EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
20
+ OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
21
+ NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
22
+ HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
23
+ WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
24
+ FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
25
+ OTHER DEALINGS IN THE SOFTWARE.
data/OGL.md ADDED
@@ -0,0 +1,35 @@
1
+ THIS LICENSE IS APPROVED FOR GENERAL USE. PERMISSION TO DISTRIBUTE THIS LICENSE IS MADE BY WIZARDS OF THE COAST!
2
+
3
+ # OPEN GAME LICENSE Version 1.0a
4
+
5
+ ### The following text is the property of Wizards of the Coast, Inc. and is Copyright 2000 Wizards of the Coast, Inc ("Wizards"). All Rights Reserved.
6
+
7
+ 1. **Definitions**: (a)"Contributors" means the copyright and/or trademark owners who have contributed Open Game Content; (b)"Derivative Material" means copyrighted material including derivative works and translations (including into other computer languages), potation, modification, correction, addition, extension, upgrade, improvement, compilation, abridgment or other form in which an existing work may be recast, transformed or adapted; (c) "Distribute" means to reproduce, license, rent, lease, sell, broadcast, publicly display, transmit or otherwise distribute; (d)"Open Game Content" means the game mechanic and includes the methods, procedures, processes and routines to the extent such content does not embody the Product Identity and is an enhancement over the prior art and any additional content clearly identified as Open Game Content by the Contributor, and means any work covered by this License, including translations and derivative works under copyright law, but specifically excludes Product Identity. (e) "Product Identity" means product and product line names, logos and identifying marks including trade dress; artifacts; creatures characters; stories, storylines, plots, thematic elements, dialogue, incidents, language, artwork, symbols, designs, depictions, likenesses, formats, poses, concepts, themes and graphic, photographic and other visual or audio representations; names and descriptions of characters, spells, enchantments, personalities, teams, personas, likenesses and special abilities; places, locations, environments, creatures, equipment, magical or supernatural abilities or effects, logos, symbols, or graphic designs; and any other trademark or registered trademark clearly identified as Product identity by the owner of the Product Identity, and which specifically excludes the Open Game Content; (f) "Trademark" means the logos, names, mark, sign, motto, designs that are used by a Contributor to identify itself or its products or the associated products contributed to the Open Game License by the Contributor (g) "Use", "Used" or "Using" means to use, Distribute, copy, edit, format, modify, translate and otherwise create Derivative Material of Open Game Content. (h) "You" or "Your" means the licensee in terms of this agreement.
8
+
9
+ 2. **The License**: This License applies to any Open Game Content that contains a notice indicating that the Open Game Content may only be Used under and in terms of this License. You must affix such a notice to any Open Game Content that you Use. No terms may be added to or subtracted from this License except as described by the License itself. No other terms or conditions may be applied to any Open Game Content distributed using this License.
10
+
11
+ 3. **Offer and Acceptance**: By Using the Open Game Content You indicate Your acceptance of the terms of this License.
12
+
13
+ 4. **Grant and Consideration**: In consideration for agreeing to use this License, the Contributors grant You a perpetual, worldwide, royalty-free, non-exclusive license with the exact terms of this License to Use, the Open Game Content.
14
+
15
+ 5. **Representation of Authority to Contribute**: If You are contributing original material as Open Game Content, You represent that Your Contributions are Your original creation and/or You have sufficient rights to grant the rights conveyed by this License.
16
+
17
+ 6. **Notice of License Copyright**: You must update the COPYRIGHT NOTICE portion of this License to include the exact text of the COPYRIGHT NOTICE of any Open Game Content You are copying, modifying or distributing, and You must add the title, the copyright date, and the copyright holder's name to the COPYRIGHT NOTICE of any original Open Game Content you Distribute.
18
+
19
+ 7. **Use of Product Identity**: You agree not to Use any Product Identity, including as an indication as to compatibility, except as expressly licensed in another, independent Agreement with the owner of each element of that Product Identity. You agree not to indicate compatibility or co-adaptability with any Trademark or Registered Trademark in conjunction with a work containing Open Game Content except as expressly licensed in another, independent Agreement with the owner of such Trademark or Registered Trademark. The use of any Product Identity in Open Game Content does not constitute a challenge to the ownership of that Product Identity. The owner of any Product Identity used in Open Game Content shall retain all rights, title and interest in and to that Product Identity.
20
+
21
+ 8. **Identification**: If you distribute Open Game Content You must clearly indicate which portions of the work that you are distributing are Open Game Content.
22
+
23
+ 9. **Updating the License**: Wizards or its designated Agents may publish updated versions of this License. You may use any authorized version of this License to copy, modify and distribute any Open Game Content originally distributed under any version of this License.
24
+
25
+ 10. **Copy of this License**: You MUST include a copy of this License with every copy of the Open Game Content You Distribute.
26
+
27
+ 11. **Use of Contributor Credits**: You may not market or advertise the Open Game Content using the name of any Contributor unless You have written permission from the Contributor to do so.
28
+
29
+ 12. **Inability to Comply**: If it is impossible for You to comply with any of the terms of this License with respect to some or all of the Open Game Content due to statute, judicial order, or governmental regulation then You may not Use any Open Game Material so affected.
30
+
31
+ 13. **Termination**: This License will terminate automatically if You fail to comply with all terms herein and fail to cure such breach within 30 days of becoming aware of the breach. All sublicenses shall survive the termination of this License.
32
+
33
+ 14. **Reformation**: If any provision of this License is held to be unenforceable, such provision shall be reformed only to the extent necessary to make it enforceable.
34
+
35
+ 15. **COPYRIGHT NOTICE**: Open Game License v 1.0 Copyright 2000, Wizards of the Coast, Inc.
@@ -0,0 +1,63 @@
1
+ # Adventure
2
+
3
+ [![Gem](https://img.shields.io/gem/v/Adventure)](https://github.com/Nereare/Adventure)
4
+ [![Version](https://img.shields.io/badge/version-0.17.7--pre-yellowgreen)](https://github.com/Nereare/Adventure/releases)
5
+ [![GitHub License](https://img.shields.io/github/license/Nereare/Adventure)](LICENSE.md)
6
+ [![Contributor Covenant](https://img.shields.io/badge/Contributor%20Covenant-v1.4%20adopted-ff69b4.svg)](CODE-OF-CONDUCT.md)
7
+
8
+ [![Build Status](https://travis-ci.org/Nereare/Adventure.svg?branch=master)](https://travis-ci.org/Nereare/Adventure)
9
+ [![Code Climate maintainability](https://img.shields.io/codeclimate/maintainability/Nereare/Adventure)](https://codeclimate.com/github/Nereare/Adventure)
10
+ [![Code Climate coverage](https://img.shields.io/codeclimate/coverage/Nereare/Adventure)](https://codeclimate.com/github/Nereare/Adventure)
11
+ [![Libraries.io dependency status for GitHub repo](https://img.shields.io/librariesio/github/Nereare/Adventure)](https://libraries.io/github/Nereare/Adventure)
12
+
13
+ A random adventure generator for D&D 5e.
14
+
15
+ ## Running
16
+
17
+ 1. Get [the code](https://github.com/Nereare/Adventure/archive/master.zip);
18
+ 2. Have these installed:
19
+ 1. [Ruby](https://www.ruby-lang.org);
20
+ 2. [Gem](https://rubygems.org/).
21
+ 3. Install [Bundler](https://bundler.io/) with `gem install bundler`;
22
+ 4. Install the dependencies with `bundle install`;
23
+ 5. Running not yet done, sorry... :cry:
24
+
25
+ ### Testing
26
+
27
+ ```shell
28
+ rubocop -a
29
+ bundle exec rspec spec
30
+ yardoc
31
+ ```
32
+
33
+ These commands run the syntax checks (via [RuboCop](https://github.com/rubocop-hq/rubocop)), the [RSpec](https://rspec.info/) checks and outputs the documentation (via [YARD](https://yardoc.org/)).
34
+
35
+ ## Contributing
36
+
37
+ 1. Fork it!
38
+ 2. Create your feature branch: `git checkout -b my-new-feature`
39
+ 3. Commit your changes: `git commit -am 'Add some feature'`
40
+ 4. Push to the branch: `git push origin my-new-feature`
41
+ 5. Submit a pull request :tada:
42
+
43
+ Please, also read our [Contributing Guidelines](CONTRIBUTING.md).
44
+
45
+ ### Code of Conduct
46
+
47
+ Please note that this project is released with a [Contributor Code of Conduct](CODE-OF-CONDUCT.md). By participating in this project you agree to abide by its terms.
48
+
49
+ ## History & Versioning
50
+
51
+ See the [Change Log](CHANGELOG.md) for further history.
52
+
53
+ This project uses [SemVer](http://semver.org/) for versioning. For the versions available, see the [tags on this repository](https://github.com/Nereare/Adventure/tags).
54
+
55
+ ## Legal Stuff
56
+
57
+ [![MIT License](https://i.imgur.com/Ze3dFob.png)](LICENSE.md)
58
+
59
+ This project is available under the [MIT License](https://opensource.org/licenses/MIT)
60
+
61
+ [![d20 Logo](https://i.imgur.com/8CG0VEv.png)](OGL.md)
62
+
63
+ `d20 System` and the `d20 System` logo are trademarks of Wizards of the Coast, Inc. and are used according to the terms of the d20 System License. A copy of this License can be found at [www.wizards.com](https://dnd.wizards.com/articles/features/systems-reference-document-srd).
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'bundler/gem_tasks'
4
+ require 'rspec/core/rake_task'
5
+
6
+ RSpec::Core::RakeTask.new(:spec)
7
+
8
+ task default: :spec
@@ -0,0 +1,40 @@
1
+ # frozen_string_literal: true
2
+
3
+ lib = File.expand_path('lib', __dir__)
4
+ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
5
+ require 'adventure/version'
6
+
7
+ Gem::Specification.new do |spec|
8
+ spec.name = 'adventure'
9
+ spec.version = Adventure.version
10
+ spec.authors = ['Igor Padoim']
11
+ spec.email = ['igorpadoim@gmail.com']
12
+ spec.license = 'MIT'
13
+
14
+ spec.summary = 'A random adventure generator for D&D 5e.'
15
+ spec.homepage = 'https://github.com/Nereare/Adventure'
16
+
17
+ spec.metadata['homepage_uri'] = spec.homepage
18
+ spec.metadata['source_code_uri'] = spec.homepage
19
+ spec.metadata['changelog_uri'] = 'https://github.com/Nereare/Adventure/blob/master/CHANGELOG.md'
20
+
21
+ # Specify which files should be added to the gem when it is released.
22
+ # The `git ls-files -z` loads the files in the RubyGem that have been
23
+ # added into git.
24
+ spec.files = Dir.chdir(File.expand_path(__dir__)) do
25
+ `git ls-files -z`.split("\x0").reject do |f|
26
+ f.match(%r{^(test|spec|features)/})
27
+ end
28
+ end
29
+ spec.bindir = 'exe'
30
+ spec.executables = spec.files.grep(%r{^exe/}) { |f| File.basename(f) }
31
+ spec.require_paths = ['lib']
32
+
33
+ spec.add_development_dependency 'bundler', '~> 2.0'
34
+ spec.add_development_dependency 'rake', '~> 12.3'
35
+ spec.add_development_dependency 'rspec', '~> 3.8.0'
36
+
37
+ spec.add_dependency 'indefinite_article', '~> 0.2.4'
38
+ spec.add_dependency 'jekyll_slugify', '~> 0.4.2'
39
+ spec.add_dependency 'random_name_generator', '~> 1.0.3'
40
+ end
@@ -0,0 +1,15 @@
1
+ #!/usr/bin/env ruby
2
+ # frozen_string_literal: true
3
+
4
+ require 'bundler/setup'
5
+ require 'Adventure'
6
+
7
+ # You can add fixtures and/or initialization code here to make experimenting
8
+ # with your gem easier. You can also use a different console, if you like.
9
+
10
+ # (If you use this, don't forget to add pry to your Gemfile!)
11
+ # require "pry"
12
+ # Pry.start
13
+
14
+ require 'irb'
15
+ IRB.start(__FILE__)
@@ -0,0 +1,8 @@
1
+ #!/usr/bin/env bash
2
+ set -euo pipefail
3
+ IFS=$'\n\t'
4
+ set -vx
5
+
6
+ bundle install
7
+
8
+ # Do any other automated setup that you need to do here
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'indefinite_article'
4
+ require 'jekyll_slugify'
5
+
6
+ require 'adventure/version'
7
+
8
+ require 'adventure/actor'
9
+ require 'adventure/building'
10
+ require 'adventure/dungeon'
11
+ require 'adventure/encounter'
12
+ require 'adventure/quest'
13
+ require 'adventure/room'
14
+ require 'adventure/settlement'
15
+
16
+ # This is the main module of this Gem. It defines each component of an
17
+ # Adventure. The export of such adventure is located elsewhere.
18
+ module Adventure; end
@@ -0,0 +1,111 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Adventure
4
+ # Defines and creates NPCs.
5
+ class Actor
6
+ attr_reader :name, :gender, :race, :align, :hair, :eyes, :skin, :personality
7
+ attr_reader :equipment, :reference
8
+
9
+ # Creates a new Actor (NPC) instance.
10
+ #
11
+ # @param name [String] The name of the NPC.
12
+ # @param gender [String] One of 'female', 'male' or others.
13
+ # @param race [String] The race of the NPC.
14
+ # @param align [String] The alignment of the character (both moral and
15
+ # ethical)
16
+ # @param desc [Array] An array of strings, in the order: hair color, eye
17
+ # color, skin color and personality.
18
+ # @param equipment [Array] An array of strings, each element being one worn
19
+ # item.
20
+ # @param ref [String or false] Either a reference to the SRD, WotC books or
21
+ # other source with further information.
22
+ def initialize(name, gender, race, align, desc, equipment, ref = false)
23
+ @name = name
24
+ @gender = gender
25
+ @race = race
26
+ @align = align
27
+
28
+ @reference = ref
29
+
30
+ check_desc(desc)
31
+ process_case
32
+ process_equipment(equipment)
33
+ end
34
+
35
+ # Constructs the description of the NPC in human-readable format.
36
+ #
37
+ # @param upcase [Boolean] If the description must begin capitalized.
38
+ # @return [String] The description of the NPC.
39
+ def description(upcase = false)
40
+ "#{pronoum(upcase)} is #{@align.indefinitize} #{@gender} #{@race}, whose"\
41
+ " hair is #{@hair}, with #{@eyes} eyes and #{@skin} skin. "\
42
+ "#{pronoum(true)} uses #{inventory}. #{@name} is "\
43
+ "#{@personality.chomp '.'}."
44
+ end
45
+
46
+ # Returns the inventory of the NPC in human-readable format.
47
+ #
48
+ # @return [String] The inventory of the NPC.
49
+ def inventory
50
+ case @equip.length
51
+ when 0
52
+ 'nothing'
53
+ when 1
54
+ @equip[0].to_s
55
+ when 2
56
+ @equip.join ' and '
57
+ else
58
+ [@equip[0, @equip.length - 1].join(', '), @equip[-1]].join ', and '
59
+ end
60
+ end
61
+
62
+ private
63
+
64
+ def pronoum(capitalize = false)
65
+ r = case @gender
66
+ when 'male'
67
+ 'he'
68
+ when 'female'
69
+ 'she'
70
+ else
71
+ 'they'
72
+ end
73
+ r = r.capitalize if capitalize
74
+
75
+ r
76
+ end
77
+
78
+ def process_case
79
+ @name = @name.capitalize
80
+ @gender = @gender.downcase
81
+ @race = @race.downcase
82
+ @align = @align.downcase
83
+
84
+ @hair = @hair.downcase
85
+ @eyes = @eyes.downcase
86
+ @skin = @skin.downcase
87
+ @personality = @personality.downcase
88
+ end
89
+
90
+ def process_equipment(equipment)
91
+ msg = 'Equipment must be an array'
92
+ raise ArgumentError, msg unless equipment.is_a? Array
93
+
94
+ @equip = equipment
95
+ @equip.compact!
96
+ @equip.each_with_index do |item, i|
97
+ @equip[i] = item.downcase.indefinitize
98
+ end
99
+ end
100
+
101
+ def check_desc(desc)
102
+ msg = 'Desc must be an Array'
103
+ raise ArgumentError, msg unless desc.is_a? Array
104
+
105
+ msg = 'Desc must have exactly four elements'
106
+ raise ArgumentError, msg unless desc.length == 4
107
+
108
+ @hair, @eyes, @skin, @personality = desc
109
+ end
110
+ end
111
+ end