@ -429,15 +429,93 @@ namespace PlayerTests
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 - > GetRightClickAbility ( ) , testKeyboardInput ) ;
player - > CheckAndPerformAbility ( player - > GetAbility1 ( ) , testKeyboardInput ) ;
player - > CheckAndPerformAbility ( player - > GetAbility2 ( ) , testKeyboardInput ) ;
player - > CheckAndPerformAbility ( player - > GetAbility3 ( ) , testKeyboardInput ) ;
player - > CheckAndPerformAbility ( player - > GetAbility4 ( ) , testKeyboardInput ) ;
game - > SetElapsedTime ( 0.01f ) ; //Force elapsed time value.
game - > OnUserUpdate ( 0.01f ) ; //Let 0.01 seconds go by. All abilities should be off cooldown.
Assert : : AreEqual ( 0.f , player - > GetRightClickAbility ( ) . cooldown , L " Using an ability with 100% CDR should result in a 0 second cooldown. " ) ; //Defensive is currently not affected by CDR.
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. " ) ;
}
TEST_METHOD ( CritRateStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor2 " s ) } ;
Assert : : AreEqual ( 0.f , player - > GetCritRatePct ( ) , L " Crit Rate is 0% " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 1.f , player - > GetCritRatePct ( ) , L " Player should have 100% Crit Rate " ) ;
}
TEST_METHOD ( CritDmgStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor2 " s ) } ;
Assert : : AreEqual ( 0.5f , player - > GetCritDmgPct ( ) , L " Crit Damage is 50% " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 1.5f , player - > GetCritDmgPct ( ) , L " Player should have 150% Crit Damage " ) ;
}
TEST_METHOD ( HealthPctStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor2 " s ) } ;
Assert : : AreEqual ( 100 , player - > GetHealth ( ) , L " Current Health is 100 " ) ;
Assert : : AreEqual ( 100 , player - > GetMaxHealth ( ) , L " Max Health is 100 " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 100 , player - > GetHealth ( ) , L " Current Health is still 100 " ) ;
Assert : : AreEqual ( 200 , player - > GetMaxHealth ( ) , L " Max Health is now 200 " ) ;
}
TEST_METHOD ( HP6RecoveryStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor2 " s ) } ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetHP6RecoveryPct ( ) , L " HP6 Recovery % is 0 " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 100.0 _Pct , player - > GetHP6RecoveryPct ( ) , L " HP6 Recovery % is 100% " ) ;
}
TEST_METHOD ( HP4RecoveryStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor3 " s ) } ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetHP4RecoveryPct ( ) , L " HP4 Recovery % is 0 " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 100.0 _Pct , player - > GetHP4RecoveryPct ( ) , L " HP4 Recovery % is 100% " ) ;
}
TEST_METHOD ( DamageReductionStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor3 " s ) } ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetDamageReductionPct ( ) , L " Damage Reduction is 0% " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 100.0 _Pct , player - > GetDamageReductionPct ( ) , L " Damage Reduction is 100% " ) ;
}
TEST_METHOD ( HPRecoveryStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor4 " s ) } ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetHPRecoveryPct ( ) , L " HP Recovery % is 0 " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 100.0 _Pct , player - > GetHPRecoveryPct ( ) , L " HP Recovery % is 100% " ) ;
}
TEST_METHOD ( AttackSpeedStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor4 " s ) } ;
Assert : : AreEqual ( 0.f , player - > GetAttackRecoveryRateReduction ( ) , L " Attack Speed Reduction is 0 seconds " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 50.f , player - > GetAttackRecoveryRateReduction ( ) , L " Attack Speed Reduction is 50 seconds " ) ;
}
TEST_METHOD ( ManaStatEquipCheck ) {
std : : weak_ptr < Item > setArmor { Inventory : : AddItem ( " Test Armor4 " s ) } ;
Assert : : AreEqual ( 100 , player - > GetMana ( ) , L " Mana is 100 " ) ;
Assert : : AreEqual ( 100 , player - > GetMaxMana ( ) , L " Max Mana is 100 " ) ;
Inventory : : EquipItem ( setArmor , EquipSlot : : ARMOR ) ;
Assert : : AreEqual ( 100 , player - > GetMana ( ) , L " Mana is still 100 " ) ;
Assert : : AreEqual ( 200 , player - > GetMaxMana ( ) , L " Max Mana is now 200 " ) ;
}
} ;
}