Fix arc not showing up. 3-5 had a missing spawn point set. More Octopus Arm behavior fixes. Release Build 11808.

master
sigonasr2 5 days ago
parent 9b94a90326
commit c9a29b2705
  1. 4
      Adventures in Lestoria/Arc.h
  2. 2
      Adventures in Lestoria/GiantOctopus.cpp
  3. 42
      Adventures in Lestoria/OctopusArm.cpp
  4. 2
      Adventures in Lestoria/Version.h
  5. 8
      Adventures in Lestoria/assets/Campaigns/3_5.tmx
  6. 2
      Adventures in Lestoria/assets/config/MonsterStrategies.txt
  7. BIN
      x64/Release/Adventures in Lestoria.exe

@ -49,11 +49,11 @@ public:
void Draw(AiL*game,const Pixel col); void Draw(AiL*game,const Pixel col);
const bool overlaps(const vf2d checkPos)const; const bool overlaps(const vf2d checkPos)const;
void GrowRadius(const float growAmt); void GrowRadius(const float growAmt);
private:
void GenerateArc();
const vf2d pos; const vf2d pos;
const float pointingAngle; const float pointingAngle;
const float sweepAngle; const float sweepAngle;
float radius; float radius;
geom2d::polygon<float>poly; geom2d::polygon<float>poly;
private:
void GenerateArc();
}; };

