gamefic-standard 3.3.0 → 4.0.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (76) hide show
  1. checksums.yaml +4 -4
  2. data/CHANGELOG.md +3 -0
  3. data/Rakefile +6 -3
  4. data/gamefic-standard.gemspec +4 -4
  5. data/lib/{gamefic-standard → gamefic/standard}/actions/drop.rb +2 -2
  6. data/lib/{gamefic-standard → gamefic/standard}/actions/enter.rb +0 -8
  7. data/lib/gamefic/standard/actions/give.rb +38 -0
  8. data/lib/gamefic/standard/actions/look.rb +149 -0
  9. data/lib/gamefic/standard/actions/mount.rb +29 -0
  10. data/lib/gamefic/standard/actions/nil.rb +37 -0
  11. data/lib/{gamefic-standard → gamefic/standard}/actions/place.rb +2 -2
  12. data/lib/{gamefic-standard → gamefic/standard}/actions/pronouns.rb +5 -7
  13. data/lib/gamefic/standard/actions/quit.rb +24 -0
  14. data/lib/gamefic/standard/actions/repeat.rb +28 -0
  15. data/lib/{gamefic-standard → gamefic/standard}/actions/search.rb +9 -9
  16. data/lib/{gamefic-standard → gamefic/standard}/actions/take.rb +2 -1
  17. data/lib/{gamefic-standard → gamefic/standard}/actions/talk.rb +2 -2
  18. data/lib/gamefic/standard/actions.rb +57 -0
  19. data/lib/{gamefic-standard → gamefic/standard}/articles.rb +2 -0
  20. data/lib/gamefic/standard/entities/character.rb +14 -0
  21. data/lib/gamefic/standard/entities/container.rb +16 -0
  22. data/lib/gamefic/standard/entities/door.rb +46 -0
  23. data/lib/gamefic/standard/entities/fixture.rb +8 -0
  24. data/lib/gamefic/standard/entities/item.rb +11 -0
  25. data/lib/gamefic/standard/entities/portal.rb +50 -0
  26. data/lib/gamefic/standard/entities/receptacle.rb +9 -0
  27. data/lib/gamefic/standard/entities/room.rb +55 -0
  28. data/lib/gamefic/standard/entities/rubble.rb +16 -0
  29. data/lib/gamefic/standard/entities/scenery.rb +13 -0
  30. data/lib/gamefic/standard/entities/supporter.rb +9 -0
  31. data/lib/gamefic/standard/entities/thing.rb +9 -0
  32. data/lib/gamefic/standard/entities.rb +18 -0
  33. data/lib/{gamefic-standard → gamefic/standard}/lockable.rb +8 -0
  34. data/lib/{gamefic-standard → gamefic/standard}/openable.rb +2 -2
  35. data/lib/gamefic/standard/queries.rb +24 -0
  36. data/lib/{gamefic-standard → gamefic/standard}/version.rb +1 -1
  37. data/lib/gamefic/standard.rb +32 -0
  38. data/lib/gamefic-standard.rb +1 -34
  39. metadata +58 -56
  40. data/lib/gamefic-standard/actions/give.rb +0 -41
  41. data/lib/gamefic-standard/actions/look.rb +0 -152
  42. data/lib/gamefic-standard/actions/nil.rb +0 -70
  43. data/lib/gamefic-standard/actions/quit.rb +0 -20
  44. data/lib/gamefic-standard/actions/repeat.rb +0 -22
  45. data/lib/gamefic-standard/actions.rb +0 -56
  46. data/lib/gamefic-standard/entities/character.rb +0 -5
  47. data/lib/gamefic-standard/entities/container.rb +0 -8
  48. data/lib/gamefic-standard/entities/door.rb +0 -42
  49. data/lib/gamefic-standard/entities/fixture.rb +0 -4
  50. data/lib/gamefic-standard/entities/item.rb +0 -7
  51. data/lib/gamefic-standard/entities/portal.rb +0 -46
  52. data/lib/gamefic-standard/entities/receptacle.rb +0 -5
  53. data/lib/gamefic-standard/entities/room.rb +0 -61
  54. data/lib/gamefic-standard/entities/rubble.rb +0 -12
  55. data/lib/gamefic-standard/entities/scenery.rb +0 -9
  56. data/lib/gamefic-standard/entities/supporter.rb +0 -5
  57. data/lib/gamefic-standard/entities/thing.rb +0 -5
  58. data/lib/gamefic-standard/entities.rb +0 -12
  59. data/lib/gamefic-standard/queries.rb +0 -12
  60. /data/lib/{gamefic-standard → gamefic/standard}/actions/attack.rb +0 -0
  61. /data/lib/{gamefic-standard → gamefic/standard}/actions/close.rb +0 -0
  62. /data/lib/{gamefic-standard → gamefic/standard}/actions/go.rb +0 -0
  63. /data/lib/{gamefic-standard → gamefic/standard}/actions/insert.rb +0 -0
  64. /data/lib/{gamefic-standard → gamefic/standard}/actions/inventory.rb +0 -0
  65. /data/lib/{gamefic-standard → gamefic/standard}/actions/leave.rb +0 -0
  66. /data/lib/{gamefic-standard → gamefic/standard}/actions/lock.rb +0 -0
  67. /data/lib/{gamefic-standard → gamefic/standard}/actions/move.rb +0 -0
  68. /data/lib/{gamefic-standard → gamefic/standard}/actions/open.rb +0 -0
  69. /data/lib/{gamefic-standard → gamefic/standard}/actions/save-restore-undo.rb +0 -0
  70. /data/lib/{gamefic-standard → gamefic/standard}/actions/unlock.rb +0 -0
  71. /data/lib/{gamefic-standard → gamefic/standard}/actions/wait.rb +0 -0
  72. /data/lib/{gamefic-standard → gamefic/standard}/direction.rb +0 -0
  73. /data/lib/{gamefic-standard → gamefic/standard}/enterable.rb +0 -0
  74. /data/lib/{gamefic-standard → gamefic/standard}/introduction.rb +0 -0
  75. /data/lib/{gamefic-standard → gamefic/standard}/pathfinder.rb +0 -0
  76. /data/lib/{gamefic-standard → gamefic/standard}/standardized.rb +0 -0
