diff --git a/Adventures in Lestoria/Arc.h b/Adventures in Lestoria/Arc.h index 759fa096..d2379e95 100644 --- a/Adventures in Lestoria/Arc.h +++ b/Adventures in Lestoria/Arc.h @@ -49,11 +49,11 @@ public: void Draw(AiL*game,const Pixel col); const bool overlaps(const vf2d checkPos)const; void GrowRadius(const float growAmt); -private: - void GenerateArc(); const vf2d pos; const float pointingAngle; const float sweepAngle; float radius; geom2d::polygonpoly; +private: + void GenerateArc(); }; \ No newline at end of file diff --git a/Adventures in Lestoria/GiantOctopus.cpp b/Adventures in Lestoria/GiantOctopus.cpp index f29334f7..cc353097 100644 --- a/Adventures in Lestoria/GiantOctopus.cpp +++ b/Adventures in Lestoria/GiantOctopus.cpp @@ -73,7 +73,7 @@ void Monster::STRATEGY::GIANT_OCTOPUS(Monster&m,float fElapsedTime,std::string s const std::weak_ptr&m{std::any_cast>(arm)}; if(m.expired()||m.lock()->IsDead()){ deadMonsterCount++; - tempArmLocs.emplace_back(std::any_cast(m.VEC(A::ARM_LOCATIONS))); + tempArmLocs.emplace_back(std::any_cast(m.lock()->VEC(A::ARM_LOCATIONS))); } } if(deadMonsterCount>0){ diff --git a/Adventures in Lestoria/OctopusArm.cpp b/Adventures in Lestoria/OctopusArm.cpp index 6c86d44b..74266579 100644 --- a/Adventures in Lestoria/OctopusArm.cpp +++ b/Adventures in Lestoria/OctopusArm.cpp @@ -56,6 +56,7 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str SEARCH, PREPARE_ATTACK, ATTACK_ANIMATION, + ATTACK_RECOVERY, SUBMERGE, }; @@ -64,6 +65,7 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str }; if(m.ANY(A::STORED_ARC).has_value()){ + game->DrawShadowStringDecal({100,100},std::format("Stored Arc Active: {}",std::any_cast(m.ANY(A::STORED_ARC)).pos.str())); const float growthRate=((ConfigFloat("Attack Radius")/100.f*24)/ConfigFloat("Attack Effect Time"))*fElapsedTime; std::any_cast(m.ANY(A::STORED_ARC)).GrowRadius(growthRate); m.F(A::ENVIRONMENT_TIMER)-=fElapsedTime; @@ -77,6 +79,7 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str m.F(A::CASTING_TIMER)=m.GetCurrentAnimation().GetTotalAnimationDuration(); SETPHASE(RISE_ANIMATION); m.SetStrategyDeathFunction([bossDamageOnDeath=ConfigInt("Boss Damage On Death")](GameEvent&event,Monster&m,const StrategyName&strategyName){ + m.SetStrategyDrawFunction([](AiL*game,Monster&monster,const std::string&strategy){}); const std::string GIANT_OCTOPUS_NAME{"Giant Octopus"}; const std::string OCTOPUS_ARM_NAME{"Octopus Arm"}; @@ -115,12 +118,11 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str Arc attackArc{GetAttackArc(m)}; - m.SetStrategyDrawFunction([&attackArc,&storedArc=m.ANY(A::STORED_ARC),&alphaTimer=m.F(A::ENVIRONMENT_TIMER),attackEffectTime=ConfigFloat("Attack Effect Time")](AiL*game,Monster&monster,const std::string&strategy){ + m.SetStrategyDrawFunction([arc=attackArc,&storedArc=m.ANY(A::STORED_ARC),&alphaTimer=m.F(A::ENVIRONMENT_TIMER),attackEffectTime=ConfigFloat("Attack Effect Time")](AiL*game,Monster&monster,const std::string&strategy){ const float alphaTimer{float(std::fmod(game->GetRunTime(),2.f))}; uint8_t alpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer)}; if(alphaTimer>1.f)alpha=util::lerp(0,255,1-(alphaTimer-1)); - game->DrawShadowStringDecal({100,100},std::format("{} - {}",alpha,alphaTimer)); - attackArc.Draw(game,{0,0,255,uint8_t(alpha)}); + const_cast(arc).Draw(game,{0,0,255,uint8_t(alpha)}); if(storedArc.has_value()){ const uint8_t effectAlpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer/attackEffectTime)}; std::any_cast(storedArc).Draw(game,{255,255,255,effectAlpha}); @@ -131,27 +133,37 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str case PREPARE_ATTACK:{ m.F(A::ATTACK_COOLDOWN)-=fElapsedTime; if(m.F(A::ATTACK_COOLDOWN)<=0.f){ + SETPHASE(ATTACK_ANIMATION); m.PerformAnimation("ATTACKING"); - m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Attack Effect Time"); + m.F(A::ENVIRONMENT_TIMER)=m.F(A::RECOVERY_TIME)=ConfigFloat("Attack Effect Time"); m.F(A::SWING_OCCURRED)=ConfigFloat("Attack Swing Damage Wait Time"); } }break; case ATTACK_ANIMATION:{ - m.F(A::RECOVERY_TIME)-=fElapsedTime; - if(m.F(A::SWING_OCCURRED)>0.f){ - m.F(A::SWING_OCCURRED)-=fElapsedTime; - if(m.F(A::SWING_OCCURRED)<=0.f){ - Arc attackArc{GetAttackArc(m)}; - if(attackArc.overlaps(game->GetPlayer()->GetPos())){ - game->GetPlayer()->Knockback(util::pointTo(m.GetPos(),game->GetPlayer()->GetPos())*ConfigFloat("Attack Knockback")); - game->GetPlayer()->Hurt(m.GetAttack(),m.OnUpperLevel(),m.GetZ()); - } - m.F(A::RECOVERY_TIME)=m.GetCurrentAnimation().GetTotalAnimationDuration(); - m.ANY(A::STORED_ARC)=GetAttackArc(m); + m.F(A::SWING_OCCURRED)-=fElapsedTime; + if(m.F(A::SWING_OCCURRED)<=0.f){ + Arc attackArc{GetAttackArc(m)}; + if(attackArc.overlaps(game->GetPlayer()->GetPos())){ + game->GetPlayer()->Knockback(util::pointTo(m.GetPos(),game->GetPlayer()->GetPos())*ConfigFloat("Attack Knockback")); + game->GetPlayer()->Hurt(m.GetAttack(),m.OnUpperLevel(),m.GetZ()); } + m.F(A::RECOVERY_TIME)=m.GetCurrentAnimation().GetTotalAnimationDuration(); + m.ANY(A::STORED_ARC)=GetAttackArc(m); + m.SetStrategyDrawFunction([&storedArc=m.ANY(A::STORED_ARC),attackEffectTime=ConfigFloat("Attack Effect Time")](AiL*game,Monster&monster,const std::string&strategy){ + const float alphaTimer{float(std::fmod(game->GetRunTime(),2.f))}; + if(storedArc.has_value()){ + const uint8_t effectAlpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer/attackEffectTime)}; + std::any_cast(storedArc).Draw(game,{255,255,255,effectAlpha}); + } + }); + SETPHASE(ATTACK_RECOVERY); } + }break; + case ATTACK_RECOVERY:{ + m.F(A::RECOVERY_TIME)-=fElapsedTime; if(m.F(A::RECOVERY_TIME)<=0.f){ m.PerformIdleAnimation(); + m.SetStrategyDrawFunction([](AiL*game,Monster&monster,const std::string&strategy){}); SETPHASE(SEARCH); } }break; diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index a482571d..012cec1d 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 11795 +#define VERSION_BUILD 11808 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/Campaigns/3_5.tmx b/Adventures in Lestoria/assets/Campaigns/3_5.tmx index 4cf988bd..a9d9ed9c 100644 --- a/Adventures in Lestoria/assets/Campaigns/3_5.tmx +++ b/Adventures in Lestoria/assets/Campaigns/3_5.tmx @@ -1,5 +1,5 @@ - + @@ -1471,7 +1471,11 @@ - + + + + + diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 83c4c8ec..80908e38 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -1211,7 +1211,7 @@ MonsterStrategy # For synchronization purposes. Damage doesn't come out until this amount of time has passed in the animation. Attack Swing Damage Wait Time = 0.45s - Attack Knockback = 50 + Attack Knockback = 200 Boss Damage On Death = 6000hp diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index d590b910..f0163b55 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