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.
- checksums.yaml +4 -4
- data/CHANGELOG.md +3 -0
- data/Rakefile +6 -3
- data/gamefic-standard.gemspec +4 -4
- data/lib/{gamefic-standard → gamefic/standard}/actions/drop.rb +2 -2
- data/lib/{gamefic-standard → gamefic/standard}/actions/enter.rb +0 -8
- data/lib/gamefic/standard/actions/give.rb +38 -0
- data/lib/gamefic/standard/actions/look.rb +149 -0
- data/lib/gamefic/standard/actions/mount.rb +29 -0
- data/lib/gamefic/standard/actions/nil.rb +37 -0
- data/lib/{gamefic-standard → gamefic/standard}/actions/place.rb +2 -2
- data/lib/{gamefic-standard → gamefic/standard}/actions/pronouns.rb +5 -7
- data/lib/gamefic/standard/actions/quit.rb +24 -0
- data/lib/gamefic/standard/actions/repeat.rb +28 -0
- data/lib/{gamefic-standard → gamefic/standard}/actions/search.rb +9 -9
- data/lib/{gamefic-standard → gamefic/standard}/actions/take.rb +2 -1
- data/lib/{gamefic-standard → gamefic/standard}/actions/talk.rb +2 -2
- data/lib/gamefic/standard/actions.rb +57 -0
- data/lib/{gamefic-standard → gamefic/standard}/articles.rb +2 -0
- data/lib/gamefic/standard/entities/character.rb +14 -0
- data/lib/gamefic/standard/entities/container.rb +16 -0
- data/lib/gamefic/standard/entities/door.rb +46 -0
- data/lib/gamefic/standard/entities/fixture.rb +8 -0
- data/lib/gamefic/standard/entities/item.rb +11 -0
- data/lib/gamefic/standard/entities/portal.rb +50 -0
- data/lib/gamefic/standard/entities/receptacle.rb +9 -0
- data/lib/gamefic/standard/entities/room.rb +55 -0
- data/lib/gamefic/standard/entities/rubble.rb +16 -0
- data/lib/gamefic/standard/entities/scenery.rb +13 -0
- data/lib/gamefic/standard/entities/supporter.rb +9 -0
- data/lib/gamefic/standard/entities/thing.rb +9 -0
- data/lib/gamefic/standard/entities.rb +18 -0
- data/lib/{gamefic-standard → gamefic/standard}/lockable.rb +8 -0
- data/lib/{gamefic-standard → gamefic/standard}/openable.rb +2 -2
- data/lib/gamefic/standard/queries.rb +24 -0
- data/lib/{gamefic-standard → gamefic/standard}/version.rb +1 -1
- data/lib/gamefic/standard.rb +32 -0
- data/lib/gamefic-standard.rb +1 -34
- metadata +58 -56
- data/lib/gamefic-standard/actions/give.rb +0 -41
- data/lib/gamefic-standard/actions/look.rb +0 -152
- data/lib/gamefic-standard/actions/nil.rb +0 -70
- data/lib/gamefic-standard/actions/quit.rb +0 -20
- data/lib/gamefic-standard/actions/repeat.rb +0 -22
- data/lib/gamefic-standard/actions.rb +0 -56
- data/lib/gamefic-standard/entities/character.rb +0 -5
- data/lib/gamefic-standard/entities/container.rb +0 -8
- data/lib/gamefic-standard/entities/door.rb +0 -42
- data/lib/gamefic-standard/entities/fixture.rb +0 -4
- data/lib/gamefic-standard/entities/item.rb +0 -7
- data/lib/gamefic-standard/entities/portal.rb +0 -46
- data/lib/gamefic-standard/entities/receptacle.rb +0 -5
- data/lib/gamefic-standard/entities/room.rb +0 -61
- data/lib/gamefic-standard/entities/rubble.rb +0 -12
- data/lib/gamefic-standard/entities/scenery.rb +0 -9
- data/lib/gamefic-standard/entities/supporter.rb +0 -5
- data/lib/gamefic-standard/entities/thing.rb +0 -5
- data/lib/gamefic-standard/entities.rb +0 -12
- data/lib/gamefic-standard/queries.rb +0 -12
- /data/lib/{gamefic-standard → gamefic/standard}/actions/attack.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/close.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/go.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/insert.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/inventory.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/leave.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/lock.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/move.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/open.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/save-restore-undo.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/unlock.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/actions/wait.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/direction.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/enterable.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/introduction.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/pathfinder.rb +0 -0
- /data/lib/{gamefic-standard → gamefic/standard}/standardized.rb +0 -0
@@ -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,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,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
|
@@ -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
|
@@ -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
|
data/lib/gamefic-standard.rb
CHANGED
@@ -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:
|
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:
|
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: '
|
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: '
|
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.
|
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.
|
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: '
|
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: '
|
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
|
149
|
-
- lib/gamefic
|
150
|
-
- lib/gamefic
|
151
|
-
- lib/gamefic
|
152
|
-
- lib/gamefic
|
153
|
-
- lib/gamefic
|
154
|
-
- lib/gamefic
|
155
|
-
- lib/gamefic
|
156
|
-
- lib/gamefic
|
157
|
-
- lib/gamefic
|
158
|
-
- lib/gamefic
|
159
|
-
- lib/gamefic
|
160
|
-
- lib/gamefic
|
161
|
-
- lib/gamefic
|
162
|
-
- lib/gamefic
|
163
|
-
- lib/gamefic
|
164
|
-
- lib/gamefic
|
165
|
-
- lib/gamefic
|
166
|
-
- lib/gamefic
|
167
|
-
- lib/gamefic
|
168
|
-
- lib/gamefic
|
169
|
-
- lib/gamefic
|
170
|
-
- lib/gamefic
|
171
|
-
- lib/gamefic
|
172
|
-
- lib/gamefic
|
173
|
-
- lib/gamefic
|
174
|
-
- lib/gamefic
|
175
|
-
- lib/gamefic
|
176
|
-
- lib/gamefic
|
177
|
-
- lib/gamefic
|
178
|
-
- lib/gamefic
|
179
|
-
- lib/gamefic
|
180
|
-
- lib/gamefic
|
181
|
-
- lib/gamefic
|
182
|
-
- lib/gamefic
|
183
|
-
- lib/gamefic
|
184
|
-
- lib/gamefic
|
185
|
-
- lib/gamefic
|
186
|
-
- lib/gamefic
|
187
|
-
- lib/gamefic
|
188
|
-
- lib/gamefic
|
189
|
-
- lib/gamefic
|
190
|
-
- lib/gamefic
|
191
|
-
- lib/gamefic
|
192
|
-
- lib/gamefic
|
193
|
-
- lib/gamefic
|
194
|
-
- lib/gamefic
|
195
|
-
- lib/gamefic
|
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
|