gamefic-standard 3.2.3 → 3.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (57) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/Rakefile +5 -2
  4. data/gamefic-standard.gemspec +13 -11
  5. data/lib/gamefic-standard/actions/attack.rb +23 -19
  6. data/lib/gamefic-standard/actions/close.rb +16 -10
  7. data/lib/gamefic-standard/actions/drop.rb +31 -16
  8. data/lib/gamefic-standard/actions/enter.rb +32 -26
  9. data/lib/gamefic-standard/actions/give.rb +41 -0
  10. data/lib/gamefic-standard/actions/go.rb +47 -43
  11. data/lib/gamefic-standard/actions/insert.rb +42 -28
  12. data/lib/gamefic-standard/actions/inventory.rb +13 -8
  13. data/lib/gamefic-standard/actions/leave.rb +44 -37
  14. data/lib/gamefic-standard/actions/lock.rb +22 -16
  15. data/lib/gamefic-standard/actions/look.rb +123 -104
  16. data/lib/gamefic-standard/actions/move.rb +18 -14
  17. data/lib/gamefic-standard/actions/nil.rb +62 -52
  18. data/lib/gamefic-standard/actions/open.rb +34 -24
  19. data/lib/gamefic-standard/actions/place.rb +35 -20
  20. data/lib/gamefic-standard/actions/pronouns.rb +26 -18
  21. data/lib/gamefic-standard/actions/quit.rb +17 -7
  22. data/lib/gamefic-standard/actions/repeat.rb +17 -9
  23. data/lib/gamefic-standard/actions/save-restore-undo.rb +19 -11
  24. data/lib/gamefic-standard/actions/search.rb +31 -21
  25. data/lib/gamefic-standard/actions/take.rb +47 -34
  26. data/lib/gamefic-standard/actions/talk.rb +45 -31
  27. data/lib/gamefic-standard/actions/unlock.rb +31 -21
  28. data/lib/gamefic-standard/actions/wait.rb +15 -5
  29. data/lib/gamefic-standard/actions.rb +33 -0
  30. data/lib/gamefic-standard/articles.rb +45 -40
  31. data/lib/gamefic-standard/enterable.rb +13 -0
  32. data/lib/gamefic-standard/entities/character.rb +3 -0
  33. data/lib/gamefic-standard/entities/container.rb +2 -2
  34. data/lib/gamefic-standard/entities/door.rb +13 -13
  35. data/lib/gamefic-standard/entities/portal.rb +1 -1
  36. data/lib/gamefic-standard/entities/receptacle.rb +1 -1
  37. data/lib/gamefic-standard/entities/room.rb +20 -5
  38. data/lib/gamefic-standard/entities/supporter.rb +1 -1
  39. data/lib/gamefic-standard/entities/thing.rb +1 -5
  40. data/lib/gamefic-standard/introduction.rb +14 -4
  41. data/lib/gamefic-standard/lockable.rb +36 -0
  42. data/lib/gamefic-standard/openable.rb +33 -0
  43. data/lib/gamefic-standard/pathfinder.rb +75 -55
  44. data/lib/gamefic-standard/standardized.rb +65 -0
  45. data/lib/gamefic-standard/version.rb +1 -1
  46. data/lib/gamefic-standard.rb +12 -3
  47. metadata +36 -13
  48. data/lib/gamefic-standard/give.rb +0 -21
  49. data/lib/gamefic-standard/grammar/attributes.rb +0 -37
  50. data/lib/gamefic-standard/grammar/pronoun.rb +0 -101
  51. data/lib/gamefic-standard/grammar.rb +0 -2
  52. data/lib/gamefic-standard/modules/enterable.rb +0 -9
  53. data/lib/gamefic-standard/modules/lockable.rb +0 -34
  54. data/lib/gamefic-standard/modules/openable.rb +0 -19
  55. data/lib/gamefic-standard/modules/standardized.rb +0 -57
  56. data/lib/gamefic-standard/modules.rb +0 -6
  57. data/spec-opal/spec_helper.rb +0 -32
