diff --git a/Adventures in Lestoria/MonsterAttribute.h b/Adventures in Lestoria/MonsterAttribute.h index 7246fe13..e25881f7 100644 --- a/Adventures in Lestoria/MonsterAttribute.h +++ b/Adventures in Lestoria/MonsterAttribute.h @@ -118,4 +118,6 @@ enum class Attribute{ TARGET_FLYING_HEIGHT, SPAWNER_TIMER, ATTACK_CHOICE, + WIND_STRENGTH, + WIND_PHASE_TIMER, }; \ No newline at end of file diff --git a/Adventures in Lestoria/Overlay.cpp b/Adventures in Lestoria/Overlay.cpp index 0a7e8851..11219866 100644 --- a/Adventures in Lestoria/Overlay.cpp +++ b/Adventures in Lestoria/Overlay.cpp @@ -39,10 +39,13 @@ All rights reserved. #include "DEFINES.h" #include "AdventuresInLestoria.h" #include "Overlay.h" +#include "util.h" INCLUDE_game INCLUDE_ANIMATION_DATA +const float Overlay::ALPHA_TIME{0.5f}; + Overlay::Overlay(std::string animationName,Pixel overlayCol) :animationName(animationName),overlayCol(overlayCol){} const Pixel&Overlay::GetOverlayCol()const{ @@ -52,15 +55,22 @@ void Overlay::SetOverlayCol(Pixel newOverlayCol){ overlayCol=newOverlayCol; } void Overlay::Enable(){ + alpha=0; + alphaTimer=0.f; enabled=true; } void Overlay::Disable(){ + alpha=255; + alphaTimer=0.f; enabled=false; } void Overlay::Draw(){ - if(!enabled)return; + alphaTimer+=game->GetElapsedTime(); + if(enabled)alpha=util::lerp(0,255,std::min(1.f,alphaTimer/ALPHA_TIME)); + else alpha=util::lerp(255,0,std::min(1.f,alphaTimer/ALPHA_TIME)); + const Animate2D::Frame&animationFrame{ANIMATION_DATA.at(animationName).GetFrame(game->GetRunTime())}; - game->DrawPartialDecal({},animationFrame.GetSourceRect().size,animationFrame.GetSourceImage()->Decal(),animationFrame.GetSourceRect().pos,animationFrame.GetSourceRect().size,overlayCol); + game->DrawPartialDecal({},animationFrame.GetSourceRect().size,animationFrame.GetSourceImage()->Decal(),animationFrame.GetSourceRect().pos,animationFrame.GetSourceRect().size,{overlayCol.r,overlayCol.g,overlayCol.b,uint8_t(overlayCol.a*uint8_t(alpha/255.f))}); } void Overlay::Reset(){ animationName="pixel.png"; diff --git a/Adventures in Lestoria/Overlay.h b/Adventures in Lestoria/Overlay.h index c77ba4b9..eb9c6fbd 100644 --- a/Adventures in Lestoria/Overlay.h +++ b/Adventures in Lestoria/Overlay.h @@ -53,4 +53,7 @@ private: bool enabled{true}; std::string animationName; Pixel overlayCol; + uint8_t alpha{255}; + float alphaTimer{0.f}; + static const float ALPHA_TIME; }; \ No newline at end of file diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 5a061c2e..3ce9c79f 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -548,21 +548,21 @@ void Player::Update(float fElapsedTime){ ERR(std::format("WARNING! The velocity vector for the player is NOT normal! Current vel:{} . Attempting manual resetting of velocity.",vel.str())); vel={}; } - if(vel.x>0){ - vel.x=std::max(0.f,vel.x-friction*fElapsedTime); - } else { - vel.x=std::min(0.f,vel.x+friction*fElapsedTime); - } - if(vel.y>0){ - vel.y=std::max(0.f,vel.y-friction*fElapsedTime); - } else { - vel.y=std::min(0.f,vel.y+friction*fElapsedTime); - } if(vel!=vf2d{0,0}){ float newX=pos.x+vel.x*fElapsedTime; float newY=pos.y+vel.y*fElapsedTime; SetX(newX); SetY(newY); + if(vel.x>0){ + vel.x=std::max(0.f,vel.x-friction*fElapsedTime); + } else { + vel.x=std::min(0.f,vel.x+friction*fElapsedTime); + } + if(vel.y>0){ + vel.y=std::max(0.f,vel.y-friction*fElapsedTime); + } else { + vel.y=std::min(0.f,vel.y+friction*fElapsedTime); + } } if(Menu::stack.empty()){ @@ -1574,4 +1574,8 @@ void Player::ProximityKnockback(const vf2d centerPoint,const float knockbackFact lineToPlayer={centerPoint,centerPoint+vf2d{cos(randomDir),sin(randomDir)}*1}; } game->GetPlayer()->Knockback(lineToPlayer.vector().norm()*knockbackFactor); +} + +void Player::AddVelocity(vf2d vel){ + this->vel+=vel; } \ No newline at end of file diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 6cc119a6..cf1275b0 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -256,6 +256,7 @@ public: const float GetAtkGrowthRate()const; const float GetIframeTime()const; const Renderable&GetMinimapImage()const; + void AddVelocity(vf2d vel); private: int hp="Warrior.BaseHealth"_I; int mana="Player.BaseMana"_I; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index a6c50b72..73eb89e6 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 9491 +#define VERSION_BUILD 9494 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Zephy.cpp b/Adventures in Lestoria/Zephy.cpp index 22304603..7933cb32 100644 --- a/Adventures in Lestoria/Zephy.cpp +++ b/Adventures in Lestoria/Zephy.cpp @@ -200,9 +200,15 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) if(m.GetZ()==0.f){ m.phase=WIND_ATTACK; game->GetOverlay().Enable(); + m.F(A::CASTING_TIMER)=ConfigFloat("Wind Attack.Wind Duration"); + m.F(A::WIND_STRENGTH)=ConfigFloat("Wind Attack.Wind Starting Strength")/100.f; + m.F(A::WIND_PHASE_TIMER)=ConfigFloat("Wind Attack.Wind Increase Phase Wait Time"); } }break; case WIND_ATTACK:{ + m.F(A::CASTING_TIMER)-=fElapsedTime; + m.F(A::WIND_PHASE_TIMER)-=fElapsedTime; + const bool OnLeftLandingSite=m.I(A::ATTACK_CHOICE); if(OnLeftLandingSite)m.PerformAnimation("ATTACK",Direction::EAST); @@ -238,6 +244,25 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Wind Attack.Wind Streak Spawn Rate"); } #pragma endregion + + if(m.F(A::WIND_STRENGTH)GetPlayer()->AddVelocity(windSpd); + m.F(A::CASTING_TIMER)=ConfigFloat("Wind Attack.Wind Duration"); + #pragma endregion + + if(m.F(A::CASTING_TIMER)<=0.f){ + m.phase=IDLE; + game->GetOverlay().Disable(); + } }break; case HALFHEALTH_PHASE:{ diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 2716288c..667e167e 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -831,6 +831,19 @@ MonsterStrategy Left Landing Site = 1608, 1728 Right Landing Site = 2472, 1728 + + Wind Starting Strength = 10% + # Amount of increase per wind stage. + Wind Strength Increase = 10% + Wind Max Strength = 60% + # How much time between each stage. + Wind Increase Phase Wait Time = 1s + # Total amount of time of the attack. + Wind Duration = 18s + + Wind Projectile Spawn Rate = 0.5s + Wind Projectile X Speed Range = 120px/s, 240px/s + Wind Projectile Y Speed Range = -32px/s, 32px/s Wind Overlay Sprite = "wind_vignette.png" Wind Overlay Color = 64, 64, 64, 255 diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index ec810a2d..b36aa425 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