@ -44,8 +44,8 @@ All rights reserved.
INCLUDE_game
PoisonBottle : : PoisonBottle ( vf2d pos , vf2d targetPos , float explodeRadius , float z , float totalFallTime , float totalRiseZAmt , int damage , bool upperLevel , bool hitsMultiple , float lifetime , bool friendly , Pixel col , vf2d scale , float image_angle )
: Bullet ( pos , util : : pointTo ( pos , targetPos ) * util : : distance ( pos , targetPos ) / totalFallTime , 0.f , damage , " poison_bottle.png " , upperLevel , hitsMultiple , lifetime , false , friendly , col , scale , image_angle ) , initialZ ( z ) , explodeRadius ( explodeRadius ) , totalRiseZAmt ( totalRiseZAmt ) , totalFallTime ( totalFallTime ) , startingPos ( pos ) , targetPos ( targetPos ) , originalRisingTime ( totalFallTime * 0.25f ) , risingTime ( originalRisingTime ) , originalFallingTime ( totalFallTime * 0.75f ) , fallingTime ( originalFallingTime ) {
PoisonBottle : : PoisonBottle ( vf2d pos , vf2d targetPos , float explodeRadius , float bounceExplodeRadius , float z , float totalFallTime , float totalRiseZAmt , int damage , int additionalBounceCount , bool upperLevel , bool hitsMultiple , float lifetime , bool friendly , Pixel col , vf2d scale , float image_angle )
: Bullet ( pos , util : : pointTo ( pos , targetPos ) * util : : distance ( pos , targetPos ) / totalFallTime , 0.f , damage , " poison_bottle.png " , upperLevel , hitsMultiple , lifetime , false , friendly , col , scale , image_angle ) , initialZ ( z ) , explodeRadius ( explodeRadius ) , bounceExplodeRadius ( bounceExplodeRadius ) , totalRiseZAmt ( totalRiseZAmt ) , totalFallTime ( totalFallTime ) , startingPos ( pos ) , targetPos ( targetPos ) , originalRisingTime ( totalFallTime * 0.25f / ( additionalBounceCount + 1 ) ) , risingTime ( originalRisingTime ) , originalFallingTime ( totalFallTime * 0.75f / ( additionalBounceCount + 1 ) ) , fallingTime ( originalFallingTime ) , additionalBounceCount ( additionalBounceCount ) {
this - > z = z ;
}
@ -58,7 +58,12 @@ void PoisonBottle::Update(float fElapsedTime){
z = 0.f ;
SoundEffect : : PlaySFX ( " Glass Break " , pos ) ;
SoundEffect : : PlaySFX ( " Poison Pool " , pos ) ;
const float poisonCircleScale { " Witch.Ability 2.Casting Size " _F / 100.f } ;
float poisonCircleScale { " Witch.Ability 2.Casting Size " _F / 100.f } ;
if ( additionalBounceCount > 0 ) poisonCircleScale = " Poison Bounce " _ENC [ " BOUNCE EXPLODE RADIUS " ] / 100.f ;
float currentExplodeRadius { explodeRadius } ;
if ( additionalBounceCount > 0 ) currentExplodeRadius = bounceExplodeRadius ;
game - > AddEffect ( std : : make_unique < Effect > ( pos , 0.f , " poison_pool.png " , game - > GetPlayer ( ) - > OnUpperLevel ( ) , 0.5f , 1.2f , vf2d { poisonCircleScale , poisonCircleScale } , vf2d { } , WHITE , 0.f , 0.f , false ) , true ) ;
for ( int i : std : : ranges : : iota_view ( 0 , 200 ) ) {
float size { util : : random_range ( 0.4f , 0.8f ) } ;
@ -66,26 +71,38 @@ void PoisonBottle::Update(float fElapsedTime){
col . a = util : : random_range ( 60 , 200 ) ;
game - > AddEffect ( std : : make_unique < Effect > ( pos + vf2d { util : : random ( 16 ) * poisonCircleScale , util : : random ( 2 * PI ) } . cart ( ) , util : : random_range ( 1.f , 4.f ) , " circle.png " , game - > GetPlayer ( ) - > OnUpperLevel ( ) , vf2d { size , size } , util : : random_range ( 0.2f , 0.5f ) , vf2d { util : : random_range ( - 6.f , 6.f ) , util : : random_range ( - 12.f , - 4.f ) } , col ) ) ;
}
if ( game - > GetPlayer ( ) - > HasEnchant ( " Pooling Poison " ) ) {
game - > AddEffect ( std : : make_unique < PoisonPool > ( pos , " poison_pool.png " , explodeRadius , game - > GetPlayer ( ) - > GetAttack ( ) * " Pooling Poison " _ENC [ " POISON POOL DAMAGE PCT " ] / 100.f , " Pooling Poison " _ENC [ " POISON POOL DAMAGE FREQUENCY " ] , friendly ? HurtType : : MONSTER : HurtType : : PLAYER , " Pooling Poison " _ENC [ " SPLASH LINGER TIME " ] , 2. f, OnUpperLevel ( ) , poisonCircleScale , vf2d { } , WHITE , 0.f , 0.f , false , 0.05f , [ pos = pos , col = col , poisonCircleScale ] ( ) {
if ( additionalBounceCount = = 0 & & game - > GetPlayer ( ) - > HasEnchant ( " Pooling Poison " ) ) {
game - > AddEffect ( std : : make_unique < PoisonPool > ( pos , " poison_pool.png " , bounc eE xplodeRadius, game - > GetPlayer ( ) - > GetAttack ( ) * " Pooling Poison " _ENC [ " POISON POOL DAMAGE PCT " ] / 100.f , " Pooling Poison " _ENC [ " POISON POOL DAMAGE FREQUENCY " ] , friendly ? HurtType : : MONSTER : HurtType : : PLAYER , " Pooling Poison " _ENC [ " SPLASH LINGER TIME " ] , 0.5 f, OnUpperLevel ( ) , poisonCircleScale , vf2d { } , WHITE , 0.f , 0.f , false , 0.05f , [ pos = pos , col = col , poisonCircleScale ] ( ) {
float size { util : : random_range ( 0.4f , 0.8f ) } ;
return Effect { pos + vf2d { util : : random ( 16 ) * poisonCircleScale , util : : random ( 2 * PI ) } . cart ( ) , util : : random_range ( 1.f , 4.f ) , " circle.png " , game - > GetPlayer ( ) - > OnUpperLevel ( ) , vf2d { size , size } , util : : random_range ( 0.2f , 0.5f ) , vf2d { util : : random_range ( - 6.f , 6.f ) , util : : random_range ( - 12.f , - 4.f ) } , col } ;
} ) , true ) ;
}
const HurtList hurtList { game - > Hurt ( pos , explodeRadius , damage , OnUpperLevel ( ) , z , HurtType : : MONSTER , HurtFlag : : PLAYER_ABILITY ) } ;
for ( const auto & [ targetPtr , wasHit ] : hurtList ) {
if ( wasHit ) {
Monster * monsterPtr { std : : get < Monster * > ( targetPtr ) } ;
const int buffDamage { int ( game - > GetPlayer ( ) - > GetAttack ( ) * " Witch.Ability 2.Poison Debuff " _f [ 0 ] ) } ;
const float buffDuration { " Witch.Ability 2.Poison Debuff " _f [ 2 ] } ;
const float buffTimeBetweenTicks { " Witch.Ability 2.Poison Debuff " _f [ 1 ] } ;
monsterPtr - > AddBuff ( BuffType : : COLOR_MOD , buffDuration , Pixel { GREEN } . n ) ;
monsterPtr - > ApplyDot ( buffDuration , buffDamage , buffTimeBetweenTicks ) ;
int poolDamage { damage } ;
if ( additionalBounceCount > 0 ) poolDamage = game - > GetPlayer ( ) - > GetAttack ( ) * " Poison Bounce " _ENC [ " BOUNCE DAMAGE " ] / 100.f ;
const HurtList hurtList { game - > Hurt ( pos , bounceExplodeRadius , poolDamage , OnUpperLevel ( ) , z , HurtType : : MONSTER , HurtFlag : : PLAYER_ABILITY ) } ;
if ( additionalBounceCount = = 0 ) {
for ( const auto & [ targetPtr , wasHit ] : hurtList ) {
if ( wasHit ) {
Monster * monsterPtr { std : : get < Monster * > ( targetPtr ) } ;
const int buffDamage { int ( game - > GetPlayer ( ) - > GetAttack ( ) * " Witch.Ability 2.Poison Debuff " _f [ 0 ] ) } ;
const float buffDuration { " Witch.Ability 2.Poison Debuff " _f [ 2 ] } ;
const float buffTimeBetweenTicks { " Witch.Ability 2.Poison Debuff " _f [ 1 ] } ;
monsterPtr - > AddBuff ( BuffType : : COLOR_MOD , buffDuration , Pixel { GREEN } . n ) ;
monsterPtr - > ApplyDot ( buffDuration , buffDamage , buffTimeBetweenTicks ) ;
}
}
}
vel = { } ;
fadeOutTime = 0.25f ;
Deactivate ( ) ;
if ( additionalBounceCount > 0 ) {
additionalBounceCount - - ;
risingTime = originalRisingTime ;
fallingTime = originalFallingTime ;
} else {
vel = { } ;
fadeOutTime = 0.25f ;
Deactivate ( ) ;
}
} else {
if ( risingTime > 0.f ) {
risingTime - = fElapsedTime ;