@@ -1,24 +1,39 @@
1
- Gamefic::Standard.script do
2
- respond :place, children, available do |actor, thing, supporter|
3
- actor.tell "You can't put #{the thing} on #{the supporter}."
4
- end
1
+ # frozen_string_literal: true
5
2
 
6
- respond :place, available, available(Supporter) do |actor, thing, supporter|
7
- actor.execute :take, thing unless thing.parent == actor
8
- next unless thing.parent == actor
9
- thing.parent = supporter
10
- actor.tell "You put #{the thing} on #{the supporter}."
11
- end
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Place
7
+ extend Gamefic::Scriptable
12
8
 
13
- respond :place, children, available(Supporter) do |actor, thing, supporter|
14
- thing.parent = supporter
15
- actor.tell "You put #{the thing} on #{the supporter}."
16
- end
9
+ respond :place, children, available do |actor, thing, supporter|
10
+ actor.tell "You can't put #{the thing} on #{the supporter}."
11
+ end
12
+
13
+ respond :place, available, available(Supporter) do |actor, thing, supporter|
14
+ actor.execute :take, thing unless thing.parent == actor
15
+ next unless thing.parent == actor
17
16
 
18
- interpret 'put :thing on :supporter', 'place :thing :supporter'
19
- interpret 'put :thing down on :supporter', 'place :thing :supporter'
20
- interpret 'set :thing on :supporter', 'place :thing :supporter'
21
- interpret 'set :thing down on :supporter', 'place :thing :supporter'
22
- interpret 'drop :thing on :supporter', 'place :thing :supporter'
23
- interpret 'place :thing on :supporter', 'place :thing :supporter'
17
+ thing.parent = supporter
18
+ actor.tell "You put #{the thing} on #{the supporter}."
19
+ end
20
+
21
+ respond :place, children, available(Supporter) do |actor, thing, supporter|
22
+ thing.parent = supporter
23
+ actor.tell "You put #{the thing} on #{the supporter}."
24
+ end
25
+
26
+ respond :place, children, room do |actor, thing|
27
+ actor.execute :drop, thing
28
+ end
29
+
30
+ interpret 'put :thing on :supporter', 'place :thing :supporter'
31
+ interpret 'put :thing down on :supporter', 'place :thing :supporter'
32
+ interpret 'set :thing on :supporter', 'place :thing :supporter'
33
+ interpret 'set :thing down on :supporter', 'place :thing :supporter'
34
+ interpret 'drop :thing on :supporter', 'place :thing :supporter'
35
+ interpret 'place :thing on :supporter', 'place :thing :supporter'
36
+ end
37
+ end
38
+ end
24
39
  end
@@ -1,28 +1,36 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Gamefic::Standard.script do
4
- introduction do |actor|
5
- actor[:standard_pronoun_targets] = []
6
- end
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Pronouns
7
+ extend Gamefic::Scriptable
7
8
 
8
- after_action do |action|
9
- next unless action.verb
9
+ introduction do |actor|
10
+ actor[:standard_pronoun_targets] = []
11
+ end
10
12
 
11
- action.actor[:standard_pronoun_targets].replace action.arguments.that_are(Thing)
12
- end
13
+ after_action do |action|
14
+ next unless action.verb
13
15
 
14
- meta nil, plaintext do |actor, string|
15
- keywords = string.keywords
16
- list = actor.epic.synonyms
17
- next actor.proceed unless list.include?(keywords.first&.to_sym)
16
+ action.actor[:standard_pronoun_targets].replace action.arguments.that_are(Thing)
17
+ end
18
18
 
19
- xlation = keywords[1..].map do |word|
20
- next word unless %w[him her it them].include?(word)
19
+ meta nil, plaintext do |actor, string|
20
+ keywords = string.keywords
21
+ list = actor.epic.synonyms
22
+ next actor.proceed unless list.include?(keywords.first&.to_sym)
21
23
 
