diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
index 65b81d7e..2f4fa101 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj
@@ -564,6 +564,10 @@
+
+
+
+
diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
index 86bc0026..a8465a61 100644
--- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
+++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters
@@ -716,6 +716,9 @@
Source Files\Bullet Types
+
+ Source Files\Monster Strategies
+
diff --git a/Adventures in Lestoria/Frog.cpp b/Adventures in Lestoria/Frog.cpp
new file mode 100644
index 00000000..009e9e2c
--- /dev/null
+++ b/Adventures in Lestoria/Frog.cpp
@@ -0,0 +1,97 @@
+#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 © 2023 The FreeType
+Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
+All rights reserved.
+*/
+#pragma endregion
+
+#include "Monster.h"
+#include "AdventuresInLestoria.h"
+#include "MonsterStrategyHelpers.h"
+#include "util.h"
+
+INCLUDE_game
+
+using A=Attribute;
+
+void Monster::STRATEGY::FROG(Monster&m,float fElapsedTime,std::string strategy){
+ phase:
+ switch(m.I(A::PHASE)){
+ case 0:{ //Move towards phase.
+ float distToPlayer=geom2d::line(m.GetPos(),game->GetPlayer()->GetPos()).length();
+ if(distToPlayer<24*ConfigInt("Range")/100.f){
+ m.I(A::PHASE)++;
+ m.F(A::LOCKON_WAITTIME)=ConfigFloat("Lockon Wait Time");
+ m.V(A::LOCKON_POS)=game->GetPlayer()->GetPos();
+ float dirToPlayer=util::angleTo(m.GetPos(),m.V(A::LOCKON_POS));
+ if(abs(dirToPlayer)<0.5f*PI){ //This sprite is supposed to be facing right (flipped)
+ m.facingDirection=RIGHT;
+ m.spriteRot=dirToPlayer;
+ }else{
+ m.facingDirection=LEFT;
+ if(dirToPlayer>0){
+ m.spriteRot=-PI+dirToPlayer;
+ }else{
+ m.spriteRot=PI+dirToPlayer;
+ }
+ }
+ goto phase;
+ }
+ float dirToPlayer=util::angleTo(m.GetPos(),m.target);
+ if(abs(dirToPlayer)<0.5f*PI){ //This sprite is supposed to be facing right (flipped)
+ m.facingDirection=RIGHT;
+ m.spriteRot=dirToPlayer;
+ }else{
+ m.facingDirection=LEFT;
+ if(dirToPlayer>0){
+ m.spriteRot=-PI+dirToPlayer;
+ }else{
+ m.spriteRot=PI+dirToPlayer;
+ }
+ }
+ RUN_TOWARDS(m,fElapsedTime,"Run Towards");
+ m.PerformJumpAnimation();
+ }break;
+ case 1:{
+ m.F(A::LOCKON_WAITTIME)=std::max(0.0f,m.F(A::LOCKON_WAITTIME)-fElapsedTime);
+ if(m.F(A::LOCKON_WAITTIME)==0.0f){
+ m.I(A::PHASE)=0;
+ }
+ m.PerformIdleAnimation();
+ }break;
+ default:{
+ ERR(std::format("Unhandled phase {} for {} strategy!",m.I(A::PHASE),strategy));
+ }
+ }
+}
\ No newline at end of file
diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp
index fbaf0987..068bcad2 100644
--- a/Adventures in Lestoria/Monster.cpp
+++ b/Adventures in Lestoria/Monster.cpp
@@ -264,7 +264,7 @@ void Monster::Draw(){
vf2d shadowScale=vf2d{8*GetSizeMult()/3.f,1}/std::max(1.f,GetZ()/24);
game->view.DrawDecal(GetPos()-vf2d{3,3}*shadowScale/2+vf2d{0,6*GetSizeMult()},GFX["circle.png"].Decal(),shadowScale,BLACK);
}
- game->view.DrawPartialRotatedDecal(GetPos()-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),0,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,vf2d(GetSizeMult()*(GetFacingDirection()==RIGHT?-1:1),GetSizeMult()),GetBuffs(BuffType::SLOWDOWN).size()>0?Pixel{uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(128+127*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration)))}:WHITE);
+ game->view.DrawPartialRotatedDecal(GetPos()-vf2d{0,GetZ()},GetFrame().GetSourceImage()->Decal(),spriteRot,GetFrame().GetSourceRect().size/2,GetFrame().GetSourceRect().pos,GetFrame().GetSourceRect().size,vf2d(GetSizeMult()*(GetFacingDirection()==RIGHT?-1:1),GetSizeMult()),GetBuffs(BuffType::SLOWDOWN).size()>0?Pixel{uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(255*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration))),uint8_t(128+127*abs(sin(1.4*GetBuffs(BuffType::SLOWDOWN)[0].duration)))}:WHITE);
#pragma region Debug Pathfinding
#ifdef _DEBUG
@@ -506,16 +506,6 @@ void Monster::SetState(State::State newState){
state=newState;
}
-void Monster::InitializeStrategies(){
- STRATEGY_DATA.insert("Run Towards",Monster::STRATEGY::RUN_TOWARDS);
- STRATEGY_DATA.insert("Shoot Afar",Monster::STRATEGY::SHOOT_AFAR);
- STRATEGY_DATA.insert("Turret",Monster::STRATEGY::TURRET);
- STRATEGY_DATA.insert("Slime King",Monster::STRATEGY::SLIMEKING);
- STRATEGY_DATA.insert("Run Away",Monster::STRATEGY::RUN_AWAY);
-
- STRATEGY_DATA.SetInitialized();
-}
-
bool Monster::HasIframes(){
return iframe_timer>0;
}
diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h
index e5a29150..62da87ad 100644
--- a/Adventures in Lestoria/Monster.h
+++ b/Adventures in Lestoria/Monster.h
@@ -202,6 +202,7 @@ private:
Pathfinding::sSpline path;
float pathIndex=0;
float lastHitTimer=0;
+ float spriteRot=0;
std::shared_ptrdamageNumberPtr;
int phase=0;
bool diesNormally=true; //If set to false, the monster death is handled in a special way. Set it to true when it's time to die.
@@ -231,6 +232,7 @@ private:
static void TURRET(Monster&m,float fElapsedTime,std::string strategy);
static void SLIMEKING(Monster&m,float fElapsedTime,std::string strategy);
static void RUN_AWAY(Monster&m,float fElapsedTime,std::string strategy);
+ static void FROG(Monster&m,float fElapsedTime,std::string strategy);
};
};
diff --git a/Adventures in Lestoria/MonsterAttribute.h b/Adventures in Lestoria/MonsterAttribute.h
index cb6a4e88..59d9fc8a 100644
--- a/Adventures in Lestoria/MonsterAttribute.h
+++ b/Adventures in Lestoria/MonsterAttribute.h
@@ -76,4 +76,7 @@ enum class Attribute{
ITEM_QUANTITY,
LAST_INVENTORY_TYPE_OPENED,
NEXT_MENU, //Set to 0 for New Game, Set to 1 for Load Game Menu. This is used for the username checks
+ PHASE,
+ LOCKON_WAITTIME,
+ LOCKON_POS,
};
\ No newline at end of file
diff --git a/Adventures in Lestoria/RUN_STRATEGY.cpp b/Adventures in Lestoria/RUN_STRATEGY.cpp
index 26a088e6..6c8f54aa 100644
--- a/Adventures in Lestoria/RUN_STRATEGY.cpp
+++ b/Adventures in Lestoria/RUN_STRATEGY.cpp
@@ -66,4 +66,15 @@ std::string Monster::STRATEGY::_GetString(Monster&m,std::string param,std::strin
void Monster::STRATEGY::RUN_STRATEGY(Monster&m,float fElapsedTime){
m.GetStrategy()(m,fElapsedTime,m.strategy);
+}
+
+void Monster::InitializeStrategies(){
+ STRATEGY_DATA.insert("Run Towards",Monster::STRATEGY::RUN_TOWARDS);
+ STRATEGY_DATA.insert("Shoot Afar",Monster::STRATEGY::SHOOT_AFAR);
+ STRATEGY_DATA.insert("Turret",Monster::STRATEGY::TURRET);
+ STRATEGY_DATA.insert("Slime King",Monster::STRATEGY::SLIMEKING);
+ STRATEGY_DATA.insert("Run Away",Monster::STRATEGY::RUN_AWAY);
+ STRATEGY_DATA.insert("Frog",Monster::STRATEGY::FROG);
+
+ STRATEGY_DATA.SetInitialized();
}
\ No newline at end of file
diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h
index 619e30c4..060d7958 100644
--- a/Adventures in Lestoria/Version.h
+++ b/Adventures in Lestoria/Version.h
@@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 0
#define VERSION_MINOR 2
#define VERSION_PATCH 1
-#define VERSION_BUILD 5743
+#define VERSION_BUILD 5750
#define stringify(a) stringify_(a)
#define stringify_(a) #a
diff --git a/Adventures in Lestoria/assets/AiL_3_4.png b/Adventures in Lestoria/assets/AiL_3_4.png
new file mode 100644
index 00000000..47b3b949
Binary files /dev/null and b/Adventures in Lestoria/assets/AiL_3_4.png differ
diff --git a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
index 236590f9..639004ad 100644
--- a/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
+++ b/Adventures in Lestoria/assets/Campaigns/1_1_v2.tmx
@@ -1075,7 +1075,7 @@