gamefic 0.2.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
Files changed (128) hide show
  1. checksums.yaml +4 -4
  2. data/lib/gamefic/action.rb +87 -56
  3. data/lib/gamefic/ansi.rb +55 -0
  4. data/lib/gamefic/character.rb +130 -76
  5. data/lib/gamefic/command.rb +19 -0
  6. data/lib/gamefic/core_ext/array.rb +51 -40
  7. data/lib/gamefic/core_ext/string.rb +4 -0
  8. data/lib/gamefic/describable.rb +108 -46
  9. data/lib/gamefic/direction.rb +46 -0
  10. data/lib/gamefic/director/delegate.rb +91 -0
  11. data/lib/gamefic/director/order.rb +10 -0
  12. data/lib/gamefic/director/parser.rb +119 -0
  13. data/lib/gamefic/director.rb +16 -197
  14. data/lib/gamefic/engine/cgi.rb +221 -0
  15. data/lib/gamefic/engine/tty.rb +237 -0
  16. data/lib/gamefic/engine.rb +88 -67
  17. data/lib/gamefic/entity.rb +96 -69
  18. data/lib/gamefic/grammar/conjugator.rb +20 -0
  19. data/lib/gamefic/grammar/gender.rb +11 -0
  20. data/lib/gamefic/grammar/person.rb +10 -0
  21. data/lib/gamefic/grammar/plural.rb +13 -0
  22. data/lib/gamefic/grammar/pronouns.rb +60 -0
  23. data/lib/gamefic/grammar/tense.rb +6 -0
  24. data/lib/gamefic/grammar/verb_set.rb +43 -0
  25. data/lib/gamefic/grammar/verbs.rb +25 -0
  26. data/lib/gamefic/grammar/word_adapter.rb +36 -0
  27. data/lib/gamefic/grammar.rb +13 -0
  28. data/lib/gamefic/html.rb +53 -0
  29. data/lib/gamefic/keywords.rb +51 -33
  30. data/lib/gamefic/node.rb +65 -58
  31. data/lib/gamefic/plot/article_mount.rb +22 -0
  32. data/lib/gamefic/plot/command_mount.rb +88 -0
  33. data/lib/gamefic/plot/entity_mount.rb +45 -0
  34. data/lib/gamefic/plot/query_mount.rb +9 -0
  35. data/lib/gamefic/plot/scene_mount.rb +181 -0
  36. data/lib/gamefic/plot/you_mount.rb +22 -0
  37. data/lib/gamefic/plot.rb +296 -247
  38. data/lib/gamefic/query/ambiguous_children.rb +5 -0
  39. data/lib/gamefic/query/base.rb +265 -0
  40. data/lib/gamefic/query/children.rb +10 -0
  41. data/lib/gamefic/query/expression.rb +47 -0
  42. data/lib/gamefic/query/family.rb +10 -0
  43. data/lib/gamefic/query/many_children.rb +7 -0
  44. data/lib/gamefic/query/matches.rb +11 -0
  45. data/lib/gamefic/query/parent.rb +10 -0
  46. data/lib/gamefic/query/plural_children.rb +14 -0
  47. data/lib/gamefic/query/self.rb +10 -0
  48. data/lib/gamefic/query/siblings.rb +10 -0
  49. data/lib/gamefic/query/text.rb +43 -0
  50. data/lib/gamefic/query.rb +19 -203
  51. data/lib/gamefic/rule.rb +18 -0
  52. data/lib/gamefic/scene/active.rb +25 -0
  53. data/lib/gamefic/scene/concluded.rb +22 -0
  54. data/lib/gamefic/scene/multiplechoice.rb +74 -0
  55. data/lib/gamefic/scene/paused.rb +26 -0
  56. data/lib/gamefic/scene/yesorno.rb +43 -0
  57. data/lib/gamefic/scene.rb +125 -0
  58. data/lib/gamefic/script/base.rb +33 -0
  59. data/lib/gamefic/script/file.rb +14 -0
  60. data/lib/gamefic/script/text.rb +14 -0
  61. data/lib/gamefic/script.rb +9 -0
  62. data/lib/gamefic/serialized.rb +24 -0
  63. data/lib/gamefic/shell.rb +9 -247
  64. data/lib/gamefic/snapshots.rb +134 -0
  65. data/lib/gamefic/source/base.rb +12 -0
  66. data/lib/gamefic/source/file.rb +23 -0
  67. data/lib/gamefic/source/text.rb +16 -0
  68. data/lib/gamefic/source.rb +9 -0
  69. data/lib/gamefic/stage.rb +75 -0
  70. data/lib/gamefic/syntax.rb +106 -124
  71. data/lib/gamefic/tester.rb +20 -0
  72. data/lib/gamefic/version.rb +3 -0
  73. data/lib/gamefic.rb +18 -12
  74. metadata +102 -70
  75. data/lib/gamefic/base.rb +0 -10
  76. data/lib/gamefic/before.rb +0 -12
  77. data/lib/gamefic/import/basics/actions/close.rb +0 -16
  78. data/lib/gamefic/import/basics/actions/commands.rb +0 -3
  79. data/lib/gamefic/import/basics/actions/drop-in.rb +0 -17
  80. data/lib/gamefic/import/basics/actions/drop-on.rb +0 -16
  81. data/lib/gamefic/import/basics/actions/drop.rb +0 -30
  82. data/lib/gamefic/import/basics/actions/enter.rb +0 -16
  83. data/lib/gamefic/import/basics/actions/go.rb +0 -35
  84. data/lib/gamefic/import/basics/actions/inventory.rb +0 -8
  85. data/lib/gamefic/import/basics/actions/leave.rb +0 -29
  86. data/lib/gamefic/import/basics/actions/look-in-at.rb +0 -27
  87. data/lib/gamefic/import/basics/actions/look-under.rb +0 -3
  88. data/lib/gamefic/import/basics/actions/look.rb +0 -71
  89. data/lib/gamefic/import/basics/actions/nil.rb +0 -25
  90. data/lib/gamefic/import/basics/actions/open.rb +0 -23
  91. data/lib/gamefic/import/basics/actions/quit.rb +0 -3
  92. data/lib/gamefic/import/basics/actions/take.rb +0 -107
  93. data/lib/gamefic/import/basics/entities/container.rb +0 -8
  94. data/lib/gamefic/import/basics/entities/entity.rb +0 -11
  95. data/lib/gamefic/import/basics/entities/fixture.rb +0 -5
  96. data/lib/gamefic/import/basics/entities/item.rb +0 -5
  97. data/lib/gamefic/import/basics/entities/portal.rb +0 -40
  98. data/lib/gamefic/import/basics/entities/room.rb +0 -30
  99. data/lib/gamefic/import/basics/entities/scenery.rb +0 -5
  100. data/lib/gamefic/import/basics/entities/supporter.rb +0 -6
  101. data/lib/gamefic/import/basics/entities/thing.rb +0 -16
  102. data/lib/gamefic/import/basics/queries/reachable.rb +0 -38
  103. data/lib/gamefic/import/basics/queries/room.rb +0 -8
  104. data/lib/gamefic/import/basics/queries/visible.rb +0 -32
  105. data/lib/gamefic/import/basics/rules/has-enough-light.rb +0 -14
  106. data/lib/gamefic/import/basics.old/actions/container.rb +0 -112
  107. data/lib/gamefic/import/basics.old/actions/inventory.rb +0 -50
  108. data/lib/gamefic/import/basics.old/actions/look.rb +0 -53
  109. data/lib/gamefic/import/basics.old/actions/meta.rb +0 -6
  110. data/lib/gamefic/import/basics.old/actions/traversal.rb +0 -35
  111. data/lib/gamefic/import/basics.old/actions.rb +0 -1
  112. data/lib/gamefic/import/basics.old/entities/container.rb +0 -3
  113. data/lib/gamefic/import/basics.old/entities/fixture.rb +0 -3
  114. data/lib/gamefic/import/basics.old/entities/item.rb +0 -3
  115. data/lib/gamefic/import/basics.old/entities/portal.rb +0 -43
  116. data/lib/gamefic/import/basics.old/entities/room.rb +0 -27
  117. data/lib/gamefic/import/basics.old/entities/scenery.rb +0 -3
  118. data/lib/gamefic/import/basics.old/entities/supporter.rb +0 -3
  119. data/lib/gamefic/import/basics.old/entities.rb +0 -1
  120. data/lib/gamefic/import/basics.old/room_modes.rb +0 -48
  121. data/lib/gamefic/import/basics.rb +0 -6
  122. data/lib/gamefic/import/room_modes.rb +0 -48
  123. data/lib/gamefic/import/standard.rb +0 -1
  124. data/lib/gamefic/meta.rb +0 -12
  125. data/lib/gamefic/optionset.rb +0 -114
  126. data/lib/gamefic/requirement.rb +0 -14
  127. data/lib/gamefic/story.rb +0 -14
  128. data/lib/gamefic/thing.rb +0 -7
