1 #pragma once 2 3 #include "trap-type.h" 4 5 struct trap_def 6 { 7 /// The position of the trap on the map 8 coord_def pos; 9 /// The type of trap 10 trap_type type; 11 /// The amount of ammo remaining. For web traps, if 1, destroy on exit. 12 short ammo_qty; 13 14 bool is_mechanical() const; 15 dungeon_feature_type feature() const; 16 string name(description_level_type desc = DESC_PLAIN) const; 17 bool is_bad_for_player() const; 18 bool is_safe(actor* act = 0) const; 19 void trigger(actor& triggerer); 20 void destroy(bool known = false); 21 void hide(); 22 void reveal(); 23 void prepare_ammo(int charges = 0); 24 bool type_has_ammo() const; 25 bool active() const; definedtrap_def26 bool defined() const { return active(); } 27 int max_damage(const actor& act); 28 int to_hit_bonus(); 29 30 private: 31 void shoot_ammo(actor& act, bool was_known); 32 item_def generate_trap_item(); 33 int shot_damage(actor& act); 34 }; 35