Knockbacks are disabled on solid monsters. Add in small knockback effect on stone throw hit. Release Build 9641.

mac-build
sigonasr2 8 months ago
parent daad7d82fb
commit 02b06424a9
  1. 3
      Adventures in Lestoria/BulletTypes.h
  2. 31
      Adventures in Lestoria/LargeStone.cpp
  3. 1
      Adventures in Lestoria/Monster.cpp
  4. 4
      Adventures in Lestoria/StoneGolem.cpp
  5. 3
      Adventures in Lestoria/TODO.txt
  6. 2
      Adventures in Lestoria/Version.h
  7. 1
      Adventures in Lestoria/assets/config/MonsterStrategies.txt
  8. BIN
      x64/Release/Adventures in Lestoria.exe

@ -229,7 +229,7 @@ struct Feather:public Bullet{
struct LargeStone:public Bullet{
public:
LargeStone(vf2d pos,const float stoneThrowTime,const vf2d landingPos,float moveVelWaitTimer,float radius,float z,float gravity,int damage,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1},float image_angle=0.f);
LargeStone(vf2d pos,const float stoneThrowTime,const vf2d landingPos,float moveVelWaitTimer,float radius,float z,float gravity,int damage,const float knockbackAmt,bool upperLevel,bool hitsMultiple=false,float lifetime=INFINITE,bool friendly=false,Pixel col=WHITE,vf2d scale={1,1},float image_angle=0.f);
protected:
void Update(float fElapsedTime)override;
BulletDestroyState PlayerHit(Player*player)override;//DO NOT CALL THIS DIRECTLY! INSTEAD USE _PlayerHit()!!
@ -244,4 +244,5 @@ private:
float zVel{};
float moveTimer; //Counts down to 0, when it hits zero sets the velocity to futurevel.
const float initialMoveWaitTime;
const float knockbackAmt;
};