@@ -1,134 +1,116 @@
1
+ require 'gamefic/command'
2
+
1
3
  module Gamefic
2
4
 
3
- class Syntax
4
- attr_reader :template, :command, :arguments
5
- @@defaults = Array.new
6
- def initialize(story, *arguments)
7
- if arguments.length < 2
8
- raise "Syntax.new requires at least two arguments (template and command)"
9
- end
10
- if arguments.length == 2 and arguments[0].kind_of?(Array) and arguments[1].kind_of?(Array)
11
- @template = arguments[0]
12
- @command = arguments[1].shift
13
- @arguments = arguments[1]
5
+ class Syntax
6
+ attr_reader :token_count, :first_word, :verb, :template, :command
7
+ @@phrase = '([\w\W\s\S]*?)'
8
+
9
+ def initialize plot, template, *command
10
+ command = command.join(' ')
11
+ words = template.split_words
12
+ @token_count = words.length
13
+ command_words = command.split_words
14
+ @verb = nil
15
+ if words[0][0] == ':'
16
+ @token_count -= 1
17
+ @first_word = ''
14
18
  else
15
- @template = []
16
- string = arguments.shift
17
- string.split_words.each { |word|
18
- if word[0,1] == ":"
19
- @template.push word[1..-1].to_sym
19
+ @verb = command_words[0].to_sym if !command_words[0].nil?
20
+ @first_word = words[0].to_s
21
+ end
22
+ @command = command_words.join(' ')
23
+ @template = words.join(' ')
24
+ tokens = []
25
+ variable_tokens = []
26
+ last_token_is_reg = false
27
+ words.each { |w|
28
+ if w.match(/^:[a-z0-9_]+$/i)
29
+ variable_tokens.push w
30
+ if last_token_is_reg
31
+ next
20
32
  else
21
- @template.push word
33
+ tokens.push @@phrase
34
+ last_token_is_reg = true
22
35
  end
23
- }
24
- #@template = arguments.shift
25
- @command = arguments.shift
26
- @arguments = arguments
27
- if story == nil
28
- #@@defaults.push self
29
- raise "Default syntaxes are deprecated"
30
36
  else
31
- story.send :add_syntax, self
32
- @story = story
37
+ tokens.push w
38
+ last_token_is_reg = false
39
+ end
40
+ }
41
+ subs = []
42
+ index = 0
43
+ command_words.each { |t|
44
+ if t[0] == ':'
45
+ index = variable_tokens.index(t) + 1
46
+ subs.push "{$#{index}}"
47
+ else
48
+ subs.push t
33
49
  end
50
+ }
51
+ @replace = subs.join(' ')
52
+ @regexp = Regexp.new("^#{tokens.join(' ')}$", Regexp::IGNORECASE)
53
+ if !plot.nil?
54
+ plot.send :add_syntax, self
34
55
  end
