diff --git a/Adventures in Lestoria Tests/PlayerTests.cpp b/Adventures in Lestoria Tests/PlayerTests.cpp index 386ac49c..f087f006 100644 --- a/Adventures in Lestoria Tests/PlayerTests.cpp +++ b/Adventures in Lestoria Tests/PlayerTests.cpp @@ -319,12 +319,6 @@ namespace PlayerTests player->AddBuff(BuffType::STAT_UP,5.f,1000.0_Pct,{"Health %"}); Assert::AreEqual(1000+player->GetBaseStat("Health"),float(player->GetMaxHealth()),L"Max Health stat should be increased from 100 to 1100."); } - TEST_METHOD(IllegalMoveSpdStatUpBuffCheck){ - try{ - player->AddBuff(BuffType::STAT_UP,5.f,1000.0_Pct,{"Move Spd %"}); - Assert::Fail(L"Adding a Move Spd % buff succeeded! This should NOT be allowed!"); - }catch(std::exception&e){} - } TEST_METHOD(IllegalCritRateStatUpBuffCheck){ try{ player->AddBuff(BuffType::STAT_UP,5.f,1000.0_Pct,{"Crit Rate"}); diff --git a/Adventures in Lestoria/Arrow.cpp b/Adventures in Lestoria/Arrow.cpp index a93392ea..c7712181 100644 --- a/Adventures in Lestoria/Arrow.cpp +++ b/Adventures in Lestoria/Arrow.cpp @@ -62,7 +62,7 @@ void Arrow::Update(float fElapsedTime){ } } -void Arrow::PointToBestTargetPath(const uint8_t perceptionLevel){ +const vf2d Arrow::PointToBestTargetPath(const uint8_t perceptionLevel){ if(perceptionLevel>90)ERR(std::format("WARNING! Perception level {} provided. Acceptable range is 0-90.",perceptionLevel)); Arrow copiedArrow{*this}; float closestDist=std::numeric_limits::max(); @@ -87,6 +87,7 @@ void Arrow::PointToBestTargetPath(const uint8_t perceptionLevel){ if(closestVel==vf2d{0,0})ERR("WARNING! We didn't find a valid path of flight for the Arrow! THIS SHOULD NOT BE HAPPENING!"); vel=closestVel; + return vel; } BulletDestroyState Arrow::PlayerHit(Player*player) diff --git a/Adventures in Lestoria/BulletTypes.h b/Adventures in Lestoria/BulletTypes.h index 1a893364..3ffd95cf 100644 --- a/Adventures in Lestoria/BulletTypes.h +++ b/Adventures in Lestoria/BulletTypes.h @@ -74,7 +74,7 @@ struct Arrow:public Bullet{ void Update(float fElapsedTime)override; // Change the arrow's heading by predicting a path somewhere in the future and aiming at the closest possible spot to its targetPos. // The perception level can be a value from 0-90 indicating the sweep angle to check beyond the initial aiming angle. - void PointToBestTargetPath(const uint8_t perceptionLevel); + const vf2d PointToBestTargetPath(const uint8_t perceptionLevel); BulletDestroyState PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!! BulletDestroyState MonsterHit(Monster&monster)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _MonsterHit()!! }; diff --git a/Adventures in Lestoria/Goblin_Bow.cpp b/Adventures in Lestoria/Goblin_Bow.cpp index 0b2891a2..f0216077 100644 --- a/Adventures in Lestoria/Goblin_Bow.cpp +++ b/Adventures in Lestoria/Goblin_Bow.cpp @@ -61,6 +61,7 @@ void Monster::STRATEGY::GOBLIN_BOW(Monster&m,float fElapsedTime,std::string stra enum PhaseName{ INITIALIZE_PERCEPTION, MOVE, + LOCKON, WINDUP, }; #pragma endregion @@ -78,7 +79,7 @@ void Monster::STRATEGY::GOBLIN_BOW(Monster&m,float fElapsedTime,std::string stra const bool outsideMaxShootingRange=distToPlayer>=ConfigPixelsArr("Stand Still and Shoot Range",1); auto PrepareToShoot=[&](){ - m.phase=WINDUP; + m.phase=LOCKON; m.F(A::SHOOT_TIMER)=ConfigFloat("Attack Windup Time"); m.PerformAnimation("SHOOT",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos())); @@ -108,17 +109,23 @@ void Monster::STRATEGY::GOBLIN_BOW(Monster&m,float fElapsedTime,std::string stra PrepareToShoot(); } }break; - case WINDUP:{ + case LOCKON:{ m.F(A::SHOOT_TIMER)-=fElapsedTime; m.UpdateFacingDirection(game->GetPlayer()->GetPos()); - if(m.F(A::SHOOT_TIMER)<=0){ + if(m.F(A::SHOOT_TIMER)<=ConfigFloat("Bow Steadying Time")){ geom2d::line pointTowardsPlayer(m.GetPos(),game->GetPlayer()->GetPos()); vf2d extendedLine=pointTowardsPlayer.upoint(1.1f); - CreateBullet(Arrow)(m.GetPos(),extendedLine,pointTowardsPlayer.vector().norm()*ConfigFloat("Arrow Spd"),"goblin_arrow.png",ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel())EndBullet; - Arrow&arrow=static_cast(*BULLET_LIST.back()); - arrow.PointToBestTargetPath(m.F(A::PERCEPTION_LEVEL)); - + m.V(A::EXTENDED_LINE)=extendedLine; + Arrow tempArrow{m.GetPos(),extendedLine,pointTowardsPlayer.vector().norm()*ConfigFloat("Arrow Spd"),"goblin_arrow.png",ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel()}; + m.V(A::FIRE_VELOCITY)=tempArrow.PointToBestTargetPath(m.F(A::PERCEPTION_LEVEL)); + m.phase=WINDUP; + } + }break; + case WINDUP:{ + m.F(A::SHOOT_TIMER)-=fElapsedTime; + if(m.F(A::SHOOT_TIMER)<=0){ m.F(A::ATTACK_COOLDOWN)=0.f; + CreateBullet(Arrow)(m.GetPos(),m.V(A::EXTENDED_LINE),m.V(A::FIRE_VELOCITY),"goblin_arrow.png",ConfigFloat("Arrow Hitbox Radius"),m.GetAttack(),m.OnUpperLevel())EndBullet; m.F(A::PERCEPTION_LEVEL)=std::min(ConfigFloat("Maximum Perception Level"),m.F(A::PERCEPTION_LEVEL)+ConfigFloat("Perception Level Increase")); m.PerformAnimation("IDLE",m.GetFacingDirectionToTarget(game->GetPlayer()->GetPos())); m.phase=MOVE; diff --git a/Adventures in Lestoria/MonsterAttribute.h b/Adventures in Lestoria/MonsterAttribute.h index 736fdfa2..0efc8ad3 100644 --- a/Adventures in Lestoria/MonsterAttribute.h +++ b/Adventures in Lestoria/MonsterAttribute.h @@ -143,4 +143,6 @@ enum class Attribute{ STONE_TOSS_COUNT, STONE_TOSS_TIMER, SHOCKWAVE_COLOR, + FIRE_VELOCITY, + EXTENDED_LINE, }; \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 5a1c9f9e..74b589b7 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 10186 +#define VERSION_BUILD 10189 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index db01c3bd..a6cfda18 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -599,6 +599,9 @@ MonsterStrategy Arrow Hitbox Radius = 8 + # How long the monster must stop turning their aim and lock in the target. The longer, the easier it is to dodge. + Bow Steadying Time = 0.33s + # When the monster will attempt to run away from target. Run Away Range = 500 # Chooses a random direction within the confines of this range, stays within it. diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 96bd298f..0aba7b50 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