Fixed Adrenaline Rush Speed Mult unit test error. Fixed not resetting the SoundEffect::soundsPlayed static variable between unit tests.
All checks were successful
Emscripten Build / Build_and_Deploy_Web_Build (push) Successful in 8m57s

This commit is contained in:
AMay 2026-03-09 15:22:17 -05:00
parent 6f90d68586
commit 8154615174
18 changed files with 92 additions and 33 deletions

View File

@ -82,6 +82,7 @@ namespace EnchantTests
Tutorial::Initialize();
Stats::InitializeDamageReductionTable();
Monster::InitializeStrategies();
SoundEffect::Initialize();
GameState::Initialize();
GameState::STATE=GameState::states.at(States::State::GAME_RUN);

View File

@ -43,6 +43,7 @@ All rights reserved.
#include <format>
#include "ItemDrop.h"
#include "DamageNumber.h"
#include"SoundEffect.h"
#include <ranges>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
@ -78,6 +79,7 @@ namespace EngineTests
Menu::InitializeMenus();
Tutorial::Initialize();
Stats::InitializeDamageReductionTable();
SoundEffect::Initialize();
GameState::Initialize();
GameState::STATE=GameState::states.at(States::State::GAME_RUN);

View File

@ -43,6 +43,7 @@ All rights reserved.
#include "DamageNumber.h"
#include "GameHelper.h"
#include "SaveFile.h"
#include"SoundEffect.h"
#include <ranges>
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
@ -76,6 +77,7 @@ namespace FileTests
Menu::InitializeMenus();
Tutorial::Initialize();
Stats::InitializeDamageReductionTable();
SoundEffect::Initialize();
GameState::Initialize();
GameState::STATE=GameState::states.at(States::State::GAME_RUN);

View File

@ -45,6 +45,7 @@ All rights reserved.
#include "GameHelper.h"
#include"RowInventoryScrollableWindowComponent.h"
#include"SaveFile.h"
#include"SoundEffect.h"
using namespace Microsoft::VisualStudio::CppUnitTestFramework;
using namespace olc::utils;
@ -82,6 +83,7 @@ namespace ItemTests
Menu::InitializeMenus();
Tutorial::Initialize();
Stats::InitializeDamageReductionTable();
SoundEffect::Initialize();
GameState::Initialize();
GameState::STATE=GameState::states.at(States::State::GAME_RUN);

View File

@ -83,6 +83,7 @@ namespace MonsterTests
Menu::InitializeMenus();
Tutorial::Initialize();
Stats::InitializeDamageReductionTable();
SoundEffect::Initialize();
GameState::Initialize();
GameState::STATE=GameState::states.at(States::State::GAME_RUN);

View File

@ -80,6 +80,7 @@ namespace PlayerTests
Menu::InitializeMenus();
Tutorial::Initialize();
Stats::InitializeDamageReductionTable();
SoundEffect::Initialize();
GameState::Initialize();
GameState::STATE=GameState::states.at(States::State::GAME_RUN);

View File