35
- end
36
- def self.defaults
37
- @@defaults.clone
38
- end
39
- def self.match(input, context)
40
- # Given the input, return all the syntaxes that potentially match it.
41
- syntaxes = (context.kind_of?(Plot) ? context.syntaxes : context)
42
- matches = Array.new
43
- words = input.split_words
44
- syntaxes.each { |syntax|
45
- input_words = words.clone
46
- tokens = Hash.new
47
- syntax_words = syntax.template.clone
48
- while syntax_words.length > 0
49
- if input_words.length == 0
50
- # No more input. Break with an imbalance.
51
- break
52
- end
53
- symbol = syntax_words.shift
54
- if symbol.kind_of?(Symbol)
55
- if syntax_words.length == 0
56
- # Last syntax word.
57
- tokens[symbol] = input_words.join(' ')
58
- input_words.clear
59
- break
60
- elsif input_words.length == 0
61
- # Last input word.
62
- break
63
- else
64
- non_vars = syntax_words.clone.delete_if { |w|
65
- w.kind_of?(Symbol)
66
- }
67
- if non_vars.length == 0
68
- # All remaining words in the syntax are variables. Dump everything now.
69
- tokens[symbol] = input_words.join(' ')
70
- syntax_words.clear
71
- input_words.clear
72
- else
73
- next_syntax_word = syntax_words.shift
74
- token = ''
75
- if syntax_words.length == 0
76
- last_input_word = input_words.pop
77
- if last_input_word == next_syntax_word
78
- tokens[symbol] = input_words.join(' ')
79
- input_words.clear
80
- end
81
- break
82
- end
83
- next_input_word = input_words.shift
84
- while next_input_word != next_syntax_word and input_words.length > 0
85
- token = token + " #{next_input_word}"
86
- next_input_word = input_words.shift
87
- end
88
- if input_words.length == 0 and syntax_words.length > 0
89
- break
90
- else
91
- tokens[symbol] = token.strip
92
- end
93
- end
94
- end
95
- else
96
- if input_words[0].downcase == symbol.downcase
97
- input_words.shift
98
- else
99
- break
100
- end
101
- end
102
- end
103
- if input_words.length == 0 and syntax_words.length == 0
104
- arguments = Array.new
105
- syntax.arguments.each { |a|
106
- if a.kind_of?(Symbol)
107
- if tokens[a] != nil and tokens[a] != ''
108
- arguments.push(tokens[a])
109
- end
110
- else
111
- if a != nil and a != ''
112
- arguments.push(a)
113
- end
114
- end
115
- }
116
- if syntax.arguments.length == arguments.length
117
- matches.push CommandHandler.new(syntax.command, arguments)
118
- end
119
- end
120
- }
121
- matches.uniq! # TODO: Is this necessary?
122
- return matches
123
- end
124
- end
125
-
126
- class CommandHandler
127
- attr_reader :command, :arguments
128
- def initialize command, arguments
129
- @command = command
130
- @arguments = arguments
131
- end
132
- end
56
+ end
57
+
58
+ # Convert a String into a Command.
59
+ #
60
+ # @param text [String]
61
+ # @return [Command]
62
+ def tokenize text
63
+ m = text.match(@regexp)
64
+ return nil if m.nil?
65
+ arguments = []
66
+ @replace.to_s.split_words.each { |r|
67
+ if r.match(/^\{\$[0-9]+\}$/)
68
+ arguments.push m[r[2..-2].to_i]
69
+ else
70
+ arguments.push r
71
+ end
72
+ }
73
+ Command.new @verb, arguments
74
+ end
75
+
76
+ # Get a signature that identifies the form of the Syntax.
77
+ # Signatures are used to compare Syntaxes to each other.
78
+ #
79
+ def signature
80
+ [@regexp, @replace]
81
+ end
82
+
83
+ def ==(other)
84
+ signature == other.signature
85
+ end
86
+
87
+ # Tokenize an Array of Commands from the specified text.
88
+ #
89
+ # @param text [String] The text to tokenize.
90
+ # @param syntaxes [Array<Syntax>] The Syntaxes to use.
91
+ # @return [Array<Command>] The tokenized commands.
92
+ def self.tokenize text, syntaxes
93
+ matches = []
94
+ syntaxes.each { |syntax|
95
+ result = syntax.tokenize text
96
+ matches.push(result) if !result.nil?
97
+ }
98
+ # Sort matches having the most populated arguments first
99
+ matches.sort! { |a, b|
100
+ ca = 0
101
+ cb = 0
102
+ a.arguments.each { |t|
103
+ break if t.nil?
104
+ ca += 1
105
+ }
106
+ b.arguments.each { |t|
107
+ break if t.nil?
108
+ cb += 1
109
+ }
110
+ cb <=> ca
111
+ }
112
+ matches
113
+ end
114
+ end
133
115
 
