-
Notifications
You must be signed in to change notification settings - Fork 763
Expand file tree
/
Copy pathaction_state.hpp
More file actions
155 lines (130 loc) · 5.11 KB
/
action_state.hpp
File metadata and controls
155 lines (130 loc) · 5.11 KB
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
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
// ==========================================================================
// Dedmonwakeen's Raid DPS/TPS Simulator.
// Send questions to natehieter@gmail.com
// ==========================================================================
#pragma once
#include <cstddef>
#include <string>
#include <iosfwd>
#include "config.hpp"
#include "util/generic.hpp"
#include "sc_enums.hpp"
#include "dbc/data_enums.hh"
#include "sim/event.hpp"
struct action_t;
struct player_t;
struct action_state_t : private noncopyable
{
action_state_t* next;
// Source action, target actor
action_t* action;
player_t* target;
// Execution attributes
unsigned n_targets; // Total number of targets the execution hits.
int chain_target; // The chain target number, 0 == no chain, 1 == first target, etc.
double original_x;
double original_y;
// Execution results
result_amount_type result_type;
result_e result;
block_result_e block_result;
double result_raw; // Base result value, without crit/glance etc.
double result_total; // Total unmitigated result, including crit bonus, glance penalty, etc.
double result_mitigated; // Result after mitigation / resist.
double result_absorbed; // Result after absorption. *NOTENOTENOTE* Only filled after action_t::impact() call
double result_crit_bonus; // Crit bonus multiplier used in the final calculation
double result_amount; // Final (actual) result
double self_absorb_amount; // The amount of damage reduced via personal absorbs such as shield_barrier.
// Snapshotted stats during execution
double haste;
double crit_chance;
double target_crit_chance;
double attack_power;
double spell_power;
// Snapshotted multipliers
double versatility;
double da_multiplier;
double ta_multiplier;
double rolling_ta_multiplier;
double player_multiplier;
double persistent_multiplier;
double pet_multiplier; // Owner -> pet multiplier
double target_da_multiplier;
double target_ta_multiplier;
double target_pet_multiplier;
// Target mitigation multipliers
double target_mitigation_da_multiplier;
double target_mitigation_ta_multiplier;
double target_armor;
static void release( action_state_t*& s );
static std::string flags_to_str( unsigned flags );
action_state_t( action_t*, player_t* );
virtual ~action_state_t() = default;
virtual void copy_state( const action_state_t* );
virtual void initialize();
virtual std::ostringstream& debug_str( std::ostringstream& s );
virtual void debug();
virtual double composite_crit_chance() const
{ return crit_chance + target_crit_chance; }
virtual double composite_attack_power() const
{ return attack_power; }
virtual double composite_spell_power() const
{ return spell_power; }
virtual double composite_versatility() const
{ return versatility; }
virtual double composite_da_multiplier() const
{
return da_multiplier * player_multiplier * persistent_multiplier * target_da_multiplier * versatility *
pet_multiplier * target_pet_multiplier;
}
virtual double composite_ta_multiplier() const
{
return ta_multiplier * player_multiplier * persistent_multiplier * target_ta_multiplier * versatility *
pet_multiplier * target_pet_multiplier;
}
virtual double composite_rolling_ta_multiplier() const
{
return rolling_ta_multiplier;
}
virtual double composite_target_mitigation_da_multiplier() const
{ return target_mitigation_da_multiplier; }
virtual double composite_target_mitigation_ta_multiplier() const
{ return target_mitigation_ta_multiplier; }
virtual double composite_target_armor() const
{ return target_armor; }
// Inlined
virtual proc_types proc_type() const;
virtual proc_types2 execute_proc_type2() const;
// Secondary proc type of the impact event (i.e., assess_damage()). Only
// triggers the "amount" procs
virtual proc_types2 impact_proc_type2() const
{
// Don't allow impact procs that do not do damage or heal anyone; they
// should all be handled by execute_proc_type2(). Note that this is based
// on the _total_ amount done. This is so that fully overhealed heals are
// still alowed to proc things.
if ( result_total <= 0 )
return PROC2_INVALID;
if ( result == RESULT_HIT )
return PROC2_HIT;
else if ( result == RESULT_CRIT )
return PROC2_CRIT;
else if ( result == RESULT_GLANCE )
return PROC2_GLANCE;
return PROC2_INVALID;
}
virtual proc_types2 cast_proc_type2() const;
virtual proc_types2 interrupt_proc_type2() const;
};
struct travel_event_t : public event_t
{
action_t* action;
action_state_t* state;
travel_event_t( action_t* a, action_state_t* state, timespan_t time_to_travel );
~travel_event_t() override;
void execute() override;
const char* name() const override
{
return "Stateless Action Travel";
}
};