mirror of
https://github.com/DarkflameUniverse/DarkflameServer.git
synced 2025-08-05 02:04:04 +00:00
Adding damage cooldown/"invincibility frames" as in Live (#1276)
* Added cooldown handling * Made most of the logs hidden outside of debug mode * removed weird submodule * kill this phantom submodule * updated to reflect reviewed feedback * Added IsCooldownImmune() method to DestroyableComponent * friggin typo * Implemented non-pending changes and added cooldown immunity functions to DestroyableComponentTests * add trailing linebreak * another typo :( * flipped cooldown test order (not leaving immune) * Clean up comment and add DestroyableComponent test
This commit is contained in:
@@ -536,3 +536,22 @@ TEST_F(DestroyableTest, DestroyableComponentImmunityTest) {
|
||||
|
||||
}
|
||||
|
||||
/**
|
||||
* Test the Damage cooldown timer of DestroyableComponent
|
||||
*/
|
||||
TEST_F(DestroyableTest, DestroyableComponentDamageCooldownTest) {
|
||||
// Test the damage immune timer state (anything above 0.0f)
|
||||
destroyableComponent->SetDamageCooldownTimer(1.0f);
|
||||
EXPECT_FLOAT_EQ(destroyableComponent->GetDamageCooldownTimer(), 1.0f);
|
||||
ASSERT_TRUE(destroyableComponent->IsCooldownImmune());
|
||||
|
||||
// Test that the Update() function correctly decrements the damage cooldown timer
|
||||
destroyableComponent->Update(0.5f);
|
||||
EXPECT_FLOAT_EQ(destroyableComponent->GetDamageCooldownTimer(), 0.5f);
|
||||
ASSERT_TRUE(destroyableComponent->IsCooldownImmune());
|
||||
|
||||
// Test the non damage immune timer state (anything below or equal to 0.0f)
|
||||
destroyableComponent->SetDamageCooldownTimer(0.0f);
|
||||
EXPECT_FLOAT_EQ(destroyableComponent->GetDamageCooldownTimer(), 0.0f);
|
||||
ASSERT_FALSE(destroyableComponent->IsCooldownImmune());
|
||||
}
|
||||
|
Reference in New Issue
Block a user