@ -56,19 +56,23 @@ ExplosiveTrap::ExplosiveTrap(vf2d pos,float radius,float explosionRadius,float a
void ExplosiveTrap : : Update ( float fElapsedTime ) {
const bool trapActivated { radius = = activationRadius } ;
if ( IsDeactivated ( ) ) return ;
if ( ! trapActivated ) {
activationWaitTime - = fElapsedTime ;
if ( activationWaitTime < = 0.f ) {
radius = activationRadius ;
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 ;
}
} else {
automaticDetonationTime - = fElapsedTime ;
lastBeepTime - = fElapsedTime ;
if ( lastBeepTime < = 0.f ) {
SoundEffect : : PlaySFX ( " Beep " , pos ) ;
beepCount = std : : min ( 4U , beepCount + 1U ) ;
SoundEffect : : PlaySFX ( std : : format ( " Beep {} " , beepCount ) , pos ) ;
lastBeepTime = 1.f ;
}
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 ) } ;
for ( const auto & [ targetPtr , wasHit ] : list ) {
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 ) - > 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 ( ) ;
}
@ -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 . 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 ) ;
Detonate ( ) ;