@ -74,6 +74,9 @@ namespace PlayerTests
Menu : : InitializeMenus ( ) ;
Tutorial : : Initialize ( ) ;
Stats : : InitializeDamageReductionTable ( ) ;
GameState : : Initialize ( ) ;
GameState : : STATE = GameState : : states . at ( States : : State : : GAME_RUN ) ;
# pragma region Setup a fake test map and test monster
game - > MAP_DATA [ " CAMPAIGN_1_1 " ] ;
@ -90,7 +93,9 @@ namespace PlayerTests
Menu : : themes . SetInitialized ( ) ;
GFX . SetInitialized ( ) ;
}
TEST_METHOD_CLEANUP ( CleanupTests ) {
testGame - > EndGame ( ) ;
}
TEST_METHOD ( PlayerAlive ) {
Assert : : IsTrue ( player - > IsAlive ( ) ) ;
}
@ -416,5 +421,23 @@ namespace PlayerTests
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 2.f , player - > GetMoveSpdMult ( ) , L " 100% Move Spd should double the move speed from 100% to 200% " ) ;
}
TEST_METHOD ( CDRStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor2 " s ) } ;
Assert : : AreEqual ( 0.f , player - > GetCooldownReductionPct ( ) , L " CDR is 0% " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 1.f , player - > GetCooldownReductionPct ( ) , L " Player should have 100% CDR " ) ;
testKey - > bHeld = true ; //Force the key to be held down for testing purposes.
player - > CheckAndPerformAbility ( player - > GetAbility1 ( ) , testKeyboardInput ) ;
player - > CheckAndPerformAbility ( player - > GetAbility2 ( ) , testKeyboardInput ) ;
player - > CheckAndPerformAbility ( player - > GetAbility3 ( ) , testKeyboardInput ) ;
player - > CheckAndPerformAbility ( player - > GetAbility4 ( ) , testKeyboardInput ) ;
game - > OnUserUpdate ( 0.01f ) ; //Let 0.01 seconds go by. All abilities should be off cooldown.
Assert : : AreEqual ( 0.f , player - > GetAbility1 ( ) . cooldown , L " Using an ability with 100% CDR should result in a 0 second cooldown. " ) ;
Assert : : AreEqual ( 0.f , player - > GetAbility2 ( ) . cooldown , L " Using an ability with 100% CDR should result in a 0 second cooldown. " ) ;
Assert : : AreEqual ( 0.f , player - > GetAbility3 ( ) . cooldown , L " Using an ability with 100% CDR should result in a 0 second cooldown. " ) ;
Assert : : AreEqual ( 0.f , player - > GetAbility4 ( ) . cooldown , L " Using an ability with 100% CDR should result in a 0 second cooldown. " ) ;
}
} ;
}