@ -97,7 +97,7 @@ namespace EnchantTests
# pragma region Setup a fake test map and test monster
# pragma region Setup a fake test map and test monster
game - > MAP_DATA [ " CAMPAIGN_1_1 " ] ;
game - > MAP_DATA [ " CAMPAIGN_1_1 " ] ;
game - > MAP_DATA [ " CAMPAIGN_1_1 " ] . _SetMapData ( MapTag { 50 , 50 , 24 , 24 } ) ;
game - > MAP_DATA [ " CAMPAIGN_1_1 " ] . _SetMapData ( MapTag { 24 * 24 , 24 * 24 , 24 , 24 } ) ;
ItemDrop : : ClearDrops ( ) ;
ItemDrop : : ClearDrops ( ) ;
MonsterData testMonsterData { " TestName " , " Test Monster " , 1000 , 10 , 5 , { MonsterDropData { " Health Potion " , 100.f , 1 , 1 } } , 200.f } ;
MonsterData testMonsterData { " TestName " , " Test Monster " , 1000 , 10 , 5 , { MonsterDropData { " Health Potion " , 100.f , 1 , 1 } } , 200.f } ;
MONSTER_DATA [ " TestName " ] = testMonsterData ;
MONSTER_DATA [ " TestName " ] = testMonsterData ;
@ -577,6 +577,7 @@ namespace EnchantTests
}
}
TEST_METHOD ( TripleTossCheck ) {
TEST_METHOD ( TripleTossCheck ) {
Game : : ChangeClass ( player , THIEF ) ;
Game : : ChangeClass ( player , THIEF ) ;
player - > SetTestScreenAimingLocation ( player - > GetPos ( ) + vf2d { 30.f , 0.f } ) ;
player - > CheckAndPerformAbility ( player - > GetAbility1 ( ) , testKeyboardInput ) ;
player - > CheckAndPerformAbility ( player - > GetAbility1 ( ) , testKeyboardInput ) ;
Game : : Update ( 0.5f ) ;
Game : : Update ( 0.5f ) ;
Assert : : AreEqual ( size_t ( 1 ) , BULLET_LIST . size ( ) , L " Only 1 dagger has spawned without the Triple Toss enchant. " ) ;
Assert : : AreEqual ( size_t ( 1 ) , BULLET_LIST . size ( ) , L " Only 1 dagger has spawned without the Triple Toss enchant. " ) ;
@ -839,6 +840,7 @@ namespace EnchantTests
Assert : : AreEqual ( size_t ( 1 ) , BULLET_LIST . size ( ) , L " An Explosive Trap still exists (in the process of detonating a few times) " ) ;
Assert : : AreEqual ( size_t ( 1 ) , BULLET_LIST . size ( ) , L " An Explosive Trap still exists (in the process of detonating a few times) " ) ;
Assert : : AreEqual ( 721 , newMonster . GetHealth ( ) , L " Monster takes 104 + 104 damage from Concussive Trap bonus (Collision+Collateral Explosion). " ) ;
Assert : : AreEqual ( 721 , newMonster . GetHealth ( ) , L " Monster takes 104 + 104 damage from Concussive Trap bonus (Collision+Collateral Explosion). " ) ;
Game : : Update ( 5.5f ) ;
Game : : Update ( 5.5f ) ;
Game : : Update ( 5.5f ) ;
Assert : : AreEqual ( size_t ( 0 ) , BULLET_LIST . size ( ) , L " Explosive Trap detonates later. " ) ;
Assert : : AreEqual ( size_t ( 0 ) , BULLET_LIST . size ( ) , L " Explosive Trap detonates later. " ) ;
}
}
TEST_METHOD ( SwordEnchantmentNoEnchantCheck ) {
TEST_METHOD ( SwordEnchantmentNoEnchantCheck ) {
@ -966,12 +968,13 @@ namespace EnchantTests
}
}
TEST_METHOD ( BouncingOrbEnchantCheck ) {
TEST_METHOD ( BouncingOrbEnchantCheck ) {
Game : : ChangeClass ( player , WITCH ) ;
Game : : ChangeClass ( player , WITCH ) ;
player - > ForceSetPos ( { 5 0.f, 0.f } ) ;
player - > ForceSetPos ( { 2 0.f, 5 0.f} ) ;
Monster & newMonster { game - > SpawnMonster ( { 30.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
Monster & newMonster { game - > SpawnMonster ( { 30.f , 5 0.f} , MONSTER_DATA [ " TestName " ] ) } ;
Monster & newMonster2 { game - > SpawnMonster ( { 50.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
Monster & newMonster2 { game - > SpawnMonster ( { 50.f , 5 0.f} , MONSTER_DATA [ " TestName " ] ) } ;
Game : : GiveAndEquipEnchantedRing ( " Bouncing Orb " ) ;
Game : : GiveAndEquipEnchantedRing ( " Bouncing Orb " ) ;
Assert : : AreEqual ( 1000 , newMonster . GetHealth ( ) , L " Monster 1 is at 1000 HP. " ) ;
Assert : : AreEqual ( 1000 , newMonster . GetHealth ( ) , L " Monster 1 is at 1000 HP. " ) ;
Assert : : AreEqual ( 1000 , newMonster2 . GetHealth ( ) , L " Monster 2 is at 1000 HP. " ) ;
Assert : : AreEqual ( 1000 , newMonster2 . GetHealth ( ) , L " Monster 2 is at 1000 HP. " ) ;
player - > SetTestScreenAimingLocation ( player - > GetPos ( ) + vf2d { 30.f , 0.f } ) ;
player - > AutoAttack ( ) ;
player - > AutoAttack ( ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 50 ) ) {
for ( int i : std : : ranges : : iota_view ( 0 , 50 ) ) {
game - > SetElapsedTime ( 0.1f ) ;
game - > SetElapsedTime ( 0.1f ) ;
@ -1150,5 +1153,36 @@ namespace EnchantTests
Assert : : AreEqual ( newMonster3 . GetMaxHealth ( ) - 500 , newMonster3 . GetHealth ( ) , L " Monster 3 takes collateral damage from Curse of Doom enchant based on the amount of damage dealt during Curse of Death debuff. " ) ;
Assert : : AreEqual ( newMonster3 . GetMaxHealth ( ) - 500 , newMonster3 . GetHealth ( ) , L " Monster 3 takes collateral damage from Curse of Doom enchant based on the amount of damage dealt during Curse of Death debuff. " ) ;
Assert : : AreEqual ( newMonster4 . GetMaxHealth ( ) - 500 , newMonster4 . GetHealth ( ) , L " Monster 4 takes collateral damage from Curse of Doom enchant based on the amount of damage dealt during Curse of Death debuff. " ) ;
Assert : : AreEqual ( newMonster4 . GetMaxHealth ( ) - 500 , newMonster4 . GetHealth ( ) , L " Monster 4 takes collateral damage from Curse of Doom enchant based on the amount of damage dealt during Curse of Death debuff. " ) ;
}
}
TEST_METHOD ( PiercingBoltNoEnchantCheck ) {
Game : : ChangeClass ( player , WIZARD ) ;
Monster & newMonster { game - > SpawnMonster ( { 30.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
Monster & newMonster2 { game - > SpawnMonster ( { 30.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
Monster & newMonster3 { game - > SpawnMonster ( { 30.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
Monster & newMonster4 { game - > SpawnMonster ( { 30.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
player - > SetTestScreenAimingLocation ( player - > GetPos ( ) + vf2d { 30.f , 0.f } ) ;
Game : : Update ( 0.f ) ;
player - > AutoAttack ( ) ;
Game : : Update ( 0.5f ) ;
Assert : : AreEqual ( 985 , newMonster . GetHealth ( ) , L " Monster 1 takes normal damage from Wizard auto attack. " ) ;
Assert : : AreEqual ( 1000 , newMonster2 . GetHealth ( ) , L " Monster 2 should still be full health. " ) ;
Assert : : AreEqual ( 1000 , newMonster3 . GetHealth ( ) , L " Monster 3 should still be full health. " ) ;
Assert : : AreEqual ( 1000 , newMonster4 . GetHealth ( ) , L " Monster 4 should still be full health. " ) ;
}
TEST_METHOD ( PiercingBoltEnchantCheck ) {
Game : : ChangeClass ( player , WIZARD ) ;
Game : : GiveAndEquipEnchantedRing ( " Piercing Bolt " ) ;
Monster & newMonster { game - > SpawnMonster ( { 30.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
Monster & newMonster2 { game - > SpawnMonster ( { 30.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
Monster & newMonster3 { game - > SpawnMonster ( { 30.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
Monster & newMonster4 { game - > SpawnMonster ( { 30.f , 0.f } , MONSTER_DATA [ " TestName " ] ) } ;
player - > SetTestScreenAimingLocation ( player - > GetPos ( ) + vf2d { 30.f , 0.f } ) ;
Game : : Update ( 0.f ) ;
player - > AutoAttack ( ) ;
Game : : Update ( 0.5f ) ;
Assert : : AreEqual ( 985 , newMonster . GetHealth ( ) , L " Monster 1 takes normal damage from Wizard auto attack. " ) ;
Assert : : AreEqual ( 992 , newMonster2 . GetHealth ( ) , L " Monster 2 should take half the damage the first target does with the Percing Bolt Enchant. " ) ;
Assert : : AreEqual ( 992 , newMonster3 . GetHealth ( ) , L " Monster 3 should take half the damage the first target does with the Percing Bolt Enchant " ) ;
Assert : : AreEqual ( 992 , newMonster4 . GetHealth ( ) , L " Monster 4 should take half the damage the first target does with the Percing Bolt Enchant " ) ;
}
} ;
} ;
}
}