Class: TwoWeaponAttackAction

Inherits:
AttackAction show all
Defined in:
lib/natural_20/actions/attack_action.rb

Instance Attribute Summary

Attributes inherited from AttackAction

#advantage_mod, #as_reaction, #npc_action, #target, #thrown, #using

Attributes inherited from Natural20::Action

#action_type, #errors, #result, #session, #source

Class Method Summary collapse

Instance Method Summary collapse

Methods inherited from AttackAction

build, #build_map, consume_resource, #resolve, #to_s, #with_advantage?, #with_disadvantage?

Methods included from Natural20::ActionDamage

#damage_event

Methods included from Natural20::AttackHelper

#after_attack_roll_hook, #calculate_cover_ac, #effective_ac

Methods included from Natural20::Weapons

#compute_advantages_and_disadvantages, #damage_modifier, #target_advantage_condition

Methods included from Natural20::Cover

#cover_calculation

Methods inherited from Natural20::Action

#initialize, #name, #resolve, #to_s, #validate

Constructor Details

This class inherits a constructor from Natural20::Action

Class Method Details

.apply!(battle, item) ⇒ Object



382
# File 'lib/natural_20/actions/attack_action.rb', line 382

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

.can?(entity, battle, options = {}) ⇒ Boolean

Parameters:

Returns:

  • (Boolean)


368
369
370
371
372
# File 'lib/natural_20/actions/attack_action.rb', line 368

def self.can?(entity, battle, options = {})
  battle.nil? || (entity.total_bonus_actions(battle).positive? && battle.two_weapon_attack?(entity) && (options[:weapon] != battle.first_hand_weapon(entity) || entity.equipped_weapons.select do |a|
    a.to_s == battle.first_hand_weapon(entity)
  end.size >= 2))
end

Instance Method Details

#labelObject



378
379
380
# File 'lib/natural_20/actions/attack_action.rb', line 378

def label
  "Bonus Action -> #{super}"
end

#second_handObject



374
375
376
# File 'lib/natural_20/actions/attack_action.rb', line 374

def second_hand
  true
end