134
116
  end
@@ -0,0 +1,20 @@
1
+ module Gamefic
2
+
3
+ module Tester
4
+ def test_procs
5
+ @test_procs ||= Hash.new
6
+ end
7
+ def on_test name = :me, &block
8
+ test_procs[name] = block
9
+ end
10
+ def run_test name, actor
11
+ queue = []
12
+ actor.plot.stage actor, queue, &test_procs[name]
13
+ actor[:test_queue] = queue
14
+ actor[:test_queue_length] = queue.length
15
+ actor[:test_queue_scene] = actor.scene
16
+ actor[:testing] = true
17
+ end
18
+ end
19
+
20
+ end
@@ -0,0 +1,3 @@
1
+ module Gamefic
2
+ VERSION = '0.6.0'
3
+ end
data/lib/gamefic.rb CHANGED
@@ -1,17 +1,23 @@
1
- require "gamefic/core_ext/array"
2
- require "gamefic/core_ext/string"
3
- require "gamefic/optionset"
4
- require "gamefic/keywords"
5
- require "gamefic/entity"
6
- require "gamefic/thing"
7
- require "gamefic/character"
1
+ require 'gamefic/core_ext/array'
2
+ require 'gamefic/core_ext/string'
3
+
4
+ require 'gamefic/grammar'
5
+ require 'gamefic/keywords'
6
+ require 'gamefic/serialized'
7
+ require 'gamefic/entity'
8
+ require 'gamefic/character'
9
+ require "gamefic/scene"
10
+ require "gamefic/scene/active"
11
+ require "gamefic/scene/concluded"
12
+ require "gamefic/scene/paused"
13
+ require "gamefic/scene/multiplechoice"
14
+ require "gamefic/scene/yesorno"
15
+ require "gamefic/query"
8
16
  require "gamefic/action"
