diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index 1049be07..25c1c4b9 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -1866,7 +1866,7 @@ void AiL::RenderHud(){ } Pixel healthOutlineCol=BLACK; - if(player->GetHealth()/float(player->GetMaxHealth())<="Player.Health Warning Pct"_F/100.f){ + if(player->GetHealthRatio()<="Player.Health Warning Pct"_F/100.f){ float runTimeAmt=fmod(GetRunTime(),"Player.Health Warning Flicker Time"_F*2); if(runTimeAmt<"Player.Health Warning Flicker Time"_F){ healthOutlineCol="Player.Health Warning Outline Color"_Pixel; diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 547d332c..e4fcff6e 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -84,14 +84,9 @@ const vf2d&Monster::GetPos()const{ } const int Monster::GetHealth()const{ return hp; -} - +} const int Monster::GetMaxHealth()const{ return stats.A_Read("Health"); - -} -const float Monster::GetRemainingHPPct()const{ - return float(GetHealth())/GetMaxHealth(); } int Monster::GetAttack(){ float mod_atk=float(stats.A("Attack")); @@ -1091,4 +1086,8 @@ const bool Monster::HasArrowIndicator()const{ const bool Monster::ReachedTargetPos(const float maxDistanceFromTarget)const{ return util::distance(GetPos(),GetTargetPos())<=maxDistanceFromTarget; +} + +const float Monster::GetHealthRatio()const{ + return GetHealth()/float(GetMaxHealth()); } \ No newline at end of file diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index aada97b4..448b71d0 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -79,7 +79,6 @@ public: const vf2d&GetPos()const; const int GetHealth()const; const int GetMaxHealth()const; - const float GetRemainingHPPct()const; int GetAttack(); float GetMoveSpdMult(); //Obtains the size multiplier (from 0.f-1.f). @@ -180,6 +179,7 @@ public: const std::string_view GetDisplayName()const; const bool HasArrowIndicator()const; const bool ReachedTargetPos(const float maxDistanceFromTarget=4.f)const; + const float GetHealthRatio()const; private: //NOTE: Marking a monster for deletion does not trigger any death events. It just simply removes the monster from the field!! // The way this works is that monsters marked for deletion will cause the monster update loop to detect there's at least one or more monsters that must be deleted and will call erase_if on the list at the end of the iteration loop. diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index b8c4206a..27302349 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -809,7 +809,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){ hurtRumbleTime="Player.Hurt Rumble Time"_F; Input::StartVibration(); - Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealth()/float(GetMaxHealth()))); + Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealthRatio())); if(lastHitTimer>0){ damageNumberPtr.get()->damage+=int(mod_dmg); @@ -821,7 +821,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){ } lastHitTimer=0.05f; - if(!lowHealthSoundPlayed&&lowHealthSoundPlayedTimer==0.f&&GetHealth()/float(GetMaxHealth())<="Player.Health Warning Pct"_F/100.f){ + if(!lowHealthSoundPlayed&&lowHealthSoundPlayedTimer==0.f&&GetHealthRatio()<="Player.Health Warning Pct"_F/100.f){ SoundEffect::PlaySFX("Health Warning",SoundEffect::CENTERED); lowHealthSoundPlayed=true; lowHealthSoundPlayedTimer="Player.Health Warning Cooldown"_F; @@ -1088,7 +1088,7 @@ bool Player::Heal(int damage,bool suppressDamageNumber){ if(!suppressDamageNumber&&damage>0){ DAMAGENUMBER_LIST.push_back(std::make_shared(GetPos(),damage,true,HEALTH_GAIN)); } - Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealth()/float(GetMaxHealth()))); + Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealthRatio())); return true; } @@ -1358,7 +1358,7 @@ void Player::PerformHPRecovery(){ Heal(hpRecoveryAmt); } - if(GetHealth()/float(GetMaxHealth())>"Player.Health Warning Pct"_F/100.f){ + if(GetHealthRatio()>"Player.Health Warning Pct"_F/100.f){ lowHealthSoundPlayed=false; } } @@ -1584,4 +1584,8 @@ void Player::ProximityKnockback(const vf2d centerPoint,const float knockbackFact void Player::AddVelocity(vf2d vel){ this->vel+=vel*game->GetElapsedTime(); +} + +const float Player::GetHealthRatio()const{ + return GetHealth()/float(GetMaxHealth()); } \ No newline at end of file diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 5fb2f82e..5478515f 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -264,6 +264,7 @@ public: const float GetIframeTime()const; const Renderable&GetMinimapImage()const; void AddVelocity(vf2d vel); + const float GetHealthRatio()const; private: int hp="Warrior.BaseHealth"_I; int mana="Player.BaseMana"_I; diff --git a/Adventures in Lestoria/SlimeKing.cpp b/Adventures in Lestoria/SlimeKing.cpp index 958cfb44..a79a6158 100644 --- a/Adventures in Lestoria/SlimeKing.cpp +++ b/Adventures in Lestoria/SlimeKing.cpp @@ -253,7 +253,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat m.phase=ConfigInt("StartPhase"); }break; case 1:{ - if(m.GetRemainingHPPct()<=ConfigFloat("Phase2.Change")/100.f){ + if(m.GetHealthRatio()<=ConfigFloat("Phase2.Change")/100.f){ m.phase=2; m.SetSize(ConfigFloat("Phase2.Size")/100,false); TransitionPhase(m.phase); @@ -286,7 +286,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat } }break; case 2:{ - if(m.GetRemainingHPPct()<=ConfigFloat("Phase3.Change")/100.f){ + if(m.GetHealthRatio()<=ConfigFloat("Phase3.Change")/100.f){ m.phase=3; m.SetSize(ConfigFloat("Phase3.Size")/100,false); if(m.I(A::PATTERN_REPEAT_COUNT)==0){ @@ -314,7 +314,7 @@ void Monster::STRATEGY::SLIMEKING(Monster&m,float fElapsedTime,std::string strat } }break; case 3:{ - if(m.GetRemainingHPPct()<=ConfigFloat("Phase4.Change")/100.f){ + if(m.GetHealthRatio()<=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 6d783091..c8cdbe0e 100644 --- a/Adventures in Lestoria/Ursule.cpp +++ b/Adventures in Lestoria/Ursule.cpp @@ -104,7 +104,7 @@ void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy m.I(A::ENVIRONMENT_PHASE)=0; }; - if(m.GetRemainingHPPct()<=ConfigFloat("Phase 2.Change")/100.f){ + if(m.GetHealthRatio()<=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; @@ -269,7 +269,7 @@ void Monster::STRATEGY::URSULE(Monster&m,float fElapsedTime,std::string strategy 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){ + if(m.GetHealthRatio()<=ConfigFloat("Phase 4.Change")/100.f){ auto TransitionToPhase5=[&](){ m.phase=5; m.PerformAnimation("SIT"); diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 516ad13e..1c566fc3 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 3 -#define VERSION_BUILD 9522 +#define VERSION_BUILD 9524 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Zephy.cpp b/Adventures in Lestoria/Zephy.cpp index 92f75e36..f7c55320 100644 --- a/Adventures in Lestoria/Zephy.cpp +++ b/Adventures in Lestoria/Zephy.cpp @@ -95,6 +95,11 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) game->GetOverlay().Disable(); return true; }); + + if(m.GetHealthRatio()<=ConfigFloat("Mid Phase Health Transition %")/100.f&&!m.B(A::PHASE)){ + m.B(A::PHASE)=true; + m.phase=HALFHEALTH_PHASE; + } }break; case IDLE:{ const int randomAttackChoice=2; diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 5a5e4a4e..b66191e2 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -785,6 +785,8 @@ MonsterStrategy Flight Oscillation Amount = 1.5px + Mid Phase Health Transition % = 50% + Fly Across Attack { Poop Damage = 25 @@ -859,5 +861,12 @@ MonsterStrategy Wind Streak Y Speed Range = -16px/s, 16px/s Wind Streak Lifetime Range = 2s, 8s } + Mid Phase + { + # The boss will go land at this position first. + Pillar Position = 2040, 1488 + + + } } } \ No newline at end of file diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index e069aa2f..1c2cb2c4 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