diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
index d367d789..98950e71 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
@@ -658,6 +658,10 @@
+
+
+
+
diff --git a/Adventures in Lestoria/Animation.cpp b/Adventures in Lestoria/Animation.cpp
index 1c036e3f..106ebbe3 100644
--- a/Adventures in Lestoria/Animation.cpp
+++ b/Adventures in Lestoria/Animation.cpp
@@ -235,6 +235,7 @@ void sig::Animation::InitializeAnimations(){
CreateHorizontalAnimationSequence("lightning_splash_effect.png",5,{24,24});
CreateHorizontalAnimationSequence("dagger_stab.png",2,{24,24},AnimationData{0.1f,Animate2D::Style::PingPong});
+ CreateHorizontalAnimationSequence("goblin_sword_slash.png",3,{24,24},{0.05f,Animate2D::Style::OneShot});
CreateStillAnimation("meteor.png",{192,192});
diff --git a/Adventures in Lestoria/BulletTypes.h b/Adventures in Lestoria/BulletTypes.h
index 76830317..d41436d0 100644
--- a/Adventures in Lestoria/BulletTypes.h
+++ b/Adventures in Lestoria/BulletTypes.h
@@ -101,6 +101,11 @@ struct Wisp:public Bullet{
bool MonsterHit(Monster&monster)override;
};
+enum class HorizontalFlip{
+ NONE,
+ FLIPPED,
+};
+
struct DaggerStab:public Bullet{
struct DirectionOffsets{
std::unordered_mapoffsets;
@@ -111,11 +116,6 @@ struct DaggerStab:public Bullet{
}
};
- enum class HorizontalFlip{
- NONE,
- FLIPPED,
- };
-
Monster&sourceMonster;
Direction facingDir;
float frameDuration;
@@ -127,4 +127,18 @@ struct DaggerStab:public Bullet{
void Update(float fElapsedTime)override;
bool PlayerHit(Player*player)override;
bool MonsterHit(Monster&monster)override;
+};
+
+struct DaggerSlash:public Bullet{
+
+ Monster&sourceMonster;
+ Direction facingDir;
+ float frameDuration;
+ float daggerSlashDistance;
+ float knockbackAmt;
+ HorizontalFlip horizontalFlip;
+ DaggerSlash(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,const HorizontalFlip horizontalFlip,bool friendly=false,Pixel col=WHITE);
+ void Update(float fElapsedTime)override;
+ bool PlayerHit(Player*player)override;
+ bool MonsterHit(Monster&monster)override;
};
\ No newline at end of file
diff --git a/Adventures in Lestoria/DaggerSlash.cpp b/Adventures in Lestoria/DaggerSlash.cpp
new file mode 100644
index 00000000..695a101b
--- /dev/null
+++ b/Adventures in Lestoria/DaggerSlash.cpp
@@ -0,0 +1,100 @@
+#pragma region License
+/*
+License (OLC-3)
+~~~~~~~~~~~~~~~
+
+Copyright 2024 Joshua Sigona
+
+Redistribution and use in source and binary forms, with or without modification,
+are permitted provided that the following conditions are met:
+
+1. Redistributions or derivations of source code must retain the above copyright
+notice, this list of conditions and the following disclaimer.
+
+2. Redistributions or derivative works in binary form must reproduce the above
+copyright notice. This list of conditions and the following disclaimer must be
+reproduced in the documentation and/or other materials provided with the distribution.
+
+3. Neither the name of the copyright holder nor the names of its contributors may
+be used to endorse or promote products derived from this software without specific
+prior written permission.
+
+THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY
+EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
+OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT
+SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
+INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
+TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR
+BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
+CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
+ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
+SUCH DAMAGE.
+
+Portions of this software are copyright © 2024 The FreeType
+Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
+All rights reserved.
+*/
+#pragma endregion
+
+#include "BulletTypes.h"
+#include "SoundEffect.h"
+#include "AdventuresInLestoria.h"
+#include "DEFINES.h"
+#include "util.h"
+
+INCLUDE_game
+INCLUDE_ANIMATION_DATA
+
+DaggerSlash::DaggerSlash(Monster&sourceMonster,float radius,int damage,const float knockbackAmt,bool upperLevel,const Direction facingDir,const float daggerFrameDuration,const float daggerSlashDistance,const HorizontalFlip horizontalFlip,bool friendly,Pixel col)
+ :Bullet(sourceMonster.GetPos(),{},radius,damage,"goblin_sword_slash.png",upperLevel,false,daggerFrameDuration*ANIMATION_DATA["goblin_sword_slash.png"].GetFrameCountBasedOnAnimationStyle(),true,friendly,col),
+ sourceMonster(sourceMonster),frameDuration(daggerFrameDuration),daggerSlashDistance(daggerSlashDistance),facingDir(facingDir),horizontalFlip(horizontalFlip),knockbackAmt(knockbackAmt){}
+void DaggerSlash::Update(float fElapsedTime){
+ ANIMATION_DATA["goblin_sword_slash.png"].ChangeFrameDuration(frameDuration);
+ pos=sourceMonster.GetPos();
+ #pragma region Dagger slash offset
+ switch(facingDir){
+ case Direction::NORTH:{
+ pos+=vf2d{0,-daggerSlashDistance};
+ }break;
+ case Direction::EAST:{
+ pos+=vf2d{daggerSlashDistance,0};
+ }break;
+ case Direction::SOUTH:{
+ pos+=vf2d{0,daggerSlashDistance};
+ }break;
+ case Direction::WEST:{
+ pos+=vf2d{-daggerSlashDistance,0};
+ }break;
+ default:ERR(std::format("WARNING! Unknown direction value {} was supplied! THIS SHOULD NOT BE HAPPENING!",int(facingDir)));
+ }
+ #pragma endregion
+ #pragma region Dagger rotation handling
+ switch(facingDir){
+ case Direction::NORTH:{
+ vel={0,-0.001f};
+ }break;
+ case Direction::EAST:{
+ vel={0.001f,0};
+ }break;
+ case Direction::SOUTH:{
+ vel={0,0.001f};
+ }break;
+ case Direction::WEST:{
+ vel={-0.001f,0};
+ }break;
+ default:ERR(std::format("WARNING! Unknown direction value {} was supplied! THIS SHOULD NOT BE HAPPENING!",int(facingDir)));
+ }
+ #pragma endregion
+}
+bool DaggerSlash::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 DaggerSlash::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 67f971c5..613930d2 100644
--- a/Adventures in Lestoria/Goblin_Dagger.cpp
+++ b/Adventures in Lestoria/Goblin_Dagger.cpp
@@ -40,6 +40,7 @@ All rights reserved.
#include "Monster.h"
#include "MonsterStrategyHelpers.h"
#include "BulletTypes.h"
+#include "util.h"
/*
Attack Strategie:
Runs infront of player,
@@ -86,13 +87,14 @@ void Monster::STRATEGY::GOBLIN_DAGGER(Monster&m,float fElapsedTime,std::string s
RUN_TOWARDS(m,fElapsedTime,"Run Towards");
}else{
m.phase=WINDUP;
- m.I(A::ATTACK_TYPE)=STAB; //TODO: Choose randomly between stab or slash.
- m.F(A::CASTING_TIMER)=ConfigFloat("Stab Windup Time");
+ m.I(A::ATTACK_TYPE)=util::random()%2; //Choose randomly between stab or slash.
switch(m.I(A::ATTACK_TYPE)){
case STAB:{
+ m.F(A::CASTING_TIMER)=ConfigFloat("Stab Windup Time");
SetFacingAnimation(STAB_WINDUP_ANIMATION,game->GetPlayer()->GetPos());
}break;
case SLASH:{
+ m.F(A::CASTING_TIMER)=ConfigFloat("Slash Windup Time");
SetFacingAnimation(SLASH_WINDUP_ANIMATION,game->GetPlayer()->GetPos());
}break;
default:ERR(std::format("WARNING! Invalid Attack type {} provided. THIS SHOULD NOT BE HAPPENING!",m.I(A::ATTACK_TYPE)));
@@ -107,11 +109,13 @@ 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(),ConfigFloat("Dagger Stab Knockback"),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()?HorizontalFlip::FLIPPED:HorizontalFlip::NONE,
DaggerStab::DirectionOffsets{ConfigVec("Dagger Up Offset"),ConfigVec("Dagger Down Offset"),ConfigVec("Dagger Left Offset")})EndBullet;
}break;
case SLASH:{
- SetFacingAnimation(SLASH_ANIMATION,game->GetPlayer()->GetPos());
+ vf2d slashTarget=game->GetPlayer()->GetPos();
+ SetFacingAnimation(SLASH_ANIMATION,slashTarget);
+ CreateBullet(DaggerSlash)(m,ConfigFloat("Dagger Hit Radius"),m.GetAttack(),ConfigFloat("Dagger Slash Knockback"),m.OnUpperLevel(),m.GetFacingDirectionToTarget(slashTarget),ConfigFloat("Dagger Frame Duration"),ConfigFloat("Dagger Slash Distance"),IsSpriteFlipped()?HorizontalFlip::FLIPPED:HorizontalFlip::NONE)EndBullet;
}break;
default:ERR(std::format("WARNING! Invalid Attack type {} provided. THIS SHOULD NOT BE HAPPENING!",m.I(A::ATTACK_TYPE)));
}
diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h
index 7f06a2f6..7245147d 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 9035
+#define VERSION_BUILD 9037
#define stringify(a) stringify_(a)
#define stringify_(a) #a
diff --git a/Adventures in Lestoria/assets/Campaigns/2_1.tmx b/Adventures in Lestoria/assets/Campaigns/2_1.tmx
index 7cf5f3ac..979840e6 100644
--- a/Adventures in Lestoria/assets/Campaigns/2_1.tmx
+++ b/Adventures in Lestoria/assets/Campaigns/2_1.tmx
@@ -1,5 +1,5 @@
-