Additional AI setup.

master
sigonasr2 3 weeks ago
parent 81bfbfb860
commit debc23bfa3
  1. 2
      Adventures in Lestoria/Monster.cpp
  2. 4
      Adventures in Lestoria/Monster.h
  3. 20
      Adventures in Lestoria/OctopusArm.cpp
  4. 2
      Adventures in Lestoria/assets/config/MonsterStrategies.txt

@ -1259,8 +1259,6 @@ const float Monster::GetCollisionDamage()const{
else return MONSTER_DATA[name].GetCollisionDmg(); else return MONSTER_DATA[name].GetCollisionDmg();
} }
//Sets the strategy death function that runs when a monster dies.
// The function should return false to indicate the event is over. If the event should keep running, return true.
void Monster::SetStrategyDeathFunction(std::function<bool(GameEvent&event,Monster&monster,const std::string&strategyName)>func){ void Monster::SetStrategyDeathFunction(std::function<bool(GameEvent&event,Monster&monster,const std::string&strategyName)>func){
strategyDeathFunc=func; strategyDeathFunc=func;
} }

@ -289,7 +289,9 @@ private:
NPCData npcData; NPCData npcData;
float lastPathfindingCooldown=0.f; float lastPathfindingCooldown=0.f;
std::function<bool(GameEvent&,Monster&,const std::string&)>strategyDeathFunc{}; std::function<bool(GameEvent&,Monster&,const std::string&)>strategyDeathFunc{};
void SetStrategyDeathFunction(std::function<bool(GameEvent&event,Monster&monster,const std::string&strategyName)>func); //Sets the strategy death function that runs when a monster dies.
// The function should return false to indicate the event is over. If the event should keep running, return true.
void SetStrategyDeathFunction(std::function<bool(GameEvent&event,Monster&monster,const StrategyName&strategyName)>func);
//If you are trying to change a Get() stat, use the STAT_UP buff (and the optional argument) to supply an attribute you want to apply. //If you are trying to change a Get() stat, use the STAT_UP buff (and the optional argument) to supply an attribute you want to apply.
const ItemAttribute&GetBonusStat(std::string_view attr)const; const ItemAttribute&GetBonusStat(std::string_view attr)const;
//Returns false if the monster could not be moved to the requested location due to collision. //Returns false if the monster could not be moved to the requested location due to collision.

@ -46,6 +46,8 @@ All rights reserved.
using A=Attribute; using A=Attribute;
INCLUDE_game INCLUDE_game
INCLUDE_MONSTER_LIST
INCLUDE_MONSTER_DATA
void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string strategy){ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string strategy){
enum PhaseName{ enum PhaseName{
@ -73,6 +75,24 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str
m.PerformAnimation("RISE",game->GetPlayer()->GetPos()); m.PerformAnimation("RISE",game->GetPlayer()->GetPos());
m.F(A::CASTING_TIMER)=m.GetCurrentAnimation().GetTotalAnimationDuration(); m.F(A::CASTING_TIMER)=m.GetCurrentAnimation().GetTotalAnimationDuration();
SETPHASE(RISE_ANIMATION); SETPHASE(RISE_ANIMATION);
m.SetStrategyDeathFunction([bossDamageOnDeath=ConfigInt("Boss Damage On Death")](GameEvent&event,Monster&m,const StrategyName&strategyName){
const std::string GIANT_OCTOPUS_NAME{"Giant Octopus"};
const std::string OCTOPUS_ARM_NAME{"Octopus Arm"};
if(!MONSTER_DATA.count(GIANT_OCTOPUS_NAME))ERR("WARNING! Octopus"
auto boss{std::find_if(MONSTER_LIST.begin(),MONSTER_LIST.end(),[&GIANT_OCTOPUS_NAME](const std::shared_ptr<Monster>&m){
return m->GetName()==GIANT_OCTOPUS_NAME;
})};
if(boss!=MONSTER_LIST.end()){
Monster&bossMonster{**boss};
bossMonster.Hurt(bossDamageOnDeath,m.OnUpperLevel(),m.GetZ());
}
std::for_each(MONSTER_LIST.begin(),MONSTER_LIST.end(),[&OCTOPUS_ARM_NAME](const std::shared_ptr<Monster>&m){
if(m->GetName()==OCTOPUS_ARM_NAME)
});
return false;
});
}break; }break;
case RISE_ANIMATION:{ case RISE_ANIMATION:{
m.F(A::CASTING_TIMER)-=fElapsedTime; m.F(A::CASTING_TIMER)-=fElapsedTime;

@ -1213,6 +1213,8 @@ MonsterStrategy
Attack Knockback = 50 Attack Knockback = 50
Boss Damage On Death = 6000hp
# Amount of time the spreading aftershock effect appears for. # Amount of time the spreading aftershock effect appears for.
Attack Effect Time = 0.4s Attack Effect Time = 0.4s
} }

Loading…
Cancel
Save