diff --git a/Adventures in Lestoria/Bullet.cpp b/Adventures in Lestoria/Bullet.cpp index f0873370..dd032577 100644 --- a/Adventures in Lestoria/Bullet.cpp +++ b/Adventures in Lestoria/Bullet.cpp @@ -213,4 +213,17 @@ Bullet&Bullet::SetFadeinTime(float fadeInTime){ const float&Bullet::GetFadeoutTimer()const{ return fadeOutTimer; +} + +Bullet&Bullet::SetIsPlayerAutoAttackProjectile(){ + playerAutoAttackProjectile=true; + return *this; +} + +const bool Bullet::IsPlayerAutoAttackProjectile()const{ + return playerAutoAttackProjectile; +} + +void Bullet::AddVelocity(vf2d vel){ + this->vel+=vel; } \ No newline at end of file diff --git a/Adventures in Lestoria/Bullet.h b/Adventures in Lestoria/Bullet.h index 55b1ec29..95c5579f 100644 --- a/Adventures in Lestoria/Bullet.h +++ b/Adventures in Lestoria/Bullet.h @@ -70,6 +70,7 @@ private: bool dead=false; //When marked as dead it wil be removed by the next frame. bool simulated=false; //A simulated bullet cannot interact / damage things in the world. It's simply used for simulating the trajectory and potential path of the bullet float iframeTimerOnHit{0.f}; + bool playerAutoAttackProjectile=false; //Set to true for bullets that are auto attack projectiles to identify them. protected: float drawOffsetY{}; bool _PlayerHit(Player*player); @@ -100,4 +101,7 @@ public: const float GetZ()const; Bullet&SetIframeTimeOnHit(float iframeTimer); Bullet&SetFadeinTime(float fadeInTime); + Bullet&SetIsPlayerAutoAttackProjectile(); //Enables the playerAutoAttackProjectile flag. + const bool IsPlayerAutoAttackProjectile()const; + void AddVelocity(vf2d vel); }; \ No newline at end of file diff --git a/Adventures in Lestoria/Ranger.cpp b/Adventures in Lestoria/Ranger.cpp index 208b5988..afca4f02 100644 --- a/Adventures in Lestoria/Ranger.cpp +++ b/Adventures in Lestoria/Ranger.cpp @@ -71,7 +71,8 @@ bool Ranger::AutoAttack(){ vf2d extendedLine=pointTowardsCursor.upoint(1.1f); float angleToCursor=atan2(extendedLine.y-GetPos().y,extendedLine.x-GetPos().x); attack_cooldown_timer=ARROW_ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); - BULLET_LIST.push_back(std::make_unique(Arrow(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F-PI/8*"Ranger.Auto Attack.ArrowSpd"_F)}+movementVelocity/1.5f,"Ranger.Auto Attack.Radius"_F,int(GetAttack()*"Ranger.Auto Attack.DamageMult"_F),OnUpperLevel(),true))); + CreateBullet(Arrow)(GetPos(),extendedLine,vf2d{cos(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F,float(sin(angleToCursor)*"Ranger.Auto Attack.ArrowSpd"_F-PI/8*"Ranger.Auto Attack.ArrowSpd"_F)}+movementVelocity/1.5f,"Ranger.Auto Attack.Radius"_F,int(GetAttack()*"Ranger.Auto Attack.DamageMult"_F),OnUpperLevel(),true)EndBullet; + BULLET_LIST.back()->SetIsPlayerAutoAttackProjectile(); SetState(State::SHOOT_ARROW); SetAnimationBasedOnTargetingDirection(angleToCursor); SoundEffect::PlaySFX("Ranger.Auto Attack.Sound"_S,SoundEffect::CENTERED); diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 73eb89e6..a5fcaa45 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 9494 +#define VERSION_BUILD 9497 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Wizard.cpp b/Adventures in Lestoria/Wizard.cpp index 0fb2ecd9..b96b714d 100644 --- a/Adventures in Lestoria/Wizard.cpp +++ b/Adventures in Lestoria/Wizard.cpp @@ -104,7 +104,8 @@ void Wizard::OnUpdate(float fElapsedTime){ bool Wizard::AutoAttack(){ attack_cooldown_timer=MAGIC_ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); float angleToCursor=atan2(GetWorldAimingLocation().y-GetPos().y,GetWorldAimingLocation().x-GetPos().x); - BULLET_LIST.push_back(std::make_unique(EnergyBolt(GetPos(),{cos(angleToCursor)*"Wizard.Auto Attack.Speed"_F,sin(angleToCursor)*"Wizard.Auto Attack.Speed"_F},"Wizard.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Wizard.Auto Attack.DamageMult"_F),upperLevel,true,WHITE))); + CreateBullet(EnergyBolt)(GetPos(),{cos(angleToCursor)*"Wizard.Auto Attack.Speed"_F,sin(angleToCursor)*"Wizard.Auto Attack.Speed"_F},"Wizard.Auto Attack.Radius"_F/100*12,int(GetAttack()*"Wizard.Auto Attack.DamageMult"_F),upperLevel,true,WHITE)EndBullet; + BULLET_LIST.back()->SetIsPlayerAutoAttackProjectile(); SoundEffect::PlaySFX("Wizard Auto Attack",SoundEffect::CENTERED); return true; } diff --git a/Adventures in Lestoria/Zephy.cpp b/Adventures in Lestoria/Zephy.cpp index 7933cb32..e0590338 100644 --- a/Adventures in Lestoria/Zephy.cpp +++ b/Adventures in Lestoria/Zephy.cpp @@ -46,6 +46,7 @@ INCLUDE_game INCLUDE_MONSTER_DATA INCLUDE_WINDOW_SIZE INCLUDE_GFX +INCLUDE_BULLET_LIST using A=Attribute; @@ -251,12 +252,14 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy) } #pragma region Wind - const bool LeftLandingSite=m.I(A::ATTACK_CHOICE); + const bool LeftLandingSite=m.I(A::ATTACK_CHOICE); - vf2d windSpd={m.F(A::WIND_STRENGTH)*"Player.MoveSpd"_F,0.f}; //Assume we landed left and causing a wind attack to the right. - if(!LeftLandingSite)windSpd*=-1; - game->GetPlayer()->AddVelocity(windSpd); - m.F(A::CASTING_TIMER)=ConfigFloat("Wind Attack.Wind Duration"); + vf2d windSpd={m.F(A::WIND_STRENGTH)*"Player.MoveSpd"_F,0.f}; //Assume we landed left and causing a wind attack to the right. + if(!LeftLandingSite)windSpd*=-1; + game->GetPlayer()->AddVelocity(windSpd); + m.F(A::CASTING_TIMER)=ConfigFloat("Wind Attack.Wind Duration"); + + std::for_each(BULLET_LIST.begin(),BULLET_LIST.end(),[&](const std::unique_ptr&bullet){if(bullet->IsPlayerAutoAttackProjectile()){bullet->AddVelocity(windSpd);}}); #pragma endregion if(m.F(A::CASTING_TIMER)<=0.f){ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index b36aa425..3f0fd583 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