AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
RageWeaponSpeedHitFactorTest.cpp File Reference
#include "IntegrationTestFixture.h"
#include "gtest/gtest.h"

Go to the source code of this file.

Functions

 TEST_F (IntegrationTestFixture, HasteChangesIntervalNotRage)
 

Function Documentation

◆ TEST_F()

TEST_F ( IntegrationTestFixture  ,
HasteChangesIntervalNotRage   
)
23{
24 TestPlayer* player = CreateTestPlayer(1, "RageTest", SEC_PLAYER);
26 player->SetMaxPower(POWER_RAGE, 10000);
27 player->SetAttackTime(BASE_ATTACK, 2000);
28
29 uint32 const before = player->GetPower(POWER_RAGE);
30 player->RewardRage(1000, player->GetRageWeaponSpeedHitFactor(BASE_ATTACK), true);
31 uint32 const rageNoHaste = player->GetPower(POWER_RAGE) - before;
32 EXPECT_GT(rageNoHaste, 0u); // rage was granted
33
34 player->ApplyAttackTimePercentMod(BASE_ATTACK, 50.0f, true); // 50% haste
35
36 EXPECT_EQ(player->GetRageWeaponSpeedHitFactor(BASE_ATTACK), 7u); // 2000/1000 * 3.5
37
38 uint32 const beforeHasted = player->GetPower(POWER_RAGE);
39 player->RewardRage(1000, player->GetRageWeaponSpeedHitFactor(BASE_ATTACK), true);
40 uint32 const rageHasted = player->GetPower(POWER_RAGE) - beforeHasted;
41
42 EXPECT_EQ(rageHasted, rageNoHaste); // per-swing rage unaffected by haste
43
45 EXPECT_EQ(player->getAttackTimer(BASE_ATTACK), 1333); // 2000 / 1.5 (50% haste)
46}
@ SEC_PLAYER
Definition Common.h:57
std::uint32_t uint32
Definition Define.h:107
@ POWER_RAGE
Definition SharedDefines.h:258
@ BASE_ATTACK
Definition Unit.h:216
@ UNIT_FIELD_LEVEL
Definition UpdateFields.h:114
Definition TestPlayer.h:24
uint32 GetRageWeaponSpeedHitFactor(WeaponAttackType att) const
Definition Unit.h:921
void ApplyAttackTimePercentMod(WeaponAttackType att, float val, bool apply)
Definition Unit.cpp:13064
void RewardRage(uint32 damage, uint32 weaponSpeedHitFactor, bool attacker)
Definition Unit.cpp:15671
void SetMaxPower(Powers power, uint32 val)
Definition Unit.cpp:12089
void SetUInt32Value(uint16 index, uint32 value)
Definition Unit.cpp:16980
int32 getAttackTimer(WeaponAttackType type) const
Definition Unit.h:888
uint32 GetPower(Powers power) const
Definition Unit.h:1141
void SetAttackTime(WeaponAttackType att, uint32 val)
Definition Unit.h:926
void resetAttackTimer(WeaponAttackType type=BASE_ATTACK)
Definition Unit.cpp:769

References Unit::ApplyAttackTimePercentMod(), BASE_ATTACK, Unit::getAttackTimer(), Unit::GetPower(), Unit::GetRageWeaponSpeedHitFactor(), POWER_RAGE, Unit::resetAttackTimer(), Unit::RewardRage(), SEC_PLAYER, Unit::SetAttackTime(), Unit::SetMaxPower(), Unit::SetUInt32Value(), and UNIT_FIELD_LEVEL.