Class: Natural20::Action

Inherits:
Object
  • Object
show all
Defined in:
lib/natural_20/actions/action.rb

Instance Attribute Summary collapse

Class Method Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(session, source, action_type, opts = {}) ⇒ Action

Returns a new instance of Action.



6
7
8
9
10
11
12
13
# File 'lib/natural_20/actions/action.rb', line 6

def initialize(session, source, action_type, opts = {})
  @source = source
  @session = session
  @action_type = action_type
  @errors = []
  @result = []
  @opts = opts
end

Instance Attribute Details

#action_typeObject (readonly)

Returns the value of attribute action_type.



4
5
6
# File 'lib/natural_20/actions/action.rb', line 4

def action_type
  @action_type
end

#errorsObject (readonly)

Returns the value of attribute errors.



4
5
6
# File 'lib/natural_20/actions/action.rb', line 4

def errors
  @errors
end

#resultObject (readonly)

Returns the value of attribute result.



4
5
6
# File 'lib/natural_20/actions/action.rb', line 4

def result
  @result
end

#sessionObject (readonly)

Returns the value of attribute session.



4
5
6
# File 'lib/natural_20/actions/action.rb', line 4

def session
  @session
end

#sourceObject (readonly)

Returns the value of attribute source.



4
5
6
# File 'lib/natural_20/actions/action.rb', line 4

def source
  @source
end

Class Method Details

.apply!(battle, item) ⇒ Object



30
# File 'lib/natural_20/actions/action.rb', line 30

def self.apply!(battle, item); end

Instance Method Details

#labelObject



23
24
25
# File 'lib/natural_20/actions/action.rb', line 23

def label
  I18n.t(:"action.#{action_type}")
end

#nameObject



15
16
17
# File 'lib/natural_20/actions/action.rb', line 15

def name
  @action_type.to_s
end

#resolve(session, map, opts = {}) ⇒ Object



32
# File 'lib/natural_20/actions/action.rb', line 32

def resolve(session, map, opts = {}); end

#to_sObject



19
20
21
# File 'lib/natural_20/actions/action.rb', line 19

def to_s
  @action_type.to_s.humanize
end

#validateObject



27
28
# File 'lib/natural_20/actions/action.rb', line 27

def validate
end