diff --git a/Adventures in Lestoria/BulletTypes.h b/Adventures in Lestoria/BulletTypes.h index bd7d292e..76830317 100644 --- a/Adventures in Lestoria/BulletTypes.h +++ b/Adventures in Lestoria/BulletTypes.h @@ -120,9 +120,10 @@ struct DaggerStab:public Bullet{ Direction facingDir; float frameDuration; float daggerStabDistance; + float knockbackAmt; DirectionOffsets daggerPositionOffsets; HorizontalFlip horizontalFlip; - DaggerStab(Monster&sourceMonster,float radius,int damage,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const HorizontalFlip horizontalFlip,const DirectionOffsets offsets,bool friendly=false,Pixel col=WHITE); + DaggerStab(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const HorizontalFlip horizontalFlip,const DirectionOffsets offsets,bool friendly=false,Pixel col=WHITE); void Update(float fElapsedTime)override; bool PlayerHit(Player*player)override; bool MonsterHit(Monster&monster)override; diff --git a/Adventures in Lestoria/DaggerStab.cpp b/Adventures in Lestoria/DaggerStab.cpp index f20b47e5..899cf02c 100644 --- a/Adventures in Lestoria/DaggerStab.cpp +++ b/Adventures in Lestoria/DaggerStab.cpp @@ -40,13 +40,14 @@ All rights reserved. #include "SoundEffect.h" #include "AdventuresInLestoria.h" #include "DEFINES.h" +#include "util.h" INCLUDE_game INCLUDE_ANIMATION_DATA -DaggerStab::DaggerStab(Monster&sourceMonster,float radius,int damage,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const HorizontalFlip horizontalFlip,const DirectionOffsets offsets,bool friendly,Pixel col) +DaggerStab::DaggerStab(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerStabDistance,const HorizontalFlip horizontalFlip,const DirectionOffsets offsets,bool friendly,Pixel col) :Bullet(sourceMonster.GetPos(),{},radius,damage,"dagger_stab.png",upperLevel,false,daggerFrameDuration*ANIMATION_DATA["dagger_stab.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col), - sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerStabDistance(daggerStabDistance),facingDir(facingDir),daggerPositionOffsets(offsets),horizontalFlip(horizontalFlip){} + sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerStabDistance(daggerStabDistance),facingDir(facingDir),daggerPositionOffsets(offsets),horizontalFlip(horizontalFlip),knockbackAmt(knockbackAmt){} void DaggerStab::Update(float fElapsedTime){ ANIMATION_DATA["dagger_stab.png"].ChangeFrameDuration(frameDuration); #pragma region Dagger Position Offset @@ -95,10 +96,12 @@ void DaggerStab::Update(float fElapsedTime){ bool DaggerStab::PlayerHit(Player*player){ deactivated=true; game->AddEffect(std::make_unique(pos,0,"lightning_splash_effect.png",upperLevel,player->GetSizeMult()*0.25f,0.25,vf2d{})); + player->Knockback(util::pointTo(sourceMonster.GetPos(),player->GetPos())*knockbackAmt); return false; } bool DaggerStab::MonsterHit(Monster&monster){ deactivated=true; game->AddEffect(std::make_unique(pos,0,"lightning_splash_effect.png",upperLevel,monster.GetSizeMult()*0.25f,0.25,vf2d{})); + monster.Knockback(util::pointTo(sourceMonster.GetPos(),monster.GetPos())*knockbackAmt); return false; } \ No newline at end of file diff --git a/Adventures in Lestoria/Goblin_Dagger.cpp b/Adventures in Lestoria/Goblin_Dagger.cpp index fa318aad..67f971c5 100644 --- a/Adventures in Lestoria/Goblin_Dagger.cpp +++ b/Adventures in Lestoria/Goblin_Dagger.cpp @@ -107,7 +107,7 @@ void Monster::STRATEGY::GOBLIN_DAGGER(Monster&m,float fElapsedTime,std::string s case STAB:{ vf2d stabTarget=game->GetPlayer()->GetPos(); SetFacingAnimation(STAB_ANIMATION,stabTarget); - CreateBullet(DaggerStab)(m,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),m.OnUpperLevel(),m.GetFacingDirectionToTarget(stabTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Stab Distance"),IsSpriteFlipped()?DaggerStab::HorizontalFlip::FLIPPED:DaggerStab::HorizontalFlip::NONE, + CreateBullet(DaggerStab)(m,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Stab Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(stabTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Stab Distance"),IsSpriteFlipped()?DaggerStab::HorizontalFlip::FLIPPED:DaggerStab::HorizontalFlip::NONE, DaggerStab::DirectionOffsets{ConfigVec("Dagger Up Offset"),ConfigVec("Dagger Down Offset"),ConfigVec("Dagger Left Offset")})EndBullet; }break; case SLASH:{ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index fd88effa..7f06a2f6 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 2 #define VERSION_PATCH 0 -#define VERSION_BUILD 9033 +#define VERSION_BUILD 9035 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 61c0e7fb..5b142ccb 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -569,10 +569,13 @@ MonsterStrategy # Number of pixels of reach the dagger stab has. Dagger Stab Distance = 2 + Dagger Stab Knockback = 100 + # How long between each dagger stab frame. Dagger Frame Duration = 0.1s # Offset for the dagger stab effect per direction from the monster's center. + # NOTE: Right is missing because left and right get mirrored by the game engine. Dagger Up Offset = 6,-5 Dagger Down Offset = -5,11 Dagger Left Offset = -10,6 diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index d9ff4788..7cf2ed0b 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