Class: Natural20::Action
- Inherits:
-
Object
- Object
- Natural20::Action
- Defined in:
- lib/natural_20/actions/action.rb
Direct Known Subclasses
AttackAction, DashAction, DisengageAction, DodgeAction, DropGrappleAction, EscapeGrappleAction, FirstAidAction, GrappleAction, GroundInteractAction, HelpAction, HideAction, InteractAction, InventoryAction, LookAction, MoveAction, MultiattackAction, ProneAction, SecondWindAction, ShortRestAction, ShoveAction, SpellAction, StandAction, UseItemAction
Instance Attribute Summary collapse
-
#action_type ⇒ Object
readonly
Returns the value of attribute action_type.
-
#errors ⇒ Object
readonly
Returns the value of attribute errors.
-
#result ⇒ Object
readonly
Returns the value of attribute result.
-
#session ⇒ Object
readonly
Returns the value of attribute session.
-
#source ⇒ Object
readonly
Returns the value of attribute source.
Class Method Summary collapse
Instance Method Summary collapse
-
#initialize(session, source, action_type, opts = {}) ⇒ Action
constructor
A new instance of Action.
- #label ⇒ Object
- #name ⇒ Object
- #resolve(session, map, opts = {}) ⇒ Object
- #to_s ⇒ Object
- #validate ⇒ Object
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_type ⇒ Object (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 |
#errors ⇒ Object (readonly)
Returns the value of attribute errors.
4 5 6 |
# File 'lib/natural_20/actions/action.rb', line 4 def errors @errors end |
#result ⇒ Object (readonly)
Returns the value of attribute result.
4 5 6 |
# File 'lib/natural_20/actions/action.rb', line 4 def result @result end |
#session ⇒ Object (readonly)
Returns the value of attribute session.
4 5 6 |
# File 'lib/natural_20/actions/action.rb', line 4 def session @session end |
#source ⇒ Object (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
#label ⇒ Object
23 24 25 |
# File 'lib/natural_20/actions/action.rb', line 23 def label I18n.t(:"action.#{action_type}") end |
#name ⇒ Object
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_s ⇒ Object
19 20 21 |
# File 'lib/natural_20/actions/action.rb', line 19 def to_s @action_type.to_s.humanize end |
#validate ⇒ Object
27 28 |
# File 'lib/natural_20/actions/action.rb', line 27 def validate end |