Fix up Opportunity Shot test to check with actual accessory equipped. Move camera initialization to a function. Camera starts at actual target location immediately (instead of lazy follow). Fix bug with lazy follow camera becoming ridiculous at low frame rates (>0.25s updates). MonsterData now provides a default collisionRadius in the constructor. 159/159 Tests Passing. Release Build 11039.
This commit is contained in:
parent
45e6027c9e
commit
9005771f77
@ -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_ptr<Item>nullRing{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);
|
||||
|
@ -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::vector<Effect*>AiL::GetAllEffects()const{
|
||||
std::vector<Effect*>backgroundEffects{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);
|
||||
}
|
@ -392,6 +392,7 @@ public:
|
||||
void AddToSpecialMarkedTargetList(std::tuple<std::weak_ptr<Monster>,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::vector<Effect*>GetForegroundEffects()const;
|
||||
std::vector<Effect*>GetBackgroundEffects()const;
|
||||
|
@ -52,7 +52,7 @@ std::map<std::string,MonsterData>MONSTER_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::vector<MonsterDropData>drops,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()){
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user