@@ -0,0 +1,8 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ class Fixture < Thing
6
+ end
7
+ end
8
+ end
@@ -0,0 +1,11 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ # An entity that is portable by default.
6
+ #
7
+ class Item < Thing
8
+ set_default portable: true
9
+ end
10
+ end
11
+ end
@@ -0,0 +1,50 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ # An entity that provides access from one room to another.
6
+ #
7
+ class Portal < Thing
8
+ # @return [Gamefic::Entity]
9
+ attr_accessor :destination
10
+
11
+ # Get the ordinal direction of this Portal
12
+ # Portals have distinct direction and name properties so games can display a
13
+ # bare compass direction for exits, e.g., "south" vs. "the southern door."
14
+ #
15
+ # A portal's destination can also be nil, in which case it can be referenced
16
+ # in commands by its destination, e.g., "go to the house."
17
+ #
18
+ # @return [Direction, nil]
19
+ attr_reader :direction
20
+
21
+ # Find the portal in the destination that returns to this portal's parent
22
+ #
23
+ # @return [Room, nil]
24
+ def reverse
25
+ return nil if destination.nil?
26
+
27
+ destination.children.that_are(Portal).find do |portal|
28
+ portal.destination == parent
29
+ end
30
+ end
31
+ alias find_reverse reverse
32
+
33
+ def direction=(dir)
34
+ @direction = Direction.find(dir)
35
+ end
36
+
37
+ def name
38
+ @name || direction&.name || destination.name
39
+ end
40
+
41
+ def instruction
42
+ direction || (destination ? "to #{destination.definitely}" : name)
43
+ end
44
+
45
+ def synonyms
46
+ "#{super} #{@destination} #{@direction} #{!direction.nil? ? direction.synonyms : ''}"
47
+ end
48
+ end
49
+ end
50
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ class Receptacle < Thing
6
+ include Gamefic::Standard::Enterable
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,55 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ class Room < Thing
6
+ attr_writer :explicit_exits
7
+
8
+ set_default explicit_exits: true
9
+
10
+ def explicit_exits?
11
+ @explicit_exits
12
+ end
13
+
14
+ def tell(message)
15
+ children.each { |c| c.tell message }
16
+ end
17
+
18
+ # @return [Array<Portal>]
19
+ def portals
20
+ children.that_are(Portal)
21
+ end
22
+
23
+ # @param destination [Room]
24
+ # @param direction [Direction, String, nil]
25
+ # @param type [Class<Portal>]
26
+ # @param two_way [Boolean]
27
+ # @return [Portal, Array<Portal>]
28
+ def connect(destination, direction: nil, type: Portal, two_way: true, **opts)
29
+ direction = Direction.find(direction)
30
+ here = type.new parent: self, destination: destination, direction: Direction.find(direction), **opts
31
+ return here unless two_way
32
+
33
+ there = type.new parent: destination, destination: self, direction: direction&.reverse, **opts
34
+ [here, there]
35
+ end
36
+
37
+ protected
38
+
39
+ %w[north south west east northeast southeast southwest northwest up down].each do |direction|
40
+ define_method "#{direction}=" do |destination|
41
+ connect destination, direction: direction
42
+ end
43
+ end
44
+
45
+ def connect=(destinations)
46
+ all = [destinations].flatten
47
+ until all.empty?
48
+ destination = all.shift
49
+ direction = (all.first.is_a?(String) ? all.shift : nil)
50
+ connect destination, direction: direction
51
+ end
52
+ end
53
+ end
54
+ end
55
+ end
@@ -0,0 +1,16 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gamefic/standard/entities/scenery'
4
+
5
+ module Gamefic
6
+ module Standard
7
+ # Rubble is Scenery with slightly modified action responses.
8
+ # Intended for things that might be portable but are useless.
9
+ # Rule of thumb: Scenery is something that can't be carried,
10
+ # like a table or the sky; and Rubble is something that might
11
+ # be portable but is otherwise useless, like trash or debris.
12
+ #
13
+ class Rubble < Scenery
14
+ end
15
+ end
16
+ end
@@ -0,0 +1,13 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ # Scenery is an entity that is not itemized by default. They're typically used
6
+ # to provide a description for objects that can be observed but do not respond
7
+ # to any other interactions.
8
+ #
9
+ class Scenery < Thing
10
+ set_default itemized: false
11
+ end
12
+ end
13
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ class Supporter < Thing
6
+ include Enterable
7
+ end
8
+ end
9
+ end
@@ -0,0 +1,9 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ Thing = Gamefic::Entity
6
+ Thing.set_default itemized: true, portable: false
7
+ Thing.include Gamefic::Standard::Standardized
8
+ end
9
+ end
@@ -0,0 +1,18 @@
1
+ # frozen_string_literal: true
2
+
3
+ module Gamefic
4
+ module Standard
5
+ require 'gamefic/standard/entities/thing'
6
+ require 'gamefic/standard/entities/character'
7
+ require 'gamefic/standard/entities/fixture'
8
+ require 'gamefic/standard/entities/item'
9
+ require 'gamefic/standard/entities/portal'
10
+ require 'gamefic/standard/entities/door'
11
+ require 'gamefic/standard/entities/receptacle'
12
+ require 'gamefic/standard/entities/container'
13
+ require 'gamefic/standard/entities/room'
14
+ require 'gamefic/standard/entities/scenery'
15
+ require 'gamefic/standard/entities/rubble'
16
+ require 'gamefic/standard/entities/supporter'
17
+ end
18
+ end
@@ -9,6 +9,14 @@ module Gamefic
9
9
 
