@ -436,7 +436,14 @@ void Monster::UpdateFacingDirection(vf2d facingTargetPoint){
}
void Monster : : Draw ( ) const {
if ( markedForDeletion ) return ;
Pixel blendCol = GetBuffs ( BuffType : : SLOWDOWN ) . size ( ) > 0 ? Pixel { uint8_t ( 255 * abs ( sin ( 1.4 * GetBuffs ( BuffType : : SLOWDOWN ) [ 0 ] . duration ) ) ) , uint8_t ( 255 * abs ( sin ( 1.4 * GetBuffs ( BuffType : : SLOWDOWN ) [ 0 ] . duration ) ) ) , uint8_t ( 128 + 127 * abs ( sin ( 1.4 * GetBuffs ( BuffType : : SLOWDOWN ) [ 0 ] . duration ) ) ) } : WHITE ;
Pixel blendCol { WHITE } ;
std : : optional < std : : reference_wrapper < Buff > > glowPurpleBuff ;
if ( GetBuffs ( BuffType : : GLOW_PURPLE ) . size ( ) > 0 ) glowPurpleBuff = GetBuffs ( BuffType : : GLOW_PURPLE ) [ 0 ] ;
if ( GetBuffs ( BuffType : : SLOWDOWN ) . size ( ) > 0 ) blendCol = Pixel { uint8_t ( 255 * abs ( sin ( 1.4 * GetBuffs ( BuffType : : SLOWDOWN ) [ 0 ] . duration ) ) ) , uint8_t ( 255 * abs ( sin ( 1.4 * GetBuffs ( BuffType : : SLOWDOWN ) [ 0 ] . duration ) ) ) , uint8_t ( 128 + 127 * abs ( sin ( 1.4 * GetBuffs ( BuffType : : SLOWDOWN ) [ 0 ] . duration ) ) ) } ;
else if ( glowPurpleBuff . has_value ( ) ) blendCol = Pixel { uint8_t ( 255 * abs ( sin ( 1.4 * glowPurpleBuff . value ( ) . get ( ) . duration ) ) ) , uint8_t ( 255 * abs ( sin ( 1.4 * glowPurpleBuff . value ( ) . get ( ) . duration ) ) ) , uint8_t ( 128 + 127 * abs ( sin ( 1.4 * glowPurpleBuff . value ( ) . get ( ) . duration ) ) ) } ;
const vf2d hitTimerOffset = vf2d { sin ( 20 * PI * lastHitTimer + randomFrameOffset ) , 0.f } * 2.f * GetSizeMult ( ) ;
const vf2d zOffset = - vf2d { 0 , GetZ ( ) } ;
@ -462,11 +469,19 @@ void Monster::Draw()const{
const float finalSpriteRot = HasFourWaySprites ( ) ? 0.f : spriteRot ; //Prevent 4-way sprites from being rotated.
game - > view . DrawPartialRotatedDecal ( drawPos , GetFrame ( ) . GetSourceImage ( ) - > Decal ( ) , finalSpriteRot , GetFrame ( ) . GetSourceRect ( ) . size / 2 , GetFrame ( ) . GetSourceRect ( ) . pos , GetFrame ( ) . GetSourceRect ( ) . size , vf2d ( GetSizeMult ( ) * ( ! HasFourWaySprites ( ) & & GetFacingDirection ( ) = = Direction : : EAST ? - 1 : 1 ) , GetSizeMult ( ) ) , blendCol ) ;
const vf2d imageScale { vf2d ( GetSizeMult ( ) * ( ! HasFourWaySprites ( ) & & GetFacingDirection ( ) = = Direction : : EAST ? - 1 : 1 ) , GetSizeMult ( ) ) } ;
const vf2d glowPurpleImageScale { imageScale * 1.1f } ;
if ( glowPurpleBuff . has_value ( ) ) game - > view . DrawPartialRotatedDecal ( drawPos , GetFrame ( ) . GetSourceImage ( ) - > Decal ( ) , finalSpriteRot , GetFrame ( ) . GetSourceRect ( ) . size / 2 , GetFrame ( ) . GetSourceRect ( ) . pos , GetFrame ( ) . GetSourceRect ( ) . size , glowPurpleImageScale , { 43 , 0 , 66 , blendCol . a } ) ;
game - > view . DrawPartialRotatedDecal ( drawPos , GetFrame ( ) . GetSourceImage ( ) - > Decal ( ) , finalSpriteRot , GetFrame ( ) . GetSourceRect ( ) . size / 2 , GetFrame ( ) . GetSourceRect ( ) . pos , GetFrame ( ) . GetSourceRect ( ) . size , imageScale , blendCol ) ;
if ( overlaySprite . length ( ) ! = 0 ) {
game - > view . DrawPartialRotatedDecal ( drawPos , GFX [ overlaySprite ] . Decal ( ) , finalSpriteRot , GetFrame ( ) . GetSourceRect ( ) . size / 2 , GetFrame ( ) . GetSourceRect ( ) . pos , GetFrame ( ) . GetSourceRect ( ) . size , vf2d ( GetSizeMult ( ) * ( ! HasFourWaySprites ( ) & & GetFacingDirection ( ) = = Direction : : EAST ? - 1 : 1 ) , GetSizeMult ( ) ) , { blendCol . r , blendCol . g , blendCol . b , overlaySpriteTransparency } ) ;
if ( glowPurpleBuff . has_value ( ) ) game - > view . DrawPartialRotatedDecal ( drawPos , GFX [ overlaySprite ] . Decal ( ) , finalSpriteRot , GetFrame ( ) . GetSourceRect ( ) . size / 2 , GetFrame ( ) . GetSourceRect ( ) . pos , GetFrame ( ) . GetSourceRect ( ) . size , glowPurpleImageScale , { 43 , 0 , 66 , overlaySpriteTransparency } ) ;
game - > view . DrawPartialRotatedDecal ( drawPos , GFX [ overlaySprite ] . Decal ( ) , finalSpriteRot , GetFrame ( ) . GetSourceRect ( ) . size / 2 , GetFrame ( ) . GetSourceRect ( ) . pos , GetFrame ( ) . GetSourceRect ( ) . size , imageScale , { blendCol . r , blendCol . g , blendCol . b , overlaySpriteTransparency } ) ;
}
if ( HasMountedMonster ( ) ) {
if ( glowPurpleBuff . has_value ( ) ) game - > view . DrawPartialRotatedDecal ( drawPos + mountedSprOffset , GetMountedFrame ( ) . value ( ) . GetSourceImage ( ) - > Decal ( ) , finalSpriteRot , GetMountedFrame ( ) . value ( ) . GetSourceRect ( ) . size / 2 , GetMountedFrame ( ) . value ( ) . GetSourceRect ( ) . pos , GetMountedFrame ( ) . value ( ) . GetSourceRect ( ) . size , glowPurpleImageScale , { 43 , 0 , 66 , blendCol . a } ) ;
game - > view . DrawPartialRotatedDecal ( drawPos + mountedSprOffset , GetMountedFrame ( ) . value ( ) . GetSourceImage ( ) - > Decal ( ) , finalSpriteRot , GetMountedFrame ( ) . value ( ) . GetSourceRect ( ) . size / 2 , GetMountedFrame ( ) . value ( ) . GetSourceRect ( ) . pos , GetMountedFrame ( ) . value ( ) . GetSourceRect ( ) . size , imageScale , blendCol ) ;
}
if ( HasMountedMonster ( ) ) game - > view . DrawPartialRotatedDecal ( drawPos + mountedSprOffset , GetMountedFrame ( ) . value ( ) . GetSourceImage ( ) - > Decal ( ) , finalSpriteRot , GetMountedFrame ( ) . value ( ) . GetSourceRect ( ) . size / 2 , GetMountedFrame ( ) . value ( ) . GetSourceRect ( ) . pos , GetMountedFrame ( ) . value ( ) . GetSourceRect ( ) . size , vf2d ( GetSizeMult ( ) * ( ! HasFourWaySprites ( ) & & GetFacingDirection ( ) = = Direction : : EAST ? - 1 : 1 ) , GetSizeMult ( ) ) , blendCol ) ;
std : : vector < Buff > shieldBuffs = GetBuffs ( BARRIER_DAMAGE_REDUCTION ) ;
if ( shieldBuffs . size ( ) > 0 ) {
@ -1307,6 +1322,10 @@ void Monster::AddBuff(BuffRestorationType type,BuffOverTimeType::BuffOverTimeTyp
buffList . push_back ( Buff { GetWeakPointer ( ) , type , overTimeType , duration , intensity , timeBetweenTicks } ) ;
}
void Monster : : AddBuff ( BuffRestorationType type , BuffOverTimeType : : BuffOverTimeType overTimeType , float duration , float intensity , float timeBetweenTicks , Buff : : MonsterBuffExpireCallbackFunction expireCallback ) {
buffList . push_back ( Buff { GetWeakPointer ( ) , type , overTimeType , duration , intensity , timeBetweenTicks , expireCallback } ) ;
}
const bool Monster : : CanMove ( ) const {
return knockUpTimer = = 0.f & & IsAlive ( ) ;
}
@ -1315,8 +1334,8 @@ const std::weak_ptr<Monster>Monster::GetWeakPointer()const{
return weakPtr ;
}
void Monster : : ApplyDot ( float duration , int damage , float timeBetweenTicks ) {
AddBuff ( BuffRestorationType : : OVER_TIME , BuffOverTimeType : : HP_DAMAGE_OVER_TIME , duration , damage , timeBetweenTicks ) ;
void Monster : : ApplyDot ( float duration , int damage , float timeBetweenTicks , Buff : : MonsterBuffExpireCallbackFunction expireCallbackFunc ) {
AddBuff ( BuffRestorationType : : OVER_TIME , BuffOverTimeType : : HP_DAMAGE_OVER_TIME , duration , damage , timeBetweenTicks , expireCallbackFunc ) ;
}
void Monster : : SetWeakPointer ( std : : shared_ptr < Monster > & sharedMonsterPtr ) {