@ -38,11 +38,14 @@ All rights reserved.
#include "BulletTypes.h"
#include "AdventuresInLestoria.h"
#include "FallingDebris.h"
#include "util.h"
INCLUDE_game
INCLUDE_MONSTER_LIST
LargeStone::LargeStone(vf2d pos,const float stoneThrowTime,const vf2d landingPos,float moveVelWaitTimer,float radius,float z,float gravity,int damage,bool upperLevel,bool hitsMultiple,float lifetime,bool friendly,Pixel col,vf2d scale,float image_angle)
:stoneThrowTime(stoneThrowTime),startingPos(pos),landingPos(landingPos),gravity(gravity),initialMoveWaitTime(moveVelWaitTimer),moveTimer(moveVelWaitTimer),Bullet(pos,{},radius,damage,"large_rock.png",upperLevel,false,INFINITE,false,friendly,col,scale,image_angle){
LargeStone::LargeStone(vf2d pos,const float stoneThrowTime,const vf2d landingPos,float moveVelWaitTimer,float radius,float z,float gravity,int damage,const float knockbackAmt,bool upperLevel,bool hitsMultiple,float lifetime,bool friendly,Pixel col,vf2d scale,float image_angle)
:knockbackAmt(knockbackAmt),stoneThrowTime(stoneThrowTime),startingPos(pos),landingPos(landingPos),gravity(gravity),initialMoveWaitTime(moveVelWaitTimer),moveTimer(moveVelWaitTimer),Bullet(pos,{},radius,damage,"large_rock.png",upperLevel,false,INFINITE,false,friendly,col,scale,image_angle){
this->z=z;
Deactivate();
}
@ -55,7 +58,29 @@ void LargeStone::Update(float fElapsedTime){
if(moveTimer>0.f)moveTimer-=fixedTimeStep;
if(moveTimer<=0.f){
if(z<=0.f&&fadeOutTime==0.f){
game->Hurt(pos,radius,damage,OnUpperLevel(),0.f,friendly?HurtType::MONSTER:HurtType::PLAYER);
const HurtList list{game->Hurt(pos,radius,damage,OnUpperLevel(),0.f,friendly?HurtType::MONSTER:HurtType::PLAYER)};
for(int i=0;i<100;i++){
const float randomDir{util::random(2*PI)};
game->AddEffect(std::make_unique<FallingDebris>(pos+vf2d{radius,randomDir}.cart(),0.f,"circle.png",OnUpperLevel(),vf2d{1.5f,1.5f}*util::random(2.f),util::random(1.f),vf2d{vf2d{radius,randomDir}.cart().x,-util::random(30.f)-20.f},BLACK));
}
#pragma region Knockback Effect
#pragma region Check for player knockback
float distToPlayer=geom2d::line<float>(pos,game->GetPlayer()->GetPos()).length();
if(distToPlayer<=radius){
game->GetPlayer()->ProximityKnockback(pos,knockbackAmt);
}
#pragma endregion
#pragma region Check for monster knockback
for(auto&monsterPtr:MONSTER_LIST){
float distToMonster=geom2d::line<float>(pos,monsterPtr->GetPos()).length();
if(distToMonster<=radius){
monsterPtr->ProximityKnockback(pos,knockbackAmt);
}
}
#pragma endregion
#pragma endregion
fadeOutTime=0.5f;
}else
if(z>0.f&&fadeOutTime>=0.f){

@ -912,6 +912,7 @@ geom2d::circle<float>Monster::BulletCollisionHitbox(){
}
void Monster::Knockback(const vf2d&vel){
if(IsSolid())return;
//A new angle will be applied, but will be constrained by whichever applied velocity is strongest (either the current velocity, or the new one). This prevents continuous uncapped velocities to knockbacks applied.
if(vel==vf2d{})return;
float maxVelThreshold;

@ -97,14 +97,14 @@ void Monster::STRATEGY::STONE_GOLEM(Monster&m,float fElapsedTime,std::string str
m.V(A::LOCKON_POS)=game->GetPlayer()->GetPos();
m.PerformAnimation("TOSS ROCK CAST");
m.F(A::CASTING_TIMER)=ConfigFloat("Standard Attack.Stone Throw Cast Time");
game->AddEffect(std::make_unique<SpellCircle>(m.V(A::LOCKON_POS),ConfigFloat("Standard Attack.Stone Throw Cast Time")+4.f,"range_indicator.png","spell_insignia.png",m.OnUpperLevel(),vf2d{1.f,1.f}*(ConfigPixels("Standard Attack.Stone Radius")/12.f)*1.25f,0.3f,vf2d{},ConfigPixel("Standard Attack.Stone Throw Spell Circle Color"),util::random(2*PI),util::degToRad(ConfigFloat("Standard Attack.Stone Throw Spell Circle Rotation Spd")),false,vf2d{1.f,1.f}*(ConfigPixels("Standard Attack.Stone Radius")/12.f)*0.9f,0.3f,vf2d{},ConfigPixel("Standard Attack.Stone Throw Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Standard Attack.Stone Throw Spell Insignia Rotation Spd"))),true);
game->AddEffect(std::make_unique<SpellCircle>(m.V(A::LOCKON_POS),ConfigFloat("Standard Attack.Stone Throw Cast Time"),"range_indicator.png","spell_insignia.png",m.OnUpperLevel(),vf2d{1.f,1.f}*(ConfigPixels("Standard Attack.Stone Radius")/12.f)*1.25f,0.3f,vf2d{},ConfigPixel("Standard Attack.Stone Throw Spell Circle Color"),util::random(2*PI),util::degToRad(ConfigFloat("Standard Attack.Stone Throw Spell Circle Rotation Spd")),false,vf2d{1.f,1.f}*(ConfigPixels("Standard Attack.Stone Radius")/12.f)*0.9f,0.3f,vf2d{},ConfigPixel("Standard Attack.Stone Throw Spell Insignia Color"),util::random(2*PI),util::degToRad(ConfigFloat("Standard Attack.Stone Throw Spell Insignia Rotation Spd"))),true);
//Use acceleration equation to determine how much time it takes for the stone to land based on gravity.
const float stoneTossTime{ConfigFloat("Standard Attack.Stone Throw Time")};
//Physics!! Kinematic equation from https://openstax.org/books/physics/pages/3-2-representing-acceleration-with-equations-and-graphs a=(2d)/(t^2)
const float acc{(2*-ConfigFloat("Standard Attack.Stone Throw Height Offset"))/std::pow(stoneTossTime,2.f)};
CreateBullet(LargeStone)(m.GetPos()+ConfigFloat("Standard Attack.Stone Throw Height Offset")/2.f,ConfigFloat("Standard Attack.Stone Throw Time"),m.V(A::LOCKON_POS),m.F(A::CASTING_TIMER),ConfigPixels("Standard Attack.Stone Radius"),ConfigFloat("Standard Attack.Stone Throw Height Offset"),acc,ConfigInt("Standard Attack.Stone Damage"),m.OnUpperLevel(),false,INFINITY,false,WHITE,vf2d{1,1}*m.GetSizeMult(),util::random(2*PI))EndBullet;
CreateBullet(LargeStone)(m.GetPos()+ConfigFloat("Standard Attack.Stone Throw Height Offset")/2.f,ConfigFloat("Standard Attack.Stone Throw Time"),m.V(A::LOCKON_POS),m.F(A::CASTING_TIMER),ConfigPixels("Standard Attack.Stone Radius"),ConfigFloat("Standard Attack.Stone Throw Height Offset"),acc,ConfigInt("Standard Attack.Stone Damage"),ConfigFloat("Standard Attack.Stone Throw Knockback Factor"),m.OnUpperLevel(),false,INFINITY,false,WHITE,vf2d{1,1}*m.GetSizeMult(),util::random(2*PI))EndBullet;
}
}break;
case STONE_THROW_CAST:{

@ -15,5 +15,8 @@ Look into removing OVERRIDE from rumble settings. It looks like it was used to p
New Monster Sound Effects
Add a Helper Function: Change proximity knockback checks regardless of player/monster friendliness to be a function call instead.
DEMO
====

@ -39,7 +39,7 @@ All rights reserved.
#define VERSION_MAJOR 1
#define VERSION_MINOR 2
#define VERSION_PATCH 3
#define VERSION_BUILD 9630
#define VERSION_BUILD 9641
#define stringify(a) stringify_(a)
#define stringify_(a) #a

@ -922,6 +922,7 @@ MonsterStrategy
# How high in the air the rock starts at from the GROUND.
Stone Throw Height Offset = 160pixels
Stone Throw Time = 0.75s
Stone Throw Knockback Factor = 80
Stone Throw Spell Circle Color = 40, 40, 40, 80
Stone Throw Spell Insignia Color = 144, 137, 160, 255

Loading…
Cancel
Save