gamefic 0.0.2 → 0.0.3

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 8d8b026aaef618411c88290ed37d4eec962d91cd
4
- data.tar.gz: c441f836978528d55d6a8dc856a62c889c62af7b
3
+ metadata.gz: 455d6e35dc1a52a6bb5199fc7149ed0fa63a78b6
4
+ data.tar.gz: e9fca3998e0753390c5e10e83c2ecfee28313f8f
5
5
  SHA512:
6
- metadata.gz: f628a686e81c26eb6c24f0157d9630cee6d3b34d0fe964dee81fa61a8bb70abe9507c3f50689f7278c724e1fd8dbfd2a6bf54296c436e38e67b1b282a3d9899b
7
- data.tar.gz: 3d680aea4280a9adf8a9c29e035156bed699a1cf979c141e5e950bd2d0739d75a3d4f1e41180b2924f187dc54875adc43274c7d87302c495f47c79d64e2d1fec
6
+ metadata.gz: cbcfef9ac4c0ae7b970048c13c2a5fb8a0efd636918d41e0aedc2a64956a3576ce07ebaf163a199a70df6f7fedc550c074f90fa1e9ec3fb732c3aa060968ddb9
7
+ data.tar.gz: 6200517ed19c41d98a9d881b799cf843211a1a20128852a194ad22a775fc7b2b9761ab7c7a07cdf4f0b299fc7a18acd28f7bbacd341edb5953ad82436ceeb923
@@ -0,0 +1,7 @@
1
+ module Gamefic
2
+
3
+ Dir[File.dirname(__FILE__) + '/action_ext/*.rb'].each do |file|
4
+ require file
5
+ end
6
+
7
+ end
@@ -2,9 +2,10 @@ module Gamefic
2
2
 
3
3
  class Character < Entity
4
4
  attr_reader :state, :queue, :user
5
- def post_initialize
5
+ def initialize(plot, args = {})
6
6
  @state = CharacterState.new(self)
7
7
  @queue = Array.new
8
+ super
8
9
  end
9
10
  def connect(user)
10
11
  @user = user
@@ -19,6 +19,9 @@ class Array
19
19
  def random
20
20
  return self[rand(self.length)]
21
21
  end
22
+ def pop_random
23
+ delete_at(rand(self.length))
24
+ end
22
25
  def shuffle
23
26
  self.sort { |a, b|
24
27
  rand(3) <=> rand(3)
@@ -0,0 +1,7 @@
1
+ module Gamefic
2
+
3
+ Dir[File.dirname(__FILE__) + '/entity_ext/*.rb'].each do |file|
4
+ require file
5
+ end
6
+
7
+ end
@@ -3,9 +3,6 @@ require "gamefic/entity_ext/portal"
3
3
  module Gamefic
4
4
 
5
5
  class Room < Entity
6
- def post_initialize
7
-
8
- end
9
6
  def connect(destination, direction, type = Portal, two_way = true)
10
7
  portal = type.new self.plot, :name => direction, :parent => self, :destination => destination
11
8
  if two_way == true
@@ -7,6 +7,9 @@ module Gamefic
7
7
  if statement.kind_of?(Keywords)
8
8
  self.concat statement
9
9
  else
10
+ if statement.kind_of?(Array)
11
+ statement = statement.join(' ')
12
+ end
10
13
  self.concat statement.to_s.gsub(/[^a-z0-9]/i, ' ').strip.downcase.split(' ')
11
14
  end
12
15
  self.delete_if { |w|
data/lib/gamefic/query.rb CHANGED
@@ -12,7 +12,8 @@ module Gamefic
12
12
  STRING = :string
13
13
  def initialize(context, *arguments)
14
14
  if context != :family and context != :children and context != :siblings and context != :parent and context != :self and context != :plot and context != :string
15
- raise "Invalid Query context '#{context}'"
15
+ #if self.class.constants.include?(context.to_sym) == false
16
+ raise "Invalid Query context '#{context.to_sym}'"
16
17
  end
17
18
  #if context == :string and arguments.length > 0
18
19
  # raise "Query with :string context cannot take additional arguments."
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: gamefic
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Fred Snyder
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2013-12-07 00:00:00.000000000 Z
11
+ date: 2014-01-25 00:00:00.000000000 Z
12
12
  dependencies: []
13
13
  description: An adventure game engine
14
14
  email: fsnyder@gamefic.com
@@ -19,9 +19,11 @@ files:
19
19
  - lib/gamefic.rb
20
20
  - lib/gamefic/entity.rb
21
21
  - lib/gamefic/character.rb
22
+ - lib/gamefic/action_ext.rb
22
23
  - lib/gamefic/story.rb
23
24
  - lib/gamefic/base.rb
24
25
  - lib/gamefic/query.rb
26
+ - lib/gamefic/entity_ext.rb
25
27
  - lib/gamefic/action.rb
26
28
  - lib/gamefic/node.rb
27
29
  - lib/gamefic/director.rb