@ -265,8 +265,10 @@ bool Monster::Update(float fElapsedTime){
monsterHurtSoundCooldown = std : : max ( 0.f , monsterHurtSoundCooldown - fElapsedTime ) ;
lastHitPlayer = std : : max ( 0.f , lastHitPlayer - fElapsedTime ) ;
lastPathfindingCooldown = std : : max ( 0.f , lastPathfindingCooldown - fElapsedTime ) ;
markApplicationTimer = std : : max ( 0.f , markApplicationTimer - fElapsedTime ) ;
lastFacingDirectionChange + = fElapsedTime ;
timeSpentAlive + = fElapsedTime ;
if ( IsSolid ( ) ) {
if ( GetPos ( ) . y > = game - > GetPlayer ( ) - > GetPos ( ) . y ) solidFadeTimer = std : : min ( TileGroup : : FADE_TIME , solidFadeTimer + game - > GetElapsedTime ( ) ) ;
else solidFadeTimer = std : : max ( 0.f , solidFadeTimer - game - > GetElapsedTime ( ) ) ;
@ -467,8 +469,28 @@ void Monster::Draw()const{
std : : vector < Buff > shieldBuffs = GetBuffs ( BARRIER_DAMAGE_REDUCTION ) ;
if ( shieldBuffs . size ( ) > 0 ) {
game - > view . DrawRotatedDecal ( drawPos , GFX [ " block.png " ] . Decal ( ) , 0.f , GFX [ " block.png " ] . Sprite ( ) - > Size ( ) / 2 , { GetSizeMult ( ) , GetSizeMult ( ) } ) ;
game - > view . DrawRotatedDecal ( drawPos , GFX [ " block.png " ] . Decal ( ) , 0.f , GFX [ " block.png " ] . Sprite ( ) - > Size ( ) / 2 , { GetSizeMult ( ) , GetSizeMult ( ) } , blendCol ) ;
}
# pragma region Render Trapper Marked Targets
const uint8_t markStackCount { GetMarkStacks ( ) } ;
if ( markStackCount > 0 ) {
float markRotation { - util : : lerp ( 0.f , 10.f , markApplicationTimer / 0.5f ) * sin ( PI * markApplicationTimer ) } ;
vf2d markScale { vf2d { } . lerp ( vf2d { GetSizeMult ( ) , GetSizeMult ( ) } , ( 0.5f - markApplicationTimer ) / 0.5f ) } ;
const Animate2D : : Frame & markImg { ANIMATION_DATA [ " target.png " ] . GetFrame ( game - > GetRunTime ( ) ) } ;
Pixel markCol { markStackCount > 1 ? WHITE : RED } ;
const std : : vector < Buff > & buffList { GetBuffs ( BuffType : : TRAPPER_MARK ) } ;
float remainingStackDuration { } ;
for ( const Buff & b : buffList ) {
if ( b . type = = BuffType : : TRAPPER_MARK ) {
remainingStackDuration = b . duration ;
break ;
}
}
if ( remainingStackDuration < 1.f ) markCol . a * = remainingStackDuration ;
game - > view . DrawPartialRotatedDecal ( drawPos , markImg . GetSourceImage ( ) - > Decal ( ) , markRotation , markImg . GetSourceRect ( ) . size / 2.f , markImg . GetSourceRect ( ) . pos , markImg . GetSourceRect ( ) . size , markScale , markCol ) ;
}
# pragma endregion
if ( GameSettings : : TerrainCollisionBoxesEnabled ( ) & & IsSolid ( ) & & solidFadeTimer > 0.f ) {
float distToPlayer = geom2d : : line < float > ( game - > GetPlayer ( ) - > GetPos ( ) , GetPos ( ) ) . length ( ) ;
@ -1201,7 +1223,7 @@ const std::optional<geom2d::rect<float>>&Monster::GetRectangleCollision()const{
return MONSTER_DATA . at ( GetName ( ) ) . GetRectangleCollision ( ) ;
}
const int Monster : : GetMarkStacks ( ) const {
const u int8_ t Monster : : GetMarkStacks ( ) const {
const std : : vector < Buff > & markBuffs { GetBuffs ( BuffType : : TRAPPER_MARK ) } ;
int stackCount { } ;
for ( const Buff & b : markBuffs ) {
@ -1212,14 +1234,30 @@ const int Monster::GetMarkStacks()const{
void Monster : : RemoveMarkStack ( ) {
if ( GetMarkStacks ( ) < = 0 ) ERR ( " WARNING! Tried to remove a mark stack, but no stacks exist. THIS SHOULD NOT BE HAPPENING! " ) ;
bool removeMarkDebuff { false } ;
for ( Buff & b : buffList ) {
if ( b . type = = BuffType : : TRAPPER_MARK & & b . intensity > 0 ) {
b . intensity - - ;
if ( b . intensity = = 0 ) removeMarkDebuff = true ;
break ;
}
}
if ( removeMarkDebuff ) RemoveBuff ( BuffType : : TRAPPER_MARK ) ;
}
void Monster : : TriggerMark ( ) {
Hurt ( 0 , OnUpperLevel ( ) , GetZ ( ) , HurtFlag : : PLAYER_ABILITY ) ;
}
void Monster : : ApplyMark ( float time , uint8_t stackCount ) {
if ( GetMarkStacks ( ) > 0 ) {
for ( Buff & b : buffList ) {
if ( b . type = = BuffType : : TRAPPER_MARK ) {
b . intensity + = stackCount ;
b . duration = std : : max ( b . duration , time ) ;
break ;
}
}
} else AddBuff ( BuffType : : TRAPPER_MARK , time , stackCount ) ;
markApplicationTimer = 0.5f ;
}