diff --git a/Adventures in Lestoria/Bear.cpp b/Adventures in Lestoria/Bear.cpp index 013cd344..954707b5 100644 --- a/Adventures in Lestoria/Bear.cpp +++ b/Adventures in Lestoria/Bear.cpp @@ -94,7 +94,7 @@ void Monster::STRATEGY::BEAR(Monster&m,float fElapsedTime,std::string strategy){ } } for(std::unique_ptr&otherM:MONSTER_LIST){ - if(!otherM->AttackAvoided(m.GetZ())&&&m!=otherM.get()&&geom2d::overlaps(attackCircle,otherM->Hitbox())){ + if(!otherM->AttackAvoided(m.GetZ())&&&m!=otherM.get()&&geom2d::overlaps(attackCircle,otherM->BulletCollisionHitbox())){ otherM->Knockup(ConfigFloat("Attack Knockup Duration")); vf2d monsterDirVecNorm=geom2d::line(m.GetPos(),otherM->GetPos()).vector().norm(); game->GetPlayer()->Knockback(monsterDirVecNorm*ConfigFloat("Attack Knockback Amount")); diff --git a/Adventures in Lestoria/Bullet.cpp b/Adventures in Lestoria/Bullet.cpp index 55a380ee..e976a946 100644 --- a/Adventures in Lestoria/Bullet.cpp +++ b/Adventures in Lestoria/Bullet.cpp @@ -91,7 +91,7 @@ void Bullet::_Update(const float fElapsedTime){ if(simulated)return true; if(friendly){ for(std::unique_ptr&m:MONSTER_LIST){ - if(geom2d::overlaps(m->Hitbox(),geom2d::circle(pos,radius))){ + if(geom2d::overlaps(m->BulletCollisionHitbox(),geom2d::circle(pos,radius))){ if(hitList.find(&*m)==hitList.end()&&m->Hurt(damage,OnUpperLevel(),z)){ if(!hitsMultiple){ if(MonsterHit(*m)){ diff --git a/Adventures in Lestoria/FrogTongue.cpp b/Adventures in Lestoria/FrogTongue.cpp index ecffac39..99ba5eb7 100644 --- a/Adventures in Lestoria/FrogTongue.cpp +++ b/Adventures in Lestoria/FrogTongue.cpp @@ -66,7 +66,7 @@ void FrogTongue::Update(float fElapsedTime){ } if(friendly){ for(std::unique_ptr&m:MONSTER_LIST){ - if(hitList.find(&*m)==hitList.end()&&geom2d::overlaps(m->Hitbox(),tongueLine)){ + if(hitList.find(&*m)==hitList.end()&&geom2d::overlaps(m->BulletCollisionHitbox(),tongueLine)){ MonsterHit(*m); hitList.insert(&*m); } diff --git a/Adventures in Lestoria/Monster.cpp b/Adventures in Lestoria/Monster.cpp index f1729b81..4ff1bdd0 100644 --- a/Adventures in Lestoria/Monster.cpp +++ b/Adventures in Lestoria/Monster.cpp @@ -332,7 +332,7 @@ bool Monster::Update(float fElapsedTime){ if(!HasIframes()){ for(std::unique_ptr&m:MONSTER_LIST){ if(&*m==this)continue; - if(!m->HasIframes()&&OnUpperLevel()==m->OnUpperLevel()&&abs(m->GetZ()-GetZ())<=1&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(m->GetPos(),12*m->GetSizeMult()/2))){ + if(!m->HasIframes()&&OnUpperLevel()==m->OnUpperLevel()&&abs(m->GetZ()-GetZ())<=1&&geom2d::overlaps(geom2d::circle(pos,GetCollisionRadius()),geom2d::circle(m->GetPos(),12*m->GetSizeMult()/2))){ m->Collision(*this); geom2d::line line(pos,m->GetPos()); float dist = line.length(); @@ -343,7 +343,7 @@ bool Monster::Update(float fElapsedTime){ } } if(!Immovable()&& - !game->GetPlayer()->HasIframes()&&abs(game->GetPlayer()->GetZ()-GetZ())<=1&&game->GetPlayer()->OnUpperLevel()==OnUpperLevel()&&geom2d::overlaps(geom2d::circle(pos,12*size/2),geom2d::circle(game->GetPlayer()->GetPos(),12*game->GetPlayer()->GetSizeMult()/2))){ + !game->GetPlayer()->HasIframes()&&abs(game->GetPlayer()->GetZ()-GetZ())<=1&&game->GetPlayer()->OnUpperLevel()==OnUpperLevel()&&geom2d::overlaps(geom2d::circle(pos,GetCollisionRadius()),geom2d::circle(game->GetPlayer()->GetPos(),12*game->GetPlayer()->GetSizeMult()/2))){ geom2d::line line(pos,game->GetPlayer()->GetPos()); float dist = line.length(); SetPos(line.rpoint(-0.1f)); @@ -873,8 +873,8 @@ const EventName&Monster::GetWalkSound(){ return MONSTER_DATA[name].GetWalkSound(); } -geom2d::circleMonster::Hitbox(){ - return {GetPos(),12*GetSizeMult()}; +geom2d::circleMonster::BulletCollisionHitbox(){ + return {GetPos(),GetCollisionRadius()*2}; } void Monster::Knockback(const vf2d&vel){ @@ -1036,7 +1036,7 @@ const std::optionalMonster::GetLifetime()const{ const std::optionalMonster::GetTotalLifetime()const{ return MONSTER_DATA.at(GetName()).GetLifetime(); } -const std::optionalMonster::GetCollisionRadius()const{ +const float Monster::GetCollisionRadius()const{ return MONSTER_DATA.at(GetName()).GetCollisionRadius(); } diff --git a/Adventures in Lestoria/Monster.h b/Adventures in Lestoria/Monster.h index a76dee2f..fc8b38de 100644 --- a/Adventures in Lestoria/Monster.h +++ b/Adventures in Lestoria/Monster.h @@ -137,7 +137,7 @@ public: void SetZ(float z); const std::function&GetStrategy()const; void SetSize(float newSize,bool immediate=true); - geom2d::circleHitbox(); + geom2d::circleBulletCollisionHitbox(); void SetStrategyDrawFunction(std::functionfunc); void SetStrategyDrawOverlayFunction(std::functionfunc); std::functionstrategyDraw=[](AiL*pge,Monster&m,const std::string&strategy){}; @@ -170,7 +170,7 @@ public: const std::optionalGetLifetime()const; const std::optionalGetTotalLifetime()const; //If an object has a collision radius, returns it. - const std::optionalGetCollisionRadius()const; + const float GetCollisionRadius()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. diff --git a/Adventures in Lestoria/MonsterData.cpp b/Adventures in Lestoria/MonsterData.cpp index 45429fa8..fa07567d 100644 --- a/Adventures in Lestoria/MonsterData.cpp +++ b/Adventures in Lestoria/MonsterData.cpp @@ -169,6 +169,8 @@ void MonsterData::InitializeMonsterData(){ if(DATA["Monsters"][MonsterName].HasProperty("Immovable"))monster.immovable=DATA["Monsters"][MonsterName]["Immovable"].GetBool(); if(DATA["Monsters"][MonsterName].HasProperty("Invulnerable"))monster.invulnerable=DATA["Monsters"][MonsterName]["Invulnerable"].GetBool(); if(DATA["Monsters"][MonsterName].HasProperty("Lifetime"))monster.lifetime=DATA["Monsters"][MonsterName]["Lifetime"].GetReal(); + + monster.collisionRadius=12*monster.GetSizeMult()/2.f; if(DATA["Monsters"][MonsterName].HasProperty("Collision Radius"))monster.collisionRadius=DATA["Monsters"][MonsterName]["Collision Radius"].GetBool(); if(hasFourWaySpriteSheet)monster.SetUsesFourWaySprites(); @@ -418,6 +420,6 @@ const bool MonsterData::Invulnerable()const{ const std::optionalMonsterData::GetLifetime()const{ return lifetime; } -const std::optionalMonsterData::GetCollisionRadius()const{ +const float MonsterData::GetCollisionRadius()const{ return collisionRadius; } \ No newline at end of file diff --git a/Adventures in Lestoria/MonsterData.h b/Adventures in Lestoria/MonsterData.h index 618da328..4b4f862a 100644 --- a/Adventures in Lestoria/MonsterData.h +++ b/Adventures in Lestoria/MonsterData.h @@ -100,7 +100,7 @@ public: //If an object has a lifetime set, returns it. const std::optionalGetLifetime()const; //If an object has a collision radius, returns it. - const std::optionalGetCollisionRadius()const; + const float GetCollisionRadius()const; private: std::string name; int hp; @@ -127,5 +127,5 @@ private: bool immovable{false}; bool invulnerable{false}; std::optionallifetime{}; - std::optionalcollisionRadius{}; + float collisionRadius{}; }; \ No newline at end of file diff --git a/Adventures in Lestoria/Stone_Elemental.cpp b/Adventures in Lestoria/Stone_Elemental.cpp index 8ab4a3c8..d9ef3ea4 100644 --- a/Adventures in Lestoria/Stone_Elemental.cpp +++ b/Adventures in Lestoria/Stone_Elemental.cpp @@ -85,10 +85,10 @@ void Monster::STRATEGY::STONE_ELEMENTAL(Monster&m,float fElapsedTime,std::string } }break; case STONE_PILLAR_CAST:{ - + m.PerformAnimation("STONE PILLAR CAST"); }break; case SHOOT_STONE_CAST:{ - + m.PerformAnimation("ROCK TOSS CAST"); }break; case DIVE_UNDERGROUND_DIG:{ diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index c1b31d7f..404b01db 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 9271 +#define VERSION_BUILD 9272 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/Monsters.txt b/Adventures in Lestoria/assets/config/Monsters.txt index ee96c686..b2179e72 100644 --- a/Adventures in Lestoria/assets/config/Monsters.txt +++ b/Adventures in Lestoria/assets/config/Monsters.txt @@ -764,6 +764,8 @@ Monsters WALK = 4, 0.2, Repeat TOSS ROCK = 4, 0.2, OneShot DEATH = 4, 0.15, OneShot + BURROW UNDERGROUND = 5, 0.15, OneShot + RISE FROM UNDERGROUND = 5, 0.15, OneShot ROCK TOSS CAST = 2, 0.3, Repeat STONE PILLAR CAST = 2, 0.3, Repeat } diff --git a/Adventures in Lestoria/assets/gamepack.pak b/Adventures in Lestoria/assets/gamepack.pak new file mode 100644 index 00000000..ca363a9e Binary files /dev/null and b/Adventures in Lestoria/assets/gamepack.pak differ diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 63ee9fd7..e8f25baf 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