9
- require "gamefic/before"
10
- require "gamefic/meta"
11
- require "gamefic/requirement"
12
17
  require "gamefic/syntax"
13
- require "gamefic/query"
18
+ require "gamefic/rule"
14
19
  require "gamefic/director"
15
20
  require "gamefic/plot"
16
- require "gamefic/story"
17
21
  require "gamefic/engine"
22
+ require "gamefic/direction"
23
+ require "gamefic/snapshots"
metadata CHANGED
@@ -1,16 +1,44 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamefic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2014-06-02 00:00:00.000000000 Z
12
- dependencies: []
13
- description: An adventure game engine
11
+ date: 2016-04-16 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ name: rubyzip
15
+ requirement: !ruby/object:Gem::Requirement
16
+ requirements:
17
+ - - '>='
18
+ - !ruby/object:Gem::Version
19
+ version: '0'
20
+ type: :runtime
21
+ prerelease: false
22
+ version_requirements: !ruby/object:Gem::Requirement
23
+ requirements:
24
+ - - '>='
25
+ - !ruby/object:Gem::Version
26
+ version: '0'
27
+ - !ruby/object:Gem::Dependency
28
+ name: rspec
29
+ requirement: !ruby/object:Gem::Requirement
30
+ requirements:
31
+ - - '>='
32
+ - !ruby/object:Gem::Version
33
+ version: '0'
34
+ type: :development
35
+ prerelease: false
36
+ version_requirements: !ruby/object:Gem::Requirement
37
+ requirements:
38
+ - - '>='
39
+ - !ruby/object:Gem::Version
40
+ version: '0'
41
+ description: An adventure game and interactive fiction framework
14
42
  email: fsnyder@gamefic.com
15
43
  executables:
16
44
  - gamefic
@@ -18,74 +46,77 @@ extensions: []
18
46
  extra_rdoc_files: []
19
47
  files:
20
48
  - lib/gamefic.rb
21
- - lib/gamefic/entity.rb
22
- - lib/gamefic/character.rb
23
- - lib/gamefic/requirement.rb
24
- - lib/gamefic/story.rb
25
- - lib/gamefic/shell.rb
26
- - lib/gamefic/optionset.rb
27
- - lib/gamefic/thing.rb
28
- - lib/gamefic/base.rb
29
- - lib/gamefic/query.rb
49
+ - lib/gamefic/grammar.rb
30
50
  - lib/gamefic/action.rb