22
- actor[:standard_pronoun_targets].find { |obj| Grammar::Pronoun.objective(obj) == word }
23
- end
24
- next actor.proceed if xlation.any?(&:nil?) || xlation.that_are(Thing).empty?
24
+ xlation = keywords[1..].map do |word|
25
+ next word unless %w[him her it them].include?(word)
25
26
 
26
- actor.perform "#{keywords[0].to_sym} #{xlation.join(' ')}"
27
+ actor[:standard_pronoun_targets].find { |obj| obj.objective == word }
28
+ end
29
+ next actor.proceed if xlation.any?(&:nil?) || xlation.that_are(Thing).empty?
30
+
31
+ actor.perform "#{keywords[0].to_sym} #{xlation.join(' ')}"
32
+ end
33
+ end
34
+ end
27
35
  end
28
36
  end
@@ -1,10 +1,20 @@
1
- Gamefic::Standard.script do
2
- yes_or_no :standard_confirm_quit do |actor, props|
3
- actor.cue :default_conclusion if props.yes?
4
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Quit
7
+ extend Gamefic::Scriptable
8
+
9
+ yes_or_no :standard_confirm_quit do |actor, props|
10
+ actor.cue :default_conclusion if props.yes?
11
+ end
5
12
 
6
- meta :quit do |actor|
7
- actor.tell "Are you sure you want to quit?"
8
- actor.cue :standard_confirm_quit
13
+ meta :quit do |actor|
14
+ actor.tell 'Are you sure you want to quit?'
15
+ actor.cue :standard_confirm_quit
16
+ end
17
+ end
18
+ end
9
19
  end
10
20
  end
@@ -1,14 +1,22 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Gamefic::Standard.script do
4
- meta :repeat do |actor|
5
- if actor.last_input && !actor.last_input.empty?
6
- actor.tell "Repeating <kbd>\"#{actor.last_input}\"</kbd>..."
7
- actor.queue.push actor.last_input
8
- else
9
- actor.tell "You don't have a previous command to repeat right now."
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Repeat
7
+ extend Gamefic::Scriptable
8
+
9
+ meta :repeat do |actor|
10
+ if actor.last_input && !actor.last_input.empty?
11
+ actor.tell "Repeating <kbd>\"#{actor.last_input}\"</kbd>..."
12
+ actor.queue.push actor.last_input
13
+ else
14
+ actor.tell "You don't have a previous command to repeat right now."
15
+ end
16
+ end
17
+
18
+ interpret 'again', 'repeat'
19
+ end
10
20
  end
11
21
  end
12
-
13
- interpret 'again', 'repeat'
14
22
  end
@@ -1,18 +1,26 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- Gamefic::Standard.script do
4
- # Save, Restore, and Undo need to be handled by the game client. They have
5
- # default implementations here to make them available in help.
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module SaveRestoreUndo
7
+ extend Gamefic::Scriptable
6
8
 
7
- meta :save do |actor|
8
- actor.tell "<kbd>Save</kbd> is not available."
9
- end
9
+ # Save, Restore, and Undo need to be handled by the game client. They have
10
+ # default implementations here to make them available in help.
10
11
 
11
- meta :restore do |actor|
12
- actor.tell "<kbd>Restore</kbd> is not available."
13
- end
12
+ meta :save do |actor|
13
+ actor.tell '<kbd>Save</kbd> is not available.'
14
+ end
15
+
16
+ meta :restore do |actor|
17
+ actor.tell '<kbd>Restore</kbd> is not available.'
18
+ end
14
19
 
15
- meta :undo do |actor|
16
- actor.tell "<kbd>Undo</kbd> is not available."
20
+ meta :undo do |actor|
21
+ actor.tell '<kbd>Undo</kbd> is not available.'
22
+ end
23
+ end
24
+ end
17
25
  end
18
26
  end
