@ -109,79 +109,128 @@ namespace EnchantTests
}
TEST_METHOD ( HealthBoostCheck ) {
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 100 , player - > GetMaxHealth ( ) , L " Player starts with 100 health. " ) ;
Inventory : : EquipItem ( nullRing , EquipSlot : : RING1 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing . lock ( ) - > EnchantItem ( " Health Boost " ) ;
Test : : InRange ( player - > GetMaxHealth ( ) , { 103 , 105 } , L " Max Health not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Health Boost " ) ;
Test : : InRange ( player - > GetMaxHealth ( ) , { 106 , 110 } , L " Max Health not in expected range with two rings equipped. " ) ;
}
}
TEST_METHOD ( AttackBoostCheck ) {
player - > SetBaseStat ( " Attack " , 100.f ) ;
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 100 , player - > GetAttack ( ) , L " Player starts with 100 attack. " ) ;
Inventory : : EquipItem ( nullRing , EquipSlot : : RING1 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing . lock ( ) - > EnchantItem ( " Attack Boost " ) ;
Test : : InRange ( player - > GetAttack ( ) , { 103 , 105 } , L " Attack not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Attack Boost " ) ;
Test : : InRange ( player - > GetAttack ( ) , { 106 , 110 } , L " Attack not in expected range with two rings equipped. " ) ;
}
}
TEST_METHOD ( MovementBoostCheck ) {
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 100.0 _Pct , player - > GetMoveSpdMult ( ) , L " Player starts with 100% Movespd. " ) ;
Inventory : : EquipItem ( nullRing , EquipSlot : : RING1 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing . lock ( ) - > EnchantItem ( " Movement Boost " ) ;
Test : : InRange ( player - > GetMoveSpdMult ( ) , { 103.0 _Pct , 105.0 _Pct } , L " Move Speed not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Movement Boost " ) ;
Test : : InRange ( player - > GetMoveSpdMult ( ) , { 106.0 _Pct , 110.0 _Pct } , L " Move Speed not in expected range with two rings equipped. " ) ;
}
}
TEST_METHOD ( AbilityHasteCheck ) {
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetCooldownReductionPct ( ) , L " Player starts with 0% CDR. " ) ;
Inventory : : EquipItem ( nullRing , EquipSlot : : RING1 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing . lock ( ) - > EnchantItem ( " Ability Haste " ) ;
Test : : InRange ( player - > GetCooldownReductionPct ( ) , { 3.0 _Pct , 5.0 _Pct } , L " CDR not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Ability Haste " ) ;
Test : : InRange ( player - > GetCooldownReductionPct ( ) , { 6.0 _Pct , 10.0 _Pct } , L " CDR not in expected range with two rings. " ) ;
}
}
TEST_METHOD ( CritRateCheck ) {
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetCritRatePct ( ) , L " Player starts with 0% Crit Rate. " ) ;
Inventory : : EquipItem ( nullRing , EquipSlot : : RING1 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing . lock ( ) - > EnchantItem ( " Crit Rate " ) ;
Test : : InRange ( player - > GetCritRatePct ( ) , { 3.0 _Pct , 5.0 _Pct } , L " Crit Rate not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Crit Rate " ) ;
Test : : InRange ( player - > GetCritRatePct ( ) , { 6.0 _Pct , 10.0 _Pct } , L " Crit Rate not in expected range with two rings. " ) ;
}
}
TEST_METHOD ( CritDamageCheck ) {
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 50.0 _Pct , player - > GetCritDmgPct ( ) , L " Player starts with 50% Crit Damage. " ) ;
Inventory : : EquipItem ( nullRing , EquipSlot : : RING1 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing . lock ( ) - > EnchantItem ( " Crit Damage " ) ;
Test : : InRange ( player - > GetCritDmgPct ( ) , { 57.0 _Pct , 60.0 _Pct } , L " Crit Damage not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Crit Damage " ) ;
Test : : InRange ( player - > GetCritDmgPct ( ) , { 64.0 _Pct , 70.0 _Pct } , L " Crit Damage not in expected range with two rings. " ) ;
}
}
TEST_METHOD ( StoneskinCheck ) {
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetDamageReductionPct ( ) , L " Player starts with 0% Damage Reduction. " ) ;
Inventory : : EquipItem ( nullRing , EquipSlot : : RING1 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing . lock ( ) - > EnchantItem ( " Stoneskin " ) ;
Test : : InRange ( player - > GetDamageReductionPct ( ) , { 3.0 _Pct , 5.0 _Pct } , L " Damage Reduction not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Stoneskin " ) ;
Test : : InRange ( player - > GetDamageReductionPct ( ) , { 6.0 _Pct , 10.0 _Pct } , L " Damage Reduction not in expected range with two rings. " ) ;
}
}
TEST_METHOD ( ManaPoolCheck ) {
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 100 , player - > GetMaxMana ( ) , L " Player starts with 100 mana. " ) ;
Inventory : : EquipItem ( nullRing , EquipSlot : : RING1 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing . lock ( ) - > EnchantItem ( " Mana Pool " ) ;
Test : : InRange ( player - > GetMaxMana ( ) , { 107 , 112 } , L " Mana Pool not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Mana Pool " ) ;
Test : : InRange ( player - > GetMaxMana ( ) , { 114 , 124 } , L " Mana Pool not in expected range with two rings. " ) ;
}
}
TEST_METHOD ( MagicalProtectionCheck ) {
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 100 , player - > GetMaxHealth ( ) , L " Player starts with 100 health. " ) ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetDamageReductionPct ( ) , L " Player starts with 0% damage reduction. " ) ;
Assert : : AreEqual ( 100.0 _Pct , player - > GetMoveSpdMult ( ) , L " Player starts with 100% move speed. " ) ;
@ -194,10 +243,19 @@ namespace EnchantTests
Test : : InRange ( player - > GetMoveSpdMult ( ) , { 102.0 _Pct , 103.0 _Pct } , L " Move Speed % not in expected range. " ) ;
Test : : InRange ( player - > GetHP6RecoveryPct ( ) , { 1.0 _Pct , 1.0 _Pct } , L " HP/6 Recovery not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Magical Protection " ) ;
Test : : InRange ( player - > GetMaxHealth ( ) , { 102 , 103 } , L " Max Health not in expected range with two rings. " ) ;
Test : : InRange ( player - > GetDamageReductionPct ( ) , { 2.0 _Pct , 3.0 _Pct } , L " Damage Reduction not in expected range with two rings. " ) ;
Test : : InRange ( player - > GetMoveSpdMult ( ) , { 102.0 _Pct , 103.0 _Pct } , L " Move Speed % not in expected range with two rings. " ) ;
Test : : InRange ( player - > GetHP6RecoveryPct ( ) , { 1.0 _Pct , 1.0 _Pct } , L " HP/6 Recovery not in expected range with two rings. " ) ;
}
}
TEST_METHOD ( AuraOfTheBeastCheck ) {
player - > SetBaseStat ( " Attack " , 100.f ) ;
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
std : : weak_ptr < Item > nullRing2 { Inventory : : AddItem ( " Null Ring " s ) } ;
Assert : : AreEqual ( 100 , player - > GetAttack ( ) , L " Player starts with 100 attack. " ) ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetCritRatePct ( ) , L " Player starts with 0% crit rate. " ) ;
Assert : : AreEqual ( 0.0 _Pct , player - > GetCooldownReductionPct ( ) , L " Player starts with 0% cooldown reduction. " ) ;
@ -210,6 +268,14 @@ namespace EnchantTests
Test : : InRange ( player - > GetCooldownReductionPct ( ) , { 2.0 _Pct , 3.0 _Pct } , L " Cooldown Reduction % not in expected range. " ) ;
Test : : InRange ( player - > GetCritDmgPct ( ) , { 53.0 _Pct , 57.0 _Pct } , L " Crit Damage not in expected range. " ) ;
}
Inventory : : EquipItem ( nullRing2 , EquipSlot : : RING2 ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 1000 ) ) {
nullRing2 . lock ( ) - > EnchantItem ( " Aura of the Beast " ) ;
Test : : InRange ( player - > GetAttack ( ) , { 102 , 103 } , L " Attack not in expected range with two rings. " ) ;
Test : : InRange ( player - > GetCritRatePct ( ) , { 2.0 _Pct , 3.0 _Pct } , L " Crit Rate not in expected range with two rings. " ) ;
Test : : InRange ( player - > GetCooldownReductionPct ( ) , { 2.0 _Pct , 3.0 _Pct } , L " Cooldown Reduction % not in expected range with two rings. " ) ;
Test : : InRange ( player - > GetCritDmgPct ( ) , { 53.0 _Pct , 57.0 _Pct } , L " Crit Damage not in expected range with two rings. " ) ;
}
}
TEST_METHOD ( LethalTempoCheck ) {
MonsterData testMonsterData { " TestName " , " Test Monster " , 30 , 10 , 5 , { MonsterDropData { " Health Potion " , 100.f , 1 , 1 } } , 200.f } ;
@ -291,5 +357,29 @@ namespace EnchantTests
}
Assert : : AreEqual ( true , survivedAtLeastOnce , L " Player should have survived at least one time with Death Defiance. " ) ;
}
TEST_METHOD ( ReaperOfSoulsCheck ) {
MonsterData testMonsterData { " TestName " , " Test Monster " , 30 , 10 , 5 , { MonsterDropData { " Health Potion " , 100.f , 1 , 1 } } , 200.f } ;
MONSTER_DATA [ " TestName " ] = testMonsterData ;
Monster testMonster { { } , MONSTER_DATA [ " TestName " ] } ;
Monster testMonster2 { { } , MONSTER_DATA [ " TestName " ] } ;
testMonster . Hurt ( 1000 , testMonster . OnUpperLevel ( ) , testMonster . GetZ ( ) ) ;
testGame - > SetElapsedTime ( 0.5f ) ;
testGame - > OnUserUpdate ( 0.5f ) ;
for ( Effect * eff : game - > GetAllEffects ( ) | std : : views : : filter ( [ ] ( Effect * eff ) { return eff - > GetType ( ) = = EffectType : : MONSTER_SOUL ; } ) ) {
Assert : : Fail ( L " A Monster Soul should not be generated " ) ;
}
std : : weak_ptr < Item > nullRing { Inventory : : AddItem ( " Null Ring " s ) } ;
Inventory : : EquipItem ( nullRing , EquipSlot : : RING1 ) ;
nullRing . lock ( ) - > EnchantItem ( " Reaper of Souls " ) ;
testMonster2 . Hurt ( 1000 , testMonster2 . OnUpperLevel ( ) , testMonster2 . GetZ ( ) ) ;
testGame - > SetElapsedTime ( 0.5f ) ;
testGame - > OnUserUpdate ( 0.5f ) ;
bool foundSoul { false } ;
for ( const Effect * eff : game - > GetAllEffects ( ) | std : : views : : filter ( [ ] ( const Effect * eff ) { return eff - > GetType ( ) = = EffectType : : MONSTER_SOUL ; } ) ) {
foundSoul = true ;
break ;
}
if ( ! foundSoul ) Assert : : Fail ( L " A soul was not generated from a kill with the Reaper of Souls enchant. " ) ;
}
} ;
}