diff --git a/Adventures in Lestoria/Animation.cpp b/Adventures in Lestoria/Animation.cpp index 13efa5cc..4837dfc1 100644 --- a/Adventures in Lestoria/Animation.cpp +++ b/Adventures in Lestoria/Animation.cpp @@ -401,6 +401,7 @@ void sig::Animation::InitializeAnimations(){ CreateHorizontalAnimationSequence("bomb_boom.png",5,{36,36},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::OneShot}}); CreateHorizontalAnimationSequence("tornado2.png",4,{24,48},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}}); CreateHorizontalAnimationSequence("large_tornado.png",4,{72,144},AnimationData{.frameDuration{0.1f},.style{Animate2D::Style::Repeat}}); + CreateHorizontalAnimationSequence("sand_suction.png",4,{72,72},AnimationData{.frameDuration{0.2f},.style{Animate2D::Style::Repeat}}); CreateStillAnimation("meteor.png",{192,192}); diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index 5b571359..97496a73 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -70,7 +70,7 @@ safemap>STRATEGY_DAT std::unordered_mapMonsterData::imgs; Monster::Monster(vf2d pos,MonsterData data,bool upperLevel,bool bossMob): - pos(pos),spawnPos(pos),hp(data.GetHealth()),size(data.GetSizeMult()),targetSize(data.GetSizeMult()),strategy(data.GetAIStrategy()),name(data.GetInternalName()),upperLevel(upperLevel),isBoss(bossMob),facingDirection(Direction::WEST),lifetime(GetTotalLifetime()){ + pos(pos),spawnPos(pos),hp(data.GetHealth()),size(data.GetSizeMult()),targetSize(data.GetSizeMult()),strategy(data.GetAIStrategy()),name(data.GetInternalName()),upperLevel(upperLevel),isBoss(bossMob),facingDirection(Direction::WEST),lifetime(GetTotalLifetime()),collisionRadius(data.GetCollisionRadius()){ for(const std::string&anim:data.GetAnimations()){ animation.AddState(anim,ANIMATION_DATA[std::format("{}_{}",name,anim)]); } @@ -1368,7 +1368,7 @@ const std::optionalMonster::GetTotalLifetime()const{ return MONSTER_DATA.at(GetName()).GetLifetime(); } const float Monster::GetCollisionRadius()const{ - return MONSTER_DATA.at(GetName()).GetCollisionRadius()*GetSizeMult(); + return collisionRadius; } void Monster::MarkForDeletion(){ @@ -1664,4 +1664,10 @@ const int Monster::GetPhase(const std::string&strategyName){ } const bool Monster::HasBuff(BuffType buff)const{ return std::find_if(buffList.begin(),buffList.end(),[type=buff](const Buff&buff){return buff.type==type;})!=buffList.end(); +} +const float Monster::GetOriginalCollisionRadius()const{ + return MONSTER_DATA.at(GetName()).GetCollisionRadius()*GetSizeMult(); +} +void Monster::SetCollisionRadius(const float collisionRadius){ + this->collisionRadius=collisionRadius; } \ No newline at end of file diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index 18f28d28..873bb672 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -234,6 +234,8 @@ public: void MoveForward(const vf2d&moveForwardVec,const float fElapsedTime); //Moves the monster forward in given vector direction (will be auto-normalized) applying speeed boosts and other proper movement requirements as if you wanted to move on a frame-by-frame basis. void SetPhase(const std::string&strategyName,int phase); const int GetPhase(const std::string&strategyName); + const float GetOriginalCollisionRadius()const; + void SetCollisionRadius(const float collisionRadius); 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. @@ -330,6 +332,7 @@ private: const bool IsUnconscious()const; const float UnconsciousTime()const; bool manualIgnoreTerrain{false}; //A manual flag that can be toggled on to dynamically make this monster ignore terrain collision. + float collisionRadius{}; //The collision radius can be modified, it's just set initially to the monster database entry. struct STRATEGY{ static std::string ERR; diff --git a/Adventures in Lestoria/Sandworm.cpp b/Adventures in Lestoria/Sandworm.cpp index eb1a40dd..4d09936f 100644 --- a/Adventures in Lestoria/Sandworm.cpp +++ b/Adventures in Lestoria/Sandworm.cpp @@ -47,5 +47,17 @@ using A=Attribute; INCLUDE_game void Monster::STRATEGY::SANDWORM(Monster&m,float fElapsedTime,std::string strategy){ - + enum PhaseName{ + INITIALIZE, + UNDERGROUND, + }; + + switch(PHASE()){ + case INITIALIZE:{ + SETPHASE(UNDERGROUND); + }break; + case UNDERGROUND:{ + m.SetCollisionRadius(0.f); + }break; + } } \ No newline at end of file diff --git a/Adventures in Lestoria/assets/config/gfx/gfx.txt b/Adventures in Lestoria/assets/config/gfx/gfx.txt index 3f123cb6..5bc8c5c3 100644 --- a/Adventures in Lestoria/assets/config/gfx/gfx.txt +++ b/Adventures in Lestoria/assets/config/gfx/gfx.txt @@ -137,6 +137,7 @@ Images GFX_MusketTrail = musket_trail.png GFX_LineIndicator = line_indicator.png GFX_MusketBullet = musket_bullet.png + GFX_SandSuction = sand_suction.png GFX_Thief_Sheet = nico-thief.png GFX_Trapper_Sheet = nico-trapper.png diff --git a/Adventures in Lestoria/assets/sand_suction.png b/Adventures in Lestoria/assets/sand_suction.png new file mode 100644 index 00000000..d60b3837 Binary files /dev/null and b/Adventures in Lestoria/assets/sand_suction.png differ