diff --git a/Adventures in Lestoria/AdventuresInLestoria.cpp b/Adventures in Lestoria/AdventuresInLestoria.cpp index f8554f29..a0380315 100644 --- a/Adventures in Lestoria/AdventuresInLestoria.cpp +++ b/Adventures in Lestoria/AdventuresInLestoria.cpp @@ -2690,7 +2690,7 @@ void AiL::_PrepareLevel(MapName map,MusicChange changeMusic){ LoadingScreen::AddPhase([&](){ for(NPCData data:game->MAP_DATA[game->GetCurrentLevel()].npcs){ if(Unlock::IsUnlocked(data.unlockCondition)){ - MONSTER_LIST.push_back(std::make_unique(data.spawnPos,MONSTER_DATA[data.name])); + MONSTER_LIST.emplace_back(std::make_unique(data.spawnPos,MONSTER_DATA[data.name])); MONSTER_LIST.back()->ApplyIframes(INFINITE); MONSTER_LIST.back()->npcData=data; } diff --git a/Adventures in Lestoria/OctopusArm.cpp b/Adventures in Lestoria/OctopusArm.cpp index 09c8a5b7..bf3d9971 100644 --- a/Adventures in Lestoria/OctopusArm.cpp +++ b/Adventures in Lestoria/OctopusArm.cpp @@ -41,6 +41,7 @@ All rights reserved. #include "AdventuresInLestoria.h" #include "SoundEffect.h" #include "BulletTypes.h" +#include "Arc.h" using A=Attribute; @@ -51,6 +52,7 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str INIT, RISE_ANIMATION, SEARCH, + PREPARE_ATTACK, }; switch(PHASE()){ case INIT:{ @@ -66,7 +68,36 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str } }break; case SEARCH:{ + if(util::distance(m.GetPos(),game->GetPlayer()->GetPos())<="Attack Radius"_F/100.f*24){ + SETPHASE(PREPARE_ATTACK); + m.F(A::ATTACK_COOLDOWN)="Attack Wiggle Time Range"_FRange; + m.PerformAnimation("ATTACKING",game->GetPlayer()->GetPos()); + float arcAngle{}; + switch(m.GetFacingDirection()){ + case Direction::NORTH:{ + arcAngle=-PI/2; + }break; + case Direction::EAST:{ + arcAngle=0.f; + }break; + case Direction::WEST:{ + arcAngle=PI; + }break; + case Direction::SOUTH:{ + arcAngle=PI/2; + }break; + } + Arc attackArc{m.GetPos(),"Attack Radius"_F/100.f*24,arcAngle,util::degToRad("Attack Arc"_F)}; + m.SetStrategyDrawFunction([&attackArc](AiL*game,Monster&monster,const std::string&strategy){ + attackArc.Draw(game,BLUE); + }); + } + }break; + case PREPARE_ATTACK:{ + m.F(A::ATTACK_COOLDOWN)-=fElapsedTime; + if(m.F(A::ATTACK_COOLDOWN)<=0.f){ + } }break; } } \ No newline at end of file diff --git a/Adventures in Lestoria/assets/config/MonsterStrategies.txt b/Adventures in Lestoria/assets/config/MonsterStrategies.txt index b919b883..d6a68c09 100644 --- a/Adventures in Lestoria/assets/config/MonsterStrategies.txt +++ b/Adventures in Lestoria/assets/config/MonsterStrategies.txt @@ -1200,4 +1200,12 @@ MonsterStrategy # Amount of movespeed gain by end of rampup time. Movespeed Rampup Final Amount = 100% } + Octopus Arm + { + Attack Radius = 600 + + Attack Wiggle Time Range = 2s,4s + Attack Arc = 60deg + Attack Wait Time = 1s + } } \ No newline at end of file diff --git a/Adventures in Lestoria/config.h b/Adventures in Lestoria/config.h index 3576fb40..252e6cd7 100644 --- a/Adventures in Lestoria/config.h +++ b/Adventures in Lestoria/config.h @@ -70,6 +70,7 @@ vf2d operator ""_V(const char*key,std::size_t len); utils::datafile operator ""_A(const char*key,std::size_t len); Pixel operator ""_Pixel(const char*key,std::size_t len); +//Outputs a number between two range values provided. float operator ""_FRange(const char*key,std::size_t len); float operator ""_Pct(long double pct);