@ -73,7 +73,7 @@ void Monster::STRATEGY::GIANT_OCTOPUS(Monster&m,float fElapsedTime,std::string s
const std::weak_ptr<Monster>&m{std::any_cast<std::weak_ptr<Monster>>(arm)}; const std::weak_ptr<Monster>&m{std::any_cast<std::weak_ptr<Monster>>(arm)};
if(m.expired()||m.lock()->IsDead()){ if(m.expired()||m.lock()->IsDead()){
deadMonsterCount++; deadMonsterCount++;
tempArmLocs.emplace_back(std::any_cast<vf2d>(m.VEC(A::ARM_LOCATIONS))); tempArmLocs.emplace_back(std::any_cast<vf2d>(m.lock()->VEC(A::ARM_LOCATIONS)));
} }
} }
if(deadMonsterCount>0){ if(deadMonsterCount>0){

@ -56,6 +56,7 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str
SEARCH, SEARCH,
PREPARE_ATTACK, PREPARE_ATTACK,
ATTACK_ANIMATION, ATTACK_ANIMATION,
ATTACK_RECOVERY,
SUBMERGE, SUBMERGE,
}; };
@ -64,6 +65,7 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str
}; };
if(m.ANY(A::STORED_ARC).has_value()){ if(m.ANY(A::STORED_ARC).has_value()){
game->DrawShadowStringDecal({100,100},std::format("Stored Arc Active: {}",std::any_cast<Arc>(m.ANY(A::STORED_ARC)).pos.str()));
const float growthRate=((ConfigFloat("Attack Radius")/100.f*24)/ConfigFloat("Attack Effect Time"))*fElapsedTime; const float growthRate=((ConfigFloat("Attack Radius")/100.f*24)/ConfigFloat("Attack Effect Time"))*fElapsedTime;
std::any_cast<Arc>(m.ANY(A::STORED_ARC)).GrowRadius(growthRate); std::any_cast<Arc>(m.ANY(A::STORED_ARC)).GrowRadius(growthRate);
m.F(A::ENVIRONMENT_TIMER)-=fElapsedTime; m.F(A::ENVIRONMENT_TIMER)-=fElapsedTime;
@ -77,6 +79,7 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str
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){ m.SetStrategyDeathFunction([bossDamageOnDeath=ConfigInt("Boss Damage On Death")](GameEvent&event,Monster&m,const StrategyName&strategyName){
m.SetStrategyDrawFunction([](AiL*game,Monster&monster,const std::string&strategy){});
const std::string GIANT_OCTOPUS_NAME{"Giant Octopus"}; const std::string GIANT_OCTOPUS_NAME{"Giant Octopus"};
const std::string OCTOPUS_ARM_NAME{"Octopus Arm"}; const std::string OCTOPUS_ARM_NAME{"Octopus Arm"};
@ -115,12 +118,11 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str
Arc attackArc{GetAttackArc(m)}; Arc attackArc{GetAttackArc(m)};
m.SetStrategyDrawFunction([&attackArc,&storedArc=m.ANY(A::STORED_ARC),&alphaTimer=m.F(A::ENVIRONMENT_TIMER),attackEffectTime=ConfigFloat("Attack Effect Time")](AiL*game,Monster&monster,const std::string&strategy){ m.SetStrategyDrawFunction([arc=attackArc,&storedArc=m.ANY(A::STORED_ARC),&alphaTimer=m.F(A::ENVIRONMENT_TIMER),attackEffectTime=ConfigFloat("Attack Effect Time")](AiL*game,Monster&monster,const std::string&strategy){
const float alphaTimer{float(std::fmod(game->GetRunTime(),2.f))}; const float alphaTimer{float(std::fmod(game->GetRunTime(),2.f))};
uint8_t alpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer)}; uint8_t alpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer)};
if(alphaTimer>1.f)alpha=util::lerp(0,255,1-(alphaTimer-1)); if(alphaTimer>1.f)alpha=util::lerp(0,255,1-(alphaTimer-1));
game->DrawShadowStringDecal({100,100},std::format("{} - {}",alpha,alphaTimer)); const_cast<Arc&>(arc).Draw(game,{0,0,255,uint8_t(alpha)});
attackArc.Draw(game,{0,0,255,uint8_t(alpha)});
if(storedArc.has_value()){ if(storedArc.has_value()){
const uint8_t effectAlpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer/attackEffectTime)}; const uint8_t effectAlpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer/attackEffectTime)};
std::any_cast<Arc>(storedArc).Draw(game,{255,255,255,effectAlpha}); std::any_cast<Arc>(storedArc).Draw(game,{255,255,255,effectAlpha});
@ -131,27 +133,37 @@ void Monster::STRATEGY::OCTOPUS_ARM(Monster&m,float fElapsedTime,std::string str
case PREPARE_ATTACK:{ case PREPARE_ATTACK:{
m.F(A::ATTACK_COOLDOWN)-=fElapsedTime; m.F(A::ATTACK_COOLDOWN)-=fElapsedTime;
if(m.F(A::ATTACK_COOLDOWN)<=0.f){ if(m.F(A::ATTACK_COOLDOWN)<=0.f){
SETPHASE(ATTACK_ANIMATION);
m.PerformAnimation("ATTACKING"); m.PerformAnimation("ATTACKING");
m.F(A::ENVIRONMENT_TIMER)=ConfigFloat("Attack Effect Time"); m.F(A::ENVIRONMENT_TIMER)=m.F(A::RECOVERY_TIME)=ConfigFloat("Attack Effect Time");
m.F(A::SWING_OCCURRED)=ConfigFloat("Attack Swing Damage Wait Time"); m.F(A::SWING_OCCURRED)=ConfigFloat("Attack Swing Damage Wait Time");
} }
}break; }break;
case ATTACK_ANIMATION:{ case ATTACK_ANIMATION:{
m.F(A::RECOVERY_TIME)-=fElapsedTime; m.F(A::SWING_OCCURRED)-=fElapsedTime;
if(m.F(A::SWING_OCCURRED)>0.f){ if(m.F(A::SWING_OCCURRED)<=0.f){
m.F(A::SWING_OCCURRED)-=fElapsedTime; Arc attackArc{GetAttackArc(m)};
if(m.F(A::SWING_OCCURRED)<=0.f){ if(attackArc.overlaps(game->GetPlayer()->GetPos())){
Arc attackArc{GetAttackArc(m)}; game->GetPlayer()->Knockback(util::pointTo(m.GetPos(),game->GetPlayer()->GetPos())*ConfigFloat("Attack Knockback"));
if(attackArc.overlaps(game->GetPlayer()->GetPos())){ game->GetPlayer()->Hurt(m.GetAttack(),m.OnUpperLevel(),m.GetZ());
game->GetPlayer()->Knockback(util::pointTo(m.GetPos(),game->GetPlayer()->GetPos())*ConfigFloat("Attack Knockback"));
game->GetPlayer()->Hurt(m.GetAttack(),m.OnUpperLevel(),m.GetZ());
}
m.F(A::RECOVERY_TIME)=m.GetCurrentAnimation().GetTotalAnimationDuration();
m.ANY(A::STORED_ARC)=GetAttackArc(m);
} }
m.F(A::RECOVERY_TIME)=m.GetCurrentAnimation().GetTotalAnimationDuration();
m.ANY(A::STORED_ARC)=GetAttackArc(m);
m.SetStrategyDrawFunction([&storedArc=m.ANY(A::STORED_ARC),attackEffectTime=ConfigFloat("Attack Effect Time")](AiL*game,Monster&monster,const std::string&strategy){
const float alphaTimer{float(std::fmod(game->GetRunTime(),2.f))};
if(storedArc.has_value()){
const uint8_t effectAlpha{util::lerp(uint8_t(0),uint8_t(255),alphaTimer/attackEffectTime)};
std::any_cast<Arc>(storedArc).Draw(game,{255,255,255,effectAlpha});
}
});
SETPHASE(ATTACK_RECOVERY);
} }
}break;
case ATTACK_RECOVERY:{
m.F(A::RECOVERY_TIME)-=fElapsedTime;
if(m.F(A::RECOVERY_TIME)<=0.f){ if(m.F(A::RECOVERY_TIME)<=0.f){
m.PerformIdleAnimation(); m.PerformIdleAnimation();
m.SetStrategyDrawFunction([](AiL*game,Monster&monster,const std::string&strategy){});
SETPHASE(SEARCH); SETPHASE(SEARCH);
} }
}break; }break;

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1 #define VERSION_MAJOR 1
#define VERSION_MINOR 3 #define VERSION_MINOR 3
#define VERSION_PATCH 0 #define VERSION_PATCH 0
#define VERSION_BUILD 11795 #define VERSION_BUILD 11808
#define stringify(a) stringify_(a) #define stringify(a) stringify_(a)
#define stringify_(a) #a #define stringify_(a) #a

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<map version="1.10" tiledversion="1.10.1" class="Map" orientation="orthogonal" renderorder="right-down" width="288" height="208" tilewidth="24" tileheight="24" infinite="0" nextlayerid="8" nextobjectid="133"> <map version="1.10" tiledversion="1.11.0" class="Map" orientation="orthogonal" renderorder="right-down" width="288" height="208" tilewidth="24" tileheight="24" infinite="0" nextlayerid="8" nextobjectid="133">
<properties> <properties>
<property name="Background Music" propertytype="BGM" value="beach"/> <property name="Background Music" propertytype="BGM" value="beach"/>
<property name="Level Type" type="int" propertytype="LevelType" value="0"/> <property name="Level Type" type="int" propertytype="LevelType" value="0"/>
@ -1471,7 +1471,11 @@
<property name="spawner" type="object" value="46"/> <property name="spawner" type="object" value="46"/>
</properties> </properties>
</object> </object>
<object id="83" template="../maps/Monsters/Pirate Buccaneer.tx" x="568" y="4033.33"/> <object id="83" template="../maps/Monsters/Pirate Buccaneer.tx" x="568" y="4033.33">
<properties>
<property name="spawner" type="object" value="46"/>
</properties>
</object>
<object id="84" template="../maps/Monsters/Pirate Marauder.tx" x="650.667" y="4180"> <object id="84" template="../maps/Monsters/Pirate Marauder.tx" x="650.667" y="4180">
<properties> <properties>
<property name="spawner" type="object" value="46"/> <property name="spawner" type="object" value="46"/>

@ -1211,7 +1211,7 @@ MonsterStrategy
# For synchronization purposes. Damage doesn't come out until this amount of time has passed in the animation. # For synchronization purposes. Damage doesn't come out until this amount of time has passed in the animation.
Attack Swing Damage Wait Time = 0.45s Attack Swing Damage Wait Time = 0.45s
Attack Knockback = 50 Attack Knockback = 200
Boss Damage On Death = 6000hp Boss Damage On Death = 6000hp

Loading…
Cancel
Save