-
Notifications
You must be signed in to change notification settings - Fork 720
/
Copy pathattack.hpp
104 lines (78 loc) · 3.44 KB
/
attack.hpp
1
2
3
4
5
6
7
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
// ==========================================================================
// Dedmonwakeen's Raid DPS/TPS Simulator.
// Send questions to [email protected]
// ==========================================================================
#pragma once
#include "config.hpp"
#include "action.hpp"
// WDPS -> Attack Power Coefficient used for BfA Attack Power calculations
constexpr double WEAPON_POWER_COEFFICIENT = 6;
struct attack_t : public action_t
{
double base_attack_expertise;
attack_t( util::string_view token, player_t* p );
attack_t( util::string_view token, player_t* p, const spell_data_t* s );
// Attack Overrides
double execute_time_pct_multiplier() const override;
void execute() override;
result_e calculate_result( action_state_t* ) const override;
result_amount_type amount_type( const action_state_t* /* state */, bool /* periodic */ = false ) const override;
result_amount_type report_amount_type( const action_state_t* /* state */ ) const override;
double miss_chance( double hit, player_t* t ) const override;
double dodge_chance( double /* expertise */, player_t* t ) const override;
double block_chance( action_state_t* s ) const override;
double crit_block_chance( action_state_t* s ) const override;
double bonus_da( const action_state_t* ) const override;
double action_multiplier() const override;
double composite_target_multiplier( player_t* ) const override;
double composite_hit() const override;
double composite_crit_chance() const override;
double composite_crit_chance_multiplier() const override;
double composite_haste() const override;
double composite_versatility( const action_state_t* state ) const override;
double recharge_multiplier( const cooldown_t& cd ) const override;
virtual double composite_expertise() const;
virtual void reschedule_auto_attack( double old_swing_haste );
void reset() override;
private:
/// attack table generator with caching
struct attack_table_t
{
std::array<double, RESULT_MAX> chances;
std::array<result_e, RESULT_MAX> results;
int num_results;
double attack_table_sum; // Used to check whether we can use cached values or not.
attack_table_t()
{
reset();
}
void reset()
{
attack_table_sum = std::numeric_limits<double>::min();
}
void build_table( double miss_chance, double dodge_chance, double parry_chance, double glance_chance,
double crit_chance, sim_t* );
};
mutable attack_table_t attack_table;
};
// Melee Attack ===================================================================
struct melee_attack_t : public attack_t
{
melee_attack_t( util::string_view token, player_t* p );
melee_attack_t( util::string_view token, player_t* p, const spell_data_t* s );
// Melee Attack Overrides
void init() override;
double parry_chance( double /* expertise */, player_t* t ) const override;
double glance_chance( int delta_level ) const override;
proc_types proc_type() const override;
};
// Ranged Attack ===================================================================
struct ranged_attack_t : public attack_t
{
ranged_attack_t( util::string_view token, player_t* p );
ranged_attack_t( util::string_view token, player_t* p, const spell_data_t* s );
// Ranged Attack Overrides
double composite_target_multiplier( player_t* ) const override;
void schedule_execute( action_state_t* execute_state = nullptr ) override;
proc_types proc_type() const override;
};