51
+ - lib/gamefic/stage.rb
52
+ - lib/gamefic/core_ext/array.rb
53
+ - lib/gamefic/core_ext/string.rb
54
+ - lib/gamefic/engine/cgi.rb
55
+ - lib/gamefic/engine/tty.rb
56
+ - lib/gamefic/html.rb
57
+ - lib/gamefic/describable.rb
58
+ - lib/gamefic/command.rb
59
+ - lib/gamefic/script/base.rb
60
+ - lib/gamefic/script/file.rb
61
+ - lib/gamefic/script/text.rb
62
+ - lib/gamefic/query/children.rb
63
+ - lib/gamefic/query/family.rb
64
+ - lib/gamefic/query/matches.rb
65
+ - lib/gamefic/query/parent.rb
66
+ - lib/gamefic/query/self.rb
67
+ - lib/gamefic/query/siblings.rb
68
+ - lib/gamefic/query/many_children.rb
69
+ - lib/gamefic/query/ambiguous_children.rb
70
+ - lib/gamefic/query/base.rb
71
+ - lib/gamefic/query/expression.rb
72
+ - lib/gamefic/query/plural_children.rb
73
+ - lib/gamefic/query/text.rb
74
+ - lib/gamefic/rule.rb
75
+ - lib/gamefic/scene.rb
76
+ - lib/gamefic/scene/concluded.rb
77
+ - lib/gamefic/scene/multiplechoice.rb
78
+ - lib/gamefic/scene/paused.rb
79
+ - lib/gamefic/scene/yesorno.rb
80
+ - lib/gamefic/scene/active.rb
81
+ - lib/gamefic/shell.rb
82
+ - lib/gamefic/snapshots.rb
83
+ - lib/gamefic/tester.rb
84
+ - lib/gamefic/version.rb
31
85
  - lib/gamefic/node.rb
32
- - lib/gamefic/director.rb
86
+ - lib/gamefic/syntax.rb
87
+ - lib/gamefic/source.rb
88
+ - lib/gamefic/source/base.rb
89
+ - lib/gamefic/source/file.rb
90
+ - lib/gamefic/source/text.rb
91
+ - lib/gamefic/ansi.rb
92
+ - lib/gamefic/script.rb
93
+ - lib/gamefic/character.rb
94
+ - lib/gamefic/entity.rb
95
+ - lib/gamefic/query.rb
33
96
  - lib/gamefic/engine.rb
34
- - lib/gamefic/plot.rb
97
+ - lib/gamefic/direction.rb
98
+ - lib/gamefic/director/order.rb
99
+ - lib/gamefic/director/delegate.rb
100
+ - lib/gamefic/director/parser.rb
101
+ - lib/gamefic/plot/query_mount.rb
102
+ - lib/gamefic/plot/article_mount.rb
103
+ - lib/gamefic/plot/you_mount.rb
104
+ - lib/gamefic/plot/command_mount.rb
105
+ - lib/gamefic/plot/entity_mount.rb
106
+ - lib/gamefic/plot/scene_mount.rb
107
+ - lib/gamefic/director.rb
108
+ - lib/gamefic/grammar/conjugator.rb
109
+ - lib/gamefic/grammar/person.rb
110
+ - lib/gamefic/grammar/plural.rb
111
+ - lib/gamefic/grammar/tense.rb
112
+ - lib/gamefic/grammar/verb_set.rb
113
+ - lib/gamefic/grammar/verbs.rb
114
+ - lib/gamefic/grammar/gender.rb
115
+ - lib/gamefic/grammar/pronouns.rb
116
+ - lib/gamefic/grammar/word_adapter.rb
117
+ - lib/gamefic/serialized.rb
35
118
  - lib/gamefic/keywords.rb
