Class: ItemLibrary::PitTrap
- Includes:
- AreaTrigger
- Defined in:
- lib/natural_20/item_library/pit_trap.rb
Overview
Represents a staple of DnD the concealed pit trap
Constant Summary
Constants included from Natural20::Entity
Natural20::Entity::ALL_SKILLS, Natural20::Entity::ATTRIBUTE_TYPES, Natural20::Entity::ATTRIBUTE_TYPES_ABBV, Natural20::Entity::SKILL_AND_ABILITY_MAP
Instance Attribute Summary collapse
-
#activated ⇒ Object
Returns the value of attribute activated.
Attributes inherited from Object
#hp, #map, #name, #resistances, #statuses
Attributes included from Natural20::Entity
#casted_effects, #color, #current_hit_die, #death_fails, #death_saves, #effects, #entity_event_hooks, #entity_uid, #max_hit_die, #session, #statuses
Instance Method Summary collapse
- #area_trigger_handler(entity, entity_pos, is_flying) ⇒ Object
- #concealed? ⇒ Boolean
- #jump_required? ⇒ Boolean
- #label ⇒ Object
- #passable? ⇒ Boolean
- #placeable? ⇒ Boolean
- #token ⇒ Object
Methods inherited from Object
#armor_class, #available_interactions, #can_hide?, #color, #cover_ac, #describe_health, #half_cover?, #initialize, #interactable?, #items_label, #light_properties, #movement_cost, #npc?, #object?, #opaque?, #pc?, #position, #size, #three_quarter_cover?, #total_cover?, #wall?
Methods included from Natural20::Notable
Methods included from Natural20::Entity
#ability_mod, #acrobatics_proficient?, #action?, #active_effects, #add_casted_effect, #add_item, #all_ability_mods, #all_ability_scores, #any_class_feature?, #athletics_proficient?, #attach_handler, #attack_ability_mod, #attack_roll_mod, #available_movement, #available_spells, #break_stealth!, #can_see?, #carry_capacity, #cha_mod, #check_equip, #class_feature?, #con_mod, #conscious!, #conscious?, #darkvision?, #dead!, #dead?, #death_saving_throw!, #deduct_item, #description, #dex_mod, #dexterity_check!, #disengage!, #disengage?, #dismiss_effect!, #dodge?, #dodging!, #drop_grapple!, #drop_items!, #entered_melee?, #equip, #equipped?, #equipped_items, #equipped_weapons, #escape_grapple_from!, #expertise, #expertise?, #free_object_interaction?, #grappled?, #grappled_by!, #grapples, #grappling, #grappling?, #grappling_targets, #hand_slots_required, #has_reaction?, #has_spell_effect?, #has_spells?, #heal!, #help!, #help?, #hiding!, #hiding?, #hit_die, #incapacitated?, #initiative!, #insight_proficient?, #int_mod, #inventory, #inventory_count, #inventory_weight, #investigation_proficient?, #item_count, #items_label, #languages, #light_properties, #locate_melee_positions, #lockpick!, #long_jump_distance, #max_spell_slots, #medicine_check!, #medicine_proficient?, #melee_distance, #melee_squares, #npc?, #object?, #opened?, #passive_perception, #pc?, #perception_proficient?, #proficiency_bonus, #proficient?, #proficient_with_armor?, #proficient_with_equipped_armor?, #proficient_with_weapon?, #prone!, #prone?, #push_from, #race, #ranged_spell_attack!, #register_effect, #register_event_hook, #reset_turn!, #resistant_to?, #saving_throw!, #sentient?, #shield_equipped?, #short_rest!, #size_identifier, #speed, #spell_slots, #squeezed!, #squeezed?, #stable!, #stable?, #stand!, #standing_jump_distance, #stealth_proficient?, #str_mod, #strength_check!, #take_damage!, #to_item, #token_size, #total_actions, #total_bonus_actions, #total_reactions, #trigger_event, #unconscious!, #unconscious?, #unequip, #unequip_all, #ungrapple, #unsqueeze, #usable_items, #usable_objects, #use_hit_die!, #used_hand_slots, #wearing_armor?, #wis_mod, #wisdom_check!
Methods included from Natural20::EntityStateEvaluator
Constructor Details
This class inherits a constructor from ItemLibrary::Object
Instance Attribute Details
#activated ⇒ Object
Returns the value of attribute activated.
6 7 8 |
# File 'lib/natural_20/item_library/pit_trap.rb', line 6 def activated @activated end |
Instance Method Details
#area_trigger_handler(entity, entity_pos, is_flying) ⇒ Object
8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 |
# File 'lib/natural_20/item_library/pit_trap.rb', line 8 def area_trigger_handler(entity, entity_pos, ) result = [] return nil if entity_pos != position return nil if unless activated damage = Natural20::DieRoll.roll(@properties[:damage_die]) result = [ { source: self, type: :state, params: { activated: true } }, { source: self, target: entity, type: :damage, attack_name: @properties[:attack_name] || 'pit trap', damage_type: @properties[:damage_type] || 'piercing', damage: damage } ] end result end |
#concealed? ⇒ Boolean
55 56 57 |
# File 'lib/natural_20/item_library/pit_trap.rb', line 55 def concealed? !activated end |
#jump_required? ⇒ Boolean
59 60 61 |
# File 'lib/natural_20/item_library/pit_trap.rb', line 59 def jump_required? activated end |
#label ⇒ Object
41 42 43 44 45 |
# File 'lib/natural_20/item_library/pit_trap.rb', line 41 def label return 'ground' unless activated @properties[:name].presence || 'pit trap' end |
#passable? ⇒ Boolean
47 48 49 |
# File 'lib/natural_20/item_library/pit_trap.rb', line 47 def passable? true end |
#placeable? ⇒ Boolean
37 38 39 |
# File 'lib/natural_20/item_library/pit_trap.rb', line 37 def placeable? !activated end |
#token ⇒ Object
51 52 53 |
# File 'lib/natural_20/item_library/pit_trap.rb', line 51 def token ["\u02ac"] end |