gamefic-standard 3.2.1 → 3.2.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 5b0c82ed182ca48a25af31d675e7a661d2956403c56ffbe74a1f88ded22ab667
4
- data.tar.gz: 7f7a7c1d1ef4eb12d1f41fa8e004e2ca92833ba2b4583bf0bcd9ac6d9df63ae4
3
+ metadata.gz: ea632da784056dc8b6bd103ef51d67c2eb2bf450f2391578774f1ead3d93ad76
4
+ data.tar.gz: 7a8ce3c3802c16121b9a457d50d9ef699bf4ba6358170f51bb315b0ecf2af12a
5
5
  SHA512:
6
- metadata.gz: fc01bbb87e5631b207b152611eed41449279ee4f25f99e5897855aaf6ffd9e558bdbc056f68c7bd48f96ec8169b891480442f1b2f0e5a8115a4466efba9bdfc8
7
- data.tar.gz: 3e090e4e91037020f9b3956f5d864be29ab0e97bebd8b813c684ca111f3234d24407c952ac324f801c1bedc79db56655018a9df905da5ab8ff5d46e9c18b0b92
6
+ metadata.gz: 9d424ac1d981a83fbfc49afaa70f5943aad9982a2cdaf219c7d19ea6eacd33cd487193efb7afc47feb72d0bb8c5013313f2dd7ad3011900976239be574a4fcf1
7
+ data.tar.gz: 7000c5c242e1f21822a5fa1bd242050abf262ba4b8cd64857bd95e73c1fce0f17879c4cf93fdac92b672bea098e2b4df20c9a2183340f252d538121a0b3bf40b
@@ -22,7 +22,7 @@ jobs:
22
22
  runs-on: ubuntu-latest
23
23
  strategy:
24
24
  matrix:
25
- ruby-version: ['2.7', '3.0', '3.1']
25
+ ruby-version: ['2.7', '3.0', '3.1', '3.3']
26
26
 
27
27
  steps:
28
28
  - uses: actions/checkout@v3
data/CHANGELOG.md CHANGED
@@ -1,3 +1,13 @@
1
+ ## 3.2.3 - September 1, 2024
2
+ - Delete gem
3
+
4
+ ## 3.2.2 - September 1, 2024
5
+ - Move help commands to their own extension
6
+ - get inside -> enter
7
+ - Use definite names in leave error
8
+ - Report commands that do not accept arguments
9
+ - Require gamefic ~> 3.3
10
+
1
11
  ## 3.2.1 - July 23, 2024
2
12
  - Help actions are meta
3
13
  - Ignore empty commands
@@ -37,7 +37,7 @@ Gem::Specification.new do |spec|
37
37
 
38
38
  spec.required_ruby_version = '>= 2.7.0'
39
39
 
40
- spec.add_dependency 'gamefic', '~> 3.1'
40
+ spec.add_dependency 'gamefic', '~> 3.3'
41
41
 
42
42
  spec.add_development_dependency 'opal', '~> 1.7'
43
43
  spec.add_development_dependency 'opal-rspec', '~> 1.0'
@@ -24,6 +24,7 @@ module Gamefic
24
24
 
25
25
  interpret "get on :thing", "enter :thing"
26
26
  interpret "get in :thing", "enter :thing"
27
+ interpret "get inside :thing", "enter :thing"
27
28
  interpret "sit on :thing", "enter :thing"
28
29
  interpret "sit in :thing", "enter :thing"
29
30
  interpret "lie on :thing", "enter :thing"
@@ -22,7 +22,7 @@ module Gamefic
22
22
  elsif portals.length == 1
23
23
  actor.execute :go, portals[0]
24
24
  else
25
- actor.tell "I don't know which way you want to go: #{portals.join_or}."
25
+ actor.tell "I don't know which way you want to go: #{portals.map(&:definitely).join_or}."
26
26
  end
27
27
  end
28
28
 
@@ -6,21 +6,49 @@ Gamefic::Standard.script do
6
6
  list = actor.epic.synonyms
7
7
  if list.include?(words[0]&.to_sym)
8
8
  if words.length > 1
9
- found = []
9
+ result = myself.query(actor, words[1..-1].join(' '))
10
+ found = [result.match].compact
10
11
  avail = available(ambiguous: true)
11
- result = avail.query(actor, words[1..-1].join(' '))
12
+ result = avail.query(actor, result.remainder)
12
13
  until result.match.nil?
13
14
  found.concat result.match
14
15
  result = avail.query(actor, result.remainder)
15
16
  end
16
17
  if found.empty?
