class DropGrappleAction
Attributes
target[RW]
Public Class Methods
apply!(_battle, item)
click to toggle source
# File lib/natural_20/actions/grapple_action.rb, line 170 def self.apply!(_battle, item) case item[:type] when :drop_grapple item[:target].escape_grapple_from!(item[:source]) Natural20::EventManager.received_event(event: :drop_grapple, target: item[:target], source: item[:source], source_roll: item[:source_roll], target_roll: item[:target_roll]) end end
build(session, source)
click to toggle source
# File lib/natural_20/actions/grapple_action.rb, line 149 def self.build(session, source) action = DropGrappleAction.new(session, source, :grapple) action.build_map end
can?(entity, battle, _options = {})
click to toggle source
# File lib/natural_20/actions/grapple_action.rb, line 121 def self.can?(entity, battle, _options = {}) battle.nil? || entity.grappling? end
Public Instance Methods
build_map()
click to toggle source
# File lib/natural_20/actions/grapple_action.rb, line 129 def build_map OpenStruct.new({ action: self, param: [ { type: :select_target, targets: @source.grappling_targets, num: 1 } ], next: lambda { |target| self.target = target OpenStruct.new({ param: nil, next: -> { self } }) } }) end
resolve(_session, _map, opts = {})
click to toggle source
@param session [Natural20::Session] @param map [Natural20::BattleMap] @option opts battle [Natural20::Battle] @option opts target [Natural20::Entity]
# File lib/natural_20/actions/grapple_action.rb, line 158 def resolve(_session, _map, opts = {}) target = opts[:target] || @target battle = opts[:battle] @result = [{ source: @source, target: target, type: :drop_grapple, battle: battle }] end
to_s()
click to toggle source
# File lib/natural_20/actions/grapple_action.rb, line 125 def to_s @action_type.to_s.humanize end