Haste buff unit test implementations completed! 230/230 tests passing. Release Build 12287.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 6m43s

This commit is contained in:
sigonasr2 2026-01-20 13:39:28 -06:00
parent f86a26d4b6
commit 45c5a03570
5 changed files with 24 additions and 6 deletions

View File

@ -535,6 +535,7 @@ namespace MonsterTests
}
TEST_METHOD(MonsterCollisionRadiusTest){
Monster&parrot{game->SpawnMonster({},MONSTER_DATA.at("Parrot"))};
parrot.strategy="[TEST]Run Right"; //Disable default AI for testing collisions
Game::Update(1.f);
Game::Update(1.f);
Assert::AreEqual(parrot.GetOriginalCollisionRadius(),parrot.GetCollisionRadius(),L"Parrot collision radius should be normal.");
@ -556,17 +557,33 @@ namespace MonsterTests
Monster&parrot{game->SpawnMonster({},MONSTER_DATA.at("Parrot"))};
}
TEST_METHOD(MonsterRunRightTest){
Monster&boar{game->SpawnMonster({12,12},MONSTER_DATA.at("Boar"))};
testGame->InitializeLevel("map_path"_S+DATA["Levels"]["TEST_MAP"]["Map File"].GetString(),"TEST_MAP");
testGame->_SetCurrentLevel("TEST_MAP");
testGame->GetPlayer()->ForceSetPos({100,100});
Monster&boar{game->SpawnMonster({24,24},MONSTER_DATA.at("Boar"))};
Game::Update(0.f); // Make sure monster spawns first.
boar.strategy="[TEST]Run Right";
const vf2d originalBoarPos{boar.GetPos()};
Game::Update(0.5f);
Assert::IsTrue(originalBoarPos+vf2d{50.f*boar.GetMoveSpdMult(),0.f}==boar.GetPos(),util::wformat("The boar should have moved {} units in half a second with the Hasten buff. Expected {}=={}",50.f*boar.GetMoveSpdMult(),(originalBoarPos+vf2d{50.f*boar.GetMoveSpdMult(),0.f}).str(),boar.GetPos().str()).c_str());
Assert::IsTrue(originalBoarPos+vf2d{50.f*boar.GetMoveSpdMult(),0.f}==boar.GetPos(),util::wformat("The boar should have moved {} units in half a second. Expected {}=={}",50.f*boar.GetMoveSpdMult(),(originalBoarPos+vf2d{50.f*boar.GetMoveSpdMult(),0.f}).str(),boar.GetPos().str()).c_str());
}
TEST_METHOD(MonsterHasteMoveTest){
testGame->InitializeLevel("map_path"_S+DATA["Levels"]["TEST_MAP"]["Map File"].GetString(),"TEST_MAP");
testGame->_SetCurrentLevel("TEST_MAP");
Monster&parrot{game->SpawnMonster({12,12},MONSTER_DATA.at("Parrot"))};
Monster&parrot{game->SpawnMonster({24,24},MONSTER_DATA.at("Parrot"))};
Game::Update(0.f); // Make sure monster spawns first.
parrot.strategy="[TEST]Run Right";
{
const vf2d originalParrotPos{parrot.GetPos()};
Game::Update(0.5f);
Assert::IsTrue(originalParrotPos+vf2d{50.f*parrot.GetMoveSpdMult(),0.f}==parrot.GetPos(),util::wformat("The parrot should have moved {} units in half a second without the Hasten buff. Expected {}=={}",50.f*parrot.GetMoveSpdMult(),(originalParrotPos+vf2d{50.f*parrot.GetMoveSpdMult(),0.f}).str(),parrot.GetPos().str()).c_str());
}
parrot.AddBuff(BuffType::HASTEN,INFINITE,0.3f);
{
const vf2d originalParrotPos{parrot.GetPos()};
Game::Update(0.5f);
Assert::IsTrue(originalParrotPos+vf2d{65.f*parrot.GetMoveSpdMult(),0.f}==parrot.GetPos(),util::wformat("The parrot should have moved {} units in half a second without the Hasten buff. Expected {}=={}",65.f*parrot.GetMoveSpdMult(),(originalParrotPos+vf2d{65.f*parrot.GetMoveSpdMult(),0.f}).str(),parrot.GetPos().str()).c_str());
}
}
};
}

View File

@ -407,7 +407,7 @@ void Monster::Update(const float fElapsedTime){
if(GetState()==State::NORMAL&&FaceTarget()){
UpdateFacingDirection(game->GetPlayer()->GetPos());
}
if(!game->TestingModeEnabled()&&CanMove())Monster::STRATEGY::RUN_STRATEGY(*this,game->GetElapsedTime());
if(CanMove())Monster::STRATEGY::RUN_STRATEGY(*this,game->GetElapsedTime());
}
animation.UpdateState(internal_animState,fElapsedTime);
if(HasMountedMonster())mounted_animation.value().UpdateState(internal_mounted_animState,fElapsedTime);

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 3
#define VERSION_PATCH 0
#define VERSION_BUILD 12282
#define VERSION_BUILD 12287
#define stringify(a) stringify_(a)
#define stringify_(a) #a

View File

@ -83,7 +83,7 @@ Credits
LINE[80]="License (OLC-3)"
LINE[81]="~~~~~~~~~~~~~~~"
LINE[82]=" "
LINE[83]="Copyright ` 2024 Sig Productions <niconiconii@lestoria.net>"
LINE[83]="Copyright ` 2026 Sig Productions <sigonasr2@gmail.com>"
LINE[84]=" "
LINE[85]="Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met:"
LINE[86]=" "

1
unique_commits.sh Normal file
View File

@ -0,0 +1 @@
git log --date=short --pretty=format:'%ad' | sort | uniq -c