@@ -1,26 +1,36 @@
1
- Gamefic::Standard.script do
2
- respond :search, available(Thing) do |actor, thing|
3
- actor.execute :look, thing
4
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Search
7
+ extend Gamefic::Scriptable
8
+
9
+ respond :search, available(Thing) do |actor, thing|
10
+ actor.execute :look, thing
11
+ end
12
+
13
+ respond :search, available(Receptacle) do |actor, thing|
14
+ if thing.accessible?
15
+ itemized = thing.children.that_are_not(proc(&:attached?)).that_are(proc(&:itemized?))
16
+ if itemized.empty?
17
+ actor.tell "There's nothing inside #{the thing}."
18
+ else
19
+ actor.tell "You see #{itemized.join_and} in #{the thing}." unless itemized.empty?
20
+ end
21
+ else
22
+ actor.tell "You can't see inside #{the thing}."
23
+ end
24
+ end
5
25
 
6
- respond :search, available(Receptacle) do |actor, thing|
7
- if thing.accessible?
8
- itemized = thing.children.that_are_not(proc(&:attached?)).that_are(proc(&:itemized?))
9
- if itemized.empty?
10
- actor.tell "There's nothing inside #{the thing}."
11
- else
12
- actor.tell "You see #{itemized.join_and} in #{the thing}." unless itemized.empty?
26
+ respond :search, available(Container, proc(&:closed?)) do |actor, container|
27
+ actor.execute :open, container
28
+ actor.proceed if container.open?
29
+ end
30
+
31
+ interpret 'look inside :thing', 'search :thing'
32
+ interpret 'look in :thing', 'search :thing'
13
33
  end
14
- else
15
- actor.tell "You can't see inside #{the thing}."
16
34
  end
17
35
  end
18
-
19
- respond :search, available(Container, proc(&:closed?)) do |actor, container|
20
- actor.execute :open, container
21
- actor.proceed if container.open?
22
- end
23
-
24
- interpret 'look inside :thing', 'search :thing'
25
- interpret 'look in :thing', 'search :thing'
26
36
  end
@@ -1,40 +1,53 @@
1
- Gamefic::Standard.script do
2
- respond :take, available do |actor, thing|
3
- if thing.parent == actor
4
- actor.tell "You're already carrying #{the thing}."
5
- elsif thing.portable?
6
- if actor.parent != thing.parent
7
- actor.tell "You take #{the thing} from #{the thing.parent}."
8
- else
9
- actor.tell "You take #{the thing}."
10
- end
11
- thing.parent = actor
12
- else
13
- actor.tell "You can't take #{the thing}."
14
- end
15
- end
1
+ # frozen_string_literal: true
16
2
 
17
- respond :take, available(proc(&:attached?)) do |actor, thing|
18
- actor.tell "#{The thing} is attached to #{the thing.parent}."
19
- end
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Take
7
+ extend Gamefic::Scriptable
20
8
 
21
- respond :take, available(Rubble) do |actor, rubble|
22
- actor.tell "You don't have any use for #{the rubble}."
23
- end
9
+ respond :take, available do |actor, thing|
10
+ if thing.parent == actor
11
+ actor.tell "You're already carrying #{the thing}."
12
+ elsif thing.portable?
13
+ if actor.parent != thing.parent
14
+ actor.tell "You take #{the thing} from #{the thing.parent}."
15
+ else
16
+ actor.tell "You take #{the thing}."
17
+ end
18
+ thing.parent = actor
19
+ else
20
+ actor.tell "You can't take #{the thing}."
21
+ end
22
+ end
24
23
 
