gamefic-standard 3.2.1 → 3.2.2
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.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +1 -1
- data/CHANGELOG.md +7 -0
- data/gamefic-standard-3.2.1.gem +0 -0
- data/gamefic-standard.gemspec +1 -1
- data/lib/gamefic-standard/actions/enter.rb +1 -0
- data/lib/gamefic-standard/actions/leave.rb +1 -1
- data/lib/gamefic-standard/actions/nil.rb +33 -5
- data/lib/gamefic-standard/actions.rb +0 -1
- data/lib/gamefic-standard/version.rb +1 -1
- metadata +5 -5
- data/lib/gamefic-standard/actions/help.rb +0 -52
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 934c9793a332bc51d87f3643530112bf53930955a012cbaaa8c20b9b652347f1
|
|
4
|
+
data.tar.gz: 5d7afbc7b668390a80ed5784921f872dacf5c51a741b0bf0b2a584b152e156d2
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: 19c479b2c1c2f6ca1deae46644056c3ee24e9a5b19f084b758e2caeaff3e13e149593deaf0d9b37af2c8b04b1fe42dfe51567b6712b3a2c2b18d3910eb416d32
|
|
7
|
+
data.tar.gz: 928429f5cb51bec69403e17797f9117368b9e847973a1c430b180b2d3567ac9b1d97948908c7f7ccf7221627452aaa160fd528a89a12346cde74dc9cc5737bce
|
data/.github/workflows/rspec.yml
CHANGED
data/CHANGELOG.md
CHANGED
|
@@ -1,3 +1,10 @@
|
|
|
1
|
+
## 3.2.2 - September 1, 2024
|
|
2
|
+
- Move help commands to their own extension
|
|
3
|
+
- get inside -> enter
|
|
4
|
+
- Use definite names in leave error
|
|
5
|
+
- Report commands that do not accept arguments
|
|
6
|
+
- Require gamefic ~> 3.3
|
|
7
|
+
|
|
1
8
|
## 3.2.1 - July 23, 2024
|
|
2
9
|
- Help actions are meta
|
|
3
10
|
- Ignore empty commands
|
|
Binary file
|
data/gamefic-standard.gemspec
CHANGED
|
@@ -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.
|
|
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
|
-
|
|
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,
|
|
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
|
-
|
|
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
|
-
|
|
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
|
-
|
|
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'
|
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.
|
|
4
|
+
version: 3.2.2
|
|
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-
|
|
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.
|
|
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.
|
|
26
|
+
version: '3.3'
|
|
27
27
|
- !ruby/object:Gem::Dependency
|
|
28
28
|
name: opal
|
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
|
@@ -115,6 +115,7 @@ files:
|
|
|
115
115
|
- Rakefile
|
|
116
116
|
- bin/console
|
|
117
117
|
- bin/setup
|
|
118
|
+
- gamefic-standard-3.2.1.gem
|
|
118
119
|
- gamefic-standard.gemspec
|
|
119
120
|
- lib/gamefic-standard.rb
|
|
120
121
|
- lib/gamefic-standard/actions.rb
|
|
@@ -123,7 +124,6 @@ files:
|
|
|
123
124
|
- lib/gamefic-standard/actions/drop.rb
|
|
124
125
|
- lib/gamefic-standard/actions/enter.rb
|
|
125
126
|
- lib/gamefic-standard/actions/go.rb
|
|
126
|
-
- lib/gamefic-standard/actions/help.rb
|
|
127
127
|
- lib/gamefic-standard/actions/insert.rb
|
|
128
128
|
- lib/gamefic-standard/actions/inventory.rb
|
|
129
129
|
- 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
|