gamefic-standard 3.2.4 → 4.0.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 (107) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +10 -0
  3. data/Rakefile +11 -5
  4. data/gamefic-standard.gemspec +15 -13
  5. data/lib/gamefic/standard/actions/attack.rb +32 -0
  6. data/lib/gamefic/standard/actions/close.rb +24 -0
  7. data/lib/gamefic/standard/actions/drop.rb +39 -0
  8. data/lib/gamefic/standard/actions/enter.rb +34 -0
  9. data/lib/gamefic/standard/actions/give.rb +38 -0
  10. data/lib/gamefic/standard/actions/go.rb +63 -0
  11. data/lib/gamefic/standard/actions/insert.rb +53 -0
  12. data/lib/gamefic/standard/actions/inventory.rb +20 -0
  13. data/lib/gamefic/standard/actions/leave.rb +57 -0
  14. data/lib/gamefic/standard/actions/lock.rb +31 -0
  15. data/lib/gamefic/standard/actions/look.rb +149 -0
  16. data/lib/gamefic/standard/actions/mount.rb +29 -0
  17. data/lib/gamefic/standard/actions/move.rb +28 -0
  18. data/lib/gamefic/standard/actions/nil.rb +37 -0
  19. data/lib/gamefic/standard/actions/open.rb +39 -0
  20. data/lib/gamefic/standard/actions/place.rb +39 -0
  21. data/lib/gamefic/standard/actions/pronouns.rb +34 -0
  22. data/lib/gamefic/standard/actions/quit.rb +24 -0
  23. data/lib/gamefic/standard/actions/repeat.rb +28 -0
  24. data/lib/gamefic/standard/actions/save-restore-undo.rb +26 -0
  25. data/lib/gamefic/standard/actions/search.rb +36 -0
  26. data/lib/gamefic/standard/actions/take.rb +54 -0
  27. data/lib/gamefic/standard/actions/talk.rb +51 -0
  28. data/lib/gamefic/standard/actions/unlock.rb +35 -0
  29. data/lib/gamefic/standard/actions/wait.rb +17 -0
  30. data/lib/gamefic/standard/actions.rb +57 -0
  31. data/lib/gamefic/standard/articles.rb +52 -0
  32. data/lib/gamefic/standard/enterable.rb +13 -0
  33. data/lib/gamefic/standard/entities/character.rb +14 -0
  34. data/lib/gamefic/standard/entities/container.rb +16 -0
  35. data/lib/gamefic/standard/entities/door.rb +46 -0
  36. data/lib/gamefic/standard/entities/fixture.rb +8 -0
  37. data/lib/gamefic/standard/entities/item.rb +11 -0
  38. data/lib/gamefic/standard/entities/portal.rb +50 -0
  39. data/lib/gamefic/standard/entities/receptacle.rb +9 -0
  40. data/lib/gamefic/standard/entities/room.rb +55 -0
  41. data/lib/gamefic/standard/entities/rubble.rb +16 -0
  42. data/lib/gamefic/standard/entities/scenery.rb +13 -0
  43. data/lib/gamefic/standard/entities/supporter.rb +9 -0
  44. data/lib/gamefic/standard/entities/thing.rb +9 -0
  45. data/lib/gamefic/standard/entities.rb +18 -0
  46. data/lib/gamefic/standard/introduction.rb +18 -0
  47. data/lib/gamefic/standard/lockable.rb +44 -0
  48. data/lib/gamefic/standard/openable.rb +33 -0
  49. data/lib/gamefic/standard/pathfinder.rb +82 -0
  50. data/lib/gamefic/standard/queries.rb +24 -0
  51. data/lib/gamefic/standard/standardized.rb +65 -0
  52. data/lib/{gamefic-standard → gamefic/standard}/version.rb +1 -1
  53. data/lib/gamefic/standard.rb +32 -0
  54. data/lib/gamefic-standard.rb +1 -27
  55. metadata +83 -58
  56. data/lib/gamefic-standard/actions/attack.rb +0 -28
  57. data/lib/gamefic-standard/actions/close.rb +0 -18
  58. data/lib/gamefic-standard/actions/drop.rb +0 -24
  59. data/lib/gamefic-standard/actions/enter.rb +0 -36
  60. data/lib/gamefic-standard/actions/go.rb +0 -59
  61. data/lib/gamefic-standard/actions/insert.rb +0 -39
  62. data/lib/gamefic-standard/actions/inventory.rb +0 -15
  63. data/lib/gamefic-standard/actions/leave.rb +0 -50
  64. data/lib/gamefic-standard/actions/lock.rb +0 -25
  65. data/lib/gamefic-standard/actions/look.rb +0 -133
  66. data/lib/gamefic-standard/actions/move.rb +0 -24
  67. data/lib/gamefic-standard/actions/nil.rb +0 -60
  68. data/lib/gamefic-standard/actions/open.rb +0 -29
  69. data/lib/gamefic-standard/actions/place.rb +0 -24
  70. data/lib/gamefic-standard/actions/pronouns.rb +0 -28
  71. data/lib/gamefic-standard/actions/quit.rb +0 -10
  72. data/lib/gamefic-standard/actions/repeat.rb +0 -14
  73. data/lib/gamefic-standard/actions/save-restore-undo.rb +0 -18
  74. data/lib/gamefic-standard/actions/search.rb +0 -26
  75. data/lib/gamefic-standard/actions/take.rb +0 -40
  76. data/lib/gamefic-standard/actions/talk.rb +0 -37
  77. data/lib/gamefic-standard/actions/unlock.rb +0 -25
  78. data/lib/gamefic-standard/actions/wait.rb +0 -7
  79. data/lib/gamefic-standard/actions.rb +0 -23
  80. data/lib/gamefic-standard/articles.rb +0 -42
  81. data/lib/gamefic-standard/entities/character.rb +0 -2
  82. data/lib/gamefic-standard/entities/container.rb +0 -8
  83. data/lib/gamefic-standard/entities/door.rb +0 -42
  84. data/lib/gamefic-standard/entities/fixture.rb +0 -4
  85. data/lib/gamefic-standard/entities/item.rb +0 -7
  86. data/lib/gamefic-standard/entities/portal.rb +0 -46
  87. data/lib/gamefic-standard/entities/receptacle.rb +0 -5
  88. data/lib/gamefic-standard/entities/room.rb +0 -46
  89. data/lib/gamefic-standard/entities/rubble.rb +0 -12
  90. data/lib/gamefic-standard/entities/scenery.rb +0 -9
  91. data/lib/gamefic-standard/entities/supporter.rb +0 -5
  92. data/lib/gamefic-standard/entities/thing.rb +0 -9
  93. data/lib/gamefic-standard/entities.rb +0 -12
  94. data/lib/gamefic-standard/give.rb +0 -21
  95. data/lib/gamefic-standard/grammar/attributes.rb +0 -37
  96. data/lib/gamefic-standard/grammar/pronoun.rb +0 -101
  97. data/lib/gamefic-standard/grammar.rb +0 -2
  98. data/lib/gamefic-standard/introduction.rb +0 -8
  99. data/lib/gamefic-standard/modules/enterable.rb +0 -9
  100. data/lib/gamefic-standard/modules/lockable.rb +0 -34
  101. data/lib/gamefic-standard/modules/openable.rb +0 -19
  102. data/lib/gamefic-standard/modules/standardized.rb +0 -57
  103. data/lib/gamefic-standard/modules.rb +0 -6
  104. data/lib/gamefic-standard/pathfinder.rb +0 -62
  105. data/lib/gamefic-standard/queries.rb +0 -12
  106. data/spec-opal/spec_helper.rb +0 -32
  107. /data/lib/{gamefic-standard → gamefic/standard}/direction.rb +0 -0
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
4
+ version: 4.0.0
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-09-10 00:00:00.000000000 Z
11
+ date: 2025-01-25 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: gamefic
@@ -16,14 +16,42 @@ dependencies:
16
16
  requirements:
17
17
  - - "~>"
18
18
  - !ruby/object:Gem::Version
19
- version: '3.3'
19
+ version: '4.0'
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.3'
26
+ version: '4.0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: gamefic-grammar
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - "~>"
32
+ - !ruby/object:Gem::Version
33
+ version: '1.1'
34
+ type: :runtime
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - "~>"
39
+ - !ruby/object:Gem::Version
40
+ version: '1.1'
41
+ - !ruby/object:Gem::Dependency
42
+ name: gamefic-what
43
+ requirement: !ruby/object:Gem::Requirement
44
+ requirements:
45
+ - - "~>"
46
+ - !ruby/object:Gem::Version
47
+ version: '2.0'
48
+ type: :runtime
49
+ prerelease: false
50
+ version_requirements: !ruby/object:Gem::Requirement
51
+ requirements:
52
+ - - "~>"
53
+ - !ruby/object:Gem::Version
54
+ version: '2.0'
27
55
  - !ruby/object:Gem::Dependency
28
56
  name: opal
29
57
  requirement: !ruby/object:Gem::Requirement
@@ -117,60 +145,57 @@ files:
117
145
  - bin/setup
118
146
  - gamefic-standard.gemspec
119
147
  - lib/gamefic-standard.rb
120
- - lib/gamefic-standard/actions.rb
121
- - lib/gamefic-standard/actions/attack.rb
122
- - lib/gamefic-standard/actions/close.rb
123
- - lib/gamefic-standard/actions/drop.rb
124
- - lib/gamefic-standard/actions/enter.rb
125
- - lib/gamefic-standard/actions/go.rb
126
- - lib/gamefic-standard/actions/insert.rb
127
- - lib/gamefic-standard/actions/inventory.rb
128
- - lib/gamefic-standard/actions/leave.rb
129
- - lib/gamefic-standard/actions/lock.rb
130
- - lib/gamefic-standard/actions/look.rb
131
- - lib/gamefic-standard/actions/move.rb
132
- - lib/gamefic-standard/actions/nil.rb
133
- - lib/gamefic-standard/actions/open.rb
134
- - lib/gamefic-standard/actions/place.rb
135
- - lib/gamefic-standard/actions/pronouns.rb
136
- - lib/gamefic-standard/actions/quit.rb
137
- - lib/gamefic-standard/actions/repeat.rb
138
- - lib/gamefic-standard/actions/save-restore-undo.rb
139
- - lib/gamefic-standard/actions/search.rb
140
- - lib/gamefic-standard/actions/take.rb
141
- - lib/gamefic-standard/actions/talk.rb
142
- - lib/gamefic-standard/actions/unlock.rb
143
- - lib/gamefic-standard/actions/wait.rb
144
- - lib/gamefic-standard/articles.rb
145
- - lib/gamefic-standard/direction.rb
146
- - lib/gamefic-standard/entities.rb
147
- - lib/gamefic-standard/entities/character.rb
148
- - lib/gamefic-standard/entities/container.rb
149
- - lib/gamefic-standard/entities/door.rb
150
- - lib/gamefic-standard/entities/fixture.rb
151
- - lib/gamefic-standard/entities/item.rb
152
- - lib/gamefic-standard/entities/portal.rb
153
- - lib/gamefic-standard/entities/receptacle.rb
154
- - lib/gamefic-standard/entities/room.rb
155
- - lib/gamefic-standard/entities/rubble.rb
156
- - lib/gamefic-standard/entities/scenery.rb
157
- - lib/gamefic-standard/entities/supporter.rb
158
- - lib/gamefic-standard/entities/thing.rb
159
- - lib/gamefic-standard/give.rb
160
- - lib/gamefic-standard/grammar.rb
161
- - lib/gamefic-standard/grammar/attributes.rb
162
- - lib/gamefic-standard/grammar/pronoun.rb
163
- - lib/gamefic-standard/introduction.rb
164
- - lib/gamefic-standard/modules.rb
165
- - lib/gamefic-standard/modules/enterable.rb
166
- - lib/gamefic-standard/modules/lockable.rb
167
- - lib/gamefic-standard/modules/openable.rb
168
- - lib/gamefic-standard/modules/standardized.rb
169
- - lib/gamefic-standard/pathfinder.rb
170
- - lib/gamefic-standard/queries.rb
171
- - lib/gamefic-standard/version.rb
172
- - spec-opal/spec_helper.rb
173
- homepage: http://gamefic.com
148
+ - lib/gamefic/standard.rb
149
+ - lib/gamefic/standard/actions.rb
150
+ - lib/gamefic/standard/actions/attack.rb
151
+ - lib/gamefic/standard/actions/close.rb
152
+ - lib/gamefic/standard/actions/drop.rb
153
+ - lib/gamefic/standard/actions/enter.rb
154
+ - lib/gamefic/standard/actions/give.rb
155
+ - lib/gamefic/standard/actions/go.rb
156
+ - lib/gamefic/standard/actions/insert.rb
157
+ - lib/gamefic/standard/actions/inventory.rb
158
+ - lib/gamefic/standard/actions/leave.rb
159
+ - lib/gamefic/standard/actions/lock.rb
160
+ - lib/gamefic/standard/actions/look.rb
161
+ - lib/gamefic/standard/actions/mount.rb
162
+ - lib/gamefic/standard/actions/move.rb
163
+ - lib/gamefic/standard/actions/nil.rb
164
+ - lib/gamefic/standard/actions/open.rb
165
+ - lib/gamefic/standard/actions/place.rb
166
+ - lib/gamefic/standard/actions/pronouns.rb
167
+ - lib/gamefic/standard/actions/quit.rb
168
+ - lib/gamefic/standard/actions/repeat.rb
169
+ - lib/gamefic/standard/actions/save-restore-undo.rb
170
+ - lib/gamefic/standard/actions/search.rb
171
+ - lib/gamefic/standard/actions/take.rb
172
+ - lib/gamefic/standard/actions/talk.rb
173
+ - lib/gamefic/standard/actions/unlock.rb
174
+ - lib/gamefic/standard/actions/wait.rb
175
+ - lib/gamefic/standard/articles.rb
176
+ - lib/gamefic/standard/direction.rb
177
+ - lib/gamefic/standard/enterable.rb
178
+ - lib/gamefic/standard/entities.rb
179
+ - lib/gamefic/standard/entities/character.rb
180
+ - lib/gamefic/standard/entities/container.rb
181
+ - lib/gamefic/standard/entities/door.rb
182
+ - lib/gamefic/standard/entities/fixture.rb
183
+ - lib/gamefic/standard/entities/item.rb
184
+ - lib/gamefic/standard/entities/portal.rb
185
+ - lib/gamefic/standard/entities/receptacle.rb
186
+ - lib/gamefic/standard/entities/room.rb
187
+ - lib/gamefic/standard/entities/rubble.rb
188
+ - lib/gamefic/standard/entities/scenery.rb
189
+ - lib/gamefic/standard/entities/supporter.rb
190
+ - lib/gamefic/standard/entities/thing.rb
191
+ - lib/gamefic/standard/introduction.rb
192
+ - lib/gamefic/standard/lockable.rb
193
+ - lib/gamefic/standard/openable.rb
194
+ - lib/gamefic/standard/pathfinder.rb
195
+ - lib/gamefic/standard/queries.rb
196
+ - lib/gamefic/standard/standardized.rb
197
+ - lib/gamefic/standard/version.rb
198
+ homepage: https://gamefic.com
174
199
  licenses:
175
200
  - MIT
176
201
  metadata: {}
@@ -1,28 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gamefic
4
- module Standard
5
- script do
6
- respond :attack do |actor, thing|
7
- actor.tell "Violence is not the answer here."
8
- end
9
-
10
- respond :attack, Thing do |actor, _thing|
11
- actor.execute :attack
12
- end
13
-
14
- interpret 'fight', 'attack'
15
- interpret 'battle', 'attack'
16
- interpret 'kill', 'attack'
17
- interpret 'punch', 'attack'
18
- interpret 'kick', 'attack'
19
- interpret 'hit', 'attack'
20
- interpret 'fight :thing', 'attack :thing'
21
- interpret 'battle :thing', 'attack :thing'
22
- interpret 'kill :thing', 'attack :thing'
23
- interpret 'punch :thing', 'attack :thing'
24
- interpret 'kick :thing', 'attack :thing'
25
- interpret 'hit :thing', 'attack :thing'
26
- end
27
- end
28
- end
@@ -1,18 +0,0 @@
1
- module Gamefic
2
- module Standard
3
- script do
4
- respond :close, available do |actor, thing|
5
- actor.tell "You can't close #{the thing}."
6
- end
7
-
8
- respond :close, available(Openable) do |actor, thing|
9
- if thing.open?
10
- actor.tell "You close #{the thing}."
11
- thing.open = false
12
- else
13
- actor.tell "#{The thing} is already closed."
14
- end
15
- end
16
- end
17
- end
18
- end
@@ -1,24 +0,0 @@
1
- module Gamefic
2
- module Standard
3
- script do
4
- respond :drop, available do |actor, thing|
5
- actor.tell "You're not carrying #{the thing}."
6
- end
7
-
8
- respond :drop, children do |actor, thing|
9
- actor.execute :take, thing
10
- next unless thing.parent == actor
11
- thing.parent = actor.parent
12
- actor.tell "You drop #{the thing}."
13
- end
14
-
15
- respond :drop, children do |actor, thing|
16
- thing.parent = actor.parent
17
- actor.tell "You drop #{the thing}."
18
- end
19
-
20
- interpret "put down :thing", "drop :thing"
21
- interpret "put :thing down", "drop :thing"
22
- end
23
- end
24
- end
@@ -1,36 +0,0 @@
1
- module Gamefic
2
- module Standard
3
- script do
4
- respond :enter, siblings do |actor, thing|
5
- actor.tell "#{The thing} can't accommodate you."
6
- end
7
-
8
- respond :enter, siblings(Enterable, proc(&:enterable?)) do |actor, supporter|
9
- actor.parent = supporter
10
- actor.tell "You get in #{the supporter}."
11
- end
12
-
13
- respond :enter, parent do |actor, container|
14
- actor.tell "You're already in #{the container}."
15
- end
16
-
17
- respond :enter, parent(Supporter) do |actor, supporter|
18
- actor.tell "You're inside #{the supporter} already."
19
- end
20
-
21
- respond :enter, siblings(Container, proc(&:enterable?), proc(&:closed?)) do |actor, container|
22
- actor.tell "#{The container} is closed."
23
- end
24
-
25
- interpret "get on :thing", "enter :thing"
26
- interpret "get in :thing", "enter :thing"
27
- interpret "get inside :thing", "enter :thing"
28
- interpret "sit on :thing", "enter :thing"
29
- interpret "sit in :thing", "enter :thing"
30
- interpret "lie on :thing", "enter :thing"
31
- interpret "lie in :thing", "enter :thing"
32
- interpret "stand on :thing", "enter :thing"
33
- interpret "stand in :thing", "enter :thing"
34
- end
35
- end
36
- end
@@ -1,59 +0,0 @@
1
- module Gamefic
2
- module Standard
3
- script do
4
- respond :go, siblings(Portal) do |actor, portal|
5
- if portal.destination.nil?
6
- actor.tell "That portal leads nowhere."
7
- else
8
- actor.parent = portal.destination
9
- if !portal.direction.nil?
10
- actor.tell "You go #{portal.direction}."
11
- end
12
- actor.execute :look
13
- end
14
- end
15
-
16
- respond :go, plaintext do |actor, text|
17
- if actor.parent == actor.room
18
- actor.tell "I don't see any way to go \"#{text}\" from here."
19
- else
20
- actor.execute :leave
21
- if actor.parent == actor.room
22
- actor.perform "go #{text}"
23
- else
24
- actor.proceed
25
- end
26
- end
27
- end
28
-
29
- respond :go, available(Door) do |actor, door|
30
- actor.execute :open, door unless door.open?
31
- actor.proceed if door.open?
32
- end
33
-
34
- interpret "north", "go north"
35
- interpret "south", "go south"
36
- interpret "west", "go west"
37
- interpret "east", "go east"
38
- interpret "up", "go up"
39
- interpret "down", "go down"
40
- interpret "northwest", "go northwest"
41
- interpret "northeast", "go northeast"
42
- interpret "southwest", "go southwest"
43
- interpret "southeast", "go southeast"
44
-
45
- interpret "n", "go north"
46
- interpret "s", "go south"
47
- interpret "w", "go west"
48
- interpret "e", "go east"
49
- interpret "u", "go up"
50
- interpret "d", "go down"
51
- interpret "nw", "go northwest"
52
- interpret "ne", "go northeast"
53
- interpret "sw", "go southwest"
54
- interpret "se", "go southeast"
55
-
56
- interpret "go to :place", "go :place"
57
- end
58
- end
59
- end
@@ -1,39 +0,0 @@
1
- module Gamefic
2
- module Standard
3
- script do
4
- respond :insert, available, available do |actor, thing, target|
5
- actor.tell "You can't put #{the thing} inside #{the target}."
6
- end
7
-
8
- respond :insert, available, available(Receptacle) do |actor, thing, receptacle|
9
- actor.execute :take, thing unless thing.parent == actor
10
- next unless thing.parent == actor
11
- thing.parent = receptacle
12
- actor.tell "You put #{the thing} in #{the receptacle}."
13
- end
14
-
15
- respond :insert, available, available(Container) do |actor, _thing, container|
16
- if container.open?
17
- actor.proceed
18
- else
19
- actor.tell "#{The container} is closed."
20
- end
21
- end
22
-
23
- interpret "drop :item in :container", "insert :item :container"
24
- interpret "put :item in :container", "insert :item :container"
25
- interpret "place :item in :container", "insert :item :container"
26
- interpret "insert :item in :container", "insert :item :container"
27
-
28
- interpret "drop :item inside :container", "insert :item :container"
29
- interpret "put :item inside :container", "insert :item :container"
30
- interpret "place :item inside :container", "insert :item :container"
31
- interpret "insert :item inside :container", "insert :item :container"
32
-
33
- interpret "drop :item into :container", "insert :item :container"
34
- interpret "put :item into :container", "insert :item :container"
35
- interpret "place :item into :container", "insert :item :container"
36
- interpret "insert :item into :container", "insert :item :container"
37
- end
38
- end
39
- end
@@ -1,15 +0,0 @@
1
- module Gamefic
2
- module Standard
3
- script do
4
- respond :inventory do |actor|
5
- if actor.children.length > 0
6
- actor.tell "You are carrying #{actor.children.join_and}."
7
- else
8
- actor.tell "You aren't carrying anything."
9
- end
10
- end
11
-
12
- interpret "i", "inventory"
13
- end
14
- end
15
- end
@@ -1,50 +0,0 @@
1
- module Gamefic
2
- module Standard
3
- script do
4
- respond :leave, parent do |actor, thing|
5
- actor.tell "There's no way out of #{the thing}."
6
- end
7
-
8
- respond :leave, parent(Enterable, proc(&:enterable?)) do |actor, thing|
9
- actor.tell "You leave #{the thing}."
10
- actor.parent = thing.parent
11
- end
12
-
13
- respond :leave, parent(Supporter, proc(&:enterable?)) do |actor, thing|
14
- actor.tell "You get off #{the thing}."
15
- actor.parent = thing.parent
16
- end
17
-
18
- respond :leave, room do |actor, room|
19
- portals = room.children.that_are(Portal)
20
- if portals.length == 0
21
- actor.tell "You don't see any obvious exits."
22
- elsif portals.length == 1
23
- actor.execute :go, portals[0]
24
- else
25
- actor.tell "I don't know which way you want to go: #{portals.map(&:definitely).join_or}."
26
- end
27
- end
28
-
29
- respond :leave do |actor|
30
- if actor.parent
31
- actor.execute :leave, actor.parent
32
- else
33
- actor.tell "You don't see any obvious exits."
34
- end
35
- end
36
-
37
- respond :leave, parent(Container, proc(&:enterable?), proc(&:closed?)) do |actor, container|
38
- actor.execute :open, container
39
- actor.proceed if container.open?
40
- end
41
-
42
- interpret "exit", "leave"
43
- interpret "exit :supporter", "leave :supporter"
44
- interpret "get on :supporter", "enter :supporter"
45
- interpret "get off :supporter", "leave :supporter"
46
- interpret "get out :container", "leave :container"
47
- interpret "get out of :container", "leave :container"
48
- end
49
- end
50
- end
@@ -1,25 +0,0 @@
1
- module Gamefic
2
- module Standard
3
- script do
4
- respond :lock, available do |actor, thing|
5
- actor.tell "You can't lock #{the thing}."
6
- end
7
-
8
- respond :lock, available(Lockable, proc(&:has_lock_key?)), children do |actor, thing, key|
9
- if thing.lock_key == key
10
- thing.locked = true
11
- actor.tell "You lock ##{the thing} with #{the key}."
12
- else
13
- actor.tell "You can't lock #{the thing} with #{the key}."
14
- end
15
- end
16
-
17
- respond :lock, available(Lockable, proc(&:has_lock_key?)), available do |actor, thing, key|
18
- actor.execute :take, key if key.parent != actor
19
- actor.proceed if key.parent == actor
20
- end
21
-
22
- interpret "lock :container with :key", "lock :container :key"
23
- end
24
- end
25
- end
@@ -1,133 +0,0 @@
1
- module Gamefic
2
- module Standard
3
- script do
4
- respond :look do |actor|
5
- actor.execute :look, actor.room
6
- end
7
-
8
- respond :look, myself do |actor, _|
9
- actor.tell actor.description
10
- actor.execute :inventory
11
- end
12
-
13
- respond :look, available(Thing) do |actor, thing|
14
- actor.tell thing.description
15
- thing.children.that_are(proc(&:attached?)).that_are(proc(&:itemized?)).each do |item|
16
- actor.tell "#{An item} is attached to #{the thing}."
17
- end
18
- end
19
-
20
- respond :look, available(Supporter) do |actor, thing|
21
- itemized = thing.children.that_are_not(proc(&:attached?)).that_are(proc(&:itemized?))
22
- # If the supporter does not have a description but it does contain
23
- # itemized things, avoid saying there's nothing special about it.
24
- actor.proceed if thing.has_description? || itemized.empty?
25
- actor.tell "You see #{itemized.join_and} on #{the thing}." unless itemized.empty?
26
- end
27
-
28
- respond :look, available(Receptacle) do |actor, thing|
29
- actor.proceed
30
- if thing.accessible?
31
- itemized = thing.children.that_are_not(proc(&:attached?)).that_are(proc(&:itemized?))
32
- actor.tell "You see #{itemized.join_and} in #{the thing}." unless itemized.empty?
33
- end
34
- end
35
-
36
- respond :look, parent(Supporter, proc(&:enterable?)) do |actor, supporter|
37
- actor.proceed
38
- actor.tell "You are currently on #{the supporter}."
39
- end
40
-
41
- respond :look, available(Thing, Openable) do |actor, thing|
42
- actor.tell thing.description if thing.has_description?
43
- actor.tell "#{The thing} is #{thing.open? ? 'open' : 'closed'}."
44
- next if thing.closed? || thing.children.empty?
45
-
46
- actor.tell "You see #{thing.children.join_and}."
47
- end
48
-
49
- respond :look, room do |actor, room|
50
- actor.execute :_describe_room
51
- end
52
-
53
- meta :_describe_room do |actor|
54
- next unless actor.room
55
-
56
- actor.tell "<strong>#{actor.room.name.cap_first}</strong>"
57
- actor.tell actor.room.description if actor.room.has_description?
58
- actor.execute :_itemize_room
59
- end
60
-
61
- meta :_itemize_room do |actor|
62
- room = actor.room
63
- next unless room
64
-
65
- with_locales = []
66
- chars = room.children.that_are(Character).that_are(proc(&:itemized?)) - [actor]
67
- charsum = []
68
- chars.each do |char|
69
- if char.locale_description.nil?
70
- charsum.push char
71
- else
72
- with_locales.push char
73
- end
74
- end
75
- if charsum.length > 0
76
- actor.tell "#{charsum.join_and.cap_first} #{charsum.length == 1 ? 'is' : 'are'} here."
77
- end
78
- items = room.children.that_are(proc(&:itemized?)) - [actor] - room.children.that_are(Character) - room.children.that_are(Portal)
79
- itemsum = []
80
- items.each do |item|
81
- if item.locale_description.nil?
82
- itemsum.push item
83
- else
84
- with_locales.push item
85
- end
86
- end
87
- if itemsum.length > 0
88
- actor.tell "You see #{itemsum.join_and}."
89
- end
90
- with_locales.each { |entity|
91
- actor.tell entity.locale_description
92
- }
93
- if room.explicit_exits?
94
- portals = room.children.that_are(Portal).that_are(proc(&:itemized?))
95
- if portals.length > 0
96
- if portals.length == 1
97
- p = portals[0]
98
- actor.tell "There is an exit #{p.instruction}."
99
- else
100
- dirs = []
101
- portals.each do |p|
102
- dirs.push p.instruction
103
- end
104
- order = ['north', 'northeast', 'east', 'southeast', 'south', 'southwest', 'west', 'northwest', 'up', 'down']
105
- dirs.sort! { |a, b| (order.index(a.to_s) || order.length) <=> (order.index(b.to_s) || order.length) }
106
- actor.tell "There are exits #{dirs.join_and(', ')}."
107
- end
108
- end
109
- end
110
- if actor.parent.is_a?(Supporter)
111
- actor.tell "You are on #{the actor.parent}."
112
- actor.parent.children.that_are_not(actor).each { |s|
113
- actor.tell "#{A s} is on #{the actor.parent}."
114
- }
115
- end
116
- end
117
-
118
- interpret 'look around', 'look'
119
- interpret 'look here', 'look'
120
- interpret 'l', 'look'
121
-
122
- interpret 'look at :thing', 'look :thing'
123
- interpret 'look on :thing', 'look :thing'
124
- interpret 'look under :thing', 'look :thing'
125
- interpret 'look beneath :thing', 'look :thing'
126
- interpret 'look around :thing', 'look :thing'
127
- interpret 'l :thing', 'look :thing'
128
- interpret 'examine :thing', 'look :thing'
129
- interpret 'x :thing', 'look :thing'
130
- interpret 'inspect :thing', 'look :thing'
131
- end
132
- end
133
- end
@@ -1,24 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gamefic
4
- module Standard
5
- script do
6
- respond :move, Thing do |actor, thing|
7
- if thing.portable?
8
- actor.tell "Maybe you want to <em>take</em> it?"
9
- else
10
- actor.tell "You can't move #{the thing}."
11
- end
12
- end
13
-
14
- respond :move, children(Thing) do |actor, thing|
15
- actor.tell "You're already carrying #{the thing}."
16
- end
17
-
18
- interpret "push :thing", "move :thing"
19
- interpret "pull :thing", "move :thing"
20
- interpret "drag :thing", "move :thing"
21
- interpret "lift :thing", "move :thing"
22
- end
23
- end
24
- end