10
10
  attr_accessor :lock_key
11
11
 
12
+ def lock
13
+ self.locked = true
14
+ end
15
+
16
+ def unlock
17
+ self.locked = false
18
+ end
19
+
12
20
  def locked=(bool)
13
21
  @locked = bool
14
22
  @open = false if @locked
@@ -25,8 +25,8 @@ module Gamefic
25
25
  !open?
26
26
  end
27
27
 
28
- def accessible?
29
- open?
28
+ def accessible
29
+ open? ? children : []
30
30
  end
31
31
  end
32
32
  end
@@ -0,0 +1,24 @@
1
+ module Gamefic
2
+ module Standard
3
+ module Queries
4
+ class RoomQuery < Gamefic::Query::Base
5
+ def span(subject)
6
+ [subject.room].compact
7
+ end
8
+ end
9
+ end
10
+ end
11
+ end
12
+
13
+ # @todo Monkey patch
14
+ module Gamefic
15
+ module Scriptable
16
+ module Queries
17
+ include Gamefic::Standard::Queries
18
+
19
+ def room *args
20
+ RoomQuery.new(Gamefic::Standard::Room, *args, name: 'room')
21
+ end
22
+ end
23
+ end
24
+ end
@@ -2,6 +2,6 @@
2
2
 
3
3
  module Gamefic
