SimulationCraft
SimulationCraft is a tool to explore combat mechanics in the popular MMO RPG World of Warcraft (tm).
dbc_proc_callback.hpp
1 // ==========================================================================
2 // Dedmonwakeen's Raid DPS/TPS Simulator.
3 // Send questions to [email protected]
4 // ==========================================================================
5 
6 #pragma once
7 
8 #include "config.hpp"
9 #include "action_callback.hpp"
10 
11 #include <functional>
12 
13 struct action_state_t;
14 struct buff_t;
15 struct cooldown_t;
17 struct item_t;
18 struct real_ppm_t;
19 namespace rng {
20  struct rng_t;
21 }
22 struct special_effect_t;
23 struct weapon_t;
24 struct proc_event_t;
25 
41 {
42  // Additional trigger callbacks, currently used to control
43  // the triggering conditions of the proc.
44  enum class trigger_fn_type
45  {
47  NONE,
50  CONDITION,
59  TRIGGER
60  };
61 
62  using execute_fn_t = std::function<void(const dbc_proc_callback_t*, action_t*, action_state_t*)>;
63  using trigger_fn_t = std::function<bool(const dbc_proc_callback_t*, action_t*, action_state_t*)>;
64 
65  static const item_t default_item_;
66 
67  const item_t& item;
68  const special_effect_t& effect;
69  cooldown_t* cooldown;
70  target_specific_cooldown_t* target_specific_cooldown;
71 
72  // Proc trigger types, cached/initialized here from special_effect_t to avoid
73  // needless spell data lookups in vast majority of cases
74  real_ppm_t* rppm;
75  double proc_chance;
76  double ppm;
77 
78  buff_t* proc_buff;
79  action_t* proc_action;
80  weapon_t* weapon;
81 
84 
88  const trigger_fn_t* trigger_fn;
90  execute_fn_t* execute_fn;
91 
92  bool can_only_proc_from_class_abilites;
93  bool can_proc_from_procs;
94 
95  dbc_proc_callback_t(const item_t& i, const special_effect_t& e);
96 
97  dbc_proc_callback_t(const item_t* i, const special_effect_t& e);
98 
100 
101  void initialize() override;
102 
103  cooldown_t* get_cooldown( player_t* target );
104 
105  void trigger(action_t* a, action_state_t* state) override;
106 
107  // Determine target for the callback (action).
108  virtual player_t* target(const action_state_t* state) const;
109 
110  rng::rng_t& rng() const;
111 
112 private:
113  bool roll(action_t* action);
114 
115 protected:
116  friend struct proc_event_t;
132  virtual void execute(action_t* /* a */, action_state_t* state);
133 };
trigger_fn_type
Definition: dbc_proc_callback.hpp:44
Definition: cooldown.hpp:26
Definition: cooldown.hpp:126
Definition: action.hpp:47
Definition: unique_gear.cpp:62
Definition: action_state.hpp:20
Definition: real_ppm.hpp:20
Definition: action_callback.hpp:16
const trigger_fn_t * trigger_fn
Override proc trigger condition with a separate callback function.
Definition: dbc_proc_callback.hpp:88
Definition: rng.hpp:305
Definition: dbc_proc_callback.cpp:23
Definition: item.hpp:60
execute_fn_t * execute_fn
Override execution behavior with a separate callback function.
Definition: dbc_proc_callback.hpp:90
Definition: player.hpp:109
Definition: buff.hpp:56
Random number generation.
Definition: action.hpp:37
bool expire_on_max_stack
Expires proc_buff on max stack, automatically set if proc_buff max_stack > 1.
Definition: dbc_proc_callback.hpp:83
DBC-driven proc callback.
Definition: dbc_proc_callback.hpp:40
Definition: weapon.hpp:12
trigger_fn_type trigger_type
Trigger condition override type.
Definition: dbc_proc_callback.hpp:86
Definition: special_effect.hpp:39