Normalized player's auto attack variable to now represent its range in units. Privatized it and added a GetAttackRange() function to use instead. Implemented Adrenaline Stim enchant. Release Build 10977.

mac-build
sigonasr2 4 months ago
parent e8ffeef5c9
commit c017c353db
  1. 21
      Adventures in Lestoria Tests/EnchantTests.cpp
  2. 1
      Adventures in Lestoria/AdventuresInLestoria.cpp
  3. 7
      Adventures in Lestoria/Player.cpp
  4. 5
      Adventures in Lestoria/Player.h
  5. 2
      Adventures in Lestoria/SwordSlash.cpp
  6. 18
      Adventures in Lestoria/Thief.cpp
  7. 2
      Adventures in Lestoria/Version.h
  8. 4
      Adventures in Lestoria/Warrior.cpp
  9. 6
      Adventures in Lestoria/assets/config/audio/events.txt
  10. BIN
      x64/Release/Adventures in Lestoria.exe

@ -700,5 +700,26 @@ namespace EnchantTests
Assert::AreEqual("Thief.Ability 2.Mana Cost"_I,Thief::ability2.manaCost,L"Deadly Dash's mana cost is back to normal.");
Assert::AreEqual("Thief.Ability 2.Cooldown"_F-3.f,Thief::ability2.cooldown,L"Deadly Dash should now be on cooldown");
}
TEST_METHOD(AdrenalineStimCheck){
testKey->bHeld=true; //Force the key to be held down for testing purposes.
game->ChangePlayerClass(THIEF);
player=game->GetPlayer();
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
Assert::AreEqual("Thief.Ability 3.Duration"_F,player->GetBuffs(BuffType::ADRENALINE_RUSH)[0].duration,L"Adrenaline Rush buff duration is normal.");
Assert::AreEqual(100,player->GetHealth(),L"Adrenaline Rush does not reduce health.");
Assert::AreEqual("Thief.Auto Attack.Cooldown"_F*"Thief.Ability 3.Attack Speed Increase"_F/100.f,player->GetAttackRecoveryRateReduction(),L"Adrenaline Rush boosts attack rate normally.");
Assert::AreEqual("Thief.Auto Attack.Range"_F,player->GetAttackRange(),L"Adrenaline Rush does not boost attack range.");
Thief::ability3.charges=1;
player->RestoreMana(100);
player->RemoveAllBuffs();
std::weak_ptr<Item>nullRing{Inventory::AddItem("Null Ring"s)};
Inventory::EquipItem(nullRing,EquipSlot::RING1);
nullRing.lock()->EnchantItem("Adrenaline Stim");
player->CheckAndPerformAbility(player->GetAbility3(),testKeyboardInput);
Assert::AreEqual("Adrenaline Stim"_ENC["NEW ADRENALINE RUSH DURATION"],player->GetBuffs(BuffType::ADRENALINE_RUSH)[0].duration,L"Adrenaline Stim enchant boosts the duration of Adrenaline Rush.");
Assert::AreEqual(80,player->GetHealth(),L"Adrenaline Stim reduces health.");
Assert::AreEqual("Thief.Auto Attack.Cooldown"_F*"Thief.Ability 3.Attack Speed Increase"_F/100.f,player->GetAttackRecoveryRateReduction(),L"Adrenaline Stim still boosts attack rate normally.");
Assert::AreEqual("Thief.Auto Attack.Range"_F+"Thief.Auto Attack.Range"_F*"Adrenaline Stim"_ENC["ATTACK RANGE INCREASE PCT"]/100.f,player->GetAttackRange(),L"Adrenaline Stim boosts attack range.");
}
};
}

