diff --git a/Adventures in Lestoria/GhostOfPirateCaptain.cpp b/Adventures in Lestoria/GhostOfPirateCaptain.cpp index 0cb8cdb6..1bd134b1 100644 --- a/Adventures in Lestoria/GhostOfPirateCaptain.cpp +++ b/Adventures in Lestoria/GhostOfPirateCaptain.cpp @@ -53,6 +53,7 @@ void Monster::STRATEGY::GHOST_OF_PIRATE_CAPTAIN(Monster&m,float fElapsedTime,std INIT, NORMAL, AFTERIMAGE_FADEIN, + GHOSTSABER_SLASH=999, }; enum CannonShotType{ @@ -187,5 +188,12 @@ void Monster::STRATEGY::GHOST_OF_PIRATE_CAPTAIN(Monster&m,float fElapsedTime,std m.SetCollisionRadius(m.GetOriginalCollisionRadius()); } }break; + case GHOSTSABER_SLASH:{ //This was triggered by GhostSaber when + m.F(A::GHOST_SABER_SLASH_ANIMATION_TIMER)-=fElapsedTime; + if(m.F(A::GHOST_SABER_SLASH_ANIMATION_TIMER)<=0.f){ + m.PerformIdleAnimation(); + SETPHASE(m.I(A::PREVIOUS_PHASE)); + } + }break; } } \ No newline at end of file diff --git a/Adventures in Lestoria/GhostSaber.cpp b/Adventures in Lestoria/GhostSaber.cpp index b7917f70..86d0087b 100644 --- a/Adventures in Lestoria/GhostSaber.cpp +++ b/Adventures in Lestoria/GhostSaber.cpp @@ -37,6 +37,7 @@ All rights reserved. #pragma endregion #include "BulletTypes.h" +#include "Attributable.h" GhostSaber::GhostSaber(const vf2d pos,const std::weak_ptrtarget,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; } diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 98b726b0..5f67e2f2 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -1712,4 +1712,8 @@ void Monster::SetupAfterImage(){ afterImage.Decal()->Update(); removeLineTimer=TIME_BETWEEN_LINE_REMOVALS; scanLine=1U; +} + +const std::string&Monster::GetStrategyName()const{ + return strategy; } \ No newline at end of file diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index 702fe628..1c240b86 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -75,7 +75,7 @@ public: DeathSpawnInfo(const std::string_view monsterName,const uint8_t spawnAmt,const vf2d spawnOffset={}); void Spawn(const vf2d monsterDeathPos,const bool onUpperLevel); }; -class Monster:IAttributable{ +class Monster:public IAttributable{ friend struct STRATEGY; friend class AiL; friend class InventoryCreator; @@ -238,6 +238,7 @@ public: const int GetPhase(const std::string&strategyName); const float GetOriginalCollisionRadius()const; void SetCollisionRadius(const float collisionRadius); + const std::string&GetStrategyName()const; private: //NOTE: Marking a monster for deletion does not trigger any death events. It just simply removes the monster from the field!! // The way this works is that monsters marked for deletion will cause the monster update loop to detect there's at least one or more monsters that must be deleted and will call erase_if on the list at the end of the iteration loop. diff --git a/Adventures in Lestoria/MonsterAttribute.h b/Adventures in Lestoria/MonsterAttribute.h index 34d3d26d..acb4aa79 100644 --- a/Adventures in Lestoria/MonsterAttribute.h +++ b/Adventures in Lestoria/MonsterAttribute.h @@ -174,4 +174,5 @@ enum class Attribute{ LAST_PLAYER_POS, FIRST_WAVE_COMPLETE, GHOST_SABER_TIMER, + GHOST_SABER_SLASH_ANIMATION_TIMER, }; \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 733a395b..fcc7c031 100644 --- a/Adventures in Lestoria/Version.h +++ b/Adventures in Lestoria/Version.h @@ -39,7 +39,7 @@ All rights reserved. #define VERSION_MAJOR 1 #define VERSION_MINOR 3 #define VERSION_PATCH 0 -#define VERSION_BUILD 12032 +#define VERSION_BUILD 12036 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 31ec5e98..e2d404a2 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