Make knockups pause monster strategies. Fix Effect drawing code being invisible if their fadein timer was zero. Add explosion sound effect to Trapper's Explosive Trap ability. Add knockup and 100% temporary slowdown to Trapper's Bear Trap ability. Release Build 10324.

This commit is contained in:
sigonasr2 2024-07-25 17:51:14 -05:00
parent 9eaaf979f3
commit 4a7ad23196
15 changed files with 76 additions and 29 deletions

View File

@ -410,7 +410,7 @@ void sig::Animation::InitializeAnimations(){
CreateHorizontalAnimationSequence("bear_trap.png",3,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::PingPong}}); CreateHorizontalAnimationSequence("bear_trap.png",3,{24,24},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("explosive_trap.png",4,{48,48},AnimationData{.frameDuration{0.06f},.style{Animate2D::Style::PingPong}}); CreateHorizontalAnimationSequence("explosive_trap.png",4,{48,48},AnimationData{.frameDuration{0.06f},.style{Animate2D::Style::PingPong}});
CreateHorizontalAnimationSequence("explosionframes.png",21,{24,24},AnimationData{.frameDuration{0.05f},.style{Animate2D::Style::OneShot}}); CreateHorizontalAnimationSequence("explosionframes.png",21,{24,24},AnimationData{.frameDuration{0.02f},.style{Animate2D::Style::OneShot}});
for(auto&dat:GFX){ for(auto&dat:GFX){
std::string imgFile=dat.first; std::string imgFile=dat.first;

View File

@ -72,5 +72,9 @@ BulletDestroyState BearTrap::MonsterHit(Monster&monster,const uint8_t markStacks
monster.ApplyMark("Trapper.Ability 2.Marked Target Reset Time"_F,numberOfStacksToReplenish); monster.ApplyMark("Trapper.Ability 2.Marked Target Reset Time"_F,numberOfStacksToReplenish);
monster.AddBuff(BuffRestorationType::OVER_TIME,BuffOverTimeType::HP_DAMAGE_OVER_TIME,bleedDuration,bleedDamage,timeBetweenTicks); monster.AddBuff(BuffRestorationType::OVER_TIME,BuffOverTimeType::HP_DAMAGE_OVER_TIME,bleedDuration,bleedDamage,timeBetweenTicks);
} }
monster.AddBuff(BuffType::SLOWDOWN,"Trapper.Ability 2.Slowdown Time"_F,"Trapper.Ability 2.Slowdown Amount"_F/100.f);
monster.Knockup("Trapper.Ability 2.Knockup Amount"_F);
return BulletDestroyState::KEEP_ALIVE; return BulletDestroyState::KEEP_ALIVE;
} }

View File

@ -316,6 +316,7 @@ private:
float automaticDetonationTime{}; float automaticDetonationTime{};
float activationWaitTime{}; float activationWaitTime{};
float lastBeepTime{}; float lastBeepTime{};
uint8_t beepCount{1U};
}; };
struct PurpleEnergyBall:public Bullet{ struct PurpleEnergyBall:public Bullet{

View File

@ -73,6 +73,7 @@ bool Effect::Update(float fElapsedTime){
} }
} }
rotation+=rotationSpd*fElapsedTime; rotation+=rotationSpd*fElapsedTime;
size+=scaleSpd*fElapsedTime;
pos+=spd*fElapsedTime; pos+=spd*fElapsedTime;
animation.UpdateState(internal_animState,fElapsedTime); animation.UpdateState(internal_animState,fElapsedTime);
return true; return true;
@ -80,14 +81,16 @@ bool Effect::Update(float fElapsedTime){
void Effect::Draw()const{ void Effect::Draw()const{
if(additiveBlending)game->SetDecalMode(DecalMode::ADDITIVE); if(additiveBlending)game->SetDecalMode(DecalMode::ADDITIVE);
if(fadeout==0&&fadein==original_fadeInTime){ const bool FadeInFinished{original_fadeInTime==0||fadein==original_fadeInTime};
game->view.DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,col); const bool HasFadeout{fadeout>0};
}else
if(fadein==original_fadeInTime){ [[unlikely]]if(!FadeInFinished){
game->view.DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,{col.r,col.g,col.b,uint8_t(fadein/original_fadeInTime*col.a)}); game->view.DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,{col.r,col.g,col.b,uint8_t(fadein/original_fadeInTime*col.a)});
}else }else
if(fadeout==0){ [[likely]]if(HasFadeout){
game->view.DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,{col.r,col.g,col.b,uint8_t(fadeout/original_fadeOutTime*col.a)}); game->view.DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,{col.r,col.g,col.b,uint8_t(fadeout/original_fadeOutTime*col.a)});
}else{
game->view.DrawPartialRotatedDecal(pos,GetFrame().GetSourceImage()->Decal(),rotation,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,size,col);
} }
game->SetDecalMode(DecalMode::NORMAL); game->SetDecalMode(DecalMode::NORMAL);
} }

