diff --git a/Adventures in Lestoria/MonsterAttribute.h b/Adventures in Lestoria/MonsterAttribute.h index 94df958a..6ab639f7 100644 --- a/Adventures in Lestoria/MonsterAttribute.h +++ b/Adventures in Lestoria/MonsterAttribute.h @@ -150,4 +150,6 @@ enum class Attribute{ MID_PHASE, RUM_DRINK_COUNT, SPEED_RAMPUP_TIMER, + BULLET_HAS_BEEN_SHOT, + SUCTION_TIMER, }; \ No newline at end of file diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index 55f13530..65b8bb0d 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -674,9 +674,11 @@ void Player::Update(float fElapsedTime){ game->GetPlayer()->SetPos(game->GetPlayer()->GetPos()+finalWindSpd*game->GetElapsedTime(),MoveFlag::PREVENT_CAST_CANCELLING); - if(vel!=vf2d{0,0}){ - float newX=pos.x+vel.x*fElapsedTime; - float newY=pos.y+vel.y*fElapsedTime; + const vf2d totalVel{vel+addedVel}; + + if(totalVel!=vf2d{}){ + float newX=pos.x+totalVel.x*fElapsedTime; + float newY=pos.y+totalVel.y*fElapsedTime; SetX(newX); SetY(newY); if(vel.x>0){ @@ -690,6 +692,8 @@ void Player::Update(float fElapsedTime){ vel.y=std::min(0.f,vel.y+friction*fElapsedTime); } } + + addedVel={}; if(Menu::stack.empty()){ @@ -1915,7 +1919,7 @@ void Player::ProximityKnockback(const vf2d centerPoint,const float knockbackFact } void Player::AddVelocity(vf2d vel){ - this->vel+=vel*game->GetElapsedTime(); + this->addedVel+=vel; } const float Player::GetHealthRatio()const{ diff --git a/Adventures in Lestoria/Player.h b/Adventures in Lestoria/Player.h index 0d93e6af..6444c086 100644 --- a/Adventures in Lestoria/Player.h +++ b/Adventures in Lestoria/Player.h @@ -294,7 +294,7 @@ public: const float GetAtkGrowthRate()const; const float GetIframeTime()const; const Renderable&GetMinimapImage()const; - void AddVelocity(vf2d vel); + void AddVelocity(vf2d vel); //Use to add more applied velocity to the player on top of what is already happening. Resets every frame. Good for pulling in/pushing out forces. const float GetHealthRatio()const; const bool IsAlive()const; //An all-in-one function that applies a stat plus any % modifiers the stat may have as well. @@ -431,6 +431,7 @@ private: std::vector>shield; bool catForm{false}; std::optionaltestAimingLoc{}; + vf2d addedVel{}; protected: const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F; const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F; diff --git a/Adventures in Lestoria/Sandworm.cpp b/Adventures in Lestoria/Sandworm.cpp index 59bc6790..77e0508d 100644 --- a/Adventures in Lestoria/Sandworm.cpp +++ b/Adventures in Lestoria/Sandworm.cpp @@ -50,19 +50,90 @@ void Monster::STRATEGY::SANDWORM(Monster&m,float fElapsedTime,std::string strate enum PhaseName{ INITIALIZE, UNDERGROUND, + SURFACING, + ATTACK, + SHOOTING, + BURROWING, + }; + + m.F(A::ATTACK_COOLDOWN)-=fElapsedTime; + m.F(A::SUCTION_TIMER)-=fElapsedTime; + const float distToPlayer{util::distance(game->GetPlayer()->GetPos(),m.GetPos())}; + if(m.F(A::SUCTION_TIMER)>0.f&&distToPlayer<=ConfigPixels("Suction Radius")){ + game->GetPlayer()->AddVelocity(util::pointTo(game->GetPlayer()->GetPos(),m.GetPos())*100.f*ConfigFloat("Suction Pull Amount")/100.f); + } + + const auto AcquireNewUndergroundTarget=[&](){ + const float randomRange=util::random_range(0,ConfigPixels("Burrow Target Range")); + m.target=game->GetPlayer()->GetPos()+vf2d{randomRange,util::random(2*PI)}.cart(); }; switch(PHASE()){ case INITIALIZE:{ SETPHASE(UNDERGROUND); - const float randomRange=util::random_range(0,ConfigFloat("Burrow Target Range")/100.f*24); - m.V(A::LOCKON_POS)=game->GetPlayer()->GetPos()+vf2d{randomRange,util::random(2*PI)}.cart(); + AcquireNewUndergroundTarget(); }break; case UNDERGROUND:{ m.SetCollisionRadius(0.f); RUN_TOWARDS(m,fElapsedTime,"Run Towards"); m.PerformAnimation("SWIM",m.GetFacingDirection()); + if(m.ReachedTargetPos()){ + m.PerformAnimation("EMERGE",game->GetPlayer()->GetPos()); + m.F(A::RECOVERY_TIME)=m.GetCurrentAnimation().GetTotalAnimationDuration(); + game->AddEffect(std::make_unique(m.GetPos(),ConfigInt("Suction Duration"),"sand_suction.png",m.OnUpperLevel(),0.25f,0.25f,ConfigFloat("Suction Animation Size")/300.f*vf2d{1.f,1.f},vf2d{},WHITE,util::random(),-PI/8),true); + SETPHASE(SURFACING); + m.F(A::SUCTION_TIMER)=ConfigFloat("Suction Duration")+0.25f; + } + }break; + case SURFACING:{ + m.F(A::RECOVERY_TIME)-=fElapsedTime; + if(m.F(A::RECOVERY_TIME)<=0.f){ + SETPHASE(ATTACK); + m.PerformAnimation("IDLE",game->GetPlayer()->GetPos()); + m.SetCollisionRadius(m.GetOriginalCollisionRadius()); + m.I(A::ATTACK_COUNT)=ConfigInt("Max Attack Count"); + } + }break; + case ATTACK:{ + if(m.I(A::ATTACK_COUNT)<=0||distToPlayer>=ConfigPixels("Max Attack Range")){ + m.SetCollisionRadius(0.f); + m.PerformAnimation("BURROW"); + m.F(A::CASTING_TIMER)=m.GetCurrentAnimation().GetTotalAnimationDuration(); + SETPHASE(BURROWING); + break; + } + if(m.F(A::ATTACK_COOLDOWN)<=0.f){ + m.PerformAnimation("SAND ATTACK",game->GetPlayer()->GetPos()); + m.F(A::CASTING_TIMER)=ConfigFloat("Shoot Delay"); + m.F(A::SHOOT_ANIMATION_TIME)=m.GetCurrentAnimation().GetTotalAnimationDuration(); + m.B(A::BULLET_HAS_BEEN_SHOT)=false; + SETPHASE(SHOOTING); + } + }break; + case SHOOTING:{ + const auto ShootBullet=[&](){ + m.B(A::BULLET_HAS_BEEN_SHOT)=true; + m.I(A::ATTACK_COUNT)--; + CreateBullet(Bullet)(m.GetPos(),vf2d{ConfigPixels("Bullet Speed"),util::angleTo(m.GetPos(),game->GetPlayer()->GetPos())}.cart(),ConfigFloat("Bullet Radius"),m.GetAttack(),m.OnUpperLevel(),false,ConfigPixel("Bullet Color"),ConfigFloat("Bullet Radius")*vf2d{1.f,1.f}/2.f)EndBullet; + }; + + m.F(A::CASTING_TIMER)-=fElapsedTime; + m.F(A::SHOOT_ANIMATION_TIME)-=fElapsedTime; + if(m.F(A::CASTING_TIMER)<=0.f&&!m.B(A::BULLET_HAS_BEEN_SHOT)){ + ShootBullet(); + } + if(m.F(A::SHOOT_ANIMATION_TIME)<=0.f){ + if(!m.B(A::BULLET_HAS_BEEN_SHOT))ShootBullet(); + m.PerformAnimation("IDLE",game->GetPlayer()->GetPos()); + SETPHASE(ATTACK); + } + }break; + case BURROWING:{ + m.F(A::CASTING_TIMER)-=fElapsedTime; + if(m.F(A::CASTING_TIMER)<=0.f){ + AcquireNewUndergroundTarget(); + SETPHASE(UNDERGROUND); + } }break; - } } \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 9212c95e..66a049ba 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 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 11714 +#define VERSION_BUILD 11725 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/Campaigns/3_1.tmx b/Adventures in Lestoria/assets/Campaigns/3_1.tmx index 50b77c1b..971ae43e 100644 --- a/Adventures in Lestoria/assets/Campaigns/3_1.tmx +++ b/Adventures in Lestoria/assets/Campaigns/3_1.tmx @@ -1,5 +1,5 @@ - + @@ -1243,7 +1243,12 @@ - + + + + + + diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 04cd9089..b919b883 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -1123,6 +1123,21 @@ MonsterStrategy { # Furthest distance sandworm travels from the player while burrowing. Burrow Target Range = 400 + # The distance from the monster the suction effect will occur. + Suction Radius = 600 + # The size of the suction animation. + Suction Animation Size = 300 + # The larger the value the more of % of movespd it affects. + Suction Pull Amount = 30% + Suction Duration = 3s + # Amount of time to wait before the bullet comes out (animation starts playing while waiting) + Shoot Delay = 0.4s + # Maximum number of attacks to fire before burrowing again. + Max Attack Count = 6 + Max Attack Range = 1500 + Bullet Radius = 6px + Bullet Speed = 450 + Bullet Color = 47r, 23g, 8b, 255a } Pirate Buccaneer { diff --git a/Adventures in Lestoria/assets/config/Monsters.txt b/Adventures in Lestoria/assets/config/Monsters.txt index bf773486..97fdcd7a 100644 --- a/Adventures in Lestoria/assets/config/Monsters.txt +++ b/Adventures in Lestoria/assets/config/Monsters.txt @@ -1511,7 +1511,7 @@ Monsters Health = 430 Attack = 45 - CollisionDmg = 10 + CollisionDmg = 45 MoveSpd = 120% Size = 60% @@ -1552,7 +1552,7 @@ Monsters Health = 1800 Attack = 49 - CollisionDmg = 20 + CollisionDmg = 49 MoveSpd = 90% Size = 180% @@ -1634,7 +1634,7 @@ Monsters Health = 400 Attack = 33 - CollisionDmg = 10 + CollisionDmg = 33 MoveSpd = 200% Size = 90% diff --git a/Adventures in Lestoria/assets/gamepack.pak b/Adventures in Lestoria/assets/gamepack.pak index bb7cd57d..3cadc32a 100644 Binary files a/Adventures in Lestoria/assets/gamepack.pak and b/Adventures in Lestoria/assets/gamepack.pak differ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 6486048c..d818ad6a 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