25
- respond :take, plaintext(/^(all|everything)$/) do |actor, _all|
26
- items = Gamefic::Scope::Family.matches(actor)
27
- .select(&:portable?)
28
- .reject { |item| actor.flatten.include?(item) }
29
- if items.empty?
30
- actor.tell "You don't see anything you can carry."
31
- else
32
- items.each { |item| actor.execute :take, item }
24
+ respond :take, available(proc(&:attached?)) do |actor, thing|
25
+ actor.tell "#{The thing} is attached to #{the thing.parent}."
26
+ end
27
+
28
+ respond :take, available(Rubble) do |actor, rubble|
29
+ actor.tell "You don't have any use for #{the rubble}."
30
+ end
31
+
32
+ respond :take, plaintext(/^(all|everything)$/) do |actor, _all|
33
+ items = Gamefic::Scope::Family.matches(actor)
34
+ .select(&:portable?)
35
+ .reject { |item| actor.flatten.include?(item) }
36
+ if items.empty?
37
+ actor.tell "You don't see anything you can carry."
38
+ else
39
+ items.each { |item| actor.execute :take, item }
40
+ end
41
+ end
42
+
43
+ interpret 'get :thing', 'take :thing'
44
+ interpret 'pick up :thing', 'take :thing'
45
+ interpret 'pick :thing up', 'take :thing'
46
+ interpret 'carry :thing', 'take :thing'
47
+ interpret 'gather :thing', 'take :thing'
48
+ interpret 'hold :thing', 'take :thing'
49
+ interpret 'collect :thing', 'take :thing'
50
+ end
33
51
  end
34
52
  end
35
-
36
- interpret "get :thing", "take :thing"
37
- interpret "pick up :thing", "take :thing"
38
- interpret "pick :thing up", "take :thing"
39
- interpret "carry :thing", "take :thing"
40
53
  end
@@ -1,37 +1,51 @@
1
- Gamefic::Standard.script do
2
- respond :talk do |actor|
3
- actor.tell "You talk to yourself."
4
- end
1
+ # frozen_string_literal: true
5
2
 
6
- respond :talk, myself do |actor, yourself|
7
- actor.execute :talk
8
- end
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Talk
7
+ extend Gamefic::Scriptable
9
8
 
10
- respond :talk, available do |actor, thing|
11
- actor.tell "Nothing happens."
12
- end
9
+ respond :talk do |actor|
10
+ actor.tell 'You talk to yourself.'
11
+ end
13
12
 
14
- respond :talk, Character do |actor, character|
15
- actor.tell "#{The character} has nothing to say."
16
- end
13
+ respond :talk, myself do |actor, _yourself|
14
+ actor.execute :talk
15
+ end
17
16
 
18
- respond :talk, Character, plaintext do |actor, character, text|
19
- actor.tell "#{The character} has nothing to say about #{text}."
20
- end
17
+ respond :talk, available do |actor, _thing|
18
+ actor.tell 'Nothing happens.'
19
+ end
21
20
 
22
- interpret "talk to :character", "talk :character"
23
- interpret "talk to :character about :subject", "talk :character :subject"
24
- interpret "ask :character :subject", "talk :character :subject"
25
- interpret "ask :character about :subject", "talk :character :subject"
26
- interpret "tell :character :subject", "talk :character :subject"
27
- interpret "tell :character about :subject", "talk :character :subject"
28
- interpret "ask :character for :subject", "talk :character :subject"
29
- interpret "speak :character", "talk :character"
30
- interpret "speak to :character", "talk :character"
31
- interpret "speak :character :subject", "talk :character :subject"
32
- interpret "speak :character about :subject", "talk :character :subject"
33
- interpret "speak to :character about :subject", "talk :character :subject"
34
- interpret "speak to :character :subject", "talk :character :subject"
35
- interpret "discuss :subject :character", "talk :character :subject"
36
- interpret "discuss :subject with :character", "talk :character :subject"
21
+ respond :talk, Character do |actor, character|
22
+ actor.tell "#{The character} has nothing to say."
23
+ end
24
+
25
+ respond :talk, available, plaintext do |actor, thing, _text|
26
+ actor.execute :talk, thing
27
+ end
28
+
29
+ respond :talk, Character, plaintext do |actor, character, _text|
30
+ actor.execute :talk, character
31
+ end
32
+
33
+ interpret 'talk to :character', 'talk :character'
34
+ interpret 'talk to :character about :subject', 'talk :character :subject'
35
+ interpret 'ask :character :subject', 'talk :character :subject'
36
+ interpret 'ask :character about :subject', 'talk :character :subject'
37
+ interpret 'tell :character :subject', 'talk :character :subject'
38
+ interpret 'tell :character about :subject', 'talk :character :subject'
39
+ interpret 'ask :character for :subject', 'talk :character :subject'
40
+ interpret 'speak :character', 'talk :character'
41
+ interpret 'speak to :character', 'talk :character'
42
+ interpret 'speak :character :subject', 'talk :character :subject'
43
+ interpret 'speak :character about :subject', 'talk :character :subject'
44
+ interpret 'speak to :character about :subject', 'talk :character :subject'
45
+ interpret 'speak to :character :subject', 'talk :character :subject'
46
+ interpret 'discuss :subject :character', 'talk :character :subject'
47
+ interpret 'discuss :subject with :character', 'talk :character :subject'
48
+ end
49
+ end
50
+ end
37
51
  end
