Fix a bug where hp recovery when at full health still applied passive hp recovery effects. Fix bug with volume transitions not respecting the user's set volume controls when adjusting audio events. Add debris spawning for second bonus boss. Release Build 9522.

This commit is contained in:
sigonasr2 2024-06-02 12:31:55 -05:00
parent e4e1a42fc1
commit 59dcde475a
10 changed files with 32 additions and 13 deletions

View File

@ -1866,7 +1866,7 @@ void AiL::RenderHud(){
}
Pixel healthOutlineCol=BLACK;
if(player->GetHealth()/player->GetMaxHealth()<="Player.Health Warning Pct"_F/100.f){
if(player->GetHealth()/float(player->GetMaxHealth())<="Player.Health Warning Pct"_F/100.f){
float runTimeAmt=fmod(GetRunTime(),"Player.Health Warning Flicker Time"_F*2);
if(runTimeAmt<"Player.Health Warning Flicker Time"_F){
healthOutlineCol="Player.Health Warning Outline Color"_Pixel;

View File

@ -341,7 +341,7 @@ void Audio::Update(){
Self().fadeToTargetVolumeTime=std::max(0.f,Self().fadeToTargetVolumeTime-game->GetElapsedTime());
for(int counter=0;float&vol:Self().prevVolumes){
const BGM&currentBgm=Self().bgm[Self().currentBGM];
Engine().SetVolume(currentBgm.GetChannelIDs()[counter],util::lerp(vol,Self().GetCalculatedBGMVolume(Self().targetVolumes[counter]),1-(Self().fadeToTargetVolumeTime/currentBgm.GetFadeTime())));
Engine().SetVolume(currentBgm.GetChannelIDs()[counter],util::lerp(Self().GetCalculatedBGMVolume(vol),Self().GetCalculatedBGMVolume(Self().targetVolumes[counter]),1-(Self().fadeToTargetVolumeTime/currentBgm.GetFadeTime())));
counter++;
}
}

View File

@ -46,14 +46,18 @@ INCLUDE_game
Debris::Debris(const vf2d pos,const vf2d vel,const int damage,const float radius,const float knockbackAmt,const float rotSpd,const float lifetime,bool upperLevel,bool friendly,Pixel col,const vf2d scale)
:Bullet(pos,vel,radius,damage,"commercial_assets/wind_solid_objects.png",upperLevel,false,lifetime,false,friendly,col,scale),knockbackAmt(knockbackAmt),rotatingSpd(rotSpd),randomFrame(util::random(GFX["commercial_assets/wind_solid_objects.png"].Sprite()->Size().x/24)){}
void Debris::Update(float fElapsedTime){
image_angle+=rotatingSpd;
image_angle+=rotatingSpd*fElapsedTime;
}
bool Debris::PlayerHit(Player*player){
player->Knockback(vel.norm()*knockbackAmt);
deactivated=true;
fadeOutTime=0.5f;
return true;
}
bool Debris::MonsterHit(Monster&monster){
monster.Knockback(vel.norm()*knockbackAmt);
deactivated=true;
fadeOutTime=0.5f;
return true;
}
void Debris::Draw(const Pixel blendCol)const{

View File

@ -250,9 +250,9 @@ const int Player::GetHealth()const{
return hp;
}
const float Player::GetMaxHealth()const{
const int Player::GetMaxHealth()const{
const float hpPctIncrease=GetStat("Health")*GetStat("Health %")/100.f;
return GetStat("Health")+hpPctIncrease;
return int(GetStat("Health")+hpPctIncrease);
}
const int Player::GetMana()const{
@ -809,7 +809,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
hurtRumbleTime="Player.Hurt Rumble Time"_F;
Input::StartVibration();
Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealth()/GetMaxHealth()));
Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealth()/float(GetMaxHealth())));
if(lastHitTimer>0){
damageNumberPtr.get()->damage+=int(mod_dmg);
@ -821,7 +821,7 @@ bool Player::Hurt(int damage,bool onUpperLevel,float z){
}
lastHitTimer=0.05f;
if(!lowHealthSoundPlayed&&lowHealthSoundPlayedTimer==0.f&&GetHealth()/GetMaxHealth()<="Player.Health Warning Pct"_F/100.f){
if(!lowHealthSoundPlayed&&lowHealthSoundPlayedTimer==0.f&&GetHealth()/float(GetMaxHealth())<="Player.Health Warning Pct"_F/100.f){
SoundEffect::PlaySFX("Health Warning",SoundEffect::CENTERED);
lowHealthSoundPlayed=true;
lowHealthSoundPlayedTimer="Player.Health Warning Cooldown"_F;
@ -1088,7 +1088,7 @@ bool Player::Heal(int damage,bool suppressDamageNumber){
if(!suppressDamageNumber&&damage>0){
DAMAGENUMBER_LIST.push_back(std::make_shared<DamageNumber>(GetPos(),damage,true,HEALTH_GAIN));
}
Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealth()/GetMaxHealth()));
Input::SetLightbar(PixelLerp(DARK_RED,GREEN,GetHealth()/float(GetMaxHealth())));
return true;
}
@ -1358,7 +1358,7 @@ void Player::PerformHPRecovery(){
Heal(hpRecoveryAmt);
}
if(GetHealth()/GetMaxHealth()>"Player.Health Warning Pct"_F/100.f){
if(GetHealth()/float(GetMaxHealth())>"Player.Health Warning Pct"_F/100.f){
lowHealthSoundPlayed=false;
}
}

View File

@ -115,7 +115,7 @@ public:
const float&GetBaseStat(std::string_view a)const;
void SetBaseStat(std::string_view a,float val);
void SetBaseStat(ItemAttribute a,float val);
const float GetMaxHealth()const;
const int GetMaxHealth()const;
const int GetHealth()const;
const int GetMana()const;
const int GetMaxMana()const;

View File

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 9515
#define VERSION_BUILD 9522
#define stringify(a) stringify_(a)
#define stringify_(a) #a

View File

@ -97,7 +97,7 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy)
});
}break;
case IDLE:{
const int randomAttackChoice=1;
const int randomAttackChoice=2;
switch(randomAttackChoice){
case 0:{
@ -273,7 +273,17 @@ void Monster::STRATEGY::ZEPHY(Monster&m,float fElapsedTime,std::string strategy)
game->SetWindSpeed({});
}
if(m.F(A::SHOOT_TIMER)<=0.f){
vf2d debrisSpawningOffset={-200.f,util::random(WINDOW_SIZE.y)-WINDOW_SIZE.y/2.f}; //Assume left landing site.
if(!LeftLandingSite)debrisSpawningOffset*=-1.f;
vf2d debrisSpd={util::random_range(ConfigFloatArr("Wind Attack.Wind Projectile X Speed Range",0),ConfigFloatArr("Wind Attack.Wind Projectile X Speed Range",1)),util::random_range(ConfigFloatArr("Wind Attack.Wind Projectile Y Speed Range",0),ConfigFloatArr("Wind Attack.Wind Projectile Y Speed Range",1))};
if(!LeftLandingSite)debrisSpd*=-1.f;
const float sizeMultiplier=util::random_range(0.75f,1.25f);
CreateBullet(Debris)(m.GetPos()+debrisSpawningOffset,debrisSpd,ConfigInt("Wind Attack.Debris Damage"),ConfigFloat("Wind Attack.Debris Radius")*sizeMultiplier,ConfigFloat("Wind Attack.Debris Knockback Multiplier"),util::random_range(util::degToRad(-180.f),util::degToRad(180.f)),INFINITE,m.OnUpperLevel(),false,WHITE,vf2d{1.f,1.f}*sizeMultiplier)EndBullet;
m.F(A::SHOOT_TIMER)=ConfigFloat("Wind Attack.Wind Projectile Spawn Rate");
}
}break;
case HALFHEALTH_PHASE:{

View File

@ -829,6 +829,8 @@ MonsterStrategy
# In Units
Fly Up Height = 700
Debris Damage = 40
Left Landing Site = 1608, 1728
Right Landing Site = 2472, 1728
@ -842,9 +844,12 @@ MonsterStrategy
Wind Duration = 18s
Wind Projectile Spawn Rate = 0.5s
Wind Projectile X Speed Range = 120px/s, 240px/s
Wind Projectile X Speed Range = 180px/s, 240px/s
Wind Projectile Y Speed Range = -32px/s, 32px/s
Debris Radius = 8
Debris Knockback Multiplier = 100
Wind Overlay Sprite = "wind_vignette.png"
Wind Overlay Color = 64, 64, 64, 255