diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index c2f4be86..d6fbb7e6 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -1097,8 +1097,8 @@ void AiL::RenderWorld(float fElapsedTime){ #pragma region Debug Collision boxes #ifdef _DEBUG if("debug_collision_boxes"_I){ - if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){ - geom2d::rectcollision=tileSheet.tileset->collision[tileSheetIndex].collision; + if(tileSheet.tileset.collision.find(tileSheetIndex)!=tileSheet.tileset.collision.end()){ + const geom2d::rectcollision=const_cast(tileSheet.tileset).collision.at(tileSheetIndex).collision; view.FillRectDecal(vf2d{float(x),float(y)}*float(GetCurrentMapData().tilewidth)+collision.pos,collision.size,{0,0,0,128}); view.DrawRectDecal(vf2d{float(x),float(y)}*float(GetCurrentMapData().tilewidth)+collision.pos,collision.size,GREY); } @@ -1128,8 +1128,8 @@ void AiL::RenderWorld(float fElapsedTime){ } #ifdef _DEBUG if("debug_collision_boxes"_I){ - if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){ - geom2d::rectcollision=tileSheet.tileset->collision[tileSheetIndex].collision; + if(tileSheet.tileset.collision.find(tileSheetIndex)!=tileSheet.tileset.collision.end()){ + const geom2d::rectcollision=const_cast(tileSheet.tileset).collision.at(tileSheetIndex).collision; view.FillRectDecal(vf2d{float(x),float(y)}*float(GetCurrentMapData().tilewidth)+collision.pos,collision.size,{0,0,0,128}); view.DrawRectDecal(vf2d{float(x),float(y)}*float(GetCurrentMapData().tilewidth)+collision.pos,collision.size,GREY); } @@ -1448,8 +1448,8 @@ void AiL::RenderWorld(float fElapsedTime){ view.DrawPartialDecal(vi2d{x,y}*game->GetCurrentMapData().tilewidth,{float(tileSheet.tileset.tilewidth),float(tileSheet.tileset.tileheight)},tileSheet.tileset.tileset->Decal(),vi2d{tileSheetX,tileSheetY}*game->GetCurrentMapData().tilewidth,{float(tileSheet.tileset.tilewidth),float(tileSheet.tileset.tileheight)},{255,255,255,uint8_t(255-bridgeFadeFactor/TileGroup::FADE_TIME*TileGroup::FADE_AMT)}); #ifdef _DEBUG if("debug_collision_boxes"_I){ - if(tileSheet.tileset->collision.find(tileSheetIndex)!=tileSheet.tileset->collision.end()){ - geom2d::rectcollision=tileSheet.tileset->collision[tileSheetIndex].collision; + if(tileSheet.tileset.collision.find(tileSheetIndex)!=tileSheet.tileset.collision.end()){ + const geom2d::rectcollision=const_cast(tileSheet.tileset).collision.at(tileSheetIndex).collision; view.FillRectDecal(vf2d{float(x),float(y)}*float(game->GetCurrentMapData().tilewidth)+collision.pos,collision.size,{0,0,0,128}); view.DrawRectDecal(vf2d{float(x),float(y)}*float(game->GetCurrentMapData().tilewidth)+collision.pos,collision.size,GREY); } diff --git a/Adventures in Lestoria/Boar.cpp b/Adventures in Lestoria/Boar.cpp index 79a7fce6..41615fce 100644 --- a/Adventures in Lestoria/Boar.cpp +++ b/Adventures in Lestoria/Boar.cpp @@ -61,26 +61,25 @@ void Monster::STRATEGY::BOAR(Monster&m,float fElapsedTime,std::string strategy){ case PhaseName::MOVE:{ float distToPlayer=geom2d::line(m.GetPos(),game->GetPlayer()->GetPos()).length(); if(m.canMove&&distToPlayer>=ConfigInt("Closein Range")/100.f*24){ - m.RemoveBuff(BuffType::SLOWDOWN); - m.targetAcquireTimer=0.f; + m.RemoveBuff(BuffType::SELF_INFLICTED_SLOWDOWN); RUN_TOWARDS(m,fElapsedTime,"Run Towards"); }else - if(m.canMove&&distToPlayer<=ConfigInt("Backpedal Range")/100.f*24){ - m.AddBuff(BuffType::SLOWDOWN,INFINITE,(100-ConfigInt("Backpedal Movespeed"))/100.f); + if(m.HasLineOfSight(game->GetPlayer()->GetPos())&&m.canMove&&distToPlayer<=ConfigInt("Backpedal Range")/100.f*24){ + m.RemoveBuff(BuffType::SELF_INFLICTED_SLOWDOWN); + m.AddBuff(BuffType::SELF_INFLICTED_SLOWDOWN,INFINITE,(100-ConfigInt("Backpedal Movespeed"))/100.f); m.target=geom2d::line(m.GetPos(),game->GetPlayer()->GetPos()).rpoint(-100); - m.targetAcquireTimer=INFINITY; if(m.attackedByPlayer)goto ScratchPhaseTransition; RUN_TOWARDS(m,fElapsedTime,"Run Towards"); m.UpdateFacingDirection(game->GetPlayer()->GetPos()); }else{ - ScratchPhaseTransition: + ScratchPhaseTransition: m.PerformOtherAnimation(0); m.F(A::CASTING_TIMER)=ConfigInt("Ground Scratch Count")*m.GetCurrentAnimation().GetTotalAnimationDuration(); m.phase=PhaseName::SCRATCH; } }break; case PhaseName::SCRATCH:{ - m.RemoveBuff(BuffType::SLOWDOWN); + m.RemoveBuff(BuffType::SELF_INFLICTED_SLOWDOWN); m.F(A::CASTING_TIMER)-=fElapsedTime; if(m.F(A::CASTING_TIMER)<=0.f){ m.PerformShootAnimation(); @@ -90,9 +89,16 @@ void Monster::STRATEGY::BOAR(Monster&m,float fElapsedTime,std::string strategy){ m.target=chargeTargetPoint; m.AddBuff(BuffType::SPEEDBOOST,INFINITE,ConfigFloat("Charge Movespeed")/100.f-1); + + float distanceToChargePoint=geom2d::line(m.GetPos(),chargeTargetPoint).length(); + m.F(A::TARGET_TIMER)=distanceToChargePoint/(100.f*m.GetMoveSpdMult()); //This should be how long a charge takes. + m.AddBuff(BuffType::COLLISION_KNOCKBACK_STRENGTH,15,ConfigFloat("Charge Knockback Amount")); } + m.UpdateFacingDirection(game->GetPlayer()->GetPos()); }break; case PhaseName::CHARGE:{ + m.F(A::TARGET_TIMER)-=fElapsedTime; + float distToTarget=geom2d::line(m.GetPos(),m.target).length(); auto TransitionToRecoveryPhase=[&](){ @@ -101,15 +107,16 @@ void Monster::STRATEGY::BOAR(Monster&m,float fElapsedTime,std::string strategy){ m.PerformIdleAnimation(); }; - if(m.bumpedIntoTerrain||distToTarget<4.f){ + if(m.F(A::TARGET_TIMER)<=0||m.bumpedIntoTerrain||distToTarget<12.f){ TransitionToRecoveryPhase(); }else{ - m.targetAcquireTimer=INFINITY; //Don't acquire a new target. RUN_TOWARDS(m,fElapsedTime,"Run Towards"); + m.PerformShootAnimation(); if(!m.canMove)TransitionToRecoveryPhase(); } }break; case PhaseName::RECOVERY:{ + m.RemoveBuff(BuffType::COLLISION_KNOCKBACK_STRENGTH); m.F(A::CHARGE_COOLDOWN)-=fElapsedTime; m.targetAcquireTimer=0.f; m.RemoveBuff(BuffType::SPEEDBOOST); diff --git a/Adventures in Lestoria/Buff.h b/Adventures in Lestoria/Buff.h index b3b1ff4a..88d2d58b 100644 --- a/Adventures in Lestoria/Buff.h +++ b/Adventures in Lestoria/Buff.h @@ -51,6 +51,7 @@ enum BuffType{ BARRIER_DAMAGE_REDUCTION, //Creates a visual barrier around the target FIXED_COLLISION_DMG, //Does a fixed amount of collision damage based on intensity of this buff. COLLISION_KNOCKBACK_STRENGTH, //Causes an amount of knockback based on intensity when hit via collision with this buff + SELF_INFLICTED_SLOWDOWN, //Used for monsters and can't be applied by any player abilities. }; class AiL; diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 64871f6c..264833ce 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -107,6 +107,9 @@ float Monster::GetMoveSpdMult(){ for(Buff&b:GetBuffs(SLOWDOWN)){ mod_moveSpd-=moveSpdPct*b.intensity; } + for(Buff&b:GetBuffs(SELF_INFLICTED_SLOWDOWN)){ + mod_moveSpd-=moveSpdPct*b.intensity; + } for(Buff&b:GetBuffs(LOCKON_SPEEDBOOST)){ mod_moveSpd+=moveSpdPct*b.intensity; } @@ -531,6 +534,8 @@ bool Monster::Hurt(int damage,bool onUpperLevel,float z){ } #pragma endregion lastHitTimer=0.05f; + + attackedByPlayer=true; if(!IsAlive()){ OnDeath(); @@ -621,7 +626,7 @@ void Monster::PathAroundBehavior(float fElapsedTime){ //Move towards the new path. geom2d::line moveTowardsLine=geom2d::line(pos,path.GetSplinePoint(pathIndex).pos); if(moveTowardsLine.length()>100*fElapsedTime*GetMoveSpdMult()){ - canMove=SetPos(pos+moveTowardsLine.vector().norm()*100*fElapsedTime*GetMoveSpdMult()); + canMove=SetPos(pos+moveTowardsLine.vector().norm()*100.f*fElapsedTime*GetMoveSpdMult()); UpdateFacingDirection(moveTowardsLine.end); }else{ if(pathIndex>=path.points.size()-1){ @@ -629,7 +634,7 @@ void Monster::PathAroundBehavior(float fElapsedTime){ pathIndex=0; targetAcquireTimer=0; }else{ - while(moveTowardsLine.length()<100*fElapsedTime*GetMoveSpdMult()){ + while(moveTowardsLine.length()<100.f*fElapsedTime*GetMoveSpdMult()){ pathIndex+=0.1f; moveTowardsLine=geom2d::line(pos,path.GetSplinePoint(pathIndex).pos); if(pathIndex>=path.points.size()-1){ @@ -640,7 +645,7 @@ void Monster::PathAroundBehavior(float fElapsedTime){ } } //Try to move to the new determined location. - canMove=SetPos(pos+moveTowardsLine.vector().norm()*100*fElapsedTime*GetMoveSpdMult()); + canMove=SetPos(pos+moveTowardsLine.vector().norm()*100.f*fElapsedTime*GetMoveSpdMult()); UpdateFacingDirection(moveTowardsLine.end); } } diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 8cec0694..be57907b 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -522,7 +522,7 @@ void Player::Update(float fElapsedTime){ m->SetPos(line.rpoint(dist*1.1f)); } if(m->IsAlive()&&!m->IsNPC()){ //Don't set the knockback if this monster is actually an NPC. Let's just push them around. - vel=line.vector().norm()*-128; + vel+=line.vector().norm()*-128; } } } diff --git a/Adventures in Lestoria/SettingsWindow.cpp b/Adventures in Lestoria/SettingsWindow.cpp index 03be6b2d..967239d7 100644 --- a/Adventures in Lestoria/SettingsWindow.cpp +++ b/Adventures in Lestoria/SettingsWindow.cpp @@ -59,7 +59,7 @@ INCLUDE_WINDOW_SIZE using A=Attribute; #define UNLOCK_ALL_BUTTON -#undef UNLOCK_ALL_BUTTON //Comment out to enable unlock all button. +//#undef UNLOCK_ALL_BUTTON //Comment out to enable unlock all button. void Menu::InitializeSettingsWindow(){ vf2d windowSize=WINDOW_SIZE-vf2d{28,28}; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 6bf86903..7ccb0e30 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 0 -#define VERSION_BUILD 8990 +#define VERSION_BUILD 9019 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 2c7ccf87..f2fa8010 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -549,5 +549,7 @@ MonsterStrategy Charge Recovery Time = 0.3s Backpedal Movespeed = 50% + + Charge Knockback Amount = 140 } } \ No newline at end of file diff --git a/Adventures in Lestoria/olcUTIL_Animate2D.h b/Adventures in Lestoria/olcUTIL_Animate2D.h index bd063902..db05b86f 100644 --- a/Adventures in Lestoria/olcUTIL_Animate2D.h +++ b/Adventures in Lestoria/olcUTIL_Animate2D.h @@ -144,6 +144,9 @@ namespace olc::utils::Animate2D case Style::PingPong: case Style::Reverse: //These two require twice as much time (minus one frame) to complete a full animation cycle. return m_vFrames.size()*m_fFrameDuration*2.f-m_fFrameDuration; + default: + ERR(std::format("WARNING! Animation style {} was not found! THIS SHOULD NOT BE HAPPENING!",int(m_nStyle))); + return 0.f; } } diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 575e0710..4381ae8d 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