@ -37,6 +37,7 @@ All rights reserved.
# pragma endregion
# include "BulletTypes.h"
# include "Attributable.h"
GhostSaber : : GhostSaber ( const vf2d pos , const std : : weak_ptr < Monster > target , const float lifetime , const float distFromTarget , const float knockbackAmt , const float initialRot , const float radius , const float expandSpd , const int damage , const bool upperLevel , const float rotSpd , const bool friendly , const Pixel col , const vf2d scale , const float image_angle )
: Bullet ( target . lock ( ) - > GetPos ( ) + vf2d { distFromTarget , initialRot } . cart ( ) , { } , radius , damage , " ghost_dagger.png " , upperLevel , false , INFINITE , false , friendly , col , scale , image_angle ) , attachedMonster ( target ) , rotSpd ( rotSpd ) , distFromTarget ( distFromTarget ) , rot ( initialRot ) , aliveTime ( lifetime ) , knockbackAmt ( knockbackAmt ) , expandSpd ( expandSpd ) { }
@ -64,6 +65,13 @@ void GhostSaber::Update(float fElapsedTime){
BulletDestroyState GhostSaber : : PlayerHit ( Player * player ) {
player - > ApplyIframes ( 0.2f ) ;
player - > Knockback ( vf2d { knockbackAmt , rot } . cart ( ) ) ;
if ( ! attachedMonster . expired ( ) ) {
const int GHOSTSABER_SLASH_PHASEID { 999 } ;
attachedMonster . lock ( ) - > GetInt ( Attribute : : PREVIOUS_PHASE ) = attachedMonster . lock ( ) - > GetPhase ( attachedMonster . lock ( ) - > GetStrategyName ( ) ) ;
attachedMonster . lock ( ) - > SetPhase ( attachedMonster . lock ( ) - > GetStrategyName ( ) , GHOSTSABER_SLASH_PHASEID ) ;
attachedMonster . lock ( ) - > PerformAnimation ( " SLASHING " ) ;
attachedMonster . lock ( ) - > GetFloat ( Attribute : : GHOST_SABER_SLASH_ANIMATION_TIMER ) = attachedMonster . lock ( ) - > GetCurrentAnimation ( ) . GetTotalAnimationDuration ( ) ;
}
return BulletDestroyState : : KEEP_ALIVE ;
}