diff --git a/Adventures in Lestoria Tests/EnchantTests.cpp b/Adventures in Lestoria Tests/EnchantTests.cpp index 5c058249..c4b46d73 100644 --- a/Adventures in Lestoria Tests/EnchantTests.cpp +++ b/Adventures in Lestoria Tests/EnchantTests.cpp @@ -100,6 +100,8 @@ namespace EnchantTests MONSTER_DATA["TestName"]=testMonsterData; #pragma endregion + testGame->InitializeCamera(); + player=testGame->GetPlayer(); //Setup key "0" as a test input testKeyboardInput.AddKeybind(Input{InputType::KEY,0}); @@ -949,7 +951,7 @@ namespace EnchantTests trap.MonsterHit(newMonster,1); //Simulate 1 mark stack on the monster to trigger the bleed. Assert::AreEqual("Trapper.Ability 2.Marked Target Bleed"_f[1]+"Lingering Scent"_ENC["BLEED EXTRA DURATION"],newMonster.GetBuffs(BuffType::OVER_TIME)[0].duration,L"Bleed duration should be 10 seconds by default."); } - TEST_METHOD(SpecialMarkNoEnchantCheck){ + TEST_METHOD(OpportunityShotNoEnchantCheck){ game->ChangePlayerClass(TRAPPER); player=game->GetPlayer(); Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])}; @@ -959,9 +961,12 @@ namespace EnchantTests } Assert::AreEqual(size_t(0),newMonster.GetBuffs(BuffType::SPECIAL_MARK).size(),L"A special mark should not be spawned without the enchant."); } - TEST_METHOD(SpecialMarkEnchantCheck){ + TEST_METHOD(OpportunityShotEnchantCheck){ game->ChangePlayerClass(TRAPPER); player=game->GetPlayer(); + std::weak_ptrnullRing{Inventory::AddItem("Null Ring"s)}; + Inventory::EquipItem(nullRing,EquipSlot::RING1); + nullRing.lock()->EnchantItem("Opportunity Shot"); Monster&newMonster{game->SpawnMonster({},MONSTER_DATA["TestName"])}; for(int i:std::ranges::iota_view(0,10)){ game->SetElapsedTime(1.f); diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index a1b3d701..98886ce4 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -309,11 +309,7 @@ bool AiL::OnUserCreate(){ InitializeLevels(); //Initialize Camera. - camera=Camera2D{WINDOW_SIZE}; - camera.SetMode(olc::utils::Camera2D::Mode::LazyFollow); - camera.SetTarget(player->GetPos()); - camera.SetWorldBoundary({0,0},GetCurrentMap().MapData.MapSize*GetCurrentMap().MapData.TileSize); - camera.EnableWorldBoundary(false); + InitializeCamera(); sig::Animation::SetupPlayerAnimations(); view=TileTransformedView{GetScreenSize(),{1,1}}; @@ -3018,6 +3014,7 @@ void AiL::ChangePlayerClass(Class cl){ Player::moneyListeners=moneyListeners; GetPlayer()->InitializeMinimapImage(); player->RecalculateEquipStats(); + player->OnLevelStart(); } void AiL::InitializeClasses(){ @@ -4611,4 +4608,14 @@ std::vectorAiL::GetAllEffects()const{ std::vectorbackgroundEffects{GetBackgroundEffects()}; std::merge(foregroundEffects.begin(),foregroundEffects.end(),backgroundEffects.begin(),backgroundEffects.end(),std::back_inserter(outputVec)); return outputVec; +} + +void AiL::InitializeCamera(){ + camera=Camera2D{WINDOW_SIZE}; + camera.SetMode(Camera2D::Mode::Simple); + camera.SetTarget(player->GetPos()); + camera.Update(0.f); + camera.SetMode(olc::utils::Camera2D::Mode::LazyFollow); + camera.SetWorldBoundary({0,0},GetCurrentMap().MapData.MapSize*GetCurrentMap().MapData.TileSize); + camera.EnableWorldBoundary(false); } \ No newline at end of file diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 5b419e13..615793c0 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -392,6 +392,7 @@ public: void AddToSpecialMarkedTargetList(std::tuple,StackCount,MarkTime>markData); void InitializeClasses(); void _SetCurrentLevel(const MapName map); //NOTE: This will modify the currentLevel variable without triggering anything else in-game, this will normally mess up the state in the game. Ideally this is only used when initializing a test level. + void InitializeCamera(); std::vectorGetForegroundEffects()const; std::vectorGetBackgroundEffects()const; diff --git a/Adventures in Lestoria/MonsterData.cpp b/Adventures in Lestoria/MonsterData.cpp index 601007ba..0a9cf54a 100644 --- a/Adventures in Lestoria/MonsterData.cpp +++ b/Adventures in Lestoria/MonsterData.cpp @@ -52,7 +52,7 @@ std::mapMONSTER_DATA; MonsterData::MonsterData() :atk(0),collisionDmg(0),hp(0),moveSpd(0),size(0),strategy("Run Towards"){} MonsterData::MonsterData(std::string name,std::string displayName,int hp,int atk,const uint32_t xp,std::vectordrops,float moveSpd,float size,std::string strategy,int collisionDmg): - name(name),displayName(displayName),hp(hp),atk(atk),xp(xp),moveSpd(moveSpd),size(size),strategy(strategy),dropData(drops),collisionDmg(collisionDmg){} + name(name),displayName(displayName),hp(hp),atk(atk),xp(xp),moveSpd(moveSpd),size(size),strategy(strategy),dropData(drops),collisionDmg(collisionDmg),collisionRadius(8.f*this->size){} void MonsterData::InitializeMonsterData(){ for(auto&[key,size]:DATA["Monsters"].GetKeys()){ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index bc0b38f0..4df1f5ab 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 2 #define VERSION_PATCH 3 -#define VERSION_BUILD 11031 +#define VERSION_BUILD 11039 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/olcUTIL_Camera2D.h b/Adventures in Lestoria/olcUTIL_Camera2D.h index 10c69d88..ba480f52 100644 --- a/Adventures in Lestoria/olcUTIL_Camera2D.h +++ b/Adventures in Lestoria/olcUTIL_Camera2D.h @@ -216,7 +216,7 @@ namespace olc::utils case Mode::LazyFollow: { - m_vPosition += (GetTarget() - m_vPosition) * m_fLazyFollowRate * fElapsedTime; + m_vPosition += (GetTarget() - m_vPosition) * std::min(1.f,m_fLazyFollowRate * fElapsedTime); } break; diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 629311d4..55dcb446 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