Class: ItemLibrary::Ground
- Includes:
- Natural20::Container
- Defined in:
- lib/natural_20/item_library/ground.rb
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
-
#key_name ⇒ Object
readonly
Returns the value of attribute key_name.
-
#locked ⇒ Object
readonly
Returns the value of attribute locked.
-
#state ⇒ Object
readonly
Returns the value of attribute state.
Attributes inherited from Object
#hp, #map, #name, #resistances, #statuses
Attributes included from Natural20::Entity
#casted_effects, #current_hit_die, #death_fails, #death_saves, #effects, #entity_event_hooks, #entity_uid, #max_hit_die, #session, #statuses
Instance Method Summary collapse
-
#available_interactions(_entity, _battle = nil) ⇒ Array
Returns available interaction with this object.
-
#build_map(action, action_object) ⇒ OpenStruct
Builds a custom UI map.
- #color ⇒ Object
- #interactable? ⇒ Boolean
- #list_notes(_entity, _perception, highlight: false) ⇒ Object
- #opaque? ⇒ Boolean
- #passable? ⇒ Boolean
- #placeable? ⇒ Boolean
- #resolve(entity, action, other_params, opts = {}) ⇒ Object
- #token ⇒ Object
- #use!(_entity, result) ⇒ Object
Methods included from Natural20::Container
Methods inherited from Object
#armor_class, #can_hide?, #concealed?, #cover_ac, #describe_health, #half_cover?, #initialize, #items_label, #jump_required?, #label, #light_properties, #movement_cost, #npc?, #object?, #pc?, #position, #size, #three_quarter_cover?, #total_cover?, #wall?
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, #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
#key_name ⇒ Object (readonly)
Returns the value of attribute key_name.
6 7 8 |
# File 'lib/natural_20/item_library/ground.rb', line 6 def key_name @key_name end |
#locked ⇒ Object (readonly)
Returns the value of attribute locked.
6 7 8 |
# File 'lib/natural_20/item_library/ground.rb', line 6 def locked @locked end |
#state ⇒ Object (readonly)
Returns the value of attribute state.
6 7 8 |
# File 'lib/natural_20/item_library/ground.rb', line 6 def state @state end |
Instance Method Details
#available_interactions(_entity, _battle = nil) ⇒ Array
Returns available interaction with this object
80 81 82 |
# File 'lib/natural_20/item_library/ground.rb', line 80 def available_interactions(_entity, _battle = nil) [] end |
#build_map(action, action_object) ⇒ OpenStruct
Builds a custom UI map
12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 |
# File 'lib/natural_20/item_library/ground.rb', line 12 def build_map(action, action_object) case action when :drop OpenStruct.new({ action: action_object, param: [ { type: :select_items, label: action_object.source.items_label, items: action_object.source.inventory } ], next: lambda { |items| action_object.other_params = items OpenStruct.new({ param: nil, next: lambda { action_object } }) } }) when :pickup OpenStruct.new({ action: action_object, param: [ { type: :select_items, label: items_label, items: inventory } ], next: lambda { |items| action_object.other_params = items OpenStruct.new({ param: nil, next: lambda { action_object } }) } }) end end |
#color ⇒ Object
73 74 75 |
# File 'lib/natural_20/item_library/ground.rb', line 73 def color :cyan end |
#interactable? ⇒ Boolean
84 85 86 |
# File 'lib/natural_20/item_library/ground.rb', line 84 def interactable? false end |
#list_notes(_entity, _perception, highlight: false) ⇒ Object
110 111 112 113 114 |
# File 'lib/natural_20/item_library/ground.rb', line 110 def list_notes(_entity, _perception, highlight: false) inventory.map do |_item| t("object.#{m.label}", default: m.label) end end |
#opaque? ⇒ Boolean
57 58 59 |
# File 'lib/natural_20/item_library/ground.rb', line 57 def opaque? false end |
#passable? ⇒ Boolean
61 62 63 |
# File 'lib/natural_20/item_library/ground.rb', line 61 def passable? true end |
#placeable? ⇒ Boolean
65 66 67 |
# File 'lib/natural_20/item_library/ground.rb', line 65 def placeable? true end |
#resolve(entity, action, other_params, opts = {}) ⇒ Object
90 91 92 93 94 95 96 97 |
# File 'lib/natural_20/item_library/ground.rb', line 90 def resolve(entity, action, other_params, opts = {}) return if action.nil? case action when :drop, :pickup { action: action, items: other_params, source: entity, target: self, battle: opts[:battle] } end end |
#token ⇒ Object
69 70 71 |
# File 'lib/natural_20/item_library/ground.rb', line 69 def token ["\u00B7".encode('utf-8')] end |
#use!(_entity, result) ⇒ Object
101 102 103 104 105 106 107 108 |
# File 'lib/natural_20/item_library/ground.rb', line 101 def use!(_entity, result) case result[:action] when :drop store(result[:battle], result[:source], result[:target], result[:items]) when :pickup retrieve(result[:battle], result[:source], result[:target], result[:items]) end end |