@@ -1,25 +1,35 @@
1
- Gamefic::Standard.script do
2
- respond :unlock, available(Lockable) do |actor, thing|
3
- if thing.has_lock_key? && actor.children.include?(thing.lock_key)
4
- actor.execute :unlock, thing, thing.lock_key
5
- else
6
- actor.tell "You can't unlock #{the thing}."
7
- end
8
- end
1
+ # frozen_string_literal: true
9
2
 
10
- respond :unlock, available(Lockable, proc(&:has_lock_key?)), children do |actor, thing, key|
11
- if thing.lock_key == key
12
- thing.locked = false
13
- actor.tell "You unlock #{the thing} with #{the key}."
14
- else
15
- actor.tell "You can't unlock #{the thing} with #{the key}."
16
- end
17
- end
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Unlock
7
+ extend Gamefic::Scriptable
18
8
 
19
- respond :unlock, available(Lockable, proc(&:has_lock_key?)), available do |actor, _thing, key|
20
- actor.execute :take, key if key.parent != actor
21
- actor.proceed if key.parent == actor
22
- end
9
+ respond :unlock, available(Lockable) do |actor, thing|
10
+ if thing.has_lock_key? && actor.children.include?(thing.lock_key)
11
+ actor.execute :unlock, thing, thing.lock_key
12
+ else
13
+ actor.tell "You can't unlock #{the thing}."
14
+ end
15
+ end
23
16
 
24
- interpret "unlock :container with :key", "unlock :container :key"
17
+ respond :unlock, available(Lockable, proc(&:has_lock_key?)), children do |actor, thing, key|
18
+ if thing.lock_key == key
19
+ thing.locked = false
20
+ actor.tell "You unlock #{the thing} with #{the key}."
21
+ else
22
+ actor.tell "You can't unlock #{the thing} with #{the key}."
23
+ end
24
+ end
25
+
26
+ respond :unlock, available(Lockable, proc(&:has_lock_key?)), available do |actor, _thing, key|
27
+ actor.execute :take, key if key.parent != actor
28
+ actor.proceed if key.parent == actor
29
+ end
30
+
31
+ interpret 'unlock :container with :key', 'unlock :container :key'
32
+ end
33
+ end
34
+ end
25
35
  end
@@ -1,7 +1,17 @@
1
- Gamefic::Standard.script do
2
- respond :wait do |actor|
3
- actor.tell "Time passes."
4
- end
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ module Actions
6
+ module Wait
7
+ extend Gamefic::Scriptable
5
8
 
6
- interpret 'z', 'wait'
9
+ respond :wait do |actor|
10
+ actor.tell 'Time passes.'
11
+ end
12
+
13
+ interpret 'z', 'wait'
14
+ end
15
+ end
16
+ end
7
17
  end
@@ -18,6 +18,39 @@ require 'gamefic-standard/actions/take'
18
18
  require 'gamefic-standard/actions/move'