View File

@ -54,12 +54,13 @@ struct Effect{
vf2d pos={0,0}; vf2d pos={0,0};
float lifetime=0; float lifetime=0;
float fadeout=0; float fadeout=0;
float fadein=0; float fadein{0.f};
vf2d size={1,1}; vf2d size={1,1};
Pixel col=WHITE; Pixel col=WHITE;
vf2d spd={}; vf2d spd={};
float rotation=0; float rotation=0;
float rotationSpd=0; float rotationSpd=0;
vf2d scaleSpd{};
bool additiveBlending=false; bool additiveBlending=false;
private: private:
bool dead=false; bool dead=false;

View File

@ -56,19 +56,23 @@ ExplosiveTrap::ExplosiveTrap(vf2d pos,float radius,float explosionRadius,float a
void ExplosiveTrap::Update(float fElapsedTime){ void ExplosiveTrap::Update(float fElapsedTime){
const bool trapActivated{radius==activationRadius}; const bool trapActivated{radius==activationRadius};
if(IsDeactivated())return;
if(!trapActivated){ if(!trapActivated){
activationWaitTime-=fElapsedTime; activationWaitTime-=fElapsedTime;
if(activationWaitTime<=0.f){ if(activationWaitTime<=0.f){
radius=activationRadius; radius=activationRadius;
animation.ChangeState(internal_animState,"explosive_trap.png"); animation.ChangeState(internal_animState,"explosive_trap.png");
SoundEffect::PlaySFX("Beep",pos); beepCount=std::min(4U,beepCount+1U);
SoundEffect::PlaySFX(std::format("Beep {}",beepCount),pos);
lastBeepTime=1.f; lastBeepTime=1.f;
} }
}else{ }else{
automaticDetonationTime-=fElapsedTime; automaticDetonationTime-=fElapsedTime;
lastBeepTime-=fElapsedTime; lastBeepTime-=fElapsedTime;
if(lastBeepTime<=0.f){ if(lastBeepTime<=0.f){
SoundEffect::PlaySFX("Beep",pos); beepCount=std::min(4U,beepCount+1U);
SoundEffect::PlaySFX(std::format("Beep {}",beepCount),pos);
lastBeepTime=1.f; lastBeepTime=1.f;
} }
if(IsActivated()&&automaticDetonationTime<=0.f)Detonate(); if(IsActivated()&&automaticDetonationTime<=0.f)Detonate();
@ -89,14 +93,16 @@ void ExplosiveTrap::Detonate(){
const HurtList list{game->HurtNotHit(pos,"Trapper.Ability 3.Explosion Radius"_F/100.f*24,damage,hitList,OnUpperLevel(),GetZ(),HurtType::MONSTER,HurtFlag::PLAYER_ABILITY)}; const HurtList list{game->HurtNotHit(pos,"Trapper.Ability 3.Explosion Radius"_F/100.f*24,damage,hitList,OnUpperLevel(),GetZ(),HurtType::MONSTER,HurtFlag::PLAYER_ABILITY)};
for(const auto&[targetPtr,wasHit]:list){ for(const auto&[targetPtr,wasHit]:list){
if(wasHit){ if(wasHit){
std::get<Monster*>(targetPtr)->ProximityKnockback(pos,"Trapper.Ability 3.Explosion Knockup Amount"_F);
std::get<Monster*>(targetPtr)->Knockup("Trapper.Ability 3.Explosion Knockup Amount"_F);
std::get<Monster*>(targetPtr)->ApplyMark("Trapper.Ability 3.Explosion Mark Stack Time"_F,"Trapper.Ability 3.Explosion Mark Stack Increase"_I); std::get<Monster*>(targetPtr)->ApplyMark("Trapper.Ability 3.Explosion Mark Stack Time"_F,"Trapper.Ability 3.Explosion Mark Stack Increase"_I);
std::get<Monster*>(targetPtr)->ProximityKnockback(pos,"Trapper.Ability 3.Explosion Knockback Amount"_F);
std::get<Monster*>(targetPtr)->Knockup("Trapper.Ability 3.Explosion Knockup Amount"_F);
} }
} }
game->AddEffect(std::make_unique<Effect>(pos,ANIMATION_DATA["explosionframes.png"].GetTotalAnimationDuration()-0.2f,"explosionframes.png",OnUpperLevel(),scale*2.f,0.2f,vf2d{},WHITE,util::random(2*PI),0.f)); std::unique_ptr<Effect>explodeEffect{std::make_unique<Effect>(pos,ANIMATION_DATA["explosionframes.png"].GetTotalAnimationDuration()-0.2f,"explosionframes.png",OnUpperLevel(),scale*2.f,0.2f,vf2d{0,-6.f},WHITE,util::random(2*PI),0.f)};
explodeEffect->scaleSpd={0.125f,0.125f};
game->AddEffect(std::move(explodeEffect));
SoundEffect::PlaySFX("Explosion",pos);
Deactivate(); Deactivate();
} }
@ -105,7 +111,7 @@ BulletDestroyState ExplosiveTrap::MonsterHit(Monster&monster,const uint8_t markS
monster.Hurt(0,monster.OnUpperLevel(),monster.GetZ(),HurtFlag::PLAYER_ABILITY);//Triggers mark multiple times after the first mark. monster.Hurt(0,monster.OnUpperLevel(),monster.GetZ(),HurtFlag::PLAYER_ABILITY);//Triggers mark multiple times after the first mark.
} }
monster.ProximityKnockback(pos,"Trapper.Ability 3.Explosion Knockup Amount"_F); monster.ProximityKnockback(pos,"Trapper.Ability 3.Explosion Knockback Amount"_F);
monster.Knockup("Trapper.Ability 3.Explosion Knockup Amount"_F); monster.Knockup("Trapper.Ability 3.Explosion Knockup Amount"_F);
Detonate(); Detonate();

View File

@ -364,7 +364,7 @@ bool Monster::Update(float fElapsedTime){
if(GetState()==State::NORMAL){ if(GetState()==State::NORMAL){
UpdateFacingDirection(game->GetPlayer()->GetPos()); UpdateFacingDirection(game->GetPlayer()->GetPos());
} }
if(!game->TestingModeEnabled())Monster::STRATEGY::RUN_STRATEGY(*this,fElapsedTime); if(!game->TestingModeEnabled()&&CanMove())Monster::STRATEGY::RUN_STRATEGY(*this,fElapsedTime);
} }
if(!IsAlive()){ if(!IsAlive()){
deathTimer+=fElapsedTime; deathTimer+=fElapsedTime;
@ -1299,3 +1299,7 @@ const bool Monster::InUndamageableState(const bool onUpperLevel,const float z)co
void Monster::AddBuff(BuffRestorationType type,BuffOverTimeType::BuffOverTimeType overTimeType,float duration,float intensity,float timeBetweenTicks){ void Monster::AddBuff(BuffRestorationType type,BuffOverTimeType::BuffOverTimeType overTimeType,float duration,float intensity,float timeBetweenTicks){
buffList.push_back(Buff{this,type,overTimeType,duration,intensity,timeBetweenTicks}); buffList.push_back(Buff{this,type,overTimeType,duration,intensity,timeBetweenTicks});
} }
const bool Monster::CanMove()const{
return knockUpTimer==0.f&&IsAlive();
}

View File

@ -206,6 +206,7 @@ public:
//Gets the nearest target that can be immediately targeted //Gets the nearest target that can be immediately targeted
static std::optional<Monster*>GetNearestMonster(const vf2d point,const float maxDistance,const bool onUpperLevel,const float z); static std::optional<Monster*>GetNearestMonster(const vf2d point,const float maxDistance,const bool onUpperLevel,const float z);
const bool InUndamageableState(const bool onUpperLevel,const float z)const; const bool InUndamageableState(const bool onUpperLevel,const float z)const;
const bool CanMove()const;
private: private:
//NOTE: Marking a monster for deletion does not trigger any death events. It just simply removes the monster from the field!! //NOTE: Marking a monster for deletion does not trigger any death events. It just simply removes the monster from the field!!
// The way this works is that monsters marked for deletion will cause the monster update loop to detect there's at least one or more monsters that must be deleted and will call erase_if on the list at the end of the iteration loop. // The way this works is that monsters marked for deletion will cause the monster update loop to detect there's at least one or more monsters that must be deleted and will call erase_if on the list at the end of the iteration loop.

View File

@ -50,6 +50,7 @@ void PurpleEnergyBall::Update(float fElapsedTime){
void PurpleEnergyBall::Draw(const Pixel blendCol)const{ void PurpleEnergyBall::Draw(const Pixel blendCol)const{
const vf2d lightOrbScale{initialScale.lerp(initialScale/2.f,sin(12*PI*game->GetRunTime())/2.f+0.5f)}; const vf2d lightOrbScale{initialScale.lerp(initialScale/2.f,sin(12*PI*game->GetRunTime())/2.f+0.5f)};
game->SetDecalMode(DecalMode::ADDITIVE); game->SetDecalMode(DecalMode::ADDITIVE);
game->DrawPartialDecal(pos,initialScale+0.2f,animation.GetFrame(internal_animState).GetSourceImage()->Decal(),animation.GetFrame(internal_animState).GetSourceRect().pos,animation.GetFrame(internal_animState).GetSourceRect().size);
game->SetDecalMode(DecalMode::NORMAL);
Bullet::Draw(blendCol); Bullet::Draw(blendCol);
} }

View File

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

View File

@ -48,14 +48,14 @@ INCLUDE_game
void Witch::Initialize(){ void Witch::Initialize(){
READFROMCONFIG(Witch,WITCH); READFROMCONFIG(Witch,WITCH);
Witch::idle_n="WARRIOR_IDLE_N"; Witch::idle_n="WITCH_IDLE_N";
Witch::idle_e="WARRIOR_IDLE_E"; Witch::idle_e="WITCH_IDLE_E";
Witch::idle_s="WARRIOR_IDLE_S"; Witch::idle_s="WITCH_IDLE_S";
Witch::idle_w="WARRIOR_IDLE_W"; Witch::idle_w="WITCH_IDLE_W";
Witch::walk_n="WARRIOR_WALK_N"; Witch::walk_n="WITCH_WALK_N";
Witch::walk_e="WARRIOR_WALK_E"; Witch::walk_e="WITCH_WALK_E";
Witch::walk_s="WARRIOR_WALK_S"; Witch::walk_s="WITCH_WALK_S";
Witch::walk_w="WARRIOR_WALK_W"; Witch::walk_w="WITCH_WALK_W";
} }
SETUP_CLASS(Witch) SETUP_CLASS(Witch)

View File

@ -19,11 +19,29 @@ Events
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = bear_slam.ogg, 70% File[0] = bear_slam.ogg, 70%
} }
Beep Beep 1
{ {
CombatSound = True CombatSound = True
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = beep.ogg, 100% File[0] = beep.ogg, 100%, 70%, 70%
}
Beep 2
{
CombatSound = True
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = beep.ogg, 100%, 90%, 90%
}
Beep 3
{
CombatSound = True
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = beep.ogg, 100%, 110%, 110%
}
Beep 4
{
CombatSound = True
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = beep.ogg, 100%, 130%, 130%
} }
Bomb Explode Bomb Explode
{ {
@ -101,6 +119,11 @@ Events
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = equip_ring.ogg, 100% File[0] = equip_ring.ogg, 100%
} }
Explosion
{
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = explosion.ogg, 80%
}
Footstep Footstep
{ {
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
@ -166,7 +189,7 @@ Events
{ {
CombatSound = True CombatSound = True
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = lockon.ogg, 100% File[0] = lockon.ogg, 100%, 140%, 140%
} }
Menu Navigate Menu Navigate
{ {

View File

@ -88,6 +88,9 @@ Trapper
# % of Attack, Duration, Time per tick # % of Attack, Duration, Time per tick
Marked Target Bleed = 10%, 10s, 1s Marked Target Bleed = 10%, 10s, 1s
Trap Radius = 11px Trap Radius = 11px
Knockup Amount = 0.3s
Slowdown Amount = 100%
Slowdown Time = 0.6s
#RGB Values. Color 1 is the circle at full cooldown, Color 2 is the color at empty cooldown. #RGB Values. Color 1 is the circle at full cooldown, Color 2 is the color at empty cooldown.
Cooldown Bar Color 1 = 64, 0, 0, 192 Cooldown Bar Color 1 = 64, 0, 0, 192
@ -120,7 +123,7 @@ Trapper
Trap Radius = 17px Trap Radius = 17px
Explosion Knockback Amount = 250 Explosion Knockback Amount = 200
Explosion Knockup Amount = 0.6s Explosion Knockup Amount = 0.6s
#RGB Values. Color 1 is the circle at full cooldown, Color 2 is the color at empty cooldown. #RGB Values. Color 1 is the circle at full cooldown, Color 2 is the color at empty cooldown.

Binary file not shown.