Stone pillars now use a separate rectangular collision to determine hiding zones, preventing the player from hiding along the outer edges of the pillar. Release Build 9948.

mac-build
sigonasr2 5 months ago
parent b4fa870236
commit 717f4551ea
  1. 4
      Adventures in Lestoria/Monster.cpp
  2. 2
      Adventures in Lestoria/Monster.h
  3. 9
      Adventures in Lestoria/MonsterData.cpp
  4. 2
      Adventures in Lestoria/MonsterData.h
  5. 9
      Adventures in Lestoria/StoneGolem.cpp
  6. 2
      Adventures in Lestoria/Version.h
  7. 4
      Adventures in Lestoria/assets/config/Monsters.txt

@ -1168,4 +1168,8 @@ const float Monster::GetModdedStatBonuses(std::string_view stat)const{
}
}
return flatBonuses+flatBonuses*pctBonusSum/100.f;
}
const std::optional<geom2d::rect<float>>&Monster::GetRectangleCollision()const{
return MONSTER_DATA.at(GetName()).GetRectangleCollision();
}

@ -198,6 +198,8 @@ public:
void _DealTrueDamage(const uint32_t damageAmt);
void Heal(const int healAmt);
const float GetModdedStatBonuses(std::string_view stat)const;
//The collision rectangle is only used currently for determining the safe spots for the stone golem boss fight.
const std::optional<geom2d::rect<float>>&GetRectangleCollision()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.

@ -189,6 +189,11 @@ void MonsterData::InitializeMonsterData(){
if(DATA["Monsters"][MonsterName].HasProperty("Collision Radius"))monster.collisionRadius=DATA["Monsters"][MonsterName]["Collision Radius"].GetReal();
if(DATA["Monsters"][MonsterName].HasProperty("ShowBossIndicator"))monster.hasArrowIndicator=DATA["Monsters"][MonsterName]["ShowBossIndicator"].GetBool();
if(DATA["Monsters"][MonsterName].HasProperty("Rectangle Collision")){
const datafile&rectData{DATA["Monsters"][MonsterName]["Rectangle Collision"]};
monster.rectCollision={{rectData.GetReal(0),rectData.GetReal(1)},{rectData.GetReal(2),rectData.GetReal(3)}};
}
if(hasFourWaySpriteSheet)monster.SetUsesFourWaySprites();
for(size_t animationRow=0;const std::string&animationName:animations){
@ -444,4 +449,8 @@ const float MonsterData::GetCollisionRadius()const{
}
const bool MonsterData::HasArrowIndicator()const{
return hasArrowIndicator;
}
const std::optional<geom2d::rect<float>>&MonsterData::GetRectangleCollision()const{
return rectCollision;
}

@ -105,6 +105,7 @@ public:
//If an object has a collision radius, returns it.
const float GetCollisionRadius()const;
const bool HasArrowIndicator()const;
const std::optional<geom2d::rect<float>>&GetRectangleCollision()const;
private:
std::string name;
int hp;
@ -134,4 +135,5 @@ private:
std::optional<float>lifetime{};
float collisionRadius{};
bool hasArrowIndicator{false};
std::optional<geom2d::rect<float>>rectCollision;
};

@ -71,10 +71,11 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
#pragma region Solve for Safe Quad
//First draw 4 lines to the corners.
const vf2d upperLeftCorner{pillar.GetPos()+vf2d{-8,-8}*pillar.GetSizeMult()};
const vf2d upperRightCorner{pillar.GetPos()+vf2d{8,-8}*pillar.GetSizeMult()};
const vf2d lowerLeftCorner{pillar.GetPos()+vf2d{-8,8}*pillar.GetSizeMult()};
const vf2d lowerRightCorner{pillar.GetPos()+vf2d{8,8}*pillar.GetSizeMult()};
const geom2d::rect<float>&collisionRect{pillar.GetRectangleCollision().value()};
const vf2d upperLeftCorner{pillar.GetPos()+collisionRect.pos*pillar.GetSizeMult()};
const vf2d upperRightCorner{pillar.GetPos()+(collisionRect.pos+vf2d{collisionRect.size.x,0.f})*pillar.GetSizeMult()};
const vf2d lowerLeftCorner{pillar.GetPos()+(collisionRect.pos+vf2d{collisionRect.size.y,0.f})*pillar.GetSizeMult()};
const vf2d lowerRightCorner{pillar.GetPos()+(collisionRect.pos+collisionRect.size)*pillar.GetSizeMult()};
const std::vector<vf2d>corners{upperLeftCorner,upperRightCorner,lowerLeftCorner,lowerRightCorner};

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 9947
#define VERSION_BUILD 9948
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -1066,6 +1066,10 @@ Monsters
# The Pillar is supposed to be 350 radius.
Size = 600%
Collision Radius = 7
# If provided, constructs a rectangular collision instance for this enemy.
# Args: Pos X,Pos Y,Width,Height.
# NOTE: Position coordinates are relative.
Rectangle Collision = -4,-4,8,8
XP = 0

Loading…
Cancel
Save