From 7be77e92a5db6a0421c91494a7ea125f1b37c849 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii <89110903+Nic0Nic0Nii@users.noreply.github.com> Date: Fri, 26 Jan 2024 13:56:25 +0000 Subject: [PATCH] Lock on targeting position for bears were relative instead of absolute. Misleading variable name and fix directional vector of knockback effect Co-authored-by: sigonasr2 --- Adventures in Lestoria/Bear.cpp | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/Adventures in Lestoria/Bear.cpp b/Adventures in Lestoria/Bear.cpp index 06dcfc90..86ad1e00 100644 --- a/Adventures in Lestoria/Bear.cpp +++ b/Adventures in Lestoria/Bear.cpp @@ -30,7 +30,7 @@ CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. -Portions of this software are copyright © 2023 The FreeType +Portions of this software are copyright � 2023 The FreeType Project (www.freetype.org). Please see LICENSE_FT.txt for more information. All rights reserved. */ @@ -59,13 +59,13 @@ void Monster::STRATEGY::BEAR(Monster&m,float fElapsedTime,std::string strategy){ m.I(A::PHASE)=1; m.PerformShootAnimation(); m.F(A::CASTING_TIMER)=ConfigFloat("Chargeup Time"); - m.V(A::LOCKON_POS)=geom2d::line(m.GetPos(),game->GetPlayer()->GetPos()).vector(); + m.V(A::LOCKON_POS)=game->GetPlayer()->GetPos(); m.SetStrategyDrawFunction([](AiL*game,Monster&m,const std::string&strategy){ if(m.IsAlive()){ - game->view.DrawRotatedDecal(m.GetPos()+m.V(A::LOCKON_POS),GFX["range_indicator.png"].Decal(),0.f,{12.f,12.f},vf2d{ConfigFloat("Smash Attack Diameter"),ConfigFloat("Smash Attack Diameter")}/100.f,{255,255,0,160}); + game->view.DrawRotatedDecal(m.V(A::LOCKON_POS),GFX["range_indicator.png"].Decal(),0.f,{12.f,12.f},vf2d{ConfigFloat("Smash Attack Diameter"),ConfigFloat("Smash Attack Diameter")}/100.f,{255,255,0,160}); } }); - m.RotateTowardsPos(m.GetPos()+m.V(A::LOCKON_POS)); + m.RotateTowardsPos(m.V(A::LOCKON_POS)); }else{ m.target=game->GetPlayer()->GetPos(); RUN_TOWARDS(m,fElapsedTime,"Run Towards"); @@ -82,14 +82,13 @@ void Monster::STRATEGY::BEAR(Monster&m,float fElapsedTime,std::string strategy){ case 2:{ m.F(A::CASTING_TIMER)=std::max(0.f,m.F(A::CASTING_TIMER)-fElapsedTime); if(m.F(A::CASTING_TIMER)==0.f){ - SoundEffect::PlaySFX("Bear Slam Attack",m.GetPos()+m.V(A::LOCKON_POS)); + SoundEffect::PlaySFX("Bear Slam Attack",m.V(A::LOCKON_POS)); m.I(A::PHASE)=0; - geom2d::circleattackCircle={m.GetPos()+m.V(A::LOCKON_POS),float(operator""_Pixels(ConfigFloat("Smash Attack Diameter"))/2.f)}; - float lockOnDistToPlayer=geom2d::line(game->GetPlayer()->GetPos(),m.V(A::LOCKON_POS)).length(); + geom2d::circleattackCircle={m.V(A::LOCKON_POS),float(operator""_Pixels(ConfigFloat("Smash Attack Diameter"))/2.f)}; if(geom2d::overlaps(attackCircle,game->GetPlayer()->Hitbox())){ if(game->GetPlayer()->Hurt(m.GetAttack(),m.OnUpperLevel(),0.f)){ game->GetPlayer()->Knockup(ConfigFloat("Attack Knockup Duration")); - vf2d playerDirVecNorm=geom2d::line(game->GetPlayer()->GetPos(),m.V(A::LOCKON_POS)).vector().norm(); + vf2d playerDirVecNorm=geom2d::line(m.V(A::LOCKON_POS),game->GetPlayer()->GetPos()).vector().norm(); game->GetPlayer()->Knockback(playerDirVecNorm*ConfigFloat("Attack Knockback Amount")); } }