36
- - lib/gamefic/before.rb
37
- - lib/gamefic/meta.rb
38
- - lib/gamefic/syntax.rb
39
- - lib/gamefic/describable.rb
40
- - lib/gamefic/import/room_modes.rb
41
- - lib/gamefic/import/basics/actions/leave.rb
42
- - lib/gamefic/import/basics/actions/take.rb
43
- - lib/gamefic/import/basics/actions/drop-in.rb
44
- - lib/gamefic/import/basics/actions/drop-on.rb
45
- - lib/gamefic/import/basics/actions/commands.rb
46
- - lib/gamefic/import/basics/actions/look-under.rb
47
- - lib/gamefic/import/basics/actions/open.rb
48
- - lib/gamefic/import/basics/actions/look.rb
49
- - lib/gamefic/import/basics/actions/quit.rb
50
- - lib/gamefic/import/basics/actions/go.rb
51
- - lib/gamefic/import/basics/actions/nil.rb
52
- - lib/gamefic/import/basics/actions/look-in-at.rb
53
- - lib/gamefic/import/basics/actions/drop.rb
54
- - lib/gamefic/import/basics/actions/inventory.rb
55
- - lib/gamefic/import/basics/actions/close.rb
56
- - lib/gamefic/import/basics/actions/enter.rb
57
- - lib/gamefic/import/basics/rules/has-enough-light.rb
58
- - lib/gamefic/import/basics/queries/room.rb
59
- - lib/gamefic/import/basics/queries/reachable.rb
60
- - lib/gamefic/import/basics/queries/visible.rb
61
- - lib/gamefic/import/basics/entities/entity.rb
62
- - lib/gamefic/import/basics/entities/supporter.rb
63
- - lib/gamefic/import/basics/entities/fixture.rb
64
- - lib/gamefic/import/basics/entities/item.rb
65
- - lib/gamefic/import/basics/entities/scenery.rb
66
- - lib/gamefic/import/basics/entities/thing.rb
67
- - lib/gamefic/import/basics/entities/room.rb
68
- - lib/gamefic/import/basics/entities/portal.rb
69
- - lib/gamefic/import/basics/entities/container.rb
70
- - lib/gamefic/import/standard.rb
71
- - lib/gamefic/import/basics.old/room_modes.rb
72
- - lib/gamefic/import/basics.old/actions/look.rb
73
- - lib/gamefic/import/basics.old/actions/inventory.rb
74
- - lib/gamefic/import/basics.old/actions/container.rb
75
- - lib/gamefic/import/basics.old/actions/meta.rb
76
- - lib/gamefic/import/basics.old/actions/traversal.rb
77
- - lib/gamefic/import/basics.old/actions.rb
78
- - lib/gamefic/import/basics.old/entities/supporter.rb
79
- - lib/gamefic/import/basics.old/entities/fixture.rb
80
- - lib/gamefic/import/basics.old/entities/item.rb
81
- - lib/gamefic/import/basics.old/entities/scenery.rb
82
- - lib/gamefic/import/basics.old/entities/room.rb
83
- - lib/gamefic/import/basics.old/entities/portal.rb
84
- - lib/gamefic/import/basics.old/entities/container.rb
85
- - lib/gamefic/import/basics.old/entities.rb
86
- - lib/gamefic/import/basics.rb
87
- - lib/gamefic/core_ext/string.rb
88
- - lib/gamefic/core_ext/array.rb
119
+ - lib/gamefic/plot.rb
89
120
  - bin/gamefic
90
121
  homepage: http://gamefic.com
91
122
  licenses:
@@ -99,7 +130,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
99
130
  requirements:
100
131
  - - '>='
101
132
  - !ruby/object:Gem::Version
102
- version: 1.8.7
133
+ version: 1.9.3
103
134
  required_rubygems_version: !ruby/object:Gem::Requirement
104
135
  requirements:
105
136
  - - '>='
@@ -107,8 +138,9 @@ required_rubygems_version: !ruby/object:Gem::Requirement
107
138
  version: '0'
108
139
  requirements: []
109
140
  rubyforge_project:
110
- rubygems_version: 2.0.7
141
+ rubygems_version: 2.0.14
111
142
  signing_key:
112
143
  specification_version: 4
113
144
  summary: Gamefic
114
145
  test_files: []
