Warrior auto attack swing now has a frontal sweep angle. Release Build 8457.
This commit is contained in:
parent
02933fdc38
commit
ee382488f9
@ -771,7 +771,6 @@ const MonsterHurtList AiL::HurtEnemies(vf2d pos,float radius,int damage,bool upp
|
|||||||
return hitList;
|
return hitList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
const MonsterHurtList AiL::HurtEnemiesNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z){
|
const MonsterHurtList AiL::HurtEnemiesNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z){
|
||||||
MonsterHurtList affectedList;
|
MonsterHurtList affectedList;
|
||||||
for(Monster&m:MONSTER_LIST){
|
for(Monster&m:MONSTER_LIST){
|
||||||
@ -784,6 +783,22 @@ const MonsterHurtList AiL::HurtEnemiesNotHit(vf2d pos,float radius,int damage,Hi
|
|||||||
return affectedList;
|
return affectedList;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const MonsterHurtList AiL::HurtEnemiesConeNotHit(vf2d pos,float radius,float angle,float sweepAngle,int damage,HitList&hitList,bool upperLevel,float z){
|
||||||
|
MonsterHurtList affectedList;
|
||||||
|
for(Monster&m:MONSTER_LIST){
|
||||||
|
if(!hitList.count(&m)&&geom2d::overlaps(geom2d::circle(pos,radius),geom2d::circle(m.GetPos(),12*m.GetSizeMult()))){
|
||||||
|
float angleToMonster=geom2d::line<float>{pos,m.GetPos()}.vector().polar().y;
|
||||||
|
float angleDiff=util::angle_difference(angleToMonster,angle);
|
||||||
|
if(abs(angleDiff)<=sweepAngle){
|
||||||
|
HurtReturnValue returnVal=m.Hurt(damage,upperLevel,z);
|
||||||
|
affectedList.push_back({&m,returnVal});
|
||||||
|
hitList.insert(&m);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return affectedList;
|
||||||
|
}
|
||||||
|
|
||||||
void AiL::PopulateRenderLists(){
|
void AiL::PopulateRenderLists(){
|
||||||
monstersBeforeLower.clear();
|
monstersBeforeLower.clear();
|
||||||
monstersAfterLower.clear();
|
monstersAfterLower.clear();
|
||||||
|
@ -218,6 +218,10 @@ public:
|
|||||||
const MonsterHurtList HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z)const;
|
const MonsterHurtList HurtEnemies(vf2d pos,float radius,int damage,bool upperLevel,float z)const;
|
||||||
//NOTE: This function will also add any enemies that were hit into the hit list!
|
//NOTE: This function will also add any enemies that were hit into the hit list!
|
||||||
const MonsterHurtList HurtEnemiesNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z);
|
const MonsterHurtList HurtEnemiesNotHit(vf2d pos,float radius,int damage,HitList&hitList,bool upperLevel,float z);
|
||||||
|
// angle: The central angle where the arc will extend from.
|
||||||
|
// sweepAngle: The amount of radians to extend in both directions from the central angle.
|
||||||
|
// NOTE: This function will also add any enemies that were hit into the hit list!
|
||||||
|
const MonsterHurtList HurtEnemiesConeNotHit(vf2d pos,float radius,float angle,float sweepAngle,int damage,HitList&hitList,bool upperLevel,float z);
|
||||||
vf2d GetWorldMousePos();
|
vf2d GetWorldMousePos();
|
||||||
bool LeftHeld();
|
bool LeftHeld();
|
||||||
bool RightHeld();
|
bool RightHeld();
|
||||||
|
@ -37,6 +37,7 @@ All rights reserved.
|
|||||||
#pragma endregion
|
#pragma endregion
|
||||||
#include "Effect.h"
|
#include "Effect.h"
|
||||||
#include "AdventuresInLestoria.h"
|
#include "AdventuresInLestoria.h"
|
||||||
|
#include "util.h"
|
||||||
|
|
||||||
INCLUDE_game
|
INCLUDE_game
|
||||||
|
|
||||||
@ -45,7 +46,7 @@ SwordSlash::SwordSlash(float lifetime, std::string imgFile, vf2d size, float fad
|
|||||||
|
|
||||||
bool SwordSlash::Update(float fElapsedTime){
|
bool SwordSlash::Update(float fElapsedTime){
|
||||||
if(lifetime>0){
|
if(lifetime>0){
|
||||||
game->HurtEnemiesNotHit(game->GetPlayer()->GetPos(),game->GetPlayer()->GetAttackRangeMult()*12.f,game->GetPlayer()->GetAttack(),hitList,game->GetPlayer()->OnUpperLevel(),game->GetPlayer()->GetZ());
|
game->HurtEnemiesConeNotHit(game->GetPlayer()->GetPos(),game->GetPlayer()->GetAttackRangeMult()*12.f,rotation,util::degToRad("Warrior.Auto Attack.SwordSlashSweepAngle"_F),game->GetPlayer()->GetAttack(),hitList,game->GetPlayer()->OnUpperLevel(),game->GetPlayer()->GetZ());
|
||||||
}
|
}
|
||||||
pos=game->GetPlayer()->GetPos();
|
pos=game->GetPlayer()->GetPos();
|
||||||
|
|
||||||
|
@ -39,7 +39,7 @@ All rights reserved.
|
|||||||
#define VERSION_MAJOR 1
|
#define VERSION_MAJOR 1
|
||||||
#define VERSION_MINOR 0
|
#define VERSION_MINOR 0
|
||||||
#define VERSION_PATCH 0
|
#define VERSION_PATCH 0
|
||||||
#define VERSION_BUILD 8451
|
#define VERSION_BUILD 8457
|
||||||
|
|
||||||
#define stringify(a) stringify_(a)
|
#define stringify(a) stringify_(a)
|
||||||
#define stringify_(a) #a
|
#define stringify_(a) #a
|
||||||
|
@ -22,6 +22,8 @@ Warrior
|
|||||||
|
|
||||||
SwordAnimationSwingTime = 0.2s
|
SwordAnimationSwingTime = 0.2s
|
||||||
SwordSlashLingerTime = 0.125s
|
SwordSlashLingerTime = 0.125s
|
||||||
|
#Sweep angle of the sword slash (in both directions)
|
||||||
|
SwordSlashSweepAngle = 45°
|
||||||
}
|
}
|
||||||
Right Click Ability
|
Right Click Ability
|
||||||
{
|
{
|
||||||
|
@ -939,6 +939,7 @@ namespace olc
|
|||||||
virtual olc::rcode DestroyDevice() = 0;
|
virtual olc::rcode DestroyDevice() = 0;
|
||||||
virtual void DisplayFrame() = 0;
|
virtual void DisplayFrame() = 0;
|
||||||
virtual void PrepareDrawing() = 0;
|
virtual void PrepareDrawing() = 0;
|
||||||
|
virtual void SetVSync(const bool vSyncEnabled) = 0;
|
||||||
virtual void PrepareRender(int width,int height) = 0;
|
virtual void PrepareRender(int width,int height) = 0;
|
||||||
virtual void SetDecalMode(const olc::DecalMode& mode) = 0;
|
virtual void SetDecalMode(const olc::DecalMode& mode) = 0;
|
||||||
virtual void DrawLayerQuad(const olc::vf2d& offset, const olc::vf2d& scale, const olc::Pixel tint) = 0;
|
virtual void DrawLayerQuad(const olc::vf2d& offset, const olc::vf2d& scale, const olc::Pixel tint) = 0;
|
||||||
@ -5074,6 +5075,7 @@ namespace olc
|
|||||||
virtual olc::rcode DestroyDevice() { return olc::rcode::OK; }
|
virtual olc::rcode DestroyDevice() { return olc::rcode::OK; }
|
||||||
virtual void DisplayFrame() {}
|
virtual void DisplayFrame() {}
|
||||||
virtual void PrepareDrawing() {}
|
virtual void PrepareDrawing() {}
|
||||||
|
virtual void SetVSync(const bool vSyncEnabled) {}
|
||||||
virtual void PrepareRender(int width,int height) {};
|
virtual void PrepareRender(int width,int height) {};
|
||||||
virtual void SetDecalMode(const olc::DecalMode& mode) {}
|
virtual void SetDecalMode(const olc::DecalMode& mode) {}
|
||||||
virtual void DrawLayerQuad(const olc::vf2d& offset, const olc::vf2d& scale, const olc::Pixel tint) {}
|
virtual void DrawLayerQuad(const olc::vf2d& offset, const olc::vf2d& scale, const olc::Pixel tint) {}
|
||||||
@ -5370,6 +5372,26 @@ namespace olc
|
|||||||
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
glBlendFunc(GL_SRC_ALPHA, GL_ONE_MINUS_SRC_ALPHA);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetVSync(const bool vSyncEnabled){
|
||||||
|
#if defined(OLC_PLATFORM_WINAPI)
|
||||||
|
if (locSwapInterval) locSwapInterval(vSyncEnabled?1:0);
|
||||||
|
bSync = vSyncEnabled;
|
||||||
|
#endif
|
||||||
|
#if defined(OLC_PLATFORM_X11)
|
||||||
|
locSwapInterval(olc_Display, *olc_Window, vSyncEnabled?1:0);
|
||||||
|
#endif
|
||||||
|
#if defined(OLC_PLATFORM_EMSCRIPTEN)
|
||||||
|
locSwapInterval(olc_Display, vSyncEnabled?1:0);
|
||||||
|
#endif
|
||||||
|
#if defined(OLC_PLATFORM_GLUT)
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
GLint sync = vSyncEnabled?1:0;
|
||||||
|
CGLContextObj ctx = CGLGetCurrentContext();
|
||||||
|
if (ctx) CGLSetParameter(ctx, kCGLCPSwapInterval, &sync);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void SetDecalMode(const olc::DecalMode& mode)
|
void SetDecalMode(const olc::DecalMode& mode)
|
||||||
{
|
{
|
||||||
if (mode != nDecalMode)
|
if (mode != nDecalMode)
|
||||||
@ -5967,6 +5989,26 @@ namespace olc
|
|||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void SetVSync(const bool vSyncEnabled){
|
||||||
|
#if defined(OLC_PLATFORM_WINAPI)
|
||||||
|
if (locSwapInterval) locSwapInterval(vSyncEnabled?1:0);
|
||||||
|
bSync = vSyncEnabled;
|
||||||
|
#endif
|
||||||
|
#if defined(OLC_PLATFORM_X11)
|
||||||
|
locSwapInterval(olc_Display, *olc_Window, vSyncEnabled?1:0);
|
||||||
|
#endif
|
||||||
|
#if defined(OLC_PLATFORM_EMSCRIPTEN)
|
||||||
|
locSwapInterval(olc_Display, vSyncEnabled?1:0);
|
||||||
|
#endif
|
||||||
|
#if defined(OLC_PLATFORM_GLUT)
|
||||||
|
#if defined(__APPLE__)
|
||||||
|
GLint sync = vSyncEnabled?1:0;
|
||||||
|
CGLContextObj ctx = CGLGetCurrentContext();
|
||||||
|
if (ctx) CGLSetParameter(ctx, kCGLCPSwapInterval, &sync);
|
||||||
|
#endif
|
||||||
|
#endif
|
||||||
|
}
|
||||||
|
|
||||||
void PrepareRender(int width,int height)override{
|
void PrepareRender(int width,int height)override{
|
||||||
GLint sizeUniformLoc = locGetUniformLocation(m_nQuadShader, "size");
|
GLint sizeUniformLoc = locGetUniformLocation(m_nQuadShader, "size");
|
||||||
locUniform2f(sizeUniformLoc,width,height);
|
locUniform2f(sizeUniformLoc,width,height);
|
||||||
|
@ -151,3 +151,17 @@ std::u32string util::WrapText(PixelGameEngine*pge,std::u32string str,int width,F
|
|||||||
long double operator""_Pixels(long double unitDist){
|
long double operator""_Pixels(long double unitDist){
|
||||||
return unitDist/100*24.;
|
return unitDist/100*24.;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
float util::angle_difference(float angle_1, float angle_2)
|
||||||
|
{
|
||||||
|
angle_1 = fmod(angle_1, 2 * PI);
|
||||||
|
angle_2 = fmod(angle_2, 2 * PI);
|
||||||
|
float angle_diff = angle_1 - angle_2;
|
||||||
|
|
||||||
|
if (angle_diff > PI)
|
||||||
|
angle_diff -= 2 * PI;
|
||||||
|
else if (angle_diff < -PI)
|
||||||
|
angle_diff += 2 * PI;
|
||||||
|
|
||||||
|
return -angle_diff;
|
||||||
|
}
|
@ -57,6 +57,7 @@ namespace olc::util{
|
|||||||
std::string timerStr(float time);
|
std::string timerStr(float time);
|
||||||
std::string WrapText(PixelGameEngine*pge,std::string str,int width,bool proportional,vd2d scale);
|
std::string WrapText(PixelGameEngine*pge,std::string str,int width,bool proportional,vd2d scale);
|
||||||
std::u32string WrapText(PixelGameEngine*pge,std::u32string str,int width,Font&font,vd2d scale);
|
std::u32string WrapText(PixelGameEngine*pge,std::u32string str,int width,Font&font,vd2d scale);
|
||||||
|
float angle_difference(float angle_1, float angle_2);
|
||||||
}
|
}
|
||||||
|
|
||||||
template<class TL, class TR>
|
template<class TL, class TR>
|
||||||
|
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user