@ -50,7 +50,7 @@ enum BuffType{
FIXED_COLLISION_DMG, //Does a fixed amount of collision damage based on intensity of this buff.
COLLISION_KNOCKBACK_STRENGTH, //Causes an amount of knockback based on intensity when hit via collision with this buff
SELF_INFLICTED_SLOWDOWN, //Used for monsters and can't be applied by any player abilities.
ADRENALINE_RUSH, //Intensity indicates the stack count (used by the Bloodlust enchant) this buff gives which in turn increases attack.
ADRENALINE_RUSH, //NOTE: Intensity determined by "Thief.Ability 3.Movement Speed Increase". Intensity is 0 for the purposes of using this buff! (used by the Bloodlust enchant) this buff gives which in turn increases attack.
TRAPPER_MARK,
SPECIAL_MARK, //The mark applied by the Opportunity Shot.
OVER_TIME,

View File

@ -439,21 +439,29 @@ struct HomingBullet:public Bullet{
HomingBullet(const vf2d pos,const Entity target,const float rotateTowardsSpeed,const std::string&animation,const float lifetime,const float speed,const float radius,const int damage,const bool upperLevel,const FriendlyType friendly,const Pixel col,const vf2d scale,const float image_angle);
void Update(float fElapsedTime)override;
void ModifyOutgoingDamageData(HurtDamageInfo&data)override;
private:
protected:
const Entity target;
private:
const float rotateTowardsSpeed;
const float rotateTowardsSpeedCoveredInInk;
};
struct ThunderOrb:public HomingBullet{
ThunderOrb(const vf2d pos,const Entity target,const float rotateTowardsSpeed,const float lifetime,const float speed,const float attackRadius,const int damagePerTick,const int tickRate,const bool upperLevel,const FriendlyType friendly=NON_FRIENDLY,const Pixel col=WHITE,const vf2d scale={1,1},const float image_angle=0.f);
struct ThunderOrbSettings{
float moveSpdPct;
float tickRate;
float range; //In units
float attackMult;
float lifetime;
};
ThunderOrb(const vf2d pos,const Entity target,const ThunderOrbSettings settings,const float rotateTowardsSpeed,const bool upperLevel,const FriendlyType friendly=NON_FRIENDLY,const Pixel col=WHITE,const vf2d scale={1,1},const float image_angle=0.f);
void Update(float fElapsedTime)override;
void ModifyOutgoingDamageData(HurtDamageInfo&data)override;
private:
const float attackRadius;
const int damagePerTick;
const int tickRate;
LightningBoltEmitter lightning;
ThunderOrbSettings settings;
float damageTickTimer{};
};
struct GhostSaber:public Bullet{

View File

@ -59,4 +59,5 @@ class LightningBoltEmitter:public IEmitter{
void Emit()override;
public:
LightningBoltEmitter(vf2d startPos,vf2d endPos,float frequency,float timer,bool upperLevel);
void SetStartEndPos(vf2d startPos,vf2d endPos);
};

View File

@ -101,4 +101,12 @@ const std::vector<Buff>Entity::GetBuffs(BuffType buff)const{
const bool Entity::OnUpperLevel()const{
CallClassFunc(OnUpperLevel());
}
const float Entity::GetMoveSpdMult()const{
CallClassFunc(GetMoveSpdMult());
}
const int Entity::GetAttack()const{
CallClassFunc(GetAttack());
}

View File

@ -64,6 +64,8 @@ public:
const bool IsBoss()const;
const std::vector<Buff>GetBuffs(BuffType buff)const;
const bool OnUpperLevel()const;
const float GetMoveSpdMult()const;
const int GetAttack()const;
private:
const std::variant<Monster*,Player*>entity;
inline bool operator==(const Entity&rhs){return entity==rhs.entity;}

View File

@ -72,4 +72,9 @@ void LightningBoltEmitter::DrawLightningBolt(){
currentPos+=vf2d{cos(targetAngle)*targetDist,sin(targetAngle)*targetDist};
iterations++;
}
}
void LightningBoltEmitter::SetStartEndPos(vf2d startPos,vf2d endPos){
this->startPos=startPos;
this->endPos=endPos;
}

View File

@ -113,7 +113,7 @@ float Monster::GetMoveSpdMult()const{
for(const Buff&debuff:GetBuffs({SLOWDOWN,SELF_INFLICTED_SLOWDOWN,BLOCK_SLOWDOWN,INK_SLOWDOWN,FREEZEGROUND_SLOWDOWN})){
mod_moveSpd-=moveSpdPct*debuff.intensity;
}
for(const Buff&b:GetBuffs({LOCKON_SPEEDBOOST,SPEEDBOOST,SPEED_UP_SPELL_BUFF,ADRENALINE_RUSH})){
for(const Buff&b:GetBuffs({LOCKON_SPEEDBOOST,SPEEDBOOST,SPEED_UP_SPELL_BUFF})){
mod_moveSpd+=moveSpdPct*b.intensity;
}
return mod_moveSpd;

View File

@ -316,9 +316,12 @@ float Player::GetMoveSpdMult(){
for(const Buff&debuff:GetBuffs({SLOWDOWN,SELF_INFLICTED_SLOWDOWN,BLOCK_SLOWDOWN,INK_SLOWDOWN,FREEZEGROUND_SLOWDOWN})){
mod_moveSpd-=moveSpdPct*debuff.intensity;
}
for(const Buff&b:GetBuffs({LOCKON_SPEEDBOOST,SPEEDBOOST,SPEED_UP_SPELL_BUFF,ADRENALINE_RUSH})){
for(const Buff&b:GetBuffs({LOCKON_SPEEDBOOST,SPEEDBOOST,SPEED_UP_SPELL_BUFF})){
mod_moveSpd+=moveSpdPct*b.intensity;
}
for(const Buff&b:GetBuffs(BuffType::ADRENALINE_RUSH)){
mod_moveSpd+=moveSpdPct*"Thief.Ability 3.Movement Speed Increase"_F/100.f;
}
for(const Buff&b:GetStatBuffs({"Move Spd %"})){
mod_moveSpd+=moveSpdPct*b.intensity;
}

View File

@ -64,28 +64,31 @@ SoundEffect::SoundEffect(const std::string_view filename,const float&vol,const f
}
void SoundEffect::Initialize(){
for(auto&[key,size]:DATA["Events"]["SFX"]){
int counter=0;
bool combatSound=false;
bool treatAsBGM{false};
if(DATA["Events"]["SFX"][key].HasProperty("CombatSound")){
combatSound=DATA["Events"]["SFX"][key]["CombatSound"].GetBool();
}
if(DATA["Events"]["SFX"][key].HasProperty("Treat as BGM")){
treatAsBGM=DATA["Events"]["SFX"][key]["Treat as BGM"].GetBool();
}
while(DATA["Events"]["SFX"][key].HasProperty(std::format("File[{}]",counter))){
utils::datafile&data=DATA["Events"]["SFX"][key][std::format("File[{}]",counter)];
float minPitch=0.9f;
float maxPitch=1.1f;
if(data.GetValueCount()>=3){minPitch=data.GetInt(2)/100.f;}
if(data.GetValueCount()>=4){maxPitch=data.GetInt(3)/100.f;}
SOUND_EFFECTS.insert({key,SoundEffect{data.GetString(0),data.GetInt(1)/100.f,minPitch,maxPitch,combatSound,treatAsBGM}});
counter++;
}
auto itr=SOUND_EFFECTS.equal_range(key);
for(auto it=itr.first;it!=itr.second;++it){
it->second.combatSound=combatSound;
SoundEffect::soundsPlayedLog.clear();
[[likely]]if(!game->TestingModeEnabled()){
for(auto&[key,size]:DATA["Events"]["SFX"]){
int counter=0;
bool combatSound=false;
bool treatAsBGM{false};
if(DATA["Events"]["SFX"][key].HasProperty("CombatSound")){
combatSound=DATA["Events"]["SFX"][key]["CombatSound"].GetBool();
}
if(DATA["Events"]["SFX"][key].HasProperty("Treat as BGM")){
treatAsBGM=DATA["Events"]["SFX"][key]["Treat as BGM"].GetBool();
}
while(DATA["Events"]["SFX"][key].HasProperty(std::format("File[{}]",counter))){
utils::datafile&data=DATA["Events"]["SFX"][key][std::format("File[{}]",counter)];
float minPitch=0.9f;
float maxPitch=1.1f;
if(data.GetValueCount()>=3){minPitch=data.GetInt(2)/100.f;}
if(data.GetValueCount()>=4){maxPitch=data.GetInt(3)/100.f;}
SOUND_EFFECTS.insert({key,SoundEffect{data.GetString(0),data.GetInt(1)/100.f,minPitch,maxPitch,combatSound,treatAsBGM}});
counter++;
}
auto itr=SOUND_EFFECTS.equal_range(key);
for(auto it=itr.first;it!=itr.second;++it){
it->second.combatSound=combatSound;
}
}
}
}

View File

@ -35,10 +35,24 @@ Project (www.freetype.org). Please see LICENSE_FT.txt for more information.
All rights reserved.
*/
#include"BulletTypes.h"
#include"AdventuresInLestoria.h"
ThunderOrb::ThunderOrb(const vf2d pos,const Entity target,const float rotateTowardsSpeed,const float lifetime,const float speed,const float attackRadius,const int damagePerTick,const int tickRate,const bool upperLevel,const FriendlyType friendly,const Pixel col,const vf2d scale,const float image_angle)
:lightning(pos,pos,1.f,lifetime,upperLevel),attackRadius(attackRadius),damagePerTick(damagePerTick),tickRate(tickRate),HomingBullet(pos,target,rotateTowardsSpeed,"thunderorb.png",lifetime,speed,0.f,0,upperLevel,friendly,col,scale,image_angle){}
INCLUDE_game
ThunderOrb::ThunderOrb(const vf2d pos,const Entity target,const ThunderOrbSettings settings,const float rotateTowardsSpeed,const bool upperLevel,const FriendlyType friendly,const Pixel col,const vf2d scale,const float image_angle)
:settings(settings),damageTickTimer(settings.tickRate),lightning(pos,pos,settings.tickRate,settings.lifetime,upperLevel),HomingBullet(pos,target,rotateTowardsSpeed,"thunderorb.png",settings.lifetime,100.f*target.GetMoveSpdMult()*settings.moveSpdPct,0.f,0,upperLevel,friendly,col,scale,image_angle){}
void ThunderOrb::Update(float fElapsedTime){
static vf2d lightningBoltRandomPos{};
if(damageTickTimer-=fElapsedTime<=0.f){
game->Hurt(pos,settings.range/100.f*24,target.GetAttack()*settings.attackMult,OnUpperLevel(),GetZ(),friendly?HurtType::MONSTER:HurtType::PLAYER);
lightningBoltRandomPos=pos+vf2d{settings.range/100.f*24,util::random(2*PI)}.cart();
lightning.SetStartEndPos(pos,lightningBoltRandomPos);
damageTickTimer+=settings.tickRate;
}
lightning.Update(fElapsedTime);
HomingBullet::Update(fElapsedTime);
}
void ThunderOrb::ModifyOutgoingDamageData(HurtDamageInfo&data){

View File

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

View File

@ -1460,5 +1460,11 @@ MonsterStrategy
Speed Up Radius = 400
Speed Up Boost Amount = 20%
Speed Up Boost Duration = 20s
Thunder Orb Movespeed = 60%
Thunder Orb Tick Rate = 1s
Thunder Orb Range = 100
Thunder Orb Attack Mult = 1.0x
Thunder Orb Lifetime = 12.0s
}
}