17
- actor.tell %(I recognize "#{words[0]}" as a verb but don't know what you mean by "#{words[1..-1].join(' ')}.")
18
+ verbs = actor.epic
19
+ .syntaxes
20
+ .select { |syn| syn.synonym == words[0].to_sym }
21
+ .map(&:verb)
22
+ resps = actor.epic.responses_for(*verbs)
23
+ if resps.any? { |resp| !resp.queries.empty? }
24
+ actor.tell %(I recognize "#{words[0]}" as a verb but don't know what you mean by "#{words[1..-1].join(' ')}.")
25
+ else
26
+ actor.tell %[I recognize "#{words[0]}" but not with the rest of your sentence. (Maybe it's a one-word command?)]
27
+ end
18
28
  elsif result.remainder != ''
19
29
  actor.tell %(I recognize "#{words[0]}" as a verb but was confused by "#{result.remainder}.")
20
30
  elsif found.one?
21
- actor.tell %(I recognize "#{words[0]}" and "#{found.first.name}" but could not understand them together.)
31
+ verbs = actor.epic
32
+ .syntaxes
33
+ .select { |syn| syn.synonym == words[0].to_sym }
34
+ .map(&:verb)
35
+ resps = actor.epic.responses_for(*verbs)
36
+ if resps.any? { |resp| !resp.queries.empty? }
37
+ actor.tell %(I recognize "#{words[0]}" and "#{found.first.name}" but could not understand them together.)
38
+ else
39
+ actor.tell %[I recognize "#{words[0]}" and "#{found.first.name}" but could not understand them together. (Maybe "#{words[0]}" is a one-word command?)]
40
+ end
22
41
  else
23
- actor.tell %(I recognize "#{words[0]}" but I'm not sure if "#{words[1..-1].join(' ')}" means #{found.map(&:definitely).join_or}.)
42
+ verbs = actor.epic
43
+ .syntaxes
44
+ .select { |syn| syn.synonym == words[0].to_sym }
45
+ .map(&:verb)
46
+ resps = actor.epic.responses_for(*verbs)
47
+ if resps.any? { |resp| !resp.queries.empty? }
48
+ actor.tell %(I recognize "#{words[0]}" but I'm not sure if "#{words[1..-1].join(' ')}" means #{found.map(&:definitely).join_or}.)
49
+ else
50
+ actor.tell %[I recognize "#{words[0]}" but not with the rest of your sentence. (Maybe it's a one-word command?)]
51
+ end
24
52
  end
25
53
  else
26
54
  actor.tell %(I recognize "#{words[0]}" as a verb but could not understand it in this context.)
@@ -19,6 +19,5 @@ require 'gamefic-standard/actions/move'
19
19
  require 'gamefic-standard/actions/talk'
20
20
  require 'gamefic-standard/actions/wait'
21
21
  require 'gamefic-standard/actions/repeat'
22
- require 'gamefic-standard/actions/help'
23
22
  require 'gamefic-standard/actions/save-restore-undo'
24
23
  require 'gamefic-standard/actions/pronouns'
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gamefic
4
4
  module Standard
5
- VERSION = '3.2.1'
5
+ VERSION = '3.2.3'
6
6
  end
7
7
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamefic-standard
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.2.1
4
+ version: 3.2.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2024-07-23 00:00:00.000000000 Z
11
+ date: 2024-09-01 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gamefic
@@ -16,14 +16,14 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.1'
19
+ version: '3.3'
20
20
  type: :runtime
21
21
  prerelease: false
22
22
  version_requirements: !ruby/object:Gem::Requirement
23
23
  requirements:
24
24
  - - "~>"
25
25
  - !ruby/object:Gem::Version
26
- version: '3.1'
26
+ version: '3.3'
27
27
  - !ruby/object:Gem::Dependency
28
28
  name: opal
29
29
  requirement: !ruby/object:Gem::Requirement
@@ -123,7 +123,6 @@ files:
123
123
  - lib/gamefic-standard/actions/drop.rb
124
124
  - lib/gamefic-standard/actions/enter.rb
125
125
  - lib/gamefic-standard/actions/go.rb
126
- - lib/gamefic-standard/actions/help.rb
127
126
  - lib/gamefic-standard/actions/insert.rb
128
127
  - lib/gamefic-standard/actions/inventory.rb
129
128
  - lib/gamefic-standard/actions/leave.rb
@@ -1,52 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gamefic
4
- module Standard
5
- script do
6
- meta :verbs do |actor|
7
- list = rulebook.synonyms.reject { |syn| syn.to_s.start_with?('_') }
8
- .map { |syn| "<kbd>#{syn}</kbd>"}
9
- .join_and
10
- actor.tell "I understand the following commands: #{list}."
11
- actor.tell "Try using commands in plain sentences like <kbd>go north</kbd> or <kbd>take the coin</kbd>."
12
- actor.tell "For more information about a specific command, try <kbd>help [command]</kbd>, e.g., <kbd>help go</kbd>."
13
- end
14
-
15
- interpret 'commands', 'verbs'
16
- interpret 'help', 'verbs'
17
-
18
- meta :help, plaintext do |actor, command|
19
- if rulebook.synonyms.include?(command.to_sym) && !command.start_with?('_')
20
- available = rulebook.syntaxes.select { |syntax| syntax.synonym == command.to_sym }
21
- .uniq(&:signature)
22
- examples = available.map(&:template)
23
- .map do |tmpl|
24
- tmpl.text
25
- .gsub(/:character/i, '[someone]')
26
- .gsub(/:var[0-9]?/i, '[something]')
27
- .gsub(/:([a-z0-9]+)/i, "[\\1]")
28
- end
29
- .reject { |tmpl| tmpl.include?('[something] [something]') }
30
- actor.tell 'Examples:'
31
- actor.stream '<ul>'
32
- examples.each do |xmpl|
33
- actor.stream "<li><kbd>#{xmpl}</kbd></li>"
34
- end
35
- actor.stream '</ul>'
36
- related = available.map(&:verb)
37
- .uniq
38
- .that_are_not(command.to_sym)
39
- .sort
40
- .map { |sym| "<kbd>#{sym}</kbd>"}
41
- next if related.empty?
42
-
43
- actor.tell "Related: #{related.join(', ')}"
44
- elsif command =~ /[^a-z]/i
45
- actor.tell "Try asking for help with a specific command, e.g., <kbd>help go</kbd>"
46
- else
47
- actor.tell "\"#{command.cap_first}\" is not a verb I understand."
48
- end
49
- end
50
- end
51
- end
52
- end