4
4
  module Standard
5
- VERSION = '3.3.0'
5
+ VERSION = '4.0.0'
6
6
  end
7
7
  end
@@ -0,0 +1,32 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'gamefic'
4
+ require 'gamefic-grammar'
5
+ require 'gamefic-what'
6
+
7
+ module Gamefic
8
+ # The Gamefic standard library provides a base collection of entities and
9
+ # rules for interactive fiction.
10
+ #
11
+ module Standard
12
+ extend Gamefic::Scriptable
13
+
14
+ require 'gamefic/standard/version'
15
+ require 'gamefic/standard/articles'
16
+ require 'gamefic/standard/queries'
17
+ require 'gamefic/standard/standardized'
18
+ require 'gamefic/standard/enterable'
19
+ require 'gamefic/standard/openable'
20
+ require 'gamefic/standard/lockable'
21
+ require 'gamefic/standard/direction'
22
+ require 'gamefic/standard/entities'
23
+ require 'gamefic/standard/actions'
24
+ require 'gamefic/standard/introduction'
25
+ require 'gamefic/standard/pathfinder'
26
+
27
+ include Articles
28
+ include Grammar::Pronoun
29
+ include Actions
30
+ include Introduction
31
+ end
32
+ end
@@ -1,36 +1,3 @@
1
1
  # frozen_string_literal: true
2
2
 
3
- require 'gamefic'
4
- require 'gamefic-grammar'
5
- require 'gamefic-what'
6
-
7
- module Gamefic
8
- # The Gamefic standard library provides a base collection of entities and
9
- # rules for interactive fiction.
10
- #
11
- module Standard
12
- extend Gamefic::Scriptable
13
-
14
- require 'gamefic-standard/version'
15
- require 'gamefic-standard/articles'
16
- require 'gamefic-standard/queries'
17
- require 'gamefic-standard/standardized'
18
- require 'gamefic-standard/enterable'
19
- require 'gamefic-standard/openable'
20
- require 'gamefic-standard/lockable'
21
- require 'gamefic-standard/direction'
22
- require 'gamefic-standard/entities'
23
- require 'gamefic-standard/actions'
24
- require 'gamefic-standard/introduction'
25
- require 'gamefic-standard/pathfinder'
26
-
27
- include Articles
28
- include Grammar::Pronoun
29
- include Actions
30
- include Introduction
31
-
32
- def connect(origin, destination, direction = nil, type: Portal, two_way: true)
33
- origin.connect destination, direction: direction, type: type, two_way: two_way
34
- end
35
- end
36
- end
3
+ require 'gamefic/standard'
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.3.0
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-10-05 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,42 +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
27
  - !ruby/object:Gem::Dependency
28
28
  name: gamefic-grammar
29
29
  requirement: !ruby/object:Gem::Requirement
30
30
  requirements:
31
31
  - - "~>"
32
32
  - !ruby/object:Gem::Version
33
- version: '1.0'
33
+ version: '1.1'
34
34
  type: :runtime
35
35
  prerelease: false
36
36
  version_requirements: !ruby/object:Gem::Requirement
37
37
  requirements:
38
38
  - - "~>"
39
39
  - !ruby/object:Gem::Version
40
- version: '1.0'
40
+ version: '1.1'
41
41
  - !ruby/object:Gem::Dependency
42
42
  name: gamefic-what
43
43
  requirement: !ruby/object:Gem::Requirement
44
44
  requirements:
45
45
  - - "~>"
46
46
  - !ruby/object:Gem::Version
47
- version: '1.0'
47
+ version: '2.0'
48
48
  type: :runtime
49
49
  prerelease: false
50
50
  version_requirements: !ruby/object:Gem::Requirement
51
51
  requirements:
52
52
  - - "~>"
53
53
  - !ruby/object:Gem::Version
54
- version: '1.0'
54
+ version: '2.0'
55
55
  - !ruby/object:Gem::Dependency
56
56
  name: opal
57
57
  requirement: !ruby/object:Gem::Requirement
@@ -145,54 +145,56 @@ files:
145
145
  - bin/setup
