The open source repository for the action RPG game in development by Sig Productions titled 'Adventures in Lestoria'! https://forums.lestoria.net
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
AdventuresInLestoria/Adventures in Lestoria/Ursule.cpp

442 lines
23 KiB

#pragma region License
/*
License (OLC-3)
~~~~~~~~~~~~~~~
Copyright 2024 Joshua Sigona <sigonasr2@gmail.com>
Redistribution and use in source and binary forms, with or without modification,
are permitted provided that the following conditions are met:
1. Redistributions or derivations of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions or derivative works in binary form must reproduce the above
copyright notice. This list of conditions and the following disclaimer must be
reproduced in the documentation and/or other materials provided with the distribution.
3. Neither the name of the copyright holder nor the names of its contributors may
be used to endorse or promote products derived from this software without specific
prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
Portions of this software are copyright © 2024 The FreeType
Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#pragma endregion
#include "Monster.h"
#include "AdventuresInLestoria.h"
#include "MonsterStrategyHelpers.h"
#include "util.h"
#include "BulletTypes.h"
#include "SoundEffect.h"
INCLUDE_game
INCLUDE_BULLET_LIST
INCLUDE_GFX
INCLUDE_MONSTER_LIST
INCLUDE_MONSTER_DATA
INCLUDE_DATA
using A=Attribute;
void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy){
switch(m.phase){
case 0:{
m.phase=ConfigInt("StartPhase");
m.overlaySprite=ConfigString("Overlay Sprite");
m.overlaySpriteTransparency=0U;
#pragma region Setup On Death Function
m.SetStrategyDeathFunction([&](GameEvent&event,Monster&m,const std::string&strategy){
if(!m.B(A::BULLETS_REMOVED)){
for(const std::unique_ptr<Bullet>&b:BULLET_LIST){
b->deactivated=true;
b->fadeOutTime=ConfigFloat("Phase 4.End Wisp Fadeout Time");
}
m.B(A::BULLETS_REMOVED)=true;
}
m.F(A::ENVIRONMENT_TIMER)=std::max(0.f,m.F(A::ENVIRONMENT_TIMER)-game->GetElapsedTime());
switch(m.I(A::ENVIRONMENT_PHASE)){
case 0:{ //Fade out. Use the phase 2 environment fade-in color as the previous color to lerp out from.
game->SetWorldColor(ConfigPixel("Phase 4.Environment Fade-in Color")*util::lerp(0.f,1.0f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 4.Environment Fade-out Time")));
if(m.F(A::ENVIRONMENT_TIMER)==0.f){
game->SetWorldColor({0,0,0,255});
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Phase 4.Environment Fade-in Time");
m.I(A::ENVIRONMENT_PHASE)++;
game->SetWorldColorFunc([&](vi2d pos){return game->GetWorldColor();});
}
}break;
case 1:{ //Fade in.
Pixel fadeInCol=ConfigPixel("Phase 3.Environment Fade-in Color");
game->SetWorldColor(fadeInCol*util::lerp(1.f,0.f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 4.Environment Fade-in Time")));
if(m.F(A::ENVIRONMENT_TIMER)==0.f){
game->SetWorldColor(fadeInCol);
return false;
}
}break;
}
return true;
});
#pragma endregion
}break;
case 1:{ //Run bear strategy in phase 1.
auto TransitionToPhase2=[&](){
m.phase=2;
m.PerformAnimation("SIT");
m.AddBuff(BARRIER_DAMAGE_REDUCTION,INFINITE,ConfigFloat("Phase 2.Barrier Damage Reduction")/100.f);
m.I(A::PHASE_REPEAT_COUNT)=ConfigInt("Phase 2.Wisp Pattern Spawn Count");
SoundEffect::PlaySFX("Ursule Phase Transition",SoundEffect::CENTERED);
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Phase 2.Environment Fade-out Time");
m.I(A::ENVIRONMENT_PHASE)=0;
};
if(m.GetRemainingHPPct()<=ConfigFloat("Phase 2.Change")/100.f){
//before moving to Phase 2, we need to make sure we're in Phase 0 of the bear AI.
if(m.overlaySpriteTransparency<210U){
if(m.I(A::PHASE)!=0)goto bear;
else{
if(m.F(A::RUN_AWAY_TIMER)==0.f)m.F(A::RUN_AWAY_TIMER)=ConfigFloat("Phase 1.Fur Change Color Time");
else{
m.F(A::RUN_AWAY_TIMER)=std::max(0.f,m.F(A::RUN_AWAY_TIMER)-fElapsedTime);
if(m.F(A::RUN_AWAY_TIMER)==0.f)m.overlaySpriteTransparency=210U;
}
m.overlaySpriteTransparency=util::lerp(0U,210U,1-(m.F(A::RUN_AWAY_TIMER)/ConfigFloat("Phase 1.Fur Change Color Time")));
}
break;
}else{
//We also need to move to the center of the map.
if(m.F(A::RUN_AWAY_TIMER)==0.f)m.F(A::RUN_AWAY_TIMER)=ConfigFloat("Phase 1.Run to Center Time");
else{
m.F(A::RUN_AWAY_TIMER)=std::max(0.f,m.F(A::RUN_AWAY_TIMER)-fElapsedTime);
if(m.F(A::RUN_AWAY_TIMER)==0.f){
TransitionToPhase2();
break;
}
}
vf2d mapCenter=game->GetCurrentMap().GetMapData().MapSize*vf2d{float(game->GetCurrentMap().GetMapData().tilewidth),float(game->GetCurrentMap().GetMapData().tileheight)}/2.0f;
float distToCenter=geom2d::line<float>(m.GetPos(),mapCenter).length();
if(distToCenter>4.0f){
m.targetAcquireTimer=20.f;
m.target=mapCenter;
RUN_TOWARDS(m,fElapsedTime,"Run Towards");
break;
}else{ //Now we're finally good for phase 2.
TransitionToPhase2();
break;
}
}
}
if(m.I(A::BEAR_STOMP_COUNT)%(ConfigInt("Phase 1.Stomp Count")+1)==ConfigInt("Phase 1.Stomp Count")){
m.F(A::RUN_AWAY_TIMER)=ConfigFloat("Phase 1.Run Time");
m.I(A::PREVIOUS_PHASE)=m.phase;
m.AddBuff(SPEEDBOOST,10.f,ConfigFloat("Phase 1.Run Speed Boost")/100.f);
m.phase=6;
break;
}
bear:
BEAR(m,fElapsedTime,"Bear");
}break;
case 2:{
m.PerformAnimation("GLARE");
m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime);
#pragma region Environment Color Change Handling
m.F(A::ENVIRONMENT_TIMER)=std::max(0.f,m.F(A::ENVIRONMENT_TIMER)-fElapsedTime);
switch(m.I(A::ENVIRONMENT_PHASE)){
case 0:{ //Fade out.
game->SetWorldColor(WHITE*util::lerp(0.f,1.0f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 2.Environment Fade-out Time")));
if(m.F(A::ENVIRONMENT_TIMER)==0.f){
game->SetWorldColor({0,0,0,255});
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Phase 2.Environment Fade-in Time");
m.I(A::ENVIRONMENT_PHASE)++;
game->SetWorldColorFunc([&](vi2d pos){
float fadeInRange=DATA["MonsterStrategy"]["Ursule"]["Phase 2"]["Environment Fade-in Range"].GetReal()/100.f*24.f;
float distToPlayer=geom2d::line<float>(game->GetPlayer()->GetPos(),pos).length();
return game->GetWorldColor()*std::min(1.0f,fadeInRange/distToPlayer);
});
}
}break;
case 1:{ //Fade in.
Pixel fadeInCol=ConfigPixel("Phase 2.Environment Fade-in Color");
game->SetWorldColor(fadeInCol*util::lerp(1.f,0.f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 2.Environment Fade-in Time")));
if(m.F(A::ENVIRONMENT_TIMER)==0.f){
game->SetWorldColor(fadeInCol);
}
}break;
}
#pragma endregion
if(m.I(A::PHASE_REPEAT_COUNT)>0){
if(m.F(A::SHOOT_TIMER)==0.f){
uint8_t wispPatternCount=ConfigInt("Wisp Pattern Count");
uint8_t wispPattern=util::random()%wispPatternCount;
if(ConfigString("Phase 2.Wisp Pattern Random Selection")=="Bag"){
if(m.VEC(A::WISP_PATTERN_LIST).size()==0){
for(uint8_t numb=0;numb<wispPatternCount;numb++){ //Numbers are randomly inserted into the list.
m.VEC(A::WISP_PATTERN_LIST).insert(m.VEC(A::WISP_PATTERN_LIST).begin()+(util::random()%(m.VEC(A::WISP_PATTERN_LIST).size()+1)),numb);
}
}
wispPattern=std::any_cast<uint8_t>(m.VEC(A::WISP_PATTERN_LIST).back());
m.VEC(A::WISP_PATTERN_LIST).pop_back();
}
m.F(A::SHOOT_TIMER)=ConfigFloat("Phase 2.Wisp Pattern Spawn Wait Time");
vi2d wispSize={ConfigIntArr("Phase 2.Wisp Size",0),ConfigIntArr("Phase 2.Wisp Size",1)};
float rowWidth=ConfigString(std::format("Wisp Pattern {}.Row[0]",wispPattern)).length()*wispSize.x; // Width of a wisp set in pixels.
float mapWidth=game->GetCurrentMap().GetMapData().MapSize.x*float(game->GetCurrentMap().GetMapData().tilewidth);
int rowCount=Config(std::format("Wisp Pattern {}",wispPattern)).GetKeys().size();
for(float x=0;x<mapWidth;x+=wispSize.x){
for(int y=0;y<rowCount;y++){
std::string_view row=ConfigString(std::format("Wisp Pattern {}.Row[{}]",wispPattern,y));
if(row[int(x/wispSize.x)%row.length()]!='.'){
float ySpawn=ConfigInt("Phase 2.Wisp Pattern Spawn Y")+y*wispSize.y;
BULLET_LIST.push_back(std::make_unique<Wisp>(vf2d{x,ySpawn},vf2d{0,ConfigFloat("Phase 2.Wisp Speed")},ConfigFloat("Phase 2.Wisp Hitbox Radius"),m.GetAttack(),m.OnUpperLevel(),false,ConfigPixel("Phase 2.Wisp Color")));
}
}
}
m.I(A::PHASE_REPEAT_COUNT)--;
}
}else{
auto TransitionToPhase3=[&](){
m.phase=3;
game->SetWorldColor(ConfigPixel("Phase 3.Environment Fade-in Color"));
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Phase 3.Environment Fade-in Time");
m.I(A::ENVIRONMENT_PHASE)=0;
m.RemoveBuff(BARRIER_DAMAGE_REDUCTION);
};
if(m.F(A::RECOVERY_TIME)==0.f){
if(ConfigFloat("Phase 2.Wisp Count Phase Change Wait")==0.f){
TransitionToPhase3();
}
m.F(A::RECOVERY_TIME)=ConfigFloat("Phase 2.Wisp Count Phase Change Wait");
}else{
m.F(A::RECOVERY_TIME)-=fElapsedTime;
if(m.F(A::RECOVERY_TIME)<=0.f){
TransitionToPhase3();
}
}
}
}break;
case 3:{
#pragma region Environment Color Change Handling
m.F(A::ENVIRONMENT_TIMER)=std::max(0.f,m.F(A::ENVIRONMENT_TIMER)-fElapsedTime);
switch(m.I(A::ENVIRONMENT_PHASE)){
case 0:{ //Fade out. Use the phase 2 environment fade-in color as the previous color to lerp out from.
game->SetWorldColor(ConfigPixel("Phase 2.Environment Fade-in Color")*util::lerp(0.f,1.0f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 3.Environment Fade-out Time")));
if(m.F(A::ENVIRONMENT_TIMER)==0.f){
game->SetWorldColor({0,0,0,255});
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Phase 3.Environment Fade-in Time");
m.I(A::ENVIRONMENT_PHASE)++;
game->SetWorldColorFunc([&](vi2d pos){return game->GetWorldColor();});
}
}break;
case 1:{ //Fade in.
Pixel fadeInCol=ConfigPixel("Phase 3.Environment Fade-in Color");
game->SetWorldColor(fadeInCol*util::lerp(1.f,0.f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 3.Environment Fade-in Time")));
if(m.F(A::ENVIRONMENT_TIMER)==0.f){
game->SetWorldColor(fadeInCol);
}
}break;
}
#pragma endregion
float distToPlayer=geom2d::line<float>(game->GetPlayer()->GetPos(),m.GetPos()).length();
m.F(A::CHARGE_COOLDOWN)=std::max(0.f,m.F(A::CHARGE_COOLDOWN)-fElapsedTime);
if(m.I(A::PHASE)!=0)goto bear2; //Prevent doing anything else if a part of bear AI is still running.
if(m.GetRemainingHPPct()<=ConfigFloat("Phase 4.Change")/100.f){
auto TransitionToPhase5=[&](){
m.phase=5;
m.PerformAnimation("SIT");
SoundEffect::PlaySFX("Ursule Phase Transition",SoundEffect::CENTERED);
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Phase 4.Environment Fade-out Time");
m.I(A::ENVIRONMENT_PHASE)=0;
};
//We also need to move to the center of the map.
if(m.F(A::RUN_AWAY_TIMER)==0.f)m.F(A::RUN_AWAY_TIMER)=ConfigFloat("Phase 4.Run to Center Time");
else{
m.F(A::RUN_AWAY_TIMER)=std::max(0.f,m.F(A::RUN_AWAY_TIMER)-fElapsedTime);
if(m.F(A::RUN_AWAY_TIMER)==0.f){
TransitionToPhase5();
break;
}
}
vf2d mapCenter=game->GetCurrentMap().GetMapData().MapSize*vf2d{float(game->GetCurrentMap().GetMapData().tilewidth),float(game->GetCurrentMap().GetMapData().tileheight)}/2.0f;
float distToCenter=geom2d::line<float>(m.GetPos(),mapCenter).length();
if(distToCenter>4.0f){
m.targetAcquireTimer=20.f;
m.target=mapCenter;
RUN_TOWARDS(m,fElapsedTime,"Run Towards");
break;
}else{ //Now we're finally good for phase 2.
TransitionToPhase5();
break;
}
}
if(distToPlayer>=ConfigFloat("Phase 3.Charge Range")/100.f*24.f&&m.F(A::CHARGE_COOLDOWN)==0.f){
if(ConfigFloat("Phase 3.Charge Cast Time")!=0.f){
if(m.F(A::CASTING_TIMER)==0.f){
m.F(A::CASTING_TIMER)=ConfigFloat("Phase 3.Charge Cast Time");
m.UpdateFacingDirection(geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).vector());
m.PerformAnimation("CHARGE");
m.B(A::COLLIDED_WITH_PLAYER)=false;
}
}
if(m.F(A::CASTING_TIMER)>0.f){
m.F(A::CASTING_TIMER)=std::max(0.f,m.F(A::CASTING_TIMER)-fElapsedTime);
if(m.F(A::CASTING_TIMER)==0.f){
m.phase=4;
m.AddBuff(SPEEDBOOST,10.f,ConfigFloat("Phase 3.Charge Speed Boost")/100.f);
m.AddBuff(FIXED_COLLISION_DMG,10.f,ConfigFloat("Phase 3.Charge Attack Damage"));
m.AddBuff(COLLISION_KNOCKBACK_STRENGTH,10.f,ConfigFloat("Phase 3.Charge Attack Knockback Strength"));
m.target=geom2d::line<float>(m.GetPos(),game->GetPlayer()->GetPos()).upoint(2.0f);
//It's possible the charge forces the bear outside the map, so it will attempt to run forever on the clamped edges.
m.target.x=std::clamp(m.target.x,0.f,float(game->GetCurrentMap().GetMapData().width*game->GetCurrentMap().GetMapData().tilewidth));
m.target.y=std::clamp(m.target.y,0.f,float(game->GetCurrentMap().GetMapData().height*game->GetCurrentMap().GetMapData().tileheight));
m.F(A::TARGET_TIMER)=ConfigFloat("Phase 3.Charge Max Run Time");
m.F(A::CHARGE_COOLDOWN)=ConfigFloat("Phase 3.Charge Attack Cooldown");
m.PerformAnimation("CHARGING");
m.UpdateFacingDirection(m.target);
}
break;
}
}
if(m.F(A::CASTING_TIMER)==0.f){
if(m.I(A::BEAR_STOMP_COUNT)%(ConfigInt("Phase 3.Stomp Count")+1)==ConfigInt("Phase 3.Stomp Count")){
m.F(A::RUN_AWAY_TIMER)=ConfigFloat("Phase 3.Run Time");
m.AddBuff(SPEEDBOOST,10.f,ConfigFloat("Phase 3.Run Speed Boost")/100.f);
m.I(A::PREVIOUS_PHASE)=m.phase;
m.phase=6;
break;
}
}
bear2:
BEAR(m,fElapsedTime,"Bear");
}break;
case 4:{ //A charging phase.
m.F(A::TARGET_TIMER)=std::max(0.f,m.F(A::TARGET_TIMER)-fElapsedTime);
if(geom2d::line(m.pos,m.target).length()>100*fElapsedTime*m.GetMoveSpdMult()){
vf2d newPos=m.pos+geom2d::line(m.pos,m.target).vector().norm()*100*fElapsedTime*m.GetMoveSpdMult();
m.SetPos(newPos);
}
float distToTarget=geom2d::line<float>(m.target,m.GetPos()).length();
if(distToTarget<=4.f||m.F(A::TARGET_TIMER)==0.f||m.B(A::COLLIDED_WITH_PLAYER)){
m.phase=3;
m.RemoveBuff(SPEEDBOOST);
m.RemoveBuff(FIXED_COLLISION_DMG);
m.RemoveBuff(COLLISION_KNOCKBACK_STRENGTH);
m.PerformIdleAnimation();
}
}break;
case 5:{ //Final boss phase.
m.PerformAnimation("GLARE");
m.F(A::SHOOT_TIMER)=std::max(0.f,m.F(A::SHOOT_TIMER)-fElapsedTime);
#pragma region Environment Color Change Handling
m.F(A::ENVIRONMENT_TIMER)=std::max(0.f,m.F(A::ENVIRONMENT_TIMER)-fElapsedTime);
switch(m.I(A::ENVIRONMENT_PHASE)){
case 0:{ //Fade out. Use the phase 3 environment fade-in color as the previous color to lerp out from.
game->SetWorldColor(ConfigPixel("Phase 3.Environment Fade-in Color")*util::lerp(0.f,1.0f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 4.Environment Fade-out Time")));
if(m.F(A::ENVIRONMENT_TIMER)==0.f){
game->SetWorldColor({0,0,0,255});
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Phase 4.Environment Fade-in Time");
m.I(A::ENVIRONMENT_PHASE)++;
game->SetWorldColorFunc([&](vi2d pos){
float fadeInRange=DATA["MonsterStrategy"]["Ursule"]["Phase 4"]["Environment Fade-in Range"].GetReal()/100.f*24.f;
float distToPlayer=geom2d::line<float>(game->GetPlayer()->GetPos(),pos).length();
return game->GetWorldColor()*std::min(1.0f,fadeInRange/distToPlayer);
});
}
}break;
case 1:{ //Fade in.
Pixel fadeInCol=ConfigPixel("Phase 4.Environment Fade-in Color");
game->SetWorldColor(fadeInCol*util::lerp(1.f,0.f,m.F(A::ENVIRONMENT_TIMER)/ConfigFloat("Phase 4.Environment Fade-in Time")));
if(m.F(A::ENVIRONMENT_TIMER)==0.f){
game->SetWorldColor(fadeInCol);
}
}break;
}
#pragma endregion
if(m.F(A::SHOOT_TIMER)==0.f){
uint8_t wispPatternCount=ConfigInt("Wisp Pattern Count");
uint8_t wispPattern=util::random()%wispPatternCount;
if(ConfigString("Phase 4.Wisp Pattern Random Selection")=="Bag"){
if(m.VEC(A::WISP_PATTERN_LIST).size()==0){
for(uint8_t numb=0;numb<wispPatternCount;numb++){ //Numbers are randomly inserted into the list.
m.VEC(A::WISP_PATTERN_LIST).insert(m.VEC(A::WISP_PATTERN_LIST).begin()+(util::random()%(m.VEC(A::WISP_PATTERN_LIST).size()+1)),numb);
}
}
wispPattern=std::any_cast<uint8_t>(m.VEC(A::WISP_PATTERN_LIST).back());
m.VEC(A::WISP_PATTERN_LIST).pop_back();
}
m.F(A::SHOOT_TIMER)=ConfigFloat("Phase 4.Wisp Pattern Spawn Wait Time");
vi2d wispSize={ConfigIntArr("Phase 4.Wisp Size",0),ConfigIntArr("Phase 4.Wisp Size",1)};
float rowWidth=ConfigString(std::format("Wisp Pattern {}.Row[0]",wispPattern)).length()*wispSize.x; // Width of a wisp set in pixels.
float mapWidth=game->GetCurrentMap().GetMapData().MapSize.x*float(game->GetCurrentMap().GetMapData().tilewidth);
int rowCount=Config(std::format("Wisp Pattern {}",wispPattern)).GetKeys().size();
for(float x=0;x<mapWidth;x+=wispSize.x){
for(int y=0;y<rowCount;y++){
std::string_view row=ConfigString(std::format("Wisp Pattern {}.Row[{}]",wispPattern,y));
if(row[int(x/wispSize.x)%row.length()]!='.'){
float ySpawn=ConfigInt("Phase 4.Wisp Pattern Spawn Y")+y*wispSize.y;
BULLET_LIST.push_back(std::make_unique<Wisp>(vf2d{x,ySpawn},vf2d{0,ConfigFloat("Phase 4.Wisp Speed")},ConfigFloat("Phase 4.Wisp Hitbox Radius"),m.GetAttack(),m.OnUpperLevel(),false,ConfigPixel("Phase 4.Wisp Color")));
}
}
}
}
}break;
case 6:{
//Run towards the target for a set amount of time.
m.F(A::RUN_AWAY_TIMER)=std::max(0.f,m.F(A::RUN_AWAY_TIMER)-fElapsedTime);
m.targetAcquireTimer=20.f;
m.target=game->GetPlayer()->GetPos();
RUN_TOWARDS(m,fElapsedTime,"Run Towards");
if(m.F(A::RUN_AWAY_TIMER)==0.f){
m.phase=m.I(A::PREVIOUS_PHASE);
m.RemoveBuff(SPEEDBOOST);
m.I(A::BEAR_STOMP_COUNT)=0;
}
}break;
default:{
ERR(std::format("WARNING! Unknown phase {} for {} reached!",m.phase,m.GetName()));
}
}
}