From aabc9e4cc50acd54f04a3f6f013656ba5ac35ba5 Mon Sep 17 00:00:00 2001 From: Nic0Nic0Nii <89110903+Nic0Nic0Nii@users.noreply.github.com> Date: Tue, 23 Jan 2024 20:57:25 +0000 Subject: [PATCH] Phase 1&2 prepping. Co-authored-by: sigonasr2 --- Adventures in Lestoria/SlimeKing.cpp | 6 +++--- Adventures in Lestoria/Ursule.cpp | 19 +++++++++++++++---- .../assets/config/MonsterStrategies.txt | 3 +++ 3 files changed, 21 insertions(+), 7 deletions(-) diff --git a/Adventures in Lestoria/SlimeKing.cpp b/Adventures in Lestoria/SlimeKing.cpp index c03e49ed..4d9b38dd 100644 --- a/Adventures in Lestoria/SlimeKing.cpp +++ b/Adventures in Lestoria/SlimeKing.cpp @@ -244,7 +244,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat m.phase=ConfigInt("StartPhase"); }break; case 1:{ - if(m.hp<=m.stats.A("Health")*ConfigFloat("Phase2.Change")/100){ + if(m.GetRemainingHPPct()<=ConfigFloat("Phase2.Change")/100.f){ m.phase=2; m.SetSize(ConfigFloat("Phase2.Size")/100,false); TransitionPhase(m.phase); @@ -277,7 +277,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat } }break; case 2:{ - if(m.hp<=m.stats.A("Health")*ConfigFloat("Phase3.Change")/100){ + if(m.GetRemainingHPPct()<=ConfigFloat("Phase3.Change")/100.f){ m.phase=3; m.SetSize(ConfigFloat("Phase3.Size")/100,false); TransitionPhase(m.phase); @@ -302,7 +302,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat } }break; case 3:{ - if(m.hp<=m.stats.A("Health")*ConfigFloat("Phase4.Change")/100){ + if(m.GetRemainingHPPct()<=ConfigFloat("Phase4.Change")/100.f){ m.phase=4; m.SetSize(ConfigFloat("Phase4.Size")/100,false); m.AddBuff(BuffType::SLOWDOWN,99999,ConfigFloat("Phase4.MoveSpdModifier")/100); diff --git a/Adventures in Lestoria/Ursule.cpp b/Adventures in Lestoria/Ursule.cpp index 04d4821a..b9096195 100644 --- a/Adventures in Lestoria/Ursule.cpp +++ b/Adventures in Lestoria/Ursule.cpp @@ -52,15 +52,26 @@ INCLUDE_MONSTER_DATA using A=Attribute; void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy){ - switch(m.I(A::PHASE)){ + switch(m.phase){ case 0:{ m.phase=ConfigInt("StartPhase"); }break; case 1:{ //Run bear strategy in phase 1. - if(m.GetRemainingHPPct()<=ConfigInt("Phase 2.Change")/100.f){ - m.I(A::PHASE)=2; - } + if(m.GetRemainingHPPct()<=ConfigFloat("Phase 2.Change")/100.f){ + if(m.F(A::RUN_AWAY_TIMER)==0.f)m.F(A::RUN_AWAY_TIMER)=10.f; + //before moving to Phase 2, we need to make sure we're in Phase 0 of the bear AI. + //We also need to move to the center of the map. + if(m.I(A::PHASE)!=0.f)goto bear; + else{ + float distToCenter=geom2d::line(m.GetPos(),game->GetCurrentMap().MapData.MapSize*{game->GetCurrentMap().MapData.tilewidth,game->GetCurrentMap().MapData.tileheight}).length(); + if(){ + }else{ //Now we're finally good for phase 2. + m.phase=2; + } + } + } + bear: BEAR(m,fElapsedTime,"Bear"); }break; case 2:{ diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 64395efa..07394383 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -233,6 +233,9 @@ MonsterStrategy # Which phase to start on. Should be 1 most of the time. StartPhase = 1 + # The maximum amount of time to spend trying to run to the center of the map. + Run To Center Max Time = 10.0s + Wisp Pattern 0 { Row[0] = .O...O..