gamefic-standard 2.4.0 → 3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.github/workflows/rspec.yml +41 -40
- data/.rspec-opal +2 -0
- data/CHANGELOG.md +3 -0
- data/Gemfile +2 -0
- data/README.md +64 -60
- data/Rakefile +14 -6
- data/gamefic-standard.gemspec +6 -3
- data/lib/gamefic-standard/actions/attack.rb +28 -0
- data/lib/gamefic-standard/actions/close.rb +14 -10
- data/lib/gamefic-standard/actions/drop.rb +20 -16
- data/lib/gamefic-standard/actions/enter.rb +29 -19
- data/lib/gamefic-standard/actions/go.rb +51 -47
- data/lib/gamefic-standard/actions/help.rb +52 -0
- data/lib/gamefic-standard/actions/insert.rb +33 -29
- data/lib/gamefic-standard/actions/inventory.rb +12 -8
- data/lib/gamefic-standard/actions/leave.rb +43 -39
- data/lib/gamefic-standard/actions/lock.rb +21 -17
- data/lib/gamefic-standard/actions/look.rb +117 -96
- data/lib/gamefic-standard/actions/move.rb +24 -0
- data/lib/gamefic-standard/actions/nil.rb +16 -15
- data/lib/gamefic-standard/actions/open.rb +5 -5
- data/lib/gamefic-standard/actions/place.rb +4 -4
- data/lib/gamefic-standard/actions/quit.rb +4 -8
- data/lib/gamefic-standard/actions/repeat.rb +14 -0
- data/lib/gamefic-standard/actions/save-restore-undo.rb +18 -0
- data/lib/gamefic-standard/actions/search.rb +5 -5
- data/lib/gamefic-standard/actions/take.rb +15 -4
- data/lib/gamefic-standard/actions/talk.rb +16 -4
- data/lib/gamefic-standard/actions/unlock.rb +10 -6
- data/lib/gamefic-standard/actions/wait.rb +3 -1
- data/lib/gamefic-standard/actions.rb +5 -0
- data/lib/gamefic-standard/articles.rb +2 -7
- data/lib/gamefic-standard/direction.rb +2 -3
- data/lib/gamefic-standard/entities/container.rb +2 -0
- data/lib/gamefic-standard/entities/door.rb +2 -0
- data/lib/gamefic-standard/entities/fixture.rb +2 -1
- data/lib/gamefic-standard/entities/item.rb +2 -0
- data/lib/gamefic-standard/entities/portal.rb +2 -0
- data/lib/gamefic-standard/entities/receptacle.rb +2 -0
- data/lib/gamefic-standard/entities/room.rb +21 -36
- data/lib/gamefic-standard/entities/rubble.rb +2 -1
- data/lib/gamefic-standard/entities/scenery.rb +2 -0
- data/lib/gamefic-standard/entities/supporter.rb +2 -0
- data/lib/gamefic-standard/entities/thing.rb +2 -0
- data/lib/gamefic-standard/give.rb +15 -14
- data/lib/gamefic-standard/grammar/pronoun.rb +80 -80
- data/lib/gamefic-standard/introduction.rb +8 -0
- data/lib/gamefic-standard/modules/enterable.rb +2 -0
- data/lib/gamefic-standard/modules/lockable.rb +3 -1
- data/lib/gamefic-standard/modules/standardized.rb +10 -12
- data/lib/gamefic-standard/modules.rb +0 -1
- data/lib/gamefic-standard/queries.rb +7 -20
- data/lib/gamefic-standard/version.rb +1 -1
- data/lib/gamefic-standard.rb +26 -8
- data/spec-opal/spec_helper.rb +32 -0
- metadata +33 -13
- data/lib/gamefic-standard/modules/use.rb +0 -45
- data/lib/gamefic-standard/test.rb +0 -34
@@ -1,35 +1,39 @@
|
|
1
|
-
Gamefic
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
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
|
12
14
|
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
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
|
20
22
|
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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"
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
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"
|
30
32
|
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
|
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
|
35
39
|
end
|
@@ -1,11 +1,15 @@
|
|
1
|
-
Gamefic
|
2
|
-
|
3
|
-
|
4
|
-
|
5
|
-
|
6
|
-
|
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"
|
7
13
|
end
|
8
14
|
end
|
9
|
-
|
10
|
-
interpret "i", "inventory"
|
11
15
|
end
|
@@ -1,46 +1,50 @@
|
|
1
|
-
Gamefic
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
respond :leave, parent(Enterable, proc(&:enterable?)) do |actor, thing|
|
9
|
+
actor.tell "You leave #{the thing}."
|
10
|
+
actor.parent = thing.parent
|
11
|
+
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
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
|
15
17
|
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
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.join_or}."
|
26
|
+
end
|
27
|
+
end
|
26
28
|
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
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
|
34
36
|
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
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
|
39
41
|
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
45
|
-
|
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
|
46
50
|
end
|
@@ -1,21 +1,25 @@
|
|
1
|
-
Gamefic
|
2
|
-
|
3
|
-
|
4
|
-
|
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
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
|
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
|
14
16
|
|
15
|
-
|
16
|
-
|
17
|
-
|
18
|
-
|
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
|
19
21
|
|
20
|
-
|
22
|
+
interpret "lock :container with :key", "lock :container :key"
|
23
|
+
end
|
24
|
+
end
|
21
25
|
end
|
@@ -1,112 +1,133 @@
|
|
1
|
-
Gamefic
|
2
|
-
|
3
|
-
|
4
|
-
|
1
|
+
module Gamefic
|
2
|
+
module Standard
|
3
|
+
script do
|
4
|
+
respond :look do |actor, _|
|
5
|
+
actor.execute :look, actor.room
|
6
|
+
end
|
5
7
|
|
6
|
-
|
7
|
-
|
8
|
-
|
9
|
-
|
8
|
+
respond :look, myself do |actor, _|
|
9
|
+
actor.tell actor.description
|
10
|
+
actor.execute :inventory
|
11
|
+
end
|
10
12
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
|
16
|
-
|
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
|
17
19
|
|
18
|
-
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
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
|
25
27
|
|
26
|
-
|
27
|
-
|
28
|
-
|
29
|
-
|
30
|
-
|
31
|
-
|
32
|
-
|
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
|
33
35
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
36
|
+
respond :look, parent(Supporter, proc(&:enterable?)) do |actor, supporter|
|
37
|
+
actor.proceed
|
38
|
+
actor.tell "You are currently on #{the supporter}."
|
39
|
+
end
|
38
40
|
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
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?
|
43
45
|
|
44
|
-
|
45
|
-
|
46
|
-
actor.tell room.description if room.has_description?
|
47
|
-
actor.execute :_itemize_room
|
48
|
-
end
|
46
|
+
actor.tell "You see #{thing.children.join_and}."
|
47
|
+
end
|
49
48
|
|
50
|
-
|
51
|
-
|
52
|
-
next if room.nil?
|
53
|
-
with_locales = []
|
54
|
-
chars = room.children.that_are(Character).that_are(:itemized?) - [actor]
|
55
|
-
charsum = []
|
56
|
-
chars.each do |char|
|
57
|
-
if char.locale_description.nil?
|
58
|
-
charsum.push char
|
59
|
-
else
|
60
|
-
with_locales.push char
|
49
|
+
respond :look, room do |actor, room|
|
50
|
+
actor.execute :_describe_room
|
61
51
|
end
|
62
|
-
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
if item.locale_description.nil?
|
70
|
-
itemsum.push item
|
71
|
-
else
|
72
|
-
with_locales.push item
|
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
|
73
59
|
end
|
74
|
-
|
75
|
-
|
76
|
-
|
77
|
-
|
78
|
-
|
79
|
-
|
80
|
-
|
81
|
-
|
82
|
-
|
83
|
-
|
84
|
-
|
85
|
-
|
86
|
-
|
87
|
-
|
88
|
-
|
89
|
-
|
90
|
-
|
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
|
91
85
|
end
|
92
|
-
|
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
|
+
}
|
93
115
|
end
|
94
116
|
end
|
95
|
-
end
|
96
|
-
if actor.parent.is_a?(Supporter)
|
97
|
-
actor.tell "You are on #{the actor.parent}."
|
98
|
-
actor.parent.children.that_are_not(actor).each { |s|
|
99
|
-
actor.tell "#{A s} is on #{the actor.parent}."
|
100
|
-
}
|
101
|
-
end
|
102
|
-
end
|
103
117
|
|
104
|
-
|
105
|
-
|
106
|
-
|
118
|
+
interpret 'look around', 'look'
|
119
|
+
interpret 'look here', 'look'
|
120
|
+
interpret 'l', 'look'
|
107
121
|
|
108
|
-
|
109
|
-
|
110
|
-
|
111
|
-
|
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
|
112
133
|
end
|
@@ -0,0 +1,24 @@
|
|
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
|
@@ -1,23 +1,24 @@
|
|
1
|
-
Gamefic.script do
|
2
|
-
meta nil,
|
3
|
-
words = string.
|
4
|
-
|
5
|
-
list
|
6
|
-
if list.include?(words[0])
|
1
|
+
Gamefic::Standard.script do
|
2
|
+
meta nil, plaintext do |actor, string|
|
3
|
+
words = string.keywords
|
4
|
+
list = actor.epic.synonyms
|
5
|
+
if list.include?(words[0].to_sym)
|
7
6
|
if words.length > 1
|
8
|
-
found =
|
7
|
+
found = []
|
8
|
+
avail = available(ambiguous: true)
|
9
|
+
result = avail.query(actor, words[1..-1].join(' '))
|
10
|
+
until result.match.nil?
|
11
|
+
found.concat result.match
|
12
|
+
result = avail.query(actor, result.remainder)
|
13
|
+
end
|
9
14
|
if found.empty?
|
10
|
-
|
11
|
-
|
12
|
-
|
13
|
-
actor.tell %(I recognize "#{words[0]}" as a verb but don't know what you mean by "#{words[1..-1].join(' ')}.")
|
14
|
-
else
|
15
|
-
actor.tell %(I recognize "#{words[0]}" as a verb but could not understand the rest of your sentence.)
|
16
|
-
end
|
15
|
+
actor.tell %(I recognize "#{words[0]}" as a verb but don't know what you mean by "#{words[1..-1].join(' ')}.")
|
16
|
+
elsif result.remainder != ''
|
17
|
+
actor.tell %(I recognize "#{words[0]}" as a verb but was confused by "#{result.remainder}.")
|
17
18
|
elsif found.one?
|
18
19
|
actor.tell %(I recognize "#{words[0]}" and "#{found.first.name}" but could not understand them together.)
|
19
20
|
else
|
20
|
-
actor.tell %(I'm not sure if "#{words[1..-1].join(' ')}" means #{found.map(&:definitely).join_or}.)
|
21
|
+
actor.tell %(I recognize "#{words[0]} I'm not sure if "#{words[1..-1].join(' ')}" means #{found.map(&:definitely).join_or}.)
|
21
22
|
end
|
22
23
|
else
|
23
24
|
actor.tell %(I recognize "#{words[0]}" as a verb but could not understand it in this context.)
|
@@ -1,9 +1,9 @@
|
|
1
|
-
Gamefic.script do
|
2
|
-
respond :open,
|
1
|
+
Gamefic::Standard.script do
|
2
|
+
respond :open, available do |actor, thing|
|
3
3
|
actor.tell "You can't open #{the thing}."
|
4
4
|
end
|
5
5
|
|
6
|
-
respond :open,
|
6
|
+
respond :open, available(Openable) do |actor, thing|
|
7
7
|
if thing.open?
|
8
8
|
actor.tell "#{The thing} is already open."
|
9
9
|
else
|
@@ -12,7 +12,7 @@ Gamefic.script do
|
|
12
12
|
end
|
13
13
|
end
|
14
14
|
|
15
|
-
respond :open,
|
15
|
+
respond :open, available(Lockable) do |actor, thing|
|
16
16
|
if thing.locked?
|
17
17
|
actor.tell "#{The thing} is locked."
|
18
18
|
else
|
@@ -20,7 +20,7 @@ Gamefic.script do
|
|
20
20
|
end
|
21
21
|
end
|
22
22
|
|
23
|
-
respond :open,
|
23
|
+
respond :open, available(Lockable, proc(&:has_lock_key?)), available do |actor, thing, key|
|
24
24
|
actor.execute :unlock, thing, key
|
25
25
|
actor.execute :open, thing if thing.unlocked?
|
26
26
|
end
|
@@ -1,16 +1,16 @@
|
|
1
|
-
Gamefic.script do
|
2
|
-
respond :place,
|
1
|
+
Gamefic::Standard.script do
|
2
|
+
respond :place, children, available do |actor, thing, supporter|
|
3
3
|
actor.tell "You can't put #{the thing} on #{the supporter}."
|
4
4
|
end
|
5
5
|
|
6
|
-
respond :place,
|
6
|
+
respond :place, available, available(Supporter) do |actor, thing, supporter|
|
7
7
|
actor.execute :take, thing unless thing.parent == actor
|
8
8
|
next unless thing.parent == actor
|
9
9
|
thing.parent = supporter
|
10
10
|
actor.tell "You put #{the thing} on #{the supporter}."
|
11
11
|
end
|
12
12
|
|
13
|
-
respond :place,
|
13
|
+
respond :place, children, available(Supporter) do |actor, thing, supporter|
|
14
14
|
thing.parent = supporter
|
15
15
|
actor.tell "You put #{the thing} on #{the supporter}."
|
16
16
|
end
|
@@ -1,14 +1,10 @@
|
|
1
|
-
Gamefic.script do
|
2
|
-
|
3
|
-
if
|
4
|
-
actor.cue default_conclusion
|
5
|
-
else
|
6
|
-
actor.cue default_scene
|
7
|
-
end
|
1
|
+
Gamefic::Standard.script do
|
2
|
+
yes_or_no :standard_confirm_quit do |actor, props|
|
3
|
+
actor.cue :default_conclusion if props.yes?
|
8
4
|
end
|
9
5
|
|
10
6
|
meta :quit do |actor|
|
11
7
|
actor.tell "Are you sure you want to quit?"
|
12
|
-
actor.cue
|
8
|
+
actor.cue :standard_confirm_quit
|
13
9
|
end
|
14
10
|
end
|
@@ -0,0 +1,14 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gamefic::Standard.script do
|
4
|
+
respond :repeat do |actor|
|
5
|
+
if actor.last_input && !actor.last_input.empty?
|
6
|
+
actor.tell "Repeating <kbd>\"#{actor.last_input}\"</kbd>..."
|
7
|
+
actor.queue.push actor.last_input
|
8
|
+
else
|
9
|
+
actor.tell "You don't have a previous command to repeat right now."
|
10
|
+
end
|
11
|
+
end
|
12
|
+
|
13
|
+
interpret 'again', 'repeat'
|
14
|
+
end
|
@@ -0,0 +1,18 @@
|
|
1
|
+
# frozen_string_literal: true
|
2
|
+
|
3
|
+
Gamefic::Standard.script do
|
4
|
+
# Save, Restore, and Undo need to be handled by the game client. They have
|
5
|
+
# default implementations here to make them available in help.
|
6
|
+
|
7
|
+
respond :save do |actor|
|
8
|
+
actor.tell "<kbd>Save</kbd> is not available."
|
9
|
+
end
|
10
|
+
|
11
|
+
respond :restore do |actor|
|
12
|
+
actor.tell "<kbd>Restore</kbd> is not available."
|
13
|
+
end
|
14
|
+
|
15
|
+
respond :undo do |actor|
|
16
|
+
actor.tell "<kbd>Undo</kbd> is not available."
|
17
|
+
end
|
18
|
+
end
|