diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index ad7d5481..8a35da6f 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -159,6 +159,8 @@ AiL::AiL() _DEBUG_MAP_LOAD_INFO=bool("debug_map_load_info"_I); + MONSTER_LIST.reserve(500); //This is going to make it so the monster limit is soft-capped. We have hitlists in this game that may store pointers to monsters, this hopefully protects them from invalidated pointers. Worst-case-scenario we get double hits when there are more than 500 monsters on-screen at once which I really don't think will ever occur. + std::string CONFIG_PATH = "config_path"_S; std::string GFX_CONFIG = CONFIG_PATH + "gfx_config"_S; @@ -758,7 +760,7 @@ void AiL::UpdateBullets(float fElapsedTime){ } std::erase_if(BULLET_LIST,[](std::unique_ptr&b){return b->dead;}); } -const MonsterHurtList AiL::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z){ +const MonsterHurtList AiL::HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z)const{ MonsterHurtList hitList; for(Monster&m:MONSTER_LIST){ if(geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(m.GetPos(),12*m.GetSizeMult()))){ @@ -769,6 +771,19 @@ const MonsterHurtList AiL::HurtEnemies(vf2d pos,float radius,int damage,bool upp return hitList; } + +const MonsterHurtList AiL::HurtEnemiesNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z){ + MonsterHurtList affectedList; + for(Monster&m:MONSTER_LIST){ + if(!hitList.count(&m)&&geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(m.GetPos(),12*m.GetSizeMult()))){ + HurtReturnValue returnVal=m.Hurt(damage,upperLevel,z); + affectedList.push_back({&m,returnVal}); + hitList.insert(&m); + } + } + return affectedList; +} + void AiL::PopulateRenderLists(){ monstersBeforeLower.clear(); monstersAfterLower.clear(); @@ -3827,7 +3842,9 @@ void AiL::UpdateMonsters(){ m.Update(game->GetElapsedTime()); } for(Monster&m:game->monstersToBeSpawned){ + size_t prevCapacity=MONSTER_LIST.capacity(); MONSTER_LIST.push_back(m); + if(MONSTER_LIST.capacity()>prevCapacity)LOG(std::format("WARNING! The monster list has automatically reserved more space and resized to {}! This caused one potential frame where bullet/effect hitlists that stored information on what monsters were hit to potentially be hit a second time or cause monsters that should've been hit to never be hit. Consider starting with a larger default reserved size for MONSTER_LIST if your intention was to have this many monsters!",MONSTER_LIST.capacity())); } game->monstersToBeSpawned.clear(); } diff --git a/Adventures in Lestoria/AdventuresInLestoria.h b/Adventures in Lestoria/AdventuresInLestoria.h index 9c82a0f8..a5f3c836 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.h +++ b/Adventures in Lestoria/AdventuresInLestoria.h @@ -215,7 +215,9 @@ public: void AddEffect(std::unique_ptrforeground,std::unique_ptrbackground); //If back is true, places the effect in the background void AddEffect(std::unique_ptrforeground,bool back=false); - const MonsterHurtList HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z); + const MonsterHurtList HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z)const; + //NOTE: This function will also add any enemies that were hit into the hit list! + const MonsterHurtList HurtEnemiesNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z); vf2d GetWorldMousePos(); bool LeftHeld(); bool RightHeld(); diff --git a/Adventures in Lestoria/Effect.h b/Adventures in Lestoria/Effect.h index 99a808d9..d49f280a 100644 --- a/Adventures in Lestoria/Effect.h +++ b/Adventures in Lestoria/Effect.h @@ -37,6 +37,9 @@ All rights reserved. #pragma endregion #pragma once #include "Animation.h" +#include +class Monster; +using HitList=std::unordered_set; struct Effect{ friend class AiL; @@ -86,4 +89,6 @@ struct PulsatingFire:Effect{ struct SwordSlash:Effect{ SwordSlash(float lifetime,std::string imgFile,vf2d size={1,1},float fadeout=0.0f,vf2d spd={},Pixel col=WHITE,float rotation=0,float rotationSpd=0,bool additiveBlending=false); bool Update(float fElapsedTime)override; +private: + HitList hitList; }; \ No newline at end of file diff --git a/Adventures in Lestoria/Player.cpp b/Adventures in Lestoria/Player.cpp index dda05af3..13f7e976 100644 --- a/Adventures in Lestoria/Player.cpp +++ b/Adventures in Lestoria/Player.cpp @@ -263,7 +263,7 @@ float Player::GetSizeMult(){ } float Player::GetAttackRangeMult(){ - return attack_range; + return attack_range*GetSizeMult(); } float Player::GetSpinAngle(){ diff --git a/Adventures in Lestoria/SwordSlash.cpp b/Adventures in Lestoria/SwordSlash.cpp index 5d75f97c..605950ad 100644 --- a/Adventures in Lestoria/SwordSlash.cpp +++ b/Adventures in Lestoria/SwordSlash.cpp @@ -44,6 +44,10 @@ SwordSlash::SwordSlash(float lifetime, std::string imgFile, vf2d size, float fad :Effect(game->GetPlayer()->GetPos(),lifetime,imgFile,game->GetPlayer()->OnUpperLevel(),size,fadeout,spd,col,rotation,rotationSpd,additiveBlending){} bool SwordSlash::Update(float fElapsedTime){ + if(lifetime>0){ + game->HurtEnemiesNotHit(game->GetPlayer()->GetPos(),game->GetPlayer()->GetAttackRangeMult()*12.f,game->GetPlayer()->GetAttack(),hitList,game->GetPlayer()->OnUpperLevel(),game->GetPlayer()->GetZ()); + } pos=game->GetPlayer()->GetPos(); + return Effect::Update(fElapsedTime); } \ No newline at end of file diff --git a/Adventures in Lestoria/TODO.txt b/Adventures in Lestoria/TODO.txt index 1d9cda44..91dc03ac 100644 --- a/Adventures in Lestoria/TODO.txt +++ b/Adventures in Lestoria/TODO.txt @@ -1,22 +1,6 @@ -February 28th -> Begin Internal Game Playtesting -March 6th -> Discord/Friend Playtesting -March 30th -> Public Demo Release - -end of worldmap is visible. needs to be extended a little bit -distance on 1_1 between first and second Enemy spawn feels to empty -Materials for initial craft seems to be wrong? need to recheck -do we need a minimap? (maybe with fog of war?) Maybe polling that once testing with more people. -should gemstones dropp from boss stages aswell? (Maybe lower droprate?) - -Toggle for displaying error messages - Equip Gear using Start menu tutorial -Steam Controller SDK -Steam Rich Presence Add in vsync system option -Sword attack should linger - ============================================ Make another actions config file for the main build (The app # is different) \ No newline at end of file diff --git a/Adventures in Lestoria/Version.h b/Adventures in Lestoria/Version.h index 8e7e3885..f7454988 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 0 #define VERSION_PATCH 0 -#define VERSION_BUILD 8445 +#define VERSION_BUILD 8451 #define stringify(a) stringify_(a) #define stringify_(a) #a diff --git a/Adventures in Lestoria/Warrior.cpp b/Adventures in Lestoria/Warrior.cpp index 76c33989..f6aff201 100644 --- a/Adventures in Lestoria/Warrior.cpp +++ b/Adventures in Lestoria/Warrior.cpp @@ -82,7 +82,6 @@ bool Warrior::AutoAttack(){ float targetDirection; if(closest!=nullptr){ - closest->Hurt(int(GetAttack()*"Warrior.Auto Attack.DamageMult"_F),OnUpperLevel(),GetZ()); float dirToEnemy=geom2d::line(GetPos(),closest->GetPos()).vector().polar().y; targetDirection=dirToEnemy; SetAnimationBasedOnTargetingDirection(dirToEnemy); @@ -93,9 +92,9 @@ bool Warrior::AutoAttack(){ } attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction(); - swordSwingTimer="Warrior.Auto Attack.SwordSwingTime"_F; + swordSwingTimer="Warrior.Auto Attack.SwordAnimationSwingTime"_F; - game->AddEffect(std::make_unique(0.15f,"swordslash.png"s,vf2d{1.f,1.f}*"Warrior.Auto Attack.Range"_F/100.f,0.1f,vf2d{0.f,0.f},WHITE,targetDirection)); + game->AddEffect(std::make_unique(0.125f,"swordslash.png"s,vf2d{0.9f,0.9f}*"Warrior.Auto Attack.Range"_F/100.f,0.1f,vf2d{0.f,0.f},WHITE,targetDirection)); SetState(State::SWING_SWORD); SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED); diff --git a/Adventures in Lestoria/assets/config/classes/Warrior.txt b/Adventures in Lestoria/assets/config/classes/Warrior.txt index 5c220c5e..83ae0fc7 100644 --- a/Adventures in Lestoria/assets/config/classes/Warrior.txt +++ b/Adventures in Lestoria/assets/config/classes/Warrior.txt @@ -20,7 +20,8 @@ Warrior # Whether or not this ability cancels casts. CancelCast = 1 - SwordSwingTime = 0.2 + SwordAnimationSwingTime = 0.2s + SwordSlashLingerTime = 0.125s } Right Click Ability { diff --git a/Adventures in Lestoria/assets/gamepack.pak b/Adventures in Lestoria/assets/gamepack.pak index 79f199fc..7d12d391 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/steam/matchmakingtypes.h b/Adventures in Lestoria/steam/matchmakingtypes.h index 2b766026..1c4cfd3e 100644 --- a/Adventures in Lestoria/steam/matchmakingtypes.h +++ b/Adventures in Lestoria/steam/matchmakingtypes.h @@ -7,6 +7,7 @@ #ifndef MATCHMAKINGTYPES_H #define MATCHMAKINGTYPES_H +#include "olcPixelGameEngine.h" #include #include diff --git a/x64/Release/Adventures in Lestoria.exe b/x64/Release/Adventures in Lestoria.exe index b302f172..9d579f98 100644 Binary files a/x64/Release/Adventures in Lestoria.exe and b/x64/Release/Adventures in Lestoria.exe differ