146
146
  - gamefic-standard.gemspec
147
147
  - lib/gamefic-standard.rb
148
- - lib/gamefic-standard/actions.rb
149
- - lib/gamefic-standard/actions/attack.rb
150
- - lib/gamefic-standard/actions/close.rb
151
- - lib/gamefic-standard/actions/drop.rb
152
- - lib/gamefic-standard/actions/enter.rb
153
- - lib/gamefic-standard/actions/give.rb
154
- - lib/gamefic-standard/actions/go.rb
155
- - lib/gamefic-standard/actions/insert.rb
156
- - lib/gamefic-standard/actions/inventory.rb
157
- - lib/gamefic-standard/actions/leave.rb
158
- - lib/gamefic-standard/actions/lock.rb
159
- - lib/gamefic-standard/actions/look.rb
160
- - lib/gamefic-standard/actions/move.rb
161
- - lib/gamefic-standard/actions/nil.rb
162
- - lib/gamefic-standard/actions/open.rb
163
- - lib/gamefic-standard/actions/place.rb
164
- - lib/gamefic-standard/actions/pronouns.rb
165
- - lib/gamefic-standard/actions/quit.rb
166
- - lib/gamefic-standard/actions/repeat.rb
167
- - lib/gamefic-standard/actions/save-restore-undo.rb
168
- - lib/gamefic-standard/actions/search.rb
169
- - lib/gamefic-standard/actions/take.rb
170
- - lib/gamefic-standard/actions/talk.rb
171
- - lib/gamefic-standard/actions/unlock.rb
172
- - lib/gamefic-standard/actions/wait.rb
173
- - lib/gamefic-standard/articles.rb
174
- - lib/gamefic-standard/direction.rb
175
- - lib/gamefic-standard/enterable.rb
176
- - lib/gamefic-standard/entities.rb
177
- - lib/gamefic-standard/entities/character.rb
178
- - lib/gamefic-standard/entities/container.rb
179
- - lib/gamefic-standard/entities/door.rb
180
- - lib/gamefic-standard/entities/fixture.rb
181
- - lib/gamefic-standard/entities/item.rb
182
- - lib/gamefic-standard/entities/portal.rb
183
- - lib/gamefic-standard/entities/receptacle.rb
184
- - lib/gamefic-standard/entities/room.rb
185
- - lib/gamefic-standard/entities/rubble.rb
186
- - lib/gamefic-standard/entities/scenery.rb
187
- - lib/gamefic-standard/entities/supporter.rb
188
- - lib/gamefic-standard/entities/thing.rb
189
- - lib/gamefic-standard/introduction.rb
190
- - lib/gamefic-standard/lockable.rb
191
- - lib/gamefic-standard/openable.rb
192
- - lib/gamefic-standard/pathfinder.rb
193
- - lib/gamefic-standard/queries.rb
194
- - lib/gamefic-standard/standardized.rb
195
- - lib/gamefic-standard/version.rb
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
196
198
  homepage: https://gamefic.com
197
199
  licenses:
198
200
  - MIT
@@ -1,41 +0,0 @@
1
- # frozen_string_literal: true
2
-
3
- module Gamefic
4
- module Standard
5
- module Actions
6
- module Give
7
- extend Gamefic::Scriptable
8
-
9
- include Gamefic::What
10
-
11
- script do
12
- respond :give, available, children do |actor, _character, _gift|
13
- actor.tell 'Nothing happens.'
14
- end
15
-
16
- respond :give, available(Character), available do |actor, character, gift|
17
- actor.tell "#{The character} has no use for #{the gift}."
18
- end
19
-
20
- respond :give, available(Character), available do |actor, _character, gift|
21
- actor.execute :take, gift if gift.parent != actor
22
-
23
- actor.proceed if gift.parent == actor
24
- end
25
-
26
- respond :give, Thing do |actor, thing|
27
- actor.tell "Who do you want to give #{the thing} to?"
28
- actor.ask_for_what "give #{thing} to __what__"
29
- end
30
-
31
- respond :give, Character do |actor, character|
32
- actor.tell "What do you want to give to #{the character}?"
33
- actor.ask_for_what "give __what__ to #{character}"
34
- end
35
-
36
- interpret 'give :gift to :character', 'give :character :gift'
37
- end
38
- end
39
- end
40
- end
41
- end