Octopus arm AI

master
sigonasr2 4 weeks ago
parent 7b165a64d5
commit 46ba7a780d
  1. 2
      Adventures in Lestoria/AdventuresInLestoria.cpp
  2. 31
      Adventures in Lestoria/OctopusArm.cpp
  3. 8
      Adventures in Lestoria/assets/config/MonsterStrategies.txt
  4. 1
      Adventures in Lestoria/config.h

@ -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<Monster>(data.spawnPos,MONSTER_DATA[data.name]));
MONSTER_LIST.emplace_back(std::make_unique<Monster>(data.spawnPos,MONSTER_DATA[data.name]));
MONSTER_LIST.back()->ApplyIframes(INFINITE);
MONSTER_LIST.back()->npcData=data;
}

@ -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;
}
}

@ -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
}
}

@ -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);

Loading…
Cancel
Save