Monster tests to ensure Health % and Attack % modifiers work properly. 55/55 tests passing.

removeExposedPackKey
sigonasr2 5 months ago
parent f7ec3ef630
commit ba2d568f77
  1. 17
      Adventures in Lestoria Tests/MonsterTests.cpp

@ -149,6 +149,23 @@ namespace MonsterTests
Assert::AreEqual(game->GetPlayer()->GetMaxHealth()-15,game->GetPlayer()->GetHealth(),L"Player Health is now 85."); Assert::AreEqual(game->GetPlayer()->GetMaxHealth()-15,game->GetPlayer()->GetHealth(),L"Player Health is now 85.");
Assert::AreEqual(testMonster2.GetMaxHealth()-15,testMonster2.GetHealth(),L"Monster Health is now 15."); Assert::AreEqual(testMonster2.GetMaxHealth()-15,testMonster2.GetHealth(),L"Monster Health is now 15.");
} }
TEST_METHOD(HealthUpModifierWorks){
Monster buffMonster{{},MONSTER_DATA["TestName"]};
buffMonster.AddBuff(BuffType::STAT_UP,5,5.f,{"Health"});
Assert::AreEqual(35,buffMonster.GetMaxHealth(),L"Monster Max Health is now 35.");
Assert::AreEqual(30,buffMonster.GetHealth(),L"Monster Current Health is still 30.");
}
TEST_METHOD(AttackUpPctModifierWorks){
Monster buffMonster{{},MONSTER_DATA["TestName"]};
buffMonster.AddBuff(BuffType::STAT_UP,5,100.0_Pct,{"Attack %"});
Monster testMonster2{{},MONSTER_DATA["TestName"]};
game->GetPlayer()->Hurt(buffMonster.GetAttack(),buffMonster.OnUpperLevel(),buffMonster.GetZ());
testMonster2.Hurt(buffMonster.GetAttack(),buffMonster.OnUpperLevel(),buffMonster.GetZ());
Assert::AreEqual(game->GetPlayer()->GetMaxHealth()-20,game->GetPlayer()->GetHealth(),L"Player Health is now 80.");
Assert::AreEqual(testMonster2.GetMaxHealth()-20,testMonster2.GetHealth(),L"Monster Health is now 10.");
}
TEST_METHOD(MonsterIsConsideredDeadAt0Health){ TEST_METHOD(MonsterIsConsideredDeadAt0Health){
Monster testMonster{{},MONSTER_DATA["TestName"]}; Monster testMonster{{},MONSTER_DATA["TestName"]};
testMonster.Hurt(testMonster.GetMaxHealth(),testMonster.OnUpperLevel(),testMonster.GetZ()); testMonster.Hurt(testMonster.GetMaxHealth(),testMonster.OnUpperLevel(),testMonster.GetZ());

Loading…
Cancel
Save