146
+ has_rdoc:
data/lib/gamefic/base.rb DELETED
@@ -1,10 +0,0 @@
1
- module Gamefic
2
-
3
- Dir[File.dirname(__FILE__) + '/entity_ext/*.rb'].each do |file|
4
- require file
5
- end
6
- Dir[File.dirname(__FILE__) + '/action_ext/*.rb'].each do |file|
7
- require file
8
- end
9
-
10
- end
@@ -1,12 +0,0 @@
1
- # Before Actions are processed before Rules. Their primary use is to determine
2
- # whether or not a particular Action (or thread of Actions) should be allowed
3
- # to happen. A Before Action's proc can use the pass and deny methods to
4
- # override the results of rule assertions.
5
-
6
- module Gamefic
7
-
8
- class Before < Action
9
-
10
- end
11
-
12
- end
@@ -1,16 +0,0 @@
1
- respond :close, Query::Text.new() do |actor, string|
2
- actor.tell "You don't see any \"#{string}\" here."
3
- end
4
-
5
- respond :close, Query::Reachable.new(Entity) do |actor, thing|
6
- actor.tell "You can't close #{the thing}."
7
- end
8
-
9
- respond :close, Query::Reachable.new(Container, :openable) do |actor, container|
10
- if container.is? :closed
11
- actor.tell "It's already closed."
12
- else
13
- actor.tell "You close #{the container}."
14
- container.is :closed
15
- end
16
- end
@@ -1,3 +0,0 @@
1
- meta :commands do |actor|
2
- actor.tell actor.plot.commandwords.sort.join(", ")
3
- end
@@ -1,17 +0,0 @@
1
- respond :drop_in, Query::Children.new(), Query::Reachable.new() do |actor, thing, target|
2
- puts "You can't put #{the thing} inside #{the target}."
3
- end
4
-
5
- respond :drop_in, Query::Children.new(), Query::Reachable.new(Container) do |actor, thing, container|
6
- if container.is? :closed
7
- actor.tell "#{The container} is closed."
8
- else
9
- thing.parent = container
10
- thing.is :contained
11
- actor.tell "You put #{the thing} in #{the container}."
12
- end
13
- end
14
-
15
- xlate "drop :item in :container", :drop_in, :item, :container
16
- xlate "put :item in :container", :drop_in, :item, :container
17
- xlate "place :item in :container", :drop_in, :item, :container
@@ -1,16 +0,0 @@
1
- respond :drop_on, Query::Children.new(), Query::Reachable.new() do |actor, thing, supporter|
2
- actor.tell "You can't put #{the thing} on #{the supporter}."
3
- end
4
-
5
- respond :drop_on, Query::Children.new(), Query::Reachable.new(Supporter) do |actor, thing, supporter|
6
- thing.parent = supporter
7
- thing.is :supported
8
- actor.tell "You put #{the thing} on #{the supporter}."
9
- end
10
-
11
- xlate "put :thing on :supporter", :drop_on, :thing, :supporter
12
- xlate "put :thing down on :supporter", :drop_on, :thing, :supporter
13
- xlate "set :thing on :supporter", :drop_on, :thing, :supporter
14
- xlate "set :thing down on :supporter", :drop_on, :thing, :supporter
15
- xlate "drop :thing on :supporter", :drop_on, :thing, :supporter
16
- xlate "place :thing on :supporter", :drop_on, :thing, :supporter
@@ -1,30 +0,0 @@
1
- respond :drop, Query::Visible.new() do |actor, thing|
2
- actor.tell "You're not carrying #{the thing}."
3
- end
4
-
5
- respond :drop, Query::Children.new() do |actor, thing|
6
- thing.parent = actor.parent
7
- actor.tell "You drop #{the thing}.", true
8
- end
9
-
10
- xlate "put down :thing", :drop, :thing
11
- xlate "put :thing down", :drop, :thing
12
-
13
- #respond :drop, Query::Family.new(Thing), Query::Reachable.new(Thing) do |actor, thing, supporter|
14
- # actor.tell "You're not carrying #{thing}."
15
- #end
16
- #respond :drop, Query::Text.new(), Query::Text.new() do |actor, thing, supporter|
17
- # actor.tell "You don't see anything called '#{thing}.'"
18
- #end
19
- #respond :drop, Query::Children.new(Thing), Query::Visible.new(Thing) do |actor, thing, target|
20
- # if actor.parent != target.parent
21
- # if actor.is?(:supported) or actor.is?(:container)
22
- # actor.tell "You can't reach #{the target} from #{the actor.parent}."
23
- # next
24
- # end
25
- # end
26
- # passthru
27
- #end
28
- #respond :drop, Query::Children.new(Thing), Query::Text.new() do |actor, thing, supporter|
29
- # actor.tell "You don't see anything called '#{supporter}.'"
30
- #end
@@ -1,16 +0,0 @@
1
- respond :enter, Query::Siblings.new(Supporter, :enterable) do |actor, supporter|
2
- actor.parent = supporter
3
- actor.tell "You get on #{the supporter}."
4
- end
5
- respond :enter, Query::Siblings.new(Container, :enterable) do |actor, container|
6
- actor.parent = container
7
- actor.tell "You get in #{the container}."
8
- end
9
- respond :enter, Query::Siblings.new(Thing) do |actor, thing|
10
- actor.tell "#{The thing} can't accommodate you."
11
- end
12
- xlate "sit :thing", :enter, :thing
13
- xlate "sit on :thing", :enter, :thing
14
- xlate "get on :thing", :enter, :thing
15
- xlate "get in :thing", :enter, :thing
16
- xlate "stand on :thing", :enter, :thing