@ -2999,6 +2999,7 @@ void AiL::ChangePlayerClass(Class cl){
player->cooldownSoundInstance=cooldownSoundInstance;
player->AddXP(totalXPEarned);
player->AddAccumulatedXP(totalXPEarned);
player->base_attack_range=DATA.GetProperty(player->GetClassName()+".Auto Attack.Range").GetReal();
game->healthCounter.UpdateNumberPointer(&player->hp);
game->manaCounter.UpdateNumberPointer(&player->mana);
sig::Animation::SetupPlayerAnimations();

@ -311,8 +311,11 @@ float Player::GetSizeMult()const{
return size;
}
float Player::GetAttackRangeMult(){
return attack_range*GetSizeMult();
float Player::GetAttackRange(){
float finalAttackRange{base_attack_range};
if(HasEnchant("Adrenaline Stim")&&GetBuffs(BuffType::ADRENALINE_RUSH).size()>0)finalAttackRange+=base_attack_range*"Adrenaline Stim"_ENC["ATTACK RANGE INCREASE PCT"]/100.f;
finalAttackRange*=GetSizeMult();
return finalAttackRange;
}
float Player::GetSpinAngle(){

@ -109,6 +109,7 @@ class Player{
public:
enum class TimerType{
DEADLY_MIRAGE_SECOND_CAST,
ADRENALINE_STIM,
};
Player();
@ -146,7 +147,7 @@ public:
const float GetDamageReductionPct()const;
const float GetAttackRecoveryRateReduction()const;
void SetSizeMult(float size);
float GetAttackRangeMult();
float GetAttackRange(); //Returns the player's attack range in units. Divide by 100 for number of tiles.
float GetSpinAngle();
State::State GetState();
Key GetFacingDirection()const;
@ -402,6 +403,7 @@ private:
const vf2d GetAimingLocation(bool useWalkDir=false,bool invert=false);
std::unordered_map<TimerType,Timer>timers;
void RunTimers();
float base_attack_range="Warrior.Auto Attack.Range"_F/100.f;
protected:
const float ATTACK_COOLDOWN="Warrior.Auto Attack.Cooldown"_F;
const float MAGIC_ATTACK_COOLDOWN="Wizard.Auto Attack.Cooldown"_F;
@ -417,7 +419,6 @@ protected:
std::pair<std::string,float> notificationDisplay={"",0.f};
bool upperLevel=false;
vf2d vel={0,0};
float attack_range="Warrior.Auto Attack.Range"_F/100.f;
Key facingDirection=DOWN;
float swordSwingTimer=0;
void CastSpell(Ability&ability);

@ -46,7 +46,7 @@ SwordSlash::SwordSlash(float lifetime, std::string imgFile,float damageMult, flo
bool SwordSlash::Update(float fElapsedTime){
if(lifetime>0){
game->HurtConeNotHit(game->GetPlayer()->GetPos(),game->GetPlayer()->GetAttackRangeMult()*12.f,rotation,util::degToRad(swordSweepAngle),game->GetPlayer()->GetAttack()*damageMult,hitList,game->GetPlayer()->OnUpperLevel(),game->GetPlayer()->GetZ(),HurtType::MONSTER,HurtFlag::PLAYER_ABILITY);
game->HurtConeNotHit(game->GetPlayer()->GetPos(),game->GetPlayer()->GetAttackRange()/100.f*12.f,rotation,util::degToRad(swordSweepAngle),game->GetPlayer()->GetAttack()*damageMult,hitList,game->GetPlayer()->OnUpperLevel(),game->GetPlayer()->GetZ(),HurtType::MONSTER,HurtFlag::PLAYER_ABILITY);
}
pos=game->GetPlayer()->GetPos();

@ -75,7 +75,7 @@ bool Thief::AutoAttack(){
float closest_dist=999999;
for(std::shared_ptr<Monster>&m:MONSTER_LIST){
if(m->IsAlive()&&
geom2d::overlaps(geom2d::circle<float>(GetPos(),attack_range*GetSizeMult()*12),geom2d::circle<float>(m->GetPos(),m->GetSizeMult()*12))&&
geom2d::overlaps(geom2d::circle<float>(GetPos(),GetAttackRange()/100.f*12),geom2d::circle<float>(m->GetPos(),m->GetSizeMult()*12))&&
geom2d::line<float>(GetWorldAimingLocation(),m->GetPos()).length()<closest_dist){
closest_dist=geom2d::line<float>(GetWorldAimingLocation(),m->GetPos()).length();
closest=&*m;
@ -170,7 +170,21 @@ void Thief::InitializeClassAbilities(){
Thief::ability3.action=
[](Player*p,vf2d pos={}){
SoundEffect::PlaySFX("Adrenaline Rush",SoundEffect::CENTERED);
p->AddBuff(BuffType::ADRENALINE_RUSH,"Thief.Ability 3.Duration"_F,0.f);
float adrenalineRushDuration{"Thief.Ability 3.Duration"_F};
if(p->HasEnchant("Adrenaline Stim"))adrenalineRushDuration="Adrenaline Stim"_ENC["NEW ADRENALINE RUSH DURATION"];
p->AddBuff(BuffType::ADRENALINE_RUSH,adrenalineRushDuration,0.f);
p->AddTimer(TimerType::ADRENALINE_STIM,Timer{"Adrenaline Stim Extra Sound Timer",0.3f,[](){SoundEffect::PlaySFX("Adrenaline Rush High Pitch",SoundEffect::CENTERED);},Timer::MANUAL});
int healthCost{};
if(p->HasEnchant("Adrenaline Stim"))healthCost=p->GetMaxHealth()*("Adrenaline Stim"_ENC["HEALTH PCT COST"]/100.f);
if(healthCost>0){
if(p->GetHealth()<healthCost)healthCost=p->GetHealth()-1;
p->Hurt(healthCost,p->OnUpperLevel(),p->GetZ(),TrueDamageFlag::IGNORE_DAMAGE_RULES,HurtFlag::PLAYER_ABILITY);
}
for(int i:std::ranges::iota_view(0,50)){
float size{util::random_range(0.4f,0.8f)};
game->AddEffect(std::make_unique<Effect>(p->GetPos()+vf2d{8,util::random(2*PI)}.cart(),util::random_range(0.1f,0.4f),"circle.png",p->OnUpperLevel(),vf2d{size,size},0.3f,vf2d{util::random_range(-6.f,6.f),util::random_range(-8.f,-1.f)},PixelLerp(WHITE,GREEN,util::random(1))));

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

@ -72,7 +72,7 @@ bool Warrior::AutoAttack(){
float closest_dist=999999;
for(std::shared_ptr<Monster>&m:MONSTER_LIST){
if(m->IsAlive()&&
geom2d::overlaps(geom2d::circle<float>(GetPos(),attack_range*GetSizeMult()*12),geom2d::circle<float>(m->GetPos(),m->GetSizeMult()*12))&&
geom2d::overlaps(geom2d::circle<float>(GetPos(),GetAttackRange()/100.f*12),geom2d::circle<float>(m->GetPos(),m->GetSizeMult()*12))&&
geom2d::line<float>(GetWorldAimingLocation(),m->GetPos()).length()<closest_dist){
closest_dist=geom2d::line<float>(GetWorldAimingLocation(),m->GetPos()).length();
closest=&*m;
@ -94,7 +94,7 @@ bool Warrior::AutoAttack(){
attack_cooldown_timer=ATTACK_COOLDOWN-GetAttackRecoveryRateReduction();
swordSwingTimer="Warrior.Auto Attack.SwordAnimationSwingTime"_F;
game->AddEffect(std::make_unique<SwordSlash>(0.125f,"swordslash.png"s,"Warrior.Auto Attack.DamageMult"_F,"Warrior.Auto Attack.SwordSlashSweepAngle"_F,vf2d{0.9f,0.9f}*"Warrior.Auto Attack.Range"_F/100.f,0.1f,vf2d{0.f,0.f},WHITE,targetDirection));
game->AddEffect(std::make_unique<SwordSlash>(0.125f,"swordslash.png"s,"Warrior.Auto Attack.DamageMult"_F,"Warrior.Auto Attack.SwordSlashSweepAngle"_F,vf2d{0.9f,0.9f}*GetAttackRange()/100.f,0.1f,vf2d{0.f,0.f},WHITE,targetDirection));
SetState(State::SWING_SWORD);
SoundEffect::PlaySFX("Warrior Auto Attack",SoundEffect::CENTERED);

@ -14,6 +14,12 @@ Events
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = adrenaline_rush.ogg, 70%
}
Adrenaline Rush High Pitch
{
CombatSound = True
# Specify file names, followed by volume %. Optional min and max pitch adjustment (Defaults are 90%,110%)
File[0] = adrenaline_rush.ogg, 50%, 110%, 120%
}
Bear Slam Attack
{
CombatSound = True

Loading…
Cancel
Save