diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj b/Adventures in Lestoria/Adventures in Lestoria.vcxproj index 4ca6cc91..8aa0308a 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj @@ -356,6 +356,7 @@ + diff --git a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters index f92c4214..5ac8282a 100644 --- a/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters +++ b/Adventures in Lestoria/Adventures in Lestoria.vcxproj.filters @@ -657,6 +657,9 @@ Header Files\Engine + + Source Files\Effects + diff --git a/Adventures in Lestoria/Chapter_2_Boss.txt b/Adventures in Lestoria/Chapter_2_Boss.txt index 8cb37d02..6b8ab1d6 100644 --- a/Adventures in Lestoria/Chapter_2_Boss.txt +++ b/Adventures in Lestoria/Chapter_2_Boss.txt @@ -26,9 +26,9 @@ Size: 800% -every 10% (first time at 90%) use a shockwave where you need to hide behind one of the pillar to avoid the damage. (Shockwave has 3 seconds cast, 60 dmg) +>every 10% (first time at 90%) use a shockwave where you need to hide behind one of the pillar to avoid the damage. (Shockwave has 3 seconds cast, 60 dmg) -The pillars get damaged with every shockwave. after the 3rd the pillar break. +>The pillars get damaged with every shockwave. after the 3rd the pillar break. @@ -56,7 +56,7 @@ The Boss continues with its normal behaviour while the pillars are getting caste >after 2.5 seconds the golems throws a giant rock with 250 radius on the players position. Damaging the player and destroying Pillars hit. (55 dmg) -Stone Throw cant overlap with shockwave. when a 10% mark is reached while a rock is targeting the player, Shockwave cast starts after the rock was thrown. +>Stone Throw cant overlap with shockwave. when a 10% mark is reached while a rock is targeting the player, Shockwave cast starts after the rock was thrown. diff --git a/Adventures in Lestoria/ExpandingRing.h b/Adventures in Lestoria/ExpandingRing.h new file mode 100644 index 00000000..31d82003 --- /dev/null +++ b/Adventures in Lestoria/ExpandingRing.h @@ -0,0 +1,52 @@ +#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 +#pragma once + +#include "Effect.h" + + +struct ExpandingRing:Effect{ + inline ExpandingRing(vf2d pos,float lifetime,std::string imgFile,bool upperLevel,vf2d expandingSize,vf2d size={1.f,1.f},float fadeout=0.f,vf2d spd={},Pixel col=WHITE,float rotation=0.f,float rotationSpd=0.f,bool additiveBlending=false) + :expandingSize(expandingSize),Effect(pos,lifetime,imgFile,upperLevel,size,fadeout,spd,col,rotation,rotationSpd,additiveBlending){} + inline bool Update(float fElapsedTime){ + size+=expandingSize*fElapsedTime; + return true; + } +private: + const vf2d expandingSize; +}; \ No newline at end of file diff --git a/Adventures in Lestoria/StageMaskPolygon.cpp b/Adventures in Lestoria/StageMaskPolygon.cpp index 16630f74..7129fc56 100644 --- a/Adventures in Lestoria/StageMaskPolygon.cpp +++ b/Adventures in Lestoria/StageMaskPolygon.cpp @@ -199,4 +199,14 @@ void StageMaskPolygon::PerformScreenClippingAndDrawPolygon(const geom2d::polygon void StageMaskPolygon::Draw(){ PerformScreenClippingAndDrawPolygon(polygon); //Modifies polygon +} + +const std::vector>StageMaskPolygon::GetCollisionTriangles()const{ + int index{1}; + std::vector>tris; + while(index{polygon.pos[0],polygon.pos[index],polygon.pos[index+1]}); + index++; + } + return tris; } \ No newline at end of file diff --git a/Adventures in Lestoria/StageMaskPolygon.h b/Adventures in Lestoria/StageMaskPolygon.h index 504ede19..e172f0a6 100644 --- a/Adventures in Lestoria/StageMaskPolygon.h +++ b/Adventures in Lestoria/StageMaskPolygon.h @@ -60,6 +60,7 @@ public: void SetBlendColor(const Pixel overlayCol); const bool HasOverlay()const; const StageMaskOverlay&GetOverlay()const; + const std::vector>GetCollisionTriangles()const; void Draw(); private: void PerformScreenClippingAndDrawPolygon(const geom2d::polygon&poly); diff --git a/Adventures in Lestoria/StoneGolem.cpp b/Adventures in Lestoria/StoneGolem.cpp index 16b35577..fca5ecb8 100644 --- a/Adventures in Lestoria/StoneGolem.cpp +++ b/Adventures in Lestoria/StoneGolem.cpp @@ -44,6 +44,7 @@ All rights reserved. #include "BulletTypes.h" #include "SoundEffect.h" #include "StageMaskPolygon.h" +#include "ExpandingRing.h" INCLUDE_game INCLUDE_MONSTER_LIST @@ -150,6 +151,7 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str if(m.F(A::HEALTH_PCT_PHASE)-m.GetHealthRatio()>=0.1f){ m.F(A::HEALTH_PCT_PHASE)-=0.1f; + m.F(A::CASTING_TIMER)=ConfigFloat("Shockwave.Cast Time"); PrepareSafeAreas(); m.phase=SHOCKWAVE; break; @@ -191,9 +193,38 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str } }break; case SHOCKWAVE:{ + m.F(A::CASTING_TIMER)-=fElapsedTime; Pixel newCol{PixelLerp(VERY_DARK_BLUE,BLACK,sin(geom2d::pi*game->GetRunTime()*2)/2.f+0.5f)}; newCol.a=util::lerp(255.f,210.f,sin(geom2d::pi*game->GetRunTime()*2)/2.f+0.5f); game->SetWorldColor(newCol); + + if(m.F(A::CASTING_TIMER)<=0.f){ + game->SetupWorldShake(ConfigFloat("Shockwave.Shockwave Screen Shake Time")); + bool isSafe{false}; + for(std::any&data:m.VEC(A::STAGE_POLYGONS)){ + std::vector>collisionTris{any_cast(data).GetCollisionTriangles()}; + for(geom2d::triangletri:collisionTris){ + if(geom2d::overlaps(game->GetPlayer()->Hitbox(),tri)){ + isSafe=true; + goto DoneWithCollisionCheck; + } + } + } + DoneWithCollisionCheck: + if(!isSafe){ + game->GetPlayer()->Hurt(ConfigInt("Shockwave.Damage"),m.OnUpperLevel(),m.GetZ()); + game->GetPlayer()->Knockback(util::pointTo(m.GetPos(),game->GetPlayer()->GetPos())*ConfigFloat("Shockwave.Knockback Amount")); + } + m.VEC(A::STAGE_POLYGONS).clear(); + std::for_each(MONSTER_LIST.begin(),MONSTER_LIST.end(),[&](const std::unique_ptr&monsterPtr){ + if(monsterPtr->GetName()!="Stone Golem Pillar")return; + monsterPtr->_DealTrueDamage(ConfigInt("Shockwave.Pillar Damage")); + }); + SoundEffect::PlaySFX("Shockwave",m.GetPos()); + game->AddEffect(std::make_unique(m.GetPos(),ConfigFloat("Shockwave.Shockwave Ring Lifetime"),"finishring.png",m.OnUpperLevel(),vf2d{ConfigFloat("Shockwave.Ring Expand Speed"),ConfigFloat("Shockwave.Ring Expand Speed")},vf2d{1.f,1.f},ConfigFloat("Shockwave.Shockwave Fadeout Time"),vf2d{},ConfigPixel("Shockwave.Shockwave Color")),true); + m.phase=STANDARD; + game->SetWorldColor(WHITE); + } }break; } } \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index e1ecb930..0151f473 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 3 -#define VERSION_BUILD 9703 +#define VERSION_BUILD 9715 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index 168e0ad8..0667d12b 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -931,13 +931,26 @@ MonsterStrategy # Degrees/sec. Positive is CW, Negative is CCW. Stone Throw Spell Insignia Rotation Spd = 50 } + Shockwave + { + Cast Time = 3s + Damage = 60 + Pillar Damage = 1 + Knockback Amount = 450 + Shockwave Screen Shake Time = 0.75s + + Ring Expand Speed = 5.0/s + Shockwave Ring Lifetime = 2.5s + Shockwave Fadeout Time = 0.5s + Shockwave Color = 255 red, 255 green, 255 blue, 120 alpha + } } Breaking Pillar { Unbroken Animation Name = NORMAL - Break Phase 1 HP % Threshold = below 68% + Break Phase 1 HP % Threshold = 68% or below Break Phase 1 Animation Name = BREAK1 - Break Phase 2 HP % Threshold = below 34% + Break Phase 2 HP % Threshold = 34% or below Break Phase 2 Animation Name = BREAK2 Death Ring Bullet Count = 24 diff --git a/Adventures in Lestoria/assets/config/audio/events.txt b/Adventures in Lestoria/assets/config/audio/events.txt index 0c2d112f..acf0ba42 100644 --- a/Adventures in Lestoria/assets/config/audio/events.txt +++ b/Adventures in Lestoria/assets/config/audio/events.txt @@ -212,6 +212,12 @@ Events # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) File[0] = rocktosscast.ogg, 100% } + Shockwave + { + CombatSound = True + # Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%) + File[0] = shockwave.ogg, 70% + } Slime Dead { CombatSound = True diff --git a/Adventures in Lestoria/assets/config/items/ItemDatabase.txt b/Adventures in Lestoria/assets/config/items/ItemDatabase.txt index d4e99d11..35d44319 100644 --- a/Adventures in Lestoria/assets/config/items/ItemDatabase.txt +++ b/Adventures in Lestoria/assets/config/items/ItemDatabase.txt @@ -111,7 +111,7 @@ ItemDatabase BuyValue = 10 UseSound = Consume Item } - Health Potion + Health Potion { ItemScript = Restore Description = Restores 75 health points. diff --git a/Adventures in Lestoria/assets/gamepack.pak b/Adventures in Lestoria/assets/gamepack.pak index 285925b0..ff82f6ad 100644 Binary files a/Adventures in Lestoria/assets/gamepack.pak and b/Adventures in Lestoria/assets/gamepack.pak differ diff --git a/Adventures in Lestoria/assets/items/Elixir of the Wind.png b/Adventures in Lestoria/assets/items/Elixir of the Wind.png new file mode 100644 index 00000000..9a9093ee Binary files /dev/null and b/Adventures in Lestoria/assets/items/Elixir of the Wind.png differ diff --git a/Adventures in Lestoria/assets/items/Medium Health Potion.png b/Adventures in Lestoria/assets/items/Health Potion.png similarity index 100% rename from Adventures in Lestoria/assets/items/Medium Health Potion.png rename to Adventures in Lestoria/assets/items/Health Potion.png diff --git a/Adventures in Lestoria/assets/items/Medium Mana Potion.png b/Adventures in Lestoria/assets/items/Mana Potion.png similarity index 100% rename from Adventures in Lestoria/assets/items/Medium Mana Potion.png rename to Adventures in Lestoria/assets/items/Mana Potion.png diff --git a/Adventures in Lestoria/assets/items/Recovery Potion.png b/Adventures in Lestoria/assets/items/Recovery Potion.png new file mode 100644 index 00000000..aadcffd5 Binary files /dev/null and b/Adventures in Lestoria/assets/items/Recovery Potion.png differ diff --git a/Adventures in Lestoria/assets/sounds/shockwave.ogg b/Adventures in Lestoria/assets/sounds/shockwave.ogg new file mode 100644 index 00000000..2993ca18 Binary files /dev/null and b/Adventures in Lestoria/assets/sounds/shockwave.ogg differ diff --git a/Adventures in Lestoria/olcUTIL_DataFile.h b/Adventures in Lestoria/olcUTIL_DataFile.h index f88a02e4..e4b4fddf 100644 --- a/Adventures in Lestoria/olcUTIL_DataFile.h +++ b/Adventures in Lestoria/olcUTIL_DataFile.h @@ -114,7 +114,7 @@ namespace olc::utils // Retrieves the Real Value of a Property (for a given index) or 0.0 inline const float GetReal(const size_t nItem = 0) const { - return std::atof(GetString(nItem).c_str()); + return std::stof(GetString(nItem).c_str()); } // Sets the Real Value of a Property (for a given index) @@ -126,7 +126,7 @@ namespace olc::utils // Retrieves the Integer Value of a Property (for a given index) or 0 inline const int32_t GetInt(const size_t nItem = 0) const { - return std::atoi(GetString(nItem).c_str()); + return std::stoi(GetString(nItem).c_str()); } // Retrieves the Integer Value of a Property (for a given index) or 0 diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index 73f3b7f6..492173ca 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