19
19
  require 'gamefic-standard/actions/talk'
20
20
  require 'gamefic-standard/actions/wait'
21
+ require 'gamefic-standard/actions/give'
21
22
  require 'gamefic-standard/actions/repeat'
22
23
  require 'gamefic-standard/actions/save-restore-undo'
23
24
  require 'gamefic-standard/actions/pronouns'
25
+
26
+ module Gamefic
27
+ module Standard
28
+ module Actions
29
+ include Nil
30
+ include Attack
31
+ include Drop
32
+ include Enter
33
+ include Open
34
+ include Close
35
+ include Lock
36
+ include Unlock
37
+ include Go
38
+ include Insert
39
+ include Inventory
40
+ include Leave
41
+ include Look
42
+ include Search
43
+ include Place
44
+ include Quit
45
+ include Take
46
+ include Move
47
+ include Talk
48
+ include Wait
49
+ include Give
50
+ include Repeat
51
+ include SaveRestoreUndo
52
+ include Pronouns
53
+ include Gamefic::What
54
+ end
55
+ end
56
+ end
@@ -1,45 +1,50 @@
1
- module Articles
2
- # Get a name for the entity with an indefinite article (unless the entity
3
- # has a proper name).
4
- #
5
- # @param entity [Gamefic::Entity]
6
- # @return [String]
7
- def a(entity)
8
- entity.indefinitely
9
- end
10
- alias an a
1
+ # frozen_string_literal: true
11
2
 
12
- # Get a name for the entity with a definite article (unless the entity has
13
- # a proper name).
14
- #
15
- # @param entity [Gamefic::Entity]
16
- # @return [String]
17
- def the(entity)
18
- entity.definitely
19
- end
3
+ module Gamefic
4
+ module Standard
5
+ # Methods for adding definite and indefinite articles to entity names.
6
+ #
7
+ module Articles
8
+ # Get a name for the entity with an indefinite article (unless the entity
9
+ # has a proper name).
10
+ #
11
+ # @param entity [Gamefic::Entity]
12
+ # @return [String]
13
+ def a(entity)
14
+ entity.indefinitely
15
+ end
16
+ alias an a
20
17
 
21
- # Get a capitalized name for the entity with an indefinite article (unless
22
- # the entity has a proper name).
23
- #
24
- # @param entity [Gamefic::Entity]
25
- # @return [String]
26
- def a_(entity)
27
- entity.indefinitely.cap_first
28
- end
29
- alias an_ a_
30
- alias A a_
31
- alias An a_
18
+ # Get a name for the entity with a definite article (unless the entity has
19
+ # a proper name).
20
+ #
21
+ # @param entity [Gamefic::Entity]
22
+ # @return [String]
23
+ def the(entity)
24
+ entity.definitely
25
+ end
32
26
 
33
- # Get a capitalized name for the entity with a definite article (unless
34
- # the entity has a proper name).
35
- #
36
- # @param entity [Gamefic::Entity]
37
- # @return [String]
38
- def the_(entity)
39
- entity.definitely.cap_first
27
+ # Get a capitalized name for the entity with an indefinite article (unless
28
+ # the entity has a proper name).
29
+ #
30
+ # @param entity [Gamefic::Entity]
31
+ # @return [String]
32
+ def a_(entity)
33
+ entity.indefinitely.cap_first
34
+ end
35
+ alias an_ a_
36
+ alias A a_
37
+ alias An a_
38
+
39
+ # Get a capitalized name for the entity with a definite article (unless
40
+ # the entity has a proper name).
41
+ #
42
+ # @param entity [Gamefic::Entity]
43
+ # @return [String]
44
+ def the_(entity)
45
+ entity.definitely.cap_first
46
+ end
47
+ alias The the_
48
+ end
40
49
  end
41
- alias The the_
42
50
  end
43
-
44
- # @todo Monkey patch
45
- Gamefic::Narrative.include Articles