Add player projectile auto attack flag to identify bullets for wind affecting. Release Build 9497.

pull/57/head
sigonasr2 6 months ago
parent 5150f4f218
commit 05caa062e1
  1. 13
      Adventures in Lestoria/Bullet.cpp
  2. 4
      Adventures in Lestoria/Bullet.h
  3. 3
      Adventures in Lestoria/Ranger.cpp
  4. 2
      Adventures in Lestoria/Version.h
  5. 3
      Adventures in Lestoria/Wizard.cpp
  6. 13
      Adventures in Lestoria/Zephy.cpp
  7. BIN
      x64/Release/Adventures in Lestoria.exe

@ -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;
}

@ -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);
};

@ -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>(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);

@ -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

@ -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>(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;
}

@ -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>&bullet){if(bullet->IsPlayerAutoAttackProjectile()){bullet->AddVelocity(windSpd);}});
#pragma endregion
if(m.F(A::CASTING_TIMER)<=0.f){

Loading…
